@bison-lab/ui 1.9.0 → 1.11.0

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
@@ -85,6 +85,66 @@ function useIsMobile() {
85
85
  return !!isMobile;
86
86
  }
87
87
  //#endregion
88
+ //#region src/hooks/use-hide-on-scroll.ts
89
+ /**
90
+ * Tracks scroll direction and reports whether a fixed element should hide.
91
+ * `hidden` turns on while scrolling down past `threshold` and off again on
92
+ * the first meaningful scroll up. Reads are rAF-throttled, so a fast scroll
93
+ * costs one state update per frame at most.
94
+ *
95
+ * @example
96
+ * ```tsx
97
+ * const { hidden } = useHideOnScroll();
98
+ * <header className={hidden ? "-translate-y-full" : "translate-y-0"} />
99
+ * ```
100
+ */
101
+ function useHideOnScroll(options = {}) {
102
+ const { threshold = 80, tolerance = 6, disabled = false } = options;
103
+ const [hidden, setHidden] = React.useState(false);
104
+ const [scrolled, setScrolled] = React.useState(false);
105
+ const lastY = React.useRef(0);
106
+ const frame = React.useRef(null);
107
+ React.useEffect(() => {
108
+ const read = () => {
109
+ frame.current = null;
110
+ const y = Math.max(window.scrollY, 0);
111
+ const delta = y - lastY.current;
112
+ setScrolled(y > threshold);
113
+ if (disabled) {
114
+ setHidden(false);
115
+ lastY.current = y;
116
+ return;
117
+ }
118
+ if (y <= threshold) {
119
+ setHidden(false);
120
+ lastY.current = y;
121
+ } else if (Math.abs(delta) >= tolerance) {
122
+ setHidden(delta > 0);
123
+ lastY.current = y;
124
+ }
125
+ };
126
+ const onScroll = () => {
127
+ if (frame.current === null) frame.current = requestAnimationFrame(read);
128
+ };
129
+ lastY.current = Math.max(window.scrollY, 0);
130
+ read();
131
+ window.addEventListener("scroll", onScroll, { passive: true });
132
+ return () => {
133
+ window.removeEventListener("scroll", onScroll);
134
+ if (frame.current !== null) cancelAnimationFrame(frame.current);
135
+ frame.current = null;
136
+ };
137
+ }, [
138
+ threshold,
139
+ tolerance,
140
+ disabled
141
+ ]);
142
+ return {
143
+ hidden,
144
+ scrolled
145
+ };
146
+ }
147
+ //#endregion
88
148
  //#region src/providers/theme-provider.tsx
89
149
  const ThemeProviderContext = React.createContext(void 0);
90
150
  function ThemeProvider({ children, defaultTheme = "system", storageKey = "bison-theme", attribute = "data-theme", ...props }) {
@@ -5423,6 +5483,172 @@ function HeaderBlock({ logo, nav, actions, onMenuToggle, sticky = true, classNam
5423
5483
  });
5424
5484
  }
5425
5485
  //#endregion
