@fumadocs/base-ui 16.7.2 → 16.7.3

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.
Files changed (33) hide show
  1. package/css/generated/docs.css +1 -8
  2. package/css/generated/flux.css +0 -3
  3. package/css/generated/home.css +26 -11
  4. package/css/generated/notebook.css +2 -4
  5. package/css/generated/shared.css +63 -10
  6. package/dist/components/sidebar/base.js +1 -2
  7. package/dist/components/tabs.d.ts +9 -4
  8. package/dist/components/tabs.js +12 -13
  9. package/dist/components/toc/clerk.js +65 -29
  10. package/dist/components/toc/default.js +5 -3
  11. package/dist/components/toc/index.d.ts +4 -2
  12. package/dist/components/toc/index.js +36 -18
  13. package/dist/components/ui/button.d.ts +1 -1
  14. package/dist/components/ui/collapsible.js +1 -1
  15. package/dist/components/ui/navigation-menu.d.ts +24 -12
  16. package/dist/components/ui/navigation-menu.js +47 -32
  17. package/dist/components/ui/popover.d.ts +7 -1
  18. package/dist/components/ui/popover.js +13 -13
  19. package/dist/components/ui/scroll-area.d.ts +15 -4
  20. package/dist/components/ui/scroll-area.js +26 -27
  21. package/dist/layouts/docs/page/slots/toc.js +3 -3
  22. package/dist/layouts/docs/slots/sidebar.js +9 -19
  23. package/dist/layouts/flux/page/slots/toc.js +3 -3
  24. package/dist/layouts/flux/slots/sidebar.js +8 -13
  25. package/dist/layouts/home/index.js +6 -1
  26. package/dist/layouts/home/navbar.d.ts +2 -4
  27. package/dist/layouts/home/navbar.js +6 -9
  28. package/dist/layouts/home/slots/header.d.ts +2 -3
  29. package/dist/layouts/home/slots/header.js +122 -112
  30. package/dist/layouts/notebook/page/slots/toc.js +3 -3
  31. package/dist/layouts/notebook/slots/sidebar.js +9 -19
  32. package/dist/style.css +302 -60
  33. package/package.json +4 -4
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
  import { cn } from "../utils/cn.js";
3
3
  import { Tabs as Tabs$1, TabsContent as TabsContent$1, TabsList as TabsList$1, TabsTrigger as TabsTrigger$1 } from "./ui/tabs.js";
4
- import * as React$1 from "react";
5
4
  import { createContext, useContext, useEffect, useId, useMemo, useState } from "react";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
7
6
  //#region src/components/tabs.tsx
@@ -11,18 +10,18 @@ function useTabContext() {
11
10
  if (!ctx) throw new Error("You must wrap your component in <Tabs>");
12
11
  return ctx;
13
12
  }
