@opensite/ui 3.5.3 → 3.5.5

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.
@@ -495,6 +495,46 @@ var DEFAULT_FORM_FIELDS = [
495
495
  columnSpan: 12
496
496
  }
497
497
  ];
498
+ function coerceCoordinate(value) {
499
+ if (typeof value === "number") {
500
+ return Number.isFinite(value) ? value : null;
501
+ }
502
+ if (typeof value === "string" && value.trim().length > 0) {
503
+ const parsed = Number(value);
504
+ return Number.isFinite(parsed) ? parsed : null;
505
+ }
506
+ return null;
507
+ }
508
+ function sanitizeMarker(marker) {
509
+ const markerWithAliases = marker;
510
+ const latitude = coerceCoordinate(
511
+ markerWithAliases.latitude ?? markerWithAliases.lat
512
+ );
513
+ const longitude = coerceCoordinate(
514
+ markerWithAliases.longitude ?? markerWithAliases.lng
515
+ );
516
+ if (latitude === null || longitude === null) {
517
+ return null;
518
+ }
519
+ return {
520
+ ...marker,
521
+ latitude,
522
+ longitude
523
+ };
524
+ }
525
+ function sanitizeCluster(cluster) {
526
+ const markers = cluster.markers.map((marker) => sanitizeMarker(marker)).filter((marker) => marker !== null);
527
+ if (markers.length === 0) {
528
+ return null;
529
+ }
530
+ const latitude = coerceCoordinate(cluster.latitude);
531
+ const longitude = coerceCoordinate(cluster.longitude);
532
+ return {
533
+ ...cluster,
534
+ markers,
535
+ ...latitude !== null && longitude !== null ? { latitude, longitude } : {}
536
+ };
537
+ }
498
538
  function ContactMap({
499
539
  sectionId = "contact-map",
500
540
  heading,
@@ -530,10 +570,24 @@ function ContactMap({
530
570
  }
531
571
  );
532
572
  }, [formEngineSetup]);