5486
+ //#region src/blocks/layout/floating-nav-block.tsx
5487
+ const PANEL_COLUMNS = {
5488
+ 1: "w-[min(92vw,20rem)] grid-cols-1",
5489
+ 2: "w-[min(92vw,36rem)] grid-cols-1 sm:grid-cols-2",
5490
+ 3: "w-[min(92vw,48rem)] grid-cols-1 sm:grid-cols-3"
5491
+ };
5492
+ const FloatingNavBlock = React.forwardRef(({ logo, items = [], actions, renderLink, hideOnScroll = true, scrollThreshold = 80, viewport = false, navLabel = "Main", mobileMenuLabel = "Toggle menu", containerClassName, navClassName, className, ...props }, ref) => {
5493
+ const [openPanel, setOpenPanel] = React.useState("");
5494
+ const [mobileOpen, setMobileOpen] = React.useState(false);
5495
+ const { hidden, scrolled } = useHideOnScroll({
5496
+ threshold: scrollThreshold,
5497
+ disabled: !hideOnScroll || openPanel !== "" || mobileOpen
5498
+ });
5499
+ const closeDrawerOnLink = React.useCallback((event) => {
5500
+ if (event.target.closest("a")) setMobileOpen(false);
5501
+ }, []);
5502
+ const link = React.useCallback((linkProps) => {
5503
+ if (renderLink) return renderLink(linkProps);
5504
+ const { children, ...rest } = linkProps;
5505
+ return /* @__PURE__ */ jsx("a", {
5506
+ ...rest,
5507
+ children
5508
+ });
5509
+ }, [renderLink]);
5510
+ return /* @__PURE__ */ jsx("header", {
5511
+ ref,
5512
+ "data-hidden": hidden,
5513
+ "data-scrolled": scrolled,
5514
+ className: cn("pointer-events-none fixed inset-x-0 top-0 z-[var(--z-sticky)] pt-4 transition-transform duration-slow ease-out", hidden && "-translate-y-full", className),
5515
+ ...props,
5516
+ children: /* @__PURE__ */ jsx("div", {
5517
+ className: cn("mx-auto w-full max-w-6xl px-4 sm:px-6", containerClassName),
5518
+ children: /* @__PURE__ */ jsxs("div", {
5519
+ className: cn("pointer-events-auto flex items-center gap-6 rounded-xl border bg-background/85 px-3 py-3 shadow-lg backdrop-blur-2xl sm:px-5", navClassName),
5520
+ children: [
5521
+ /* @__PURE__ */ jsx("div", {
5522
+ className: "flex flex-1 items-center",
5523
+ children: logo
5524
+ }),
5525
+ items.length > 0 ? /* @__PURE__ */ jsx(NavigationMenu, {
5526
+ "aria-label": navLabel,
5527
+ viewport,
5528
+ value: openPanel,
5529
+ onValueChange: setOpenPanel,
5530
+ className: "hidden md:flex",
5531
+ children: /* @__PURE__ */ jsx(NavigationMenuList, {
5532
+ className: "gap-1",
5533
+ children: items.map((item) => {
5534
+ const panel = item.content ?? (item.items?.length ? /* @__PURE__ */ jsx("div", {
5535
+ className: cn("grid gap-1 p-2", PANEL_COLUMNS[item.columns ?? 2]),
5536
+ children: item.items.map((sub) => /* @__PURE__ */ jsx(NavigationMenuLink, {
5537
+ asChild: true,
5538
+ children: link({
5539
+ href: sub.href,
5540
+ className: "flex select-none items-start gap-3 rounded-md p-3 leading-none no-underline outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground",
5541
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [sub.icon ? /* @__PURE__ */ jsx("span", {
5542
+ className: "mt-0.5 shrink-0 text-muted-foreground",
5543
+ children: sub.icon
5544
+ }) : null, /* @__PURE__ */ jsxs("span", {
5545
+ className: "min-w-0",
5546
+ children: [/* @__PURE__ */ jsx("span", {
5547
+ className: "block text-sm font-medium",
5548
+ children: sub.label
5549
+ }), sub.description ? /* @__PURE__ */ jsx("span", {
5550
+ className: "mt-1.5 block text-sm leading-snug text-muted-foreground",
5551
+ children: sub.description
5552
+ }) : null]
5553
+ })] })
5554
+ })
5555
+ }, sub.href))
5556
+ }) : null);
5557
+ return /* @__PURE__ */ jsx(NavigationMenuItem, {
5558
+ value: item.label,
5559
+ children: panel ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(NavigationMenuTrigger, {
5560
+ "data-active": item.active,
5561
+ children: item.label
5562
+ }), /* @__PURE__ */ jsx(NavigationMenuContent, { children: panel })] }) : /* @__PURE__ */ jsx(NavigationMenuLink, {
5563
+ asChild: true,
5564
+ active: item.active,
5565
+ children: link({
5566
+ href: item.href ?? "#",
5567
+ className: navigationMenuTriggerStyle(),
5568
+ "aria-current": item.active ? "page" : void 0,
5569
+ children: item.label
5570
+ })
5571
+ })
5572
+ }, item.label);
5573
+ })
5574
+ })
5575
+ }) : null,
5576
+ /* @__PURE__ */ jsxs("div", {
5577
+ className: "flex flex-1 items-center justify-end gap-2",
5578
+ children: [actions, items.length > 0 ? /* @__PURE__ */ jsxs(Sheet, {
5579
+ open: mobileOpen,
5580
+ onOpenChange: setMobileOpen,
5581
+ children: [/* @__PURE__ */ jsx(SheetTrigger, {
5582
+ asChild: true,
5583
+ children: /* @__PURE__ */ jsx(Button, {
5584
+ variant: "ghost",
5585
+ size: "icon",
5586
+ className: "md:hidden",
5587
+ "aria-label": mobileMenuLabel,
5588
+ children: /* @__PURE__ */ jsx(Menu, {
5589
+ className: "size-5",
5590
+ "aria-hidden": true
5591
+ })
5592
+ })
5593
+ }), /* @__PURE__ */ jsxs(SheetContent, {
5594
+ side: "right",
5595
+ size: "sm",
5596
+ "aria-describedby": void 0,
5597
+ children: [/* @__PURE__ */ jsx(SheetTitle, {
5598
+ className: "sr-only",
5599
+ children: navLabel
5600
+ }), /* @__PURE__ */ jsxs("div", {
5601
+ onClick: closeDrawerOnLink,
5602
+ children: [logo ? /* @__PURE__ */ jsx("div", {
5603
+ className: "flex items-center pr-12",
5604
+ children: logo
5605
+ }) : null, /* @__PURE__ */ jsx("nav", {
5606
+ className: cn(logo ? "mt-8" : "mt-6"),
5607
+ children: /* @__PURE__ */ jsx(Accordion, {
5608
+ type: "single",
5609
+ collapsible: true,
5610
+ className: "w-full",
5611
+ children: items.map((item) => {
5612
+ const subs = item.items ?? [];
5613
+ if (!subs.length && !item.content) return /* @__PURE__ */ jsx("div", {
5614
+ className: "border-b",
5615
+ children: link({
5616
+ href: item.href ?? "#",
5617
+ className: "flex py-4 text-base font-medium hover:underline",
5618
+ "aria-current": item.active ? "page" : void 0,
5619
+ onClick: () => setMobileOpen(false),
5620
+ children: item.label
5621
+ })
5622
+ }, item.label);
5623
+ return /* @__PURE__ */ jsxs(AccordionItem, {
5624
+ value: item.label,
5625
+ children: [/* @__PURE__ */ jsx(AccordionTrigger, {
5626
+ className: "text-base",
5627
+ children: item.label
5628
+ }), /* @__PURE__ */ jsx(AccordionContent, {
5629
+ className: "flex flex-col gap-1 pl-1",
5630
+ children: item.content ?? subs.map((sub) => /* @__PURE__ */ jsx(React.Fragment, { children: link({
5631
+ href: sub.href,
5632
+ className: "block rounded-md px-2 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground",
5633
+ onClick: () => setMobileOpen(false),
5634
+ children: sub.label
5635
+ }) }, sub.href))
5636
+ })]
5637
+ }, item.label);
5638
+ })
5639
+ })
5640
+ })]
5641
+ })]
5642
+ })]
5643
+ }) : null]
5644
+ })
5645
+ ]
5646
+ })
5647
+ })
5648
+ });
5649
+ });
5650
+ FloatingNavBlock.displayName = "FloatingNavBlock";
5651
+ //#endregion
5426
5652
  //#region src/blocks/layout/sidebar-block.tsx