14
- const TabsList = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(TabsList$1, {
15
- ref,
16
- ...props,
17
- className: (s) => cn("flex gap-3.5 text-fd-secondary-foreground overflow-x-auto px-4 not-prose", typeof className === "function" ? className(s) : className)
18
- }));
19
- TabsList.displayName = "TabsList";
20
- const TabsTrigger = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(TabsTrigger$1, {
21
- ref,
22
- ...props,
23
- className: (s) => cn("inline-flex items-center gap-2 whitespace-nowrap text-fd-muted-foreground border-b border-transparent py-2 text-sm font-medium transition-colors [&_svg]:size-4 hover:text-fd-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[active]:border-fd-primary data-[active]:text-fd-primary", typeof className === "function" ? className(s) : className)
24
- }));
25
- TabsTrigger.displayName = "TabsTrigger";
13
+ function TabsList({ className, ...props }) {
14
+ return /* @__PURE__ */ jsx(TabsList$1, {
15
+ ...props,
16
+ className: (s) => cn("flex gap-3.5 text-fd-secondary-foreground overflow-x-auto px-4 not-prose", typeof className === "function" ? className(s) : className)
17
+ });
18
+ }
19
+ function TabsTrigger({ className, ...props }) {
20
+ return /* @__PURE__ */ jsx(TabsTrigger$1, {
21
+ ...props,
22
+ className: (s) => cn("inline-flex items-center gap-2 whitespace-nowrap text-fd-muted-foreground border-b border-transparent py-2 text-sm font-medium transition-colors [&_svg]:size-4 hover:text-fd-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[active]:border-fd-primary data-[active]:text-fd-primary", typeof className === "function" ? className(s) : className)
23
+ });
24
+ }
26
25
  function Tabs({ ref, className, items, label, defaultIndex = 0, defaultValue = items ? escapeValue(items[defaultIndex]) : void 0, ...props }) {
27
26
  const [value, setValue] = useState(defaultValue);
28
27
  const collection = useMemo(() => [], []);
@@ -11,29 +11,37 @@ function TOCItems({ ref, className, ...props }) {
11
11
  const containerRef = useRef(null);
12
12
  const items = useTOCItems();
13
13
  const { text } = useI18n();
14
+ const svgRef = useRef(null);
14
15
  const [svg, setSvg] = useState();
15
16
  useEffect(() => {
16
17
  if (!containerRef.current) return;
17
18
  const container = containerRef.current;
18
19
  function onResize() {
19
20
  if (container.clientHeight === 0) return;
20
- let w = 0, h = 0;
21
- const d = [];
21
+ let w = 0, h = 0, b1 = 0, d = "";
22
22
  for (let i = 0; i < items.length; i++) {
23
23
  const element = container.querySelector(`a[href="#${items[i].url.slice(1)}"]`);
24
24
  if (!element) continue;
25
25
  const styles = getComputedStyle(element);
26
- const offset = getLineOffset(items[i].depth) + 1, top = element.offsetTop + parseFloat(styles.paddingTop), bottom = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
26
+ const offset = getLineOffset(items[i].depth) + 1, t2 = element.offsetTop + parseFloat(styles.paddingTop), b2 = element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom);
27
27
  w = Math.max(offset, w);
28
- h = Math.max(h, bottom);
29
- d.push(`${i === 0 ? "M" : "L"}${offset} ${top}`);
30
- d.push(`L${offset} ${bottom}`);
28
+ h = Math.max(h, b2);
29
+ if (i === 0) d += ` M${offset} ${t2} L${offset} ${b2}`;
30
+ else {
31
+ const pOffset = getLineOffset(items[i - 1].depth) + 1;
32
+ d += ` C ${pOffset} ${t2 - 4} ${offset} ${b1 + 4} ${offset} ${t2} L${offset} ${b2}`;
33
+ }
34
+ b1 = b2;
35
+ }
36
+ w += 1;
37
+ if (!svgRef.current || svgRef.current.d !== d) {
38
+ svgRef.current = {
39
+ d,
40
+ width: w,
41
+ height: h
42
+ };
43
+ setSvg(svgRef.current);
31
44
  }
32
- setSvg({
33
- path: d.join(" "),
34
- width: w + 1,
35
- height: h
36
- });
37
45
  }
38
46
  const observer = new ResizeObserver(onResize);
39
47
  onResize();
@@ -46,17 +54,29 @@ function TOCItems({ ref, className, ...props }) {
46
54
  className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",
47
55
  children: text.tocNoHeadings
48
56
  });
49
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [svg && /* @__PURE__ */ jsx("div", {
50
- className: "absolute start-0 top-0 rtl:-scale-x-100",
57
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [svg && /* @__PURE__ */ jsxs(TocThumb, {
58
+ containerRef,
59
+ className: "absolute top-0 inset-s-0",
51
60
  style: {
52
61
  width: svg.width,
53
- height: svg.height,
54
- maskImage: `url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${svg.width} ${svg.height}"><path d="${svg.path}" stroke="black" stroke-width="1" fill="none" /></svg>`)}")`
62
+ height: svg.height
55
63
  },
56
- children: /* @__PURE__ */ jsx(TocThumb, {
57
- containerRef,
58
- className: "absolute w-full top-(--fd-top) h-(--fd-height) bg-fd-primary transition-[top,height]"
59
- })
64
+ children: [/* @__PURE__ */ jsx("svg", {
65
+ xmlns: "http://www.w3.org/2000/svg",
66
+ viewBox: `0 0 ${svg.width} ${svg.height}`,
67
+ className: "absolute inset-0 transition-[clip-path] delay-25",
68
+ style: {
69
+ width: svg.width,
70
+ height: svg.height,
71
+ clipPath: `polygon(0 var(--fd-top), 100% var(--fd-top), 100% calc(var(--fd-top) + var(--fd-height)), 0 calc(var(--fd-top) + var(--fd-height)))`
72
+ },
73
+ children: /* @__PURE__ */ jsx("path", {
74
+ d: svg.d,
75
+ className: "stroke-fd-primary",
76
+ strokeWidth: "1",
77
+ fill: "none"
78
+ })
79
+ }), /* @__PURE__ */ jsx(ThumbBox, {})]
60
80
  }), /* @__PURE__ */ jsx("div", {
61
81
  ref: mergeRefs(containerRef, ref),
62
82
  className: cn("flex flex-col", className),
@@ -68,13 +88,25 @@ function TOCItems({ ref, className, ...props }) {
68
88
  }, item.url))
69
89
  })] });
70
90
  }