573
+ const sanitizedMapData = React4__namespace.useMemo(() => {
574
+ const markers = (mapProps?.markers ?? []).map((marker) => sanitizeMarker(marker)).filter((marker) => marker !== null);
575
+ const clusters = (mapProps?.clusters ?? []).map((cluster) => sanitizeCluster(cluster)).filter((cluster) => cluster !== null);
576
+ return {
577
+ markers,
578
+ clusters,
579
+ hasRenderableMap: markers.length > 0 || clusters.length > 0
580
+ };
581
+ }, [mapProps?.clusters, mapProps?.markers]);
533
582
  const resolvedMapProps = React4__namespace.useMemo(() => {
583
+ if (!sanitizedMapData.hasRenderableMap) {
584
+ return null;
585
+ }
534
586
  return {
535
587
  panelPosition: "top-left",
536
588
  ...mapProps,
589
+ markers: sanitizedMapData.markers,
590
+ clusters: sanitizedMapData.clusters,
537
591
  // Don't override mapWrapperClassName if it's provided in mapProps
538
592
  mapWrapperClassName: mapProps?.mapWrapperClassName,
539
593
  className: cn(mapClassName, mapProps?.className),
@@ -542,7 +596,8 @@ function ContactMap({
542
596
  IconComponent: DynamicIcon,
543
597
  ImgComponent: img.Img
544
598
  };
545
- }, [mapClassName, mapProps, optixFlowConfig]);
599
+ }, [mapClassName, mapProps, optixFlowConfig, sanitizedMapData]);
600
+ const hasMap = resolvedMapProps !== null;
546
601
  return /* @__PURE__ */ jsxRuntime.jsx(
547
602
  Section,
548
603
  {
@@ -557,8 +612,10 @@ function ContactMap({
557
612
  "div",
558
613
  {
559
614
  className: cn(
560
- "mx-auto grid max-w-full md:max-w-7xl gap-8 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",
561
- contentGridClassName
615
+ "mx-auto grid max-w-full gap-8",
616
+ hasMap && "md:max-w-7xl lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",
617
+ contentGridClassName,
618
+ !hasMap && "md:max-w-3xl lg:grid-cols-1"
562
619
  ),
563
620
  children: [
564
621
  /* @__PURE__ */ jsxRuntime.jsx(Card, { className: cn("shadow-lg rounded-xl", cardClassName), children: /* @__PURE__ */ jsxRuntime.jsxs(CardContent, { className: cardContentClassName, children: [
@@ -586,7 +643,7 @@ function ContactMap({
586
643
  ] }),
587
644
  renderForm
588
645
  ] }) }),
589
- /* @__PURE__ */ jsxRuntime.jsx(
646
+ resolvedMapProps ? /* @__PURE__ */ jsxRuntime.jsx(
590
647
  "div",
591
648
  {
592
649
  className: cn(
@@ -600,7 +657,7 @@ function ContactMap({
600
657
  },
601
658
  children: /* @__PURE__ */ jsxRuntime.jsx(maps.GeoMap, { ...resolvedMapProps })
602
659
  }
603
- )
660
+ ) : null
604
661
  ]
605
662
  }
606
663
  )
@@ -474,6 +474,46 @@ var DEFAULT_FORM_FIELDS = [
474
474
  columnSpan: 12
475
475
  }
476
476
  ];
477
+ function coerceCoordinate(value) {
478
+ if (typeof value === "number") {
479
+ return Number.isFinite(value) ? value : null;
480
+ }
481
+ if (typeof value === "string" && value.trim().length > 0) {
482
+ const parsed = Number(value);
483
+ return Number.isFinite(parsed) ? parsed : null;
484
+ }
485
+ return null;
486
+ }
487
+ function sanitizeMarker(marker) {
488
+ const markerWithAliases = marker;
489
+ const latitude = coerceCoordinate(
490
+ markerWithAliases.latitude ?? markerWithAliases.lat
491
+ );
492
+ const longitude = coerceCoordinate(
493
+ markerWithAliases.longitude ?? markerWithAliases.lng
494
+ );
495
+ if (latitude === null || longitude === null) {
496
+ return null;
497
+ }
498
+ return {
499
+ ...marker,
500
+ latitude,
501
+ longitude
502
+ };
503
+ }
504
+ function sanitizeCluster(cluster) {
505
+ const markers = cluster.markers.map((marker) => sanitizeMarker(marker)).filter((marker) => marker !== null);
506
+ if (markers.length === 0) {
507
+ return null;
508
+ }
509
+ const latitude = coerceCoordinate(cluster.latitude);
510
+ const longitude = coerceCoordinate(cluster.longitude);
511
+ return {
512
+ ...cluster,
513
+ markers,
514
+ ...latitude !== null && longitude !== null ? { latitude, longitude } : {}
515
+ };
516
+ }
477
517
  function ContactMap({
478
518
  sectionId = "contact-map",
479
519
  heading,
@@ -509,10 +549,24 @@ function ContactMap({
509
549
  }
510
550
  );
511
551
  }, [formEngineSetup]);
552
+ const sanitizedMapData = React4.useMemo(() => {
553
+ const markers = (mapProps?.markers ?? []).map((marker) => sanitizeMarker(marker)).filter((marker) => marker !== null);
554
+ const clusters = (mapProps?.clusters ?? []).map((cluster) => sanitizeCluster(cluster)).filter((cluster) => cluster !== null);
555
+ return {
556
+ markers,
557
+ clusters,
558
+ hasRenderableMap: markers.length > 0 || clusters.length > 0
559
+ };
560
+ }, [mapProps?.clusters, mapProps?.markers]);
512
561
  const resolvedMapProps = React4.useMemo(() => {
562
+ if (!sanitizedMapData.hasRenderableMap) {
563
+ return null;
564
+ }
513
565
  return {
514
566
  panelPosition: "top-left",
515
567
  ...mapProps,
568
+ markers: sanitizedMapData.markers,
569
+ clusters: sanitizedMapData.clusters,
516
570
  // Don't override mapWrapperClassName if it's provided in mapProps
517
571
  mapWrapperClassName: mapProps?.mapWrapperClassName,
518
572
  className: cn(mapClassName, mapProps?.className),
@@ -521,7 +575,8 @@ function ContactMap({
521
575
  IconComponent: DynamicIcon,
522
576
  ImgComponent: Img
523
577
  };
524
- }, [mapClassName, mapProps, optixFlowConfig]);
578
+ }, [mapClassName, mapProps, optixFlowConfig, sanitizedMapData]);
579
+ const hasMap = resolvedMapProps !== null;
525
580
  return /* @__PURE__ */ jsx(
526
581
  Section,
527
582
  {
@@ -536,8 +591,10 @@ function ContactMap({
536
591
  "div",
537
592
  {
538
593
  className: cn(
539
- "mx-auto grid max-w-full md:max-w-7xl gap-8 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",
540
- contentGridClassName
594
+ "mx-auto grid max-w-full gap-8",
595
+ hasMap && "md:max-w-7xl lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",
596
+ contentGridClassName,
597
+ !hasMap && "md:max-w-3xl lg:grid-cols-1"
541
598
  ),
542
599
  children: [
543
600
  /* @__PURE__ */ jsx(Card, { className: cn("shadow-lg rounded-xl", cardClassName), children: /* @__PURE__ */ jsxs(CardContent, { className: cardContentClassName, children: [
@@ -565,7 +622,7 @@ function ContactMap({
565
622
  ] }),
566
623
  renderForm
567
624
  ] }) }),
568
- /* @__PURE__ */ jsx(
625
+ resolvedMapProps ? /* @__PURE__ */ jsx(
569
626
  "div",
570
627
  {
571
628
  className: cn(
@@ -579,7 +636,7 @@ function ContactMap({
579
636
  },
580
637
  children: /* @__PURE__ */ jsx(GeoMap, { ...resolvedMapProps })
581
638
  }
582
- )
639
+ ) : null
583
640
  ]
584
641
  }
585
642
  )
@@ -772,7 +772,7 @@ function HeroPanel({
772
772
  src,
773
773
  alt: logo.alt,
774
774
  className: cn(
775
- "h-10 md:h-12 lg:h-14 w-auto max-w-[70%] object-contain",
775
+ "h-10 md:h-12 lg:h-14 w-auto object-contain",
776
776
  logo.imgClassName,
777
777
  logoClassName
778
778
  ),
@@ -751,7 +751,7 @@ function HeroPanel({
751
751
  src,
752
752
  alt: logo.alt,
753
753
  className: cn(
754
- "h-10 md:h-12 lg:h-14 w-auto max-w-[70%] object-contain",
754
+ "h-10 md:h-12 lg:h-14 w-auto object-contain",
755
755
  logo.imgClassName,
756
756
  logoClassName
757
757
  ),
package/dist/registry.cjs CHANGED
@@ -16674,6 +16674,46 @@ var DEFAULT_FORM_FIELDS23 = [
16674
16674
  columnSpan: 12
16675
16675
  }
16676
16676
  ];
16677
+ function coerceCoordinate(value) {
16678
+ if (typeof value === "number") {
16679
+ return Number.isFinite(value) ? value : null;
16680
+ }
16681
+ if (typeof value === "string" && value.trim().length > 0) {
16682
+ const parsed = Number(value);
16683
+ return Number.isFinite(parsed) ? parsed : null;
16684
+ }
16685
+ return null;
16686
+ }
16687
+ function sanitizeMarker(marker) {
16688
+ const markerWithAliases = marker;
16689
+ const latitude = coerceCoordinate(
16690
+ markerWithAliases.latitude ?? markerWithAliases.lat
16691
+ );
16692
+ const longitude = coerceCoordinate(
16693
+ markerWithAliases.longitude ?? markerWithAliases.lng
16694
+ );
16695
+ if (latitude === null || longitude === null) {
16696
+ return null;
16697
+ }
16698
+ return {
16699
+ ...marker,
16700
+ latitude,
16701
+ longitude
16702
+ };
16703
+ }
16704
+ function sanitizeCluster(cluster) {
16705
+ const markers = cluster.markers.map((marker) => sanitizeMarker(marker)).filter((marker) => marker !== null);
16706
+ if (markers.length === 0) {
16707
+ return null;
16708
+ }
16709
+ const latitude = coerceCoordinate(cluster.latitude);
16710
+ const longitude = coerceCoordinate(cluster.longitude);
16711
+ return {
16712
+ ...cluster,
16713
+ markers,
16714
+ ...latitude !== null && longitude !== null ? { latitude, longitude } : {}
16715
+ };
16716
+ }
16677
16717
  function ContactMap({
16678
16718
  sectionId = "contact-map",
16679
16719
  heading,
@@ -16709,10 +16749,24 @@ function ContactMap({
16709
16749
  }
16710
16750
  );
16711
16751
  }, [formEngineSetup]);
16752
+ const sanitizedMapData = React30__namespace.useMemo(() => {
16753
+ const markers = (mapProps?.markers ?? []).map((marker) => sanitizeMarker(marker)).filter((marker) => marker !== null);
16754
+ const clusters = (mapProps?.clusters ?? []).map((cluster) => sanitizeCluster(cluster)).filter((cluster) => cluster !== null);
16755
+ return {
16756
+ markers,
16757
+ clusters,
16758
+ hasRenderableMap: markers.length > 0 || clusters.length > 0
16759
+ };
16760
+ }, [mapProps?.clusters, mapProps?.markers]);
16712
16761
  const resolvedMapProps = React30__namespace.useMemo(() => {
16762
+ if (!sanitizedMapData.hasRenderableMap) {
16763
+ return null;
16764
+ }
16713
16765
  return {
16714
16766
  panelPosition: "top-left",
16715
16767
  ...mapProps,
16768
+ markers: sanitizedMapData.markers,
16769
+ clusters: sanitizedMapData.clusters,
16716
16770
  // Don't override mapWrapperClassName if it's provided in mapProps
16717
16771
  mapWrapperClassName: mapProps?.mapWrapperClassName,
16718
16772
  className: cn(mapClassName, mapProps?.className),
@@ -16721,7 +16775,8 @@ function ContactMap({
16721
16775
  IconComponent: DynamicIcon,
16722
16776
  ImgComponent: img.Img
16723
16777
  };
16724
- }, [mapClassName, mapProps, optixFlowConfig]);
16778
+ }, [mapClassName, mapProps, optixFlowConfig, sanitizedMapData]);
16779
+ const hasMap = resolvedMapProps !== null;
16725
16780
  return /* @__PURE__ */ jsxRuntime.jsx(
16726
16781
  Section,
16727
16782
  {
@@ -16736,8 +16791,10 @@ function ContactMap({
16736
16791
  "div",
16737
16792
  {
16738
16793
  className: cn(
16739
- "mx-auto grid max-w-full md:max-w-7xl gap-8 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",
16740
- contentGridClassName
16794
+ "mx-auto grid max-w-full gap-8",
16795
+ hasMap && "md:max-w-7xl lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",
16796
+ contentGridClassName,
16797
+ !hasMap && "md:max-w-3xl lg:grid-cols-1"
16741
16798
  ),
16742
16799
  children: [
16743
16800
  /* @__PURE__ */ jsxRuntime.jsx(Card, { className: cn("shadow-lg rounded-xl", cardClassName), children: /* @__PURE__ */ jsxRuntime.jsxs(CardContent, { className: cardContentClassName, children: [
@@ -16765,7 +16822,7 @@ function ContactMap({
16765
16822
  ] }),
16766
16823
  renderForm
16767
16824
  ] }) }),
16768
- /* @__PURE__ */ jsxRuntime.jsx(
16825
+ resolvedMapProps ? /* @__PURE__ */ jsxRuntime.jsx(
16769
16826
  "div",
16770
16827
  {
16771
16828
  className: cn(
@@ -16779,7 +16836,7 @@ function ContactMap({
16779
16836
  },
16780
16837
  children: /* @__PURE__ */ jsxRuntime.jsx(maps.GeoMap, { ...resolvedMapProps })
16781
16838
  }
16782
- )
16839
+ ) : null
16783
16840
  ]
16784
16841
  }
16785
16842
  )
@@ -51342,7 +51399,7 @@ function HeroPanel({
51342
51399
  src,
51343
51400
  alt: logo.alt,
51344
51401
  className: cn(
51345
- "h-10 md:h-12 lg:h-14 w-auto max-w-[70%] object-contain",
51402
+ "h-10 md:h-12 lg:h-14 w-auto object-contain",
51346
51403
  logo.imgClassName,
51347
51404
  logoClassName
51348
51405
  ),
package/dist/registry.js CHANGED
@@ -16634,6 +16634,46 @@ var DEFAULT_FORM_FIELDS23 = [
16634
16634
  columnSpan: 12
16635
16635
  }
16636
16636
  ];
16637
+ function coerceCoordinate(value) {
16638
+ if (typeof value === "number") {
16639
+ return Number.isFinite(value) ? value : null;
16640
+ }
16641
+ if (typeof value === "string" && value.trim().length > 0) {
16642
+ const parsed = Number(value);
16643
+ return Number.isFinite(parsed) ? parsed : null;
16644
+ }
16645
+ return null;
16646
+ }
16647
+ function sanitizeMarker(marker) {
16648
+ const markerWithAliases = marker;
16649
+ const latitude = coerceCoordinate(
16650
+ markerWithAliases.latitude ?? markerWithAliases.lat
16651
+ );
16652
+ const longitude = coerceCoordinate(
16653
+ markerWithAliases.longitude ?? markerWithAliases.lng
16654
+ );
16655
+ if (latitude === null || longitude === null) {
16656
+ return null;
16657
+ }
16658
+ return {
16659
+ ...marker,
16660
+ latitude,
16661
+ longitude
16662
+ };
16663
+ }
16664
+ function sanitizeCluster(cluster) {
16665
+ const markers = cluster.markers.map((marker) => sanitizeMarker(marker)).filter((marker) => marker !== null);
16666
+ if (markers.length === 0) {
16667
+ return null;
16668
+ }
16669
+ const latitude = coerceCoordinate(cluster.latitude);
16670
+ const longitude = coerceCoordinate(cluster.longitude);
16671
+ return {
16672
+ ...cluster,
16673
+ markers,
16674
+ ...latitude !== null && longitude !== null ? { latitude, longitude } : {}
16675
+ };
16676
+ }
16637
16677
  function ContactMap({
16638
16678
  sectionId = "contact-map",
16639
16679
  heading,
@@ -16669,10 +16709,24 @@ function ContactMap({
16669
16709
  }
16670
16710
  );
16671
16711
  }, [formEngineSetup]);
16712
+ const sanitizedMapData = React30.useMemo(() => {
16713
+ const markers = (mapProps?.markers ?? []).map((marker) => sanitizeMarker(marker)).filter((marker) => marker !== null);
16714
+ const clusters = (mapProps?.clusters ?? []).map((cluster) => sanitizeCluster(cluster)).filter((cluster) => cluster !== null);
16715
+ return {
16716
+ markers,
16717
+ clusters,
16718
+ hasRenderableMap: markers.length > 0 || clusters.length > 0
16719
+ };
16720
+ }, [mapProps?.clusters, mapProps?.markers]);
16672
16721
  const resolvedMapProps = React30.useMemo(() => {
16722
+ if (!sanitizedMapData.hasRenderableMap) {
16723
+ return null;
16724
+ }
16673
16725
  return {
16674
16726
  panelPosition: "top-left",
16675
16727
  ...mapProps,
16728
+ markers: sanitizedMapData.markers,
16729
+ clusters: sanitizedMapData.clusters,
16676
16730
  // Don't override mapWrapperClassName if it's provided in mapProps
16677
16731
  mapWrapperClassName: mapProps?.mapWrapperClassName,
16678
16732
  className: cn(mapClassName, mapProps?.className),
@@ -16681,7 +16735,8 @@ function ContactMap({
16681
16735
  IconComponent: DynamicIcon,
16682
16736
  ImgComponent: Img
16683
16737
  };
16684
- }, [mapClassName, mapProps, optixFlowConfig]);
16738
+ }, [mapClassName, mapProps, optixFlowConfig, sanitizedMapData]);
16739
+ const hasMap = resolvedMapProps !== null;
16685
16740
  return /* @__PURE__ */ jsx(
16686
16741
  Section,
16687
16742
  {
@@ -16696,8 +16751,10 @@ function ContactMap({
16696
16751
  "div",
16697
16752
  {
16698
16753
  className: cn(
16699
- "mx-auto grid max-w-full md:max-w-7xl gap-8 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",
16700
- contentGridClassName
16754
+ "mx-auto grid max-w-full gap-8",
16755
+ hasMap && "md:max-w-7xl lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",
16756
+ contentGridClassName,
16757
+ !hasMap && "md:max-w-3xl lg:grid-cols-1"
16701
16758
  ),
16702
16759
  children: [
16703
16760
  /* @__PURE__ */ jsx(Card, { className: cn("shadow-lg rounded-xl", cardClassName), children: /* @__PURE__ */ jsxs(CardContent, { className: cardContentClassName, children: [
@@ -16725,7 +16782,7 @@ function ContactMap({
16725
16782
  ] }),
16726
16783
  renderForm
16727
16784
  ] }) }),
16728
- /* @__PURE__ */ jsx(
16785
+ resolvedMapProps ? /* @__PURE__ */ jsx(
16729
16786
  "div",
16730
16787
  {
16731
16788
  className: cn(
@@ -16739,7 +16796,7 @@ function ContactMap({
16739
16796
  },
16740
16797
  children: /* @__PURE__ */ jsx(GeoMap, { ...resolvedMapProps })
16741
16798
  }
16742
- )
16799
+ ) : null
16743
16800
  ]
16744
16801
  }
16745
16802
  )
@@ -51302,7 +51359,7 @@ function HeroPanel({
51302
51359
  src,
51303
51360
  alt: logo.alt,
51304
51361
  className: cn(
51305
- "h-10 md:h-12 lg:h-14 w-auto max-w-[70%] object-contain",
51362
+ "h-10 md:h-12 lg:h-14 w-auto object-contain",
51306
51363
  logo.imgClassName,
51307
51364
  logoClassName
51308
51365
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensite/ui",
3
- "version": "3.5.3",
3
+ "version": "3.5.5",
4
4
  "description": "Foundational UI component library for OpenSite Semantic Site Builder with tree-shakable exports and abstract styling",
5
5
  "keywords": [
6
6
  "react",