5427
5653
  function SidebarItemComponent({ item, collapsed }) {
5428
5654
  return /* @__PURE__ */ jsxs(item.href ? "a" : "button", {
@@ -5769,141 +5995,6 @@ const MediaCard = React.forwardRef(({ image, fallbackIcon, badge, title, descrip
5769
5995
  });
5770
5996
  MediaCard.displayName = "MediaCard";
5771
5997
  //#endregion
5772
- //#region src/blocks/data-display/reviews-block.tsx
5773
- function initials(name) {
5774
- return name.split(" ").map((n) => n[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
5775
- }
5776
- const SKELETON_CARDS = 4;
5777
- const ReviewsBlock = React.forwardRef(({ reviews, averageRating, totalReviews, title = "Customer Reviews", distribution, badgeVariant = "secondary", ratingClassName, loading, error, className, ...props }, ref) => {
5778
- const displayRating = Math.round(averageRating * 10) / 10;
5779
- return /* @__PURE__ */ jsx("section", {
5780
- ref,
5781
- className: cn("py-16 md:py-24", className),
5782
- ...props,
5783
- children: /* @__PURE__ */ jsxs("div", {
5784
- className: "mx-auto max-w-5xl px-4 sm:px-6",
5785
- children: [/* @__PURE__ */ jsx("h2", {
5786
- className: "mb-8 text-2xl font-semibold tracking-tight md:text-3xl",
5787
- children: title
5788
- }), error ? /* @__PURE__ */ jsx("p", {
5789
- className: "text-sm text-muted-foreground",
5790
- children: error
5791
- }) : /* @__PURE__ */ jsxs("div", {
5792
- className: "grid gap-8 lg:grid-cols-[280px_1fr] lg:gap-12",
5793
- children: [/* @__PURE__ */ jsxs("div", {
5794
- className: "space-y-6",
5795
- children: [/* @__PURE__ */ jsx("div", {
5796
- className: "text-center lg:text-left",
5797
- children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
5798
- /* @__PURE__ */ jsx(Skeleton, { className: "mx-auto h-12 w-20 lg:mx-0" }),
5799
- /* @__PURE__ */ jsx(Skeleton, { className: "mx-auto mt-2 h-5 w-28 lg:mx-0" }),
5800
- /* @__PURE__ */ jsx(Skeleton, { className: "mx-auto mt-1 h-4 w-36 lg:mx-0" })
5801
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
5802
- /* @__PURE__ */ jsx("div", {
5803
- className: "text-5xl font-bold",
5804
- children: displayRating.toFixed(1)
5805
- }),
5806
- /* @__PURE__ */ jsx(Rating, {
5807
- rate: displayRating,
5808
- size: "lg",
5809
- className: cn("mt-2 justify-center lg:justify-start", ratingClassName)
5810
- }),
5811
- /* @__PURE__ */ jsxs("p", {
5812
- className: "mt-1 text-sm text-muted-foreground",
5813
- children: [
5814
- "Based on ",
5815
- totalReviews.toLocaleString(),
5816
- " reviews"
5817
- ]
5818
- })
5819
- ] })
5820
- }), !loading && distribution && distribution.length > 0 && /* @__PURE__ */ jsx("div", {
5821
- className: "space-y-2",
5822
- children: [...distribution].sort((a, b) => b.star - a.star).map(({ star, count }) => /* @__PURE__ */ jsxs("div", {
5823
- className: "flex items-center gap-3",
5824
- children: [
5825
- /* @__PURE__ */ jsxs("span", {
5826
- className: "w-8 text-sm text-muted-foreground",
5827
- children: [star, " ★"]
5828
- }),
5829
- /* @__PURE__ */ jsx(Progress, {
5830
- value: totalReviews > 0 ? count / totalReviews * 100 : 0,
5831
- className: "h-2 flex-1"
5832
- }),
5833
- /* @__PURE__ */ jsx("span", {
5834
- className: "w-8 text-right text-sm text-muted-foreground",
5835
- children: count
5836
- })
5837
- ]
5838
- }, star))
5839
- })]
5840
- }), /* @__PURE__ */ jsx("div", {
5841
- className: "grid gap-4 sm:grid-cols-2",
5842
- children: loading ? Array.from({ length: SKELETON_CARDS }).map((_, i) => /* @__PURE__ */ jsx(Card, {
5843
- className: "gap-0 p-0 shadow-none",
5844
- children: /* @__PURE__ */ jsxs(CardContent, {
5845
- className: "space-y-3 p-5",
5846
- children: [
5847
- /* @__PURE__ */ jsxs("div", {
5848
- className: "flex items-center gap-2.5",
5849
- children: [/* @__PURE__ */ jsx(Skeleton, { className: "size-9 rounded-full" }), /* @__PURE__ */ jsxs("div", {
5850
- className: "space-y-1.5",
5851
- children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-16" })]
5852
- })]
5853
- }),
5854
- /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full" }),
5855
- /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4/5" })
5856
- ]
5857
- })
5858
- }, i)) : reviews.map((review) => /* @__PURE__ */ jsx(Card, {
5859
- className: "gap-0 p-0 shadow-none",
5860
- children: /* @__PURE__ */ jsxs(CardContent, {
5861
- className: "space-y-3 p-5",
5862
- children: [/* @__PURE__ */ jsxs("div", {
5863
- className: "flex items-start justify-between gap-2",
5864
- children: [/* @__PURE__ */ jsxs("div", {
5865
- className: "flex items-center gap-2.5",
5866
- children: [/* @__PURE__ */ jsxs(Avatar, {
5867
- className: "size-9",
5868
- children: [review.author.avatarUrl && /* @__PURE__ */ jsx(AvatarImage, {
5869
- src: review.author.avatarUrl,
5870
- alt: review.author.name
5871
- }), /* @__PURE__ */ jsx(AvatarFallback, {
5872
- className: "text-xs",
5873
- children: initials(review.author.name)
5874
- })]
5875
- }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
5876
- className: "flex items-center gap-1.5",
5877
- children: [/* @__PURE__ */ jsx("span", {
5878
- className: "text-sm font-medium",
5879
- children: review.author.name
5880
- }), review.badgeLabel && /* @__PURE__ */ jsx(Badge, {
5881
- variant: badgeVariant,
5882
- className: "h-5 px-1.5 text-[0.625rem]",
5883
- children: review.badgeLabel
5884
- })]
5885
- }), /* @__PURE__ */ jsx("p", {
5886
- className: "text-xs text-muted-foreground",
5887
- children: review.date
5888
- })] })]
5889
- }), /* @__PURE__ */ jsx(Rating, {
5890
- rate: review.rating,
5891
- size: "sm",
5892
- className: ratingClassName
5893
- })]
5894
- }), /* @__PURE__ */ jsx("p", {
5895
- className: "line-clamp-4 text-sm leading-relaxed text-muted-foreground",
5896
- children: review.content
5897
- })]
5898
- })
5899
- }, review.id))
5900
- })]
5901
- })]
5902
- })
5903
- });
5904
- });
5905
- ReviewsBlock.displayName = "ReviewsBlock";
5906
- //#endregion
5907
5998
  //#region src/blocks/marketing/json-ld.tsx