91
+ function ThumbBox() {
92
+ const items = useTOCItems();
93
+ const ids = Primitive.useActiveAnchors();
94
+ const item = items.findLast((item) => ids.includes(item.url.slice(1)));
95
+ if (!item) return;
96
+ return /* @__PURE__ */ jsx("div", {
97
+ className: "absolute size-1 bg-fd-primary rounded-full delay-25 transition-transform",
98
+ style: { translate: `calc(${getLineOffset(item.depth)}px - 1.25px) calc(var(--fd-top) + var(--fd-height))` }
99
+ });
100
+ }
71
101
  function getItemOffset(depth) {
72
102
  if (depth <= 2) return 14;
73
103
  if (depth === 3) return 26;
74
104
  return 36;
75
105
  }
76
106
  function getLineOffset(depth) {
77
- return depth >= 3 ? 10 : 0;
107
+ if (depth <= 2) return 2;
108
+ if (depth === 3) return 10;
109
+ return 20;
78
110
  }
79
111
  function TOCItem({ item, upper = item.depth, lower = item.depth }) {
80
112
  const offset = getLineOffset(item.depth), upperOffset = getLineOffset(upper), lowerOffset = getLineOffset(lower);
@@ -85,15 +117,19 @@ function TOCItem({ item, upper = item.depth, lower = item.depth }) {
85
117
  children: [
86
118
  offset !== upperOffset && /* @__PURE__ */ jsx("svg", {
87
119
  xmlns: "http://www.w3.org/2000/svg",
88
- viewBox: "0 0 16 16",
89
- className: "absolute -top-1.5 start-0 size-4 rtl:-scale-x-100",
90
- children: /* @__PURE__ */ jsx("line", {
91
- x1: upperOffset,
92
- y1: "0",
93
- x2: offset,
94
- y2: "12",
95
- className: "stroke-fd-foreground/10",
96
- strokeWidth: "1"
120
+ viewBox: `${Math.min(offset, upperOffset)} 0 ${Math.abs(upperOffset - offset)} 12`,
121
+ className: "absolute -top-1.5",
122
+ style: {
123
+ width: Math.abs(upperOffset - offset) + 1,
124
+ height: 12,
125
+ insetInlineStart: Math.min(offset, upperOffset)
126
+ },
127
+ children: /* @__PURE__ */ jsx("path", {
128
+ d: `M ${upperOffset} 0 C ${upperOffset} 8 ${offset} 4 ${offset} 12`,
129
+ stroke: "black",
130
+ strokeWidth: "1",
131
+ fill: "none",
132
+ className: "stroke-fd-foreground/10"
97
133
  })
98
134
  }),
99
135
  /* @__PURE__ */ jsx("div", {
@@ -15,9 +15,11 @@ function TOCItems({ ref, className, ...props }) {
15
15
  className: "rounded-lg border bg-fd-card p-3 text-xs text-fd-muted-foreground",
16
16
  children: text.tocNoHeadings
17
17
  });
18
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(TocThumb, {
18
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(TocThumb, {
19
19
  containerRef,
20
- className: "absolute top-(--fd-top) h-(--fd-height) w-0.5 rounded-e-sm bg-fd-primary transition-[top,height] ease-linear"
20
+ align: "center",
21
+ className: "absolute top-(--fd-top) h-(--fd-height) w-px bg-linear-to-t via-fd-primary transition-[top,height] delay-25",
22
+ children: [/* @__PURE__ */ jsx("div", { className: "absolute top-0 -translate-y-1/2 size-1 rounded-e-full bg-fd-primary" }), /* @__PURE__ */ jsx("div", { className: "absolute bottom-0 translate-y-1/2 size-1 rounded-e-full bg-fd-primary" })]
21
23
  }), /* @__PURE__ */ jsx("div", {
22
24
  ref: mergeRefs(ref, containerRef),
23
25
  className: cn("flex flex-col border-s border-fd-foreground/10", className),
@@ -28,7 +30,7 @@ function TOCItems({ ref, className, ...props }) {
28
30
  function TOCItem({ item }) {
29
31
  return /* @__PURE__ */ jsx(Primitive.TOCItem, {
30
32
  href: item.url,
31
- className: cn("prose py-1.5 text-sm text-fd-muted-foreground transition-colors wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary", item.depth <= 2 && "ps-3", item.depth === 3 && "ps-6", item.depth >= 4 && "ps-8"),
33
+ className: cn("prose py-1.5 text-sm text-fd-muted-foreground transition-colors delay-25 wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary hover:text-fd-accent-foreground hover:delay-0", item.depth <= 2 && "ps-3", item.depth === 3 && "ps-6", item.depth >= 4 && "ps-8"),
32
34
  children: item.title
33
35
  });
34
36
  }
@@ -16,12 +16,14 @@ declare function TOCScrollArea({
16
16
  className,
17
17
  ...props
18
18
  }: ComponentProps<'div'>): react_jsx_runtime0.JSX.Element;
19
- interface RefProps {
19
+ interface TocThumbProps extends ComponentProps<'div'> {
20
20
  containerRef: RefObject<HTMLElement | null>;
21
+ align?: 'center' | 'end';
21
22
  }
22
23
  declare function TocThumb({
23
24
  containerRef,
25
+ align,
24
26
  ...props
25
- }: ComponentProps<'div'> & RefProps): react_jsx_runtime0.JSX.Element;
27
+ }: TocThumbProps): react_jsx_runtime0.JSX.Element;
26
28
  //#endregion
27
29
  export { TOCProvider, TOCProviderProps, TOCScrollArea, TocThumb, useActiveAnchor, useActiveAnchors, useTOCItems };
@@ -42,17 +42,46 @@ function TOCScrollArea({ ref, className, ...props }) {
42
42
  })
43
43
  });
44
44
  }
45
- function TocThumb({ containerRef, ...props }) {
45
+ function TocThumb({ containerRef, align = "end", ...props }) {
46
46
  const thumbRef = useRef(null);
47
47
  const active = useActiveAnchors();
48
48
  function update(info) {
49
49
  const element = thumbRef.current;
50
- if (!element) return;
51
- element.style.setProperty("--fd-top", `${info[0]}px`);
52
- element.style.setProperty("--fd-height", `${info[1]}px`);
50
+ const container = containerRef.current;
51
+ if (!element || !container) return;
52
+ element.style.setProperty("--fd-top", `${info.top}px`);
53
+ element.style.setProperty("--fd-height", `${info.height}px`);
54
+ }
55
+ function calc(active) {
56
+ const container = containerRef.current;
57
+ if (!container || container.clientHeight === 0) return null;
58
+ if (active.length === 0) return {
59
+ height: 0,
60
+ top: 0
61
+ };
62
+ let upper = Number.MAX_VALUE;
63
+ let lower = 0;
64
+ for (const item of active) {
65
+ const element = container.querySelector(`a[href="#${item}"]`);
66
+ if (!element) continue;
67
+ if (align === "center") {
68
+ const y = element.offsetTop + element.clientHeight / 2;
69
+ upper = Math.min(upper, y);
70
+ lower = Math.max(lower, y);
71
+ } else {
72
+ const styles = getComputedStyle(element);
73
+ upper = Math.min(upper, element.offsetTop + parseFloat(styles.paddingTop));
74
+ lower = Math.max(lower, element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom));
75
+ }
76
+ }
77
+ return {
78
+ top: upper,
79
+ height: lower - upper
80
+ };
53
81
  }
54
82
  const onPrint = useEffectEvent(() => {
55
- if (containerRef.current) update(calc(containerRef.current, active));
83
+ const result = calc(active);
84
+ if (result) update(result);
56
85
  });
57
86
  useEffect(() => {
58
87
  if (!containerRef.current) return;
@@ -64,7 +93,8 @@ function TocThumb({ containerRef, ...props }) {
64
93
  };
65
94
  }, [containerRef]);
66
95
  useOnChange(active, () => {
67
- if (containerRef.current) update(calc(containerRef.current, active));
96
+ const result = calc(active);
97
+ if (result) update(result);
68
98
  });
69
99
  return /* @__PURE__ */ jsx("div", {
70
100
  ref: thumbRef,
@@ -72,17 +102,5 @@ function TocThumb({ containerRef, ...props }) {
72
102
  ...props
73
103
  });
74
104
  }
75
- function calc(container, active) {
76
- if (active.length === 0 || container.clientHeight === 0) return [0, 0];
77
- let upper = Number.MAX_VALUE, lower = 0;
78
- for (const item of active) {
79
- const element = container.querySelector(`a[href="#${item}"]`);
80
- if (!element) continue;
81
- const styles = getComputedStyle(element);
82
- upper = Math.min(upper, element.offsetTop + parseFloat(styles.paddingTop));
83
- lower = Math.max(lower, element.offsetTop + element.clientHeight - parseFloat(styles.paddingBottom));
84
- }
85
- return [upper, lower - upper];
86
- }
87
105
  //#endregion
88
106
  export { TOCProvider, TOCScrollArea, TocThumb, toc_exports, useActiveAnchor, useActiveAnchors, useTOCItems };
@@ -5,7 +5,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
5
5
  declare const buttonVariants: (props?: ({
6
6
  variant?: "primary" | "outline" | "ghost" | "secondary" | null | undefined;
7
7
  color?: "primary" | "outline" | "ghost" | "secondary" | null | undefined;
8
- size?: "sm" | "icon" | "icon-sm" | "icon-xs" | null | undefined;
8
+ size?: "icon" | "sm" | "icon-sm" | "icon-xs" | null | undefined;
9
9
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
10
10
  type ButtonProps = VariantProps<typeof buttonVariants>;
11
11
  //#endregion
@@ -8,7 +8,7 @@ const CollapsibleTrigger = Collapsible$1.Trigger;
8
8
  function CollapsibleContent({ children, className, ...props }) {
9
9
  return /* @__PURE__ */ jsx(Collapsible$1.Panel, {
10
10
  ...props,
11
- className: (s) => cn("overflow-hidden [&[hidden]:not([hidden='until-found'])]:hidden h-(--collapsible-panel-height) transition-[height] data-[starting-style]:h-0 data-[ending-style]:h-0", typeof className === "function" ? className(s) : className),
11
+ className: (s) => cn("overflow-hidden [&[hidden]:not([hidden='until-found'])]:hidden h-(--collapsible-panel-height) transition-[height,opacity] data-starting-style:opacity-0 data-starting-style:h-0 data-ending-style:h-0 data-ending-style:opacity-0", typeof className === "function" ? className(s) : className),
12
12
  children
13
13
  });
14
14
  }
@@ -1,18 +1,30 @@
1
1
  import * as React$1 from "react";
2
- import { NavigationMenu } from "@base-ui/react/navigation-menu";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+ import { NavigationMenu as NavigationMenu$1 } from "@base-ui/react/navigation-menu";
3
4
  import * as _base_ui_react0 from "@base-ui/react";
4
5
 
5
6
  //#region src/components/ui/navigation-menu.d.ts
6
- type NavigationMenuContentProps = NavigationMenu.Content.Props;
7
- type NavigationMenuTriggerProps = NavigationMenu.Trigger.Props;
8
- declare const NavigationMenuRoot: React$1.ForwardRefExoticComponent<Omit<_base_ui_react0.NavigationMenuRootProps, "ref"> & React$1.RefAttributes<HTMLElement>>;
7
+ type NavigationMenuContentProps = NavigationMenu$1.Content.Props;
8
+ type NavigationMenuTriggerProps = NavigationMenu$1.Trigger.Props;
9
+ declare const NavigationMenu: React$1.ForwardRefExoticComponent<Omit<_base_ui_react0.NavigationMenuRootProps, "ref"> & React$1.RefAttributes<HTMLElement>>;
9
10
  declare const NavigationMenuList: React$1.ForwardRefExoticComponent<Omit<_base_ui_react0.NavigationMenuListProps, "ref"> & React$1.RefAttributes<HTMLUListElement>>;
10
- declare const NavigationMenuItem: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.NavigationMenuItemProps, "ref"> & React$1.RefAttributes<HTMLLIElement>, "ref"> & React$1.RefAttributes<HTMLLIElement>>;
11
- declare const NavigationMenuTrigger: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.NavigationMenuTriggerProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
12
- declare const NavigationMenuContent: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.NavigationMenuContentProps, "ref"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
13
- declare const NavigationMenuLink: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.NavigationMenuLinkProps, "ref"> & React$1.RefAttributes<HTMLAnchorElement>, "ref"> & {
14
- asChild?: boolean;
15
- } & React$1.RefAttributes<HTMLAnchorElement>>;
16
- declare function NavigationMenuViewport(): null;
11
+ declare function NavigationMenuItem({
12
+ className,
13
+ children,
14
+ ...props
15
+ }: React$1.ComponentPropsWithRef<typeof NavigationMenu$1.Item>): react_jsx_runtime0.JSX.Element;
16
+ declare function NavigationMenuTrigger({
17
+ children,
18
+ ...props
19
+ }: React$1.ComponentPropsWithRef<typeof NavigationMenu$1.Trigger>): react_jsx_runtime0.JSX.Element;
20
+ declare function NavigationMenuContent({
21
+ className,
22
+ ...props
23
+ }: React$1.ComponentPropsWithRef<typeof NavigationMenu$1.Content>): react_jsx_runtime0.JSX.Element;
24
+ declare function NavigationMenuLink({
25
+ children,
26
+ ...props
27
+ }: React$1.ComponentPropsWithRef<typeof NavigationMenu$1.Link>): react_jsx_runtime0.JSX.Element;
28
+ declare function NavigationMenuViewport(props: NavigationMenu$1.Positioner.Props): react_jsx_runtime0.JSX.Element;
17
29
  //#endregion
18
- export { NavigationMenuRoot as NavigationMenu, NavigationMenuRoot, NavigationMenuContent, NavigationMenuContentProps, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuTriggerProps, NavigationMenuViewport };
30
+ export { NavigationMenu, NavigationMenuContent, NavigationMenuContentProps, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuTriggerProps, NavigationMenuViewport };
@@ -1,41 +1,56 @@
1
1
  "use client";
2
2
  import { cn } from "../../utils/cn.js";
3
- import * as React$1 from "react";
3
+ import "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
- import { NavigationMenu } from "@base-ui/react/navigation-menu";
5
+ import { NavigationMenu as NavigationMenu$1 } from "@base-ui/react/navigation-menu";
6
6
  //#region src/components/ui/navigation-menu.tsx
7
- const NavigationMenuRoot = NavigationMenu.Root;
8
- const NavigationMenuList = NavigationMenu.List;
9
- const NavigationMenuItem = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(NavigationMenu.Item, {
10
- ref,
11
- className: (s) => cn("list-none", typeof className === "function" ? className(s) : className),
12
- ...props,
13
- children
14
- }));
15
- NavigationMenuItem.displayName = NavigationMenu.Item.displayName;
16
- const NavigationMenuTrigger = React$1.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ jsx(NavigationMenu.Trigger, {
17
- ref,
18
- ...props,
19
- children
20
- }));
21
- NavigationMenuTrigger.displayName = NavigationMenu.Trigger.displayName;
22
- const NavigationMenuContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(NavigationMenu.Content, {
23
- ref,
24
- className: (s) => cn("size-full p-4", "transition-[opacity,transform,translate] duration-(--duration) ease-(--easing)", "data-starting-style:opacity-0 data-ending-style:opacity-0", "data-starting-style:data-[activation-direction=left]:-translate-x-1/2", "data-starting-style:data-[activation-direction=right]:translate-x-1/2", "data-ending-style:data-[activation-direction=left]:translate-x-1/2", "data-ending-style:data-[activation-direction=right]:-translate-x-1/2", typeof className === "function" ? className(s) : className),
25
- ...props
26
- }));
27
- NavigationMenuContent.displayName = NavigationMenu.Content.displayName;
28
- const NavigationMenuLink = React$1.forwardRef(({ asChild, children, ...props }, ref) => {
29
- if (asChild) return children;
30
- return /* @__PURE__ */ jsx(NavigationMenu.Link, {
31
- ref,
7
+ const NavigationMenu = NavigationMenu$1.Root;
8
+ const NavigationMenuList = NavigationMenu$1.List;
9
+ function NavigationMenuItem({ className, children, ...props }) {
10
+ return /* @__PURE__ */ jsx(NavigationMenu$1.Item, {
11
+ className: (s) => cn("list-none", typeof className === "function" ? className(s) : className),
32
12
  ...props,
33
13
  children
34
14
  });
35
- });
36
- NavigationMenuLink.displayName = NavigationMenu.Link.displayName;
37
- function NavigationMenuViewport() {
38
- return null;
15
+ }
16
+ function NavigationMenuTrigger({ children, ...props }) {
17
+ return /* @__PURE__ */ jsx(NavigationMenu$1.Trigger, {
18
+ ...props,
19
+ children
20
+ });
21
+ }
22
+ function NavigationMenuContent({ className, ...props }) {
23
+ return /* @__PURE__ */ jsx(NavigationMenu$1.Content, {
24
+ className: (s) => cn("size-full p-3", "transition-[opacity,transform,translate] duration-(--duration) ease-(--easing)", "data-starting-style:opacity-0 data-ending-style:opacity-0", "data-starting-style:data-[activation-direction=left]:-translate-x-1/2", "data-starting-style:data-[activation-direction=right]:translate-x-1/2", "data-ending-style:data-[activation-direction=left]:translate-x-1/2", "data-ending-style:data-[activation-direction=right]:-translate-x-1/2", typeof className === "function" ? className(s) : className),
25
+ ...props
26
+ });
27
+ }
28
+ function NavigationMenuLink({ children, ...props }) {
29
+ return /* @__PURE__ */ jsx(NavigationMenu$1.Link, {
30
+ ...props,
31
+ children
32
+ });
33
+ }
34
+ function NavigationMenuViewport(props) {
35
+ return /* @__PURE__ */ jsx(NavigationMenu$1.Portal, { children: /* @__PURE__ */ jsx(NavigationMenu$1.Positioner, {
36
+ collisionPadding: {
37
+ top: 5,
38
+ bottom: 5,
39
+ left: 20,
40
+ right: 20
41
+ },
42
+ ...props,
43
+ className: (s) => cn("box-border h-(--positioner-height) w-(--anchor-width) max-w-(--available-width) duration-(--duration) ease-(--easing) before:absolute before:content-[''] data-instant:transition-none data-[side=bottom]:before:top-[-10px] data-[side=bottom]:before:right-0 data-[side=bottom]:before:left-0 data-[side=bottom]:before:h-2.5 data-[side=left]:before:top-0 data-[side=left]:before:right-[-10px] data-[side=left]:before:bottom-0 data-[side=left]:before:w-2.5 data-[side=right]:before:top-0 data-[side=right]:before:bottom-0 data-[side=right]:before:left-[-10px] data-[side=right]:before:w-2.5 data-[side=top]:before:right-0 data-[side=top]:before:bottom-[-10px] data-[side=top]:before:left-0 data-[side=top]:before:h-2.5", typeof props.className === "function" ? props.className(s) : props.className),
44
+ style: {
45
+ ["--duration"]: "0.35s",
46
+ ["--easing"]: "cubic-bezier(0.22, 1, 0.36, 1)",
47
+ ...props.style
48
+ },
49
+ children: /* @__PURE__ */ jsx(NavigationMenu$1.Popup, {
50
+ className: "data-[ending-style]:easing-[ease] relative border h-(--popup-height) origin-(--transform-origin) rounded-xl bg-fd-popover/80 text-fd-popover-foreground backdrop-blur-md shadow-lg transition-[opacity,transform,width,height,scale,translate] duration-(--duration) ease-(--easing) data-ending-style:scale-90 data-ending-style:opacity-0 data-ending-style:duration-150 data-starting-style:scale-90 data-starting-style:opacity-0 w-(--popup-width)",
51
+ children: /* @__PURE__ */ jsx(NavigationMenu$1.Viewport, { className: "relative size-full overflow-hidden" })
52
+ })
53
+ }) });
39
54
  }
40
55
  //#endregion
41
- export { NavigationMenuRoot as NavigationMenu, NavigationMenuRoot, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport };
56
+ export { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport };
@@ -1,11 +1,17 @@
1
1
  import * as React$1 from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
3
  import { Popover as Popover$1 } from "@base-ui/react/popover";
3
4
  import * as _base_ui_react0 from "@base-ui/react";
4
5
 
5
6
  //#region src/components/ui/popover.d.ts
6
7
  declare const Popover: typeof Popover$1.Root;
7
8
  declare const PopoverTrigger: Popover$1.Trigger;
8
- declare const PopoverContent: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.PopoverPopupProps, "ref"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & Pick<_base_ui_react0.PopoverPositionerProps, "sideOffset" | "align"> & React$1.RefAttributes<HTMLDivElement>>;
9
+ declare function PopoverContent({
10
+ className,
11
+ align,
12
+ sideOffset,
13
+ ...props
14
+ }: React$1.ComponentPropsWithRef<typeof Popover$1.Popup> & Pick<Popover$1.Positioner.Props, 'sideOffset' | 'align'>): react_jsx_runtime0.JSX.Element;
9
15
  declare const PopoverClose: React$1.ForwardRefExoticComponent<Omit<_base_ui_react0.PopoverCloseProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
10
16
  //#endregion
11
17
  export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
@@ -1,23 +1,23 @@
1
1
  "use client";
2
2
  import { cn } from "../../utils/cn.js";
3
- import * as React$1 from "react";
3
+ import "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { Popover as Popover$1 } from "@base-ui/react/popover";
6
6
  //#region src/components/ui/popover.tsx
7
7
  const Popover = Popover$1.Root;
8
8
  const PopoverTrigger = Popover$1.Trigger;
9
- const PopoverContent = React$1.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
10
- align,
11
- side: "bottom",
12
- sideOffset,
13
- className: "z-50",
14
- children: /* @__PURE__ */ jsx(Popover$1.Popup, {
15
- ref,
16
- className: (s) => cn("z-50 origin-(--transform-origin) overflow-y-auto max-h-(--available-height) min-w-[240px] max-w-[98vw] rounded-xl border bg-fd-popover/60 backdrop-blur-lg p-2 text-sm text-fd-popover-foreground shadow-lg focus-visible:outline-none data-[closed]:animate-fd-popover-out data-[open]:animate-fd-popover-in", typeof className === "function" ? className(s) : className),
17
- ...props
18
- })
19
- }) }));
20
- PopoverContent.displayName = Popover$1.Popup.displayName;
9
+ function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
10
+ return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
11
+ align,
12
+ side: "bottom",
13
+ sideOffset,
14
+ className: "z-50",
15
+ children: /* @__PURE__ */ jsx(Popover$1.Popup, {
16
+ className: (s) => cn("z-50 origin-(--transform-origin) overflow-y-auto max-h-(--available-height) min-w-[240px] max-w-[98vw] rounded-xl border bg-fd-popover/60 backdrop-blur-lg p-2 text-sm text-fd-popover-foreground shadow-lg focus-visible:outline-none data-[closed]:animate-fd-popover-out data-[open]:animate-fd-popover-in", typeof className === "function" ? className(s) : className),
17
+ ...props
18
+ })
19
+ }) });
20
+ }
21
21
  const PopoverClose = Popover$1.Close;
22
22
  //#endregion
23
23
  export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
@@ -1,11 +1,22 @@
1
1
  import * as React$1 from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
3
  import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
3
- import * as _base_ui_react0 from "@base-ui/react";
4
4
 
5
5
  //#region src/components/ui/scroll-area.d.ts
6
- declare const ScrollArea: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.ScrollAreaRootProps, "ref"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
7
- declare const ScrollViewport: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.ScrollAreaViewportProps, "ref"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
8
- declare const ScrollBar: React$1.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.ScrollAreaScrollbarProps, "ref"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
6
+ declare function ScrollArea({
7
+ children,
8
+ ...props
9
+ }: React$1.ComponentPropsWithRef<typeof ScrollArea$1.Root>): react_jsx_runtime0.JSX.Element;
10
+ declare function ScrollViewport({
11
+ className,
12
+ children,
13
+ ...props
14
+ }: React$1.ComponentPropsWithRef<typeof ScrollArea$1.Viewport>): react_jsx_runtime0.JSX.Element;
15
+ declare function ScrollBar({
16
+ className,
17
+ orientation,
18
+ ...props
19
+ }: React$1.ComponentPropsWithRef<typeof ScrollArea$1.Scrollbar>): react_jsx_runtime0.JSX.Element;
9
20
  type ScrollAreaProps = ScrollArea$1.Root.Props;