5908
5999
  /**
5909
6000
  * Maps a `NapRecord` — the same object rendered by `NapBlock` — onto
@@ -6649,6 +6740,285 @@ const FAQColumnsBlock = React.forwardRef(({ items, title, description, eyebrow,
6649
6740
  });
6650
6741
  FAQColumnsBlock.displayName = "FAQColumnsBlock";
6651
6742
  //#endregion
6743
+ //#region src/blocks/marketing/reviews-block.tsx
6744
+ function initials$1(name) {
6745
+ return name.split(" ").map((n) => n[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
6746
+ }
6747
+ const SKELETON_CARDS = 4;
6748
+ const ReviewsBlock = React.forwardRef(({ reviews, averageRating, totalReviews, title = "Customer Reviews", distribution, badgeVariant = "secondary", ratingClassName, loading, error, className, ...props }, ref) => {
6749
+ const displayRating = Math.round(averageRating * 10) / 10;
6750
+ return /* @__PURE__ */ jsx("section", {
6751
+ ref,
6752
+ className: cn("py-16 md:py-24", className),
6753
+ ...props,
6754
+ children: /* @__PURE__ */ jsxs("div", {
6755
+ className: "mx-auto max-w-5xl px-4 sm:px-6",
6756
+ children: [/* @__PURE__ */ jsx("h2", {
6757
+ className: "mb-8 text-2xl font-semibold tracking-tight md:text-3xl",
6758
+ children: title
6759
+ }), error ? /* @__PURE__ */ jsx("p", {
6760
+ className: "text-sm text-muted-foreground",
6761
+ children: error
6762
+ }) : /* @__PURE__ */ jsxs("div", {
6763
+ className: "grid gap-8 lg:grid-cols-[280px_1fr] lg:gap-12",
6764
+ children: [/* @__PURE__ */ jsxs("div", {
6765
+ className: "space-y-6",
6766
+ children: [/* @__PURE__ */ jsx("div", {
6767
+ className: "text-center lg:text-left",
6768
+ children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
6769
+ /* @__PURE__ */ jsx(Skeleton, { className: "mx-auto h-12 w-20 lg:mx-0" }),
6770
+ /* @__PURE__ */ jsx(Skeleton, { className: "mx-auto mt-2 h-5 w-28 lg:mx-0" }),
6771
+ /* @__PURE__ */ jsx(Skeleton, { className: "mx-auto mt-1 h-4 w-36 lg:mx-0" })
6772
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
6773
+ /* @__PURE__ */ jsx("div", {
6774
+ className: "text-5xl font-bold",
6775
+ children: displayRating.toFixed(1)
6776
+ }),
6777
+ /* @__PURE__ */ jsx(Rating, {
6778
+ rate: displayRating,
6779
+ size: "lg",
6780
+ className: cn("mt-2 justify-center lg:justify-start", ratingClassName)
6781
+ }),
6782
+ /* @__PURE__ */ jsxs("p", {
6783
+ className: "mt-1 text-sm text-muted-foreground",
6784
+ children: [
6785
+ "Based on ",
6786
+ totalReviews.toLocaleString(),
6787
+ " reviews"
6788
+ ]
6789
+ })
6790
+ ] })
6791
+ }), !loading && distribution && distribution.length > 0 && /* @__PURE__ */ jsx("div", {
6792
+ className: "space-y-2",
6793
+ children: [...distribution].sort((a, b) => b.star - a.star).map(({ star, count }) => /* @__PURE__ */ jsxs("div", {
6794
+ className: "flex items-center gap-3",
6795
+ children: [
6796
+ /* @__PURE__ */ jsxs("span", {
6797
+ className: "w-8 text-sm text-muted-foreground",
6798
+ children: [star, " ★"]
6799
+ }),
6800
+ /* @__PURE__ */ jsx(Progress, {
6801
+ value: totalReviews > 0 ? count / totalReviews * 100 : 0,
6802
+ className: "h-2 flex-1"
6803
+ }),
6804
+ /* @__PURE__ */ jsx("span", {
6805
+ className: "w-8 text-right text-sm text-muted-foreground",
6806
+ children: count
6807
+ })
6808
+ ]
6809
+ }, star))
6810
+ })]
6811
+ }), /* @__PURE__ */ jsx("div", {
6812
+ className: "grid gap-4 sm:grid-cols-2",
6813
+ children: loading ? Array.from({ length: SKELETON_CARDS }).map((_, i) => /* @__PURE__ */ jsx(Card, {
6814
+ className: "gap-0 p-0 shadow-none",
6815
+ children: /* @__PURE__ */ jsxs(CardContent, {
6816
+ className: "space-y-3 p-5",
6817
+ children: [
6818
+ /* @__PURE__ */ jsxs("div", {
6819
+ className: "flex items-center gap-2.5",
6820
+ children: [/* @__PURE__ */ jsx(Skeleton, { className: "size-9 rounded-full" }), /* @__PURE__ */ jsxs("div", {
6821
+ className: "space-y-1.5",
6822
+ children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-16" })]
6823
+ })]
6824
+ }),
6825
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full" }),
6826
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-4/5" })
6827
+ ]
6828
+ })
6829
+ }, i)) : reviews.map((review) => /* @__PURE__ */ jsx(Card, {
6830
+ className: "gap-0 p-0 shadow-none",
6831
+ children: /* @__PURE__ */ jsxs(CardContent, {
6832
+ className: "space-y-3 p-5",
6833
+ children: [/* @__PURE__ */ jsxs("div", {
6834
+ className: "flex items-start justify-between gap-2",
6835
+ children: [/* @__PURE__ */ jsxs("div", {
6836
+ className: "flex items-center gap-2.5",
6837
+ children: [/* @__PURE__ */ jsxs(Avatar, {
6838
+ className: "size-9",
6839
+ children: [review.author.avatarUrl && /* @__PURE__ */ jsx(AvatarImage, {
6840
+ src: review.author.avatarUrl,
6841
+ alt: review.author.name
6842
+ }), /* @__PURE__ */ jsx(AvatarFallback, {
6843
+ className: "text-xs",
6844
+ children: initials$1(review.author.name)
6845
+ })]
6846
+ }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
6847
+ className: "flex items-center gap-1.5",
6848
+ children: [/* @__PURE__ */ jsx("span", {
6849
+ className: "text-sm font-medium",
6850
+ children: review.author.name
6851
+ }), review.badgeLabel && /* @__PURE__ */ jsx(Badge, {
6852
+ variant: badgeVariant,
6853
+ className: "h-5 px-1.5 text-[0.625rem]",
6854
+ children: review.badgeLabel
6855
+ })]
6856
+ }), /* @__PURE__ */ jsx("p", {
6857
+ className: "text-xs text-muted-foreground",
6858
+ children: review.date
6859
+ })] })]
6860
+ }), /* @__PURE__ */ jsx(Rating, {
6861
+ rate: review.rating,
6862
+ size: "sm",
6863
+ className: ratingClassName
6864
+ })]
6865
+ }), /* @__PURE__ */ jsx("p", {
6866
+ className: "line-clamp-4 text-sm leading-relaxed text-muted-foreground",
6867
+ children: review.content
6868
+ })]
6869
+ })
6870
+ }, review.id))
6871
+ })]
6872
+ })]
6873
+ })
6874
+ });
6875
+ });
6876
+ ReviewsBlock.displayName = "ReviewsBlock";
6877
+ //#endregion
6878
+ //#region src/blocks/marketing/testimonial-masonry-block.tsx
6879
+ function initials(name) {
6880
+ return name.split(" ").map((part) => part[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
6881
+ }
6882
+ function groupCardsByRow(cards) {
6883
+ const rows = /* @__PURE__ */ new Map();
6884
+ for (const card of cards) {
6885
+ const top = Math.round(card.getBoundingClientRect().top);
6886
+ const row = rows.get(top) ?? [];
6887
+ row.push(card);
6888
+ rows.set(top, row);
6889
+ }
6890
+ return rows;
6891
+ }
6892
+ function measureClampHeight(cards, gridTop, maxVisibleRows) {
6893
+ const rows = groupCardsByRow(cards);
6894
+ const visibleTops = [...rows.keys()].sort((a, b) => a - b).slice(0, maxVisibleRows);
6895
+ let bottom = gridTop;
6896
+ for (const top of visibleTops) for (const card of rows.get(top) ?? []) bottom = Math.max(bottom, card.getBoundingClientRect().bottom);
6897
+ return bottom - gridTop;
6898
+ }
6899
+ const TestimonialMasonry = React.forwardRef(({ items, title, description, eyebrow, link, minItemsForFade = 7, minItemsForClamp = 10, maxVisibleRows = 2, containerClassName, eyebrowClassName, titleClassName, descriptionClassName, gridWrapperClassName, gridClassName, cardClassName, contentClassName, authorNameClassName, authorTitleClassName, avatarClassName, fadeClassName, linkClassName, className, ...props }, ref) => {
6900
+ const headingId = React.useId();
6901
+ const gridRef = React.useRef(null);
6902
+ const [clampHeight, setClampHeight] = React.useState();
6903
+ const showFade = items.length >= minItemsForFade;
6904
+ React.useLayoutEffect(() => {
6905
+ const grid = gridRef.current;
6906
+ if (!grid) return;
6907
+ const measure = () => {
6908
+ if (items.length < minItemsForClamp) {
6909
+ setClampHeight(void 0);
6910
+ return;
6911
+ }
6912
+ const cards = Array.from(grid.querySelectorAll("[data-testimonial-card]"));
6913
+ if (cards.length === 0) {
6914
+ setClampHeight(void 0);
6915
+ return;
6916
+ }
6917
+ const gridTop = grid.getBoundingClientRect().top;
6918
+ setClampHeight(measureClampHeight(cards, gridTop, maxVisibleRows));
6919
+ };
6920
+ measure();
6921
+ const observer = new ResizeObserver(measure);
6922
+ observer.observe(grid);
6923
+ window.addEventListener("resize", measure);
6924
+ return () => {
6925
+ observer.disconnect();
6926
+ window.removeEventListener("resize", measure);
6927
+ };
6928
+ }, [
6929
+ items,
6930
+ maxVisibleRows,
6931
+ minItemsForClamp
6932
+ ]);
6933
+ return /* @__PURE__ */ jsx("section", {
6934
+ ref,
6935
+ "aria-labelledby": props["aria-label"] ? void 0 : headingId,
6936
+ className: cn("bg-accent px-6 lg:px-0", className),
6937
+ ...props,
6938
+ children: /* @__PURE__ */ jsxs("div", {
6939
+ className: cn("mx-auto max-w-6xl px-0 py-16 sm:py-20 md:px-6 md:py-28", containerClassName),
6940
+ children: [
6941
+ eyebrow != null ? typeof eyebrow === "string" ? /* @__PURE__ */ jsx("p", {
6942
+ className: cn("mb-4 text-center text-sm font-normal leading-tight text-muted-foreground sm:text-base", eyebrowClassName),
6943
+ children: eyebrow
6944
+ }) : /* @__PURE__ */ jsx("div", {
6945
+ className: cn("mb-4 text-center", eyebrowClassName),
6946
+ children: eyebrow
6947
+ }) : null,
6948
+ /* @__PURE__ */ jsx("h2", {
6949
+ id: headingId,
6950
+ className: cn("mx-auto max-w-4xl text-balance text-center text-3xl font-medium leading-tight tracking-tight sm:text-4xl md:text-5xl", titleClassName),
6951
+ children: title
6952
+ }),
6953
+ description ? /* @__PURE__ */ jsx("p", {
6954
+ className: cn("mx-auto mt-4 max-w-2xl text-center text-base font-normal text-muted-foreground sm:text-lg", descriptionClassName),
6955
+ children: description
6956
+ }) : null,
6957
+ /* @__PURE__ */ jsxs("div", {
6958
+ className: cn("relative mt-10 md:mt-14", gridWrapperClassName),
6959
+ style: clampHeight != null ? {
6960
+ maxHeight: clampHeight,
6961
+ overflow: "hidden"
6962
+ } : void 0,
6963
+ children: [showFade ? /* @__PURE__ */ jsx("div", {
6964
+ "aria-hidden": true,
6965
+ className: cn("pointer-events-none absolute inset-x-0 bottom-0 z-10 h-24 bg-gradient-to-t from-accent to-accent/0", fadeClassName)
6966
+ }) : null, /* @__PURE__ */ jsx("ul", {
6967
+ ref: gridRef,
6968
+ className: cn("flex flex-wrap justify-center gap-4", gridClassName),
6969
+ children: items.map((item) => /* @__PURE__ */ jsxs("li", {
6970
+ "data-testimonial-card": true,
6971
+ className: cn("flex w-full flex-col justify-between rounded-2xl bg-card p-6", "sm:w-[calc((100%-1rem)/2)]", "lg:w-[calc((100%-2rem)/3)]", cardClassName),
6972
+ children: [/* @__PURE__ */ jsx("p", {
6973
+ className: cn("text-base font-normal leading-relaxed", contentClassName),
6974
+ children: item.content
6975
+ }), /* @__PURE__ */ jsxs("div", {
6976
+ className: "mt-6 flex items-center gap-3",
6977
+ children: [/* @__PURE__ */ jsx(Avatar, {
6978
+ className: cn("size-9", avatarClassName),
6979
+ children: item.author.avatar ? /* @__PURE__ */ jsx(AvatarFallback, {
6980
+ className: "text-xs",
6981
+ children: item.author.avatar
6982
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [item.author.avatarUrl ? /* @__PURE__ */ jsx(AvatarImage, {
6983
+ src: item.author.avatarUrl,
6984
+ alt: item.author.name
6985
+ }) : null, /* @__PURE__ */ jsx(AvatarFallback, {
6986
+ className: "text-xs",
6987
+ children: initials(item.author.name)
6988
+ })] })
6989
+ }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
6990
+ className: cn("mb-0.5 text-base font-medium leading-tight", authorNameClassName),
6991
+ children: item.author.name
6992
+ }), item.author.title ? /* @__PURE__ */ jsx("div", {
6993
+ className: cn("text-sm font-normal text-muted-foreground", authorTitleClassName),
6994
+ children: item.author.title
6995
+ }) : null] })]
6996
+ })]
6997
+ }, item.id))
6998
+ })]
6999
+ }),
7000
+ showFade && link ? /* @__PURE__ */ jsx("div", {
7001
+ className: cn("relative z-20 -mt-6 flex justify-center transition-all duration-300", linkClassName),
7002
+ children: /* @__PURE__ */ jsx(Button, {
7003
+ asChild: true,
7004
+ variant: link.variant ?? "default",
7005
+ size: link.size ?? "lg",
7006
+ children: /* @__PURE__ */ jsx("a", {
7007
+ href: link.href,
7008
+ ...link.newTab ? {
7009
+ target: "_blank",
7010
+ rel: "noopener noreferrer"
7011
+ } : {},
7012
+ children: link.label
7013
+ })
7014
+ })
7015
+ }) : null
7016
+ ]
7017
+ })
7018
+ });
7019
+ });
7020
+ TestimonialMasonry.displayName = "TestimonialMasonry";
7021
+ //#endregion
6652
7022
  //#region src/blocks/settings/profile-settings-block.tsx