10
21
  //#endregion
11
22
  export { ScrollArea, ScrollAreaProps, ScrollBar, ScrollViewport };
@@ -1,33 +1,32 @@
1
1
  import { cn } from "../../utils/cn.js";
2
- import * as React$1 from "react";
2
+ import "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
5
5
  //#region src/components/ui/scroll-area.tsx
6
- const ScrollArea = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(ScrollArea$1.Root, {
7
- ref,
8
- className: (s) => cn("overflow-hidden", typeof className === "function" ? className(s) : className),
9
- ...props,
10
- children: [
11
- children,
12
- /* @__PURE__ */ jsx(ScrollArea$1.Corner, {}),
13
- /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" })
14
- ]
15
- }));
16
- ScrollArea.displayName = ScrollArea$1.Root.displayName;
17
- const ScrollViewport = React$1.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(ScrollArea$1.Viewport, {
18
- ref,
19
- className: (s) => cn("size-full rounded-[inherit]", typeof className === "function" ? className(s) : className),
20
- ...props,
21
- children
22
- }));
23
- ScrollViewport.displayName = ScrollArea$1.Viewport.displayName;
24
- const ScrollBar = React$1.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(ScrollArea$1.Scrollbar, {
25
- ref,
26
- orientation,
27
- className: (s) => cn("flex select-none transition-opacity", !s.hovering && "opacity-0", orientation === "vertical" && "h-full w-1.5", orientation === "horizontal" && "h-1.5 flex-col", typeof className === "function" ? className(s) : className),
28
- ...props,
29
- children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "relative flex-1 rounded-full bg-fd-border" })
30
- }));
31
- ScrollBar.displayName = ScrollArea$1.Scrollbar.displayName;
6
+ function ScrollArea({ children, ...props }) {
7
+ return /* @__PURE__ */ jsxs(ScrollArea$1.Root, {
8
+ ...props,
9
+ children: [
10
+ children,
11
+ /* @__PURE__ */ jsx(ScrollArea$1.Corner, {}),
12
+ /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" })
13
+ ]
14
+ });
15
+ }
16
+ function ScrollViewport({ className, children, ...props }) {
17
+ return /* @__PURE__ */ jsx(ScrollArea$1.Viewport, {
18
+ className: (s) => cn("size-full rounded-[inherit]", typeof className === "function" ? className(s) : className),
19
+ ...props,
20
+ children
21
+ });
22
+ }
23
+ function ScrollBar({ className, orientation = "vertical", ...props }) {
24
+ return /* @__PURE__ */ jsx(ScrollArea$1.Scrollbar, {
25
+ orientation,
26
+ className: (s) => cn("flex select-none transition-opacity", !s.hovering && "opacity-0", orientation === "vertical" && "h-full w-1.5", orientation === "horizontal" && "h-1.5 flex-col", typeof className === "function" ? className(s) : className),
27
+ ...props,
28
+ children: /* @__PURE__ */ jsx(ScrollArea$1.Thumb, { className: "relative flex-1 rounded-full bg-fd-border" })
29
+ });
30
+ }
32
31
  //#endregion
33
32
  export { ScrollArea, ScrollBar, ScrollViewport };
@@ -36,13 +36,13 @@ const TocPopoverContext = createContext(null);
36
36
  function TOCPopover({ container, trigger, content, header, footer, style }) {
37
37
  return /* @__PURE__ */ jsxs(PageTOCPopover, {
38
38
  ...container,
39
- children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsxs(PageTOCPopoverContent, {
39
+ children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsx(PageTOCPopoverContent, {
40
40
  ...content,
41
- children: [
41
+ children: /* @__PURE__ */ jsxs("div", { children: [
42
42
  header,
43
43
  /* @__PURE__ */ jsx(TOCScrollArea, { children: style === "clerk" ? /* @__PURE__ */ jsx(TOCItems$1, {}) : /* @__PURE__ */ jsx(TOCItems, {}) }),
44
44
  footer
45
- ]
45
+ ] })
46
46
  })]
47
47
  });
48
48
  }