6653
7023
  function ProfileSettingsBlock({ initialData, onSave, onAvatarChange, loading = false, error, disabled = false, className }) {
6654
7024
  const fileInputRef = React.useRef(null);
@@ -6927,6 +7297,6 @@ function NotificationSettingsBlock({ groups, onSave, loading = false, error, dis
6927
7297
  });
6928
7298
  }
6929
7299
  //#endregion
6930
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CodeInput, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CurrencyInput, DataTable, DataTableColumnHeader, DatePicker, DateRangePicker, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditableTitle, EmptyStateBlock, FAQColumnsBlock, FieldGroupScope, FieldProvider, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, Input, InputGroup, JsonLd, Label, MaintenanceBlock, MediaCard, NapBlock, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, OutlinedField, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, PhoneInput, Popover, PopoverContent, PopoverTrigger, ProcessStepsBlock, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, Rating, ResetPasswordBlock, ReviewsBlock, SavedPing, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, ShowcasePanelsBlock, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialProviders, Spinner, Stepper, StepperDescription, StepperIndicator, StepperItem, StepperLabel, StepperSeparator, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TextContent, TextEditor, Textarea, ThemeProvider, ThemeScope, TimePicker, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VerifyBlock, actionNegativeToneClasses, actionNeutralIconChromeClasses, actionNeutralToneClasses, actionPositiveToneClasses, alertVariants, avatarVariants, badgeVariants, buttonVariants, cn, dateRangePresets, editableTitleVariants, formatUsPhone, napRecordToJsonLd, navigationMenuTriggerStyle, outlinedFieldNestResetClasses, parseUsPhoneDigits, progressBarVariants, ratingVariants, spinnerVariants, stepperIndicatorVariants, stepperItemVariants, stepperLabelVariants, switchVariants, toast, useDensity, useField, useFieldControl, useFieldGroup, useFieldIds, useFormContext, useIsMobile, useScrollReveal, useSidebar, useTheme };
7300
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CodeInput, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CurrencyInput, DataTable, DataTableColumnHeader, DatePicker, DateRangePicker, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditableTitle, EmptyStateBlock, FAQColumnsBlock, FieldGroupScope, FieldProvider, FloatingNavBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, Input, InputGroup, JsonLd, Label, MaintenanceBlock, MediaCard, NapBlock, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, OutlinedField, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, PhoneInput, Popover, PopoverContent, PopoverTrigger, ProcessStepsBlock, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, Rating, ResetPasswordBlock, ReviewsBlock, SavedPing, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, ShowcasePanelsBlock, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialProviders, Spinner, Stepper, StepperDescription, StepperIndicator, StepperItem, StepperLabel, StepperSeparator, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TestimonialMasonry, TextContent, TextEditor, Textarea, ThemeProvider, ThemeScope, TimePicker, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VerifyBlock, actionNegativeToneClasses, actionNeutralIconChromeClasses, actionNeutralToneClasses, actionPositiveToneClasses, alertVariants, avatarVariants, badgeVariants, buttonVariants, cn, dateRangePresets, editableTitleVariants, formatUsPhone, napRecordToJsonLd, navigationMenuTriggerStyle, outlinedFieldNestResetClasses, parseUsPhoneDigits, progressBarVariants, ratingVariants, spinnerVariants, stepperIndicatorVariants, stepperItemVariants, stepperLabelVariants, switchVariants, toast, useDensity, useField, useFieldControl, useFieldGroup, useFieldIds, useFormContext, useHideOnScroll, useIsMobile, useScrollReveal, useSidebar, useTheme };
6931
7301
 
6932
7302
  //# sourceMappingURL=index.mjs.map