@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.
- package/css/generated/docs.css +1 -8
- package/css/generated/flux.css +0 -3
- package/css/generated/home.css +26 -11
- package/css/generated/notebook.css +2 -4
- package/css/generated/shared.css +63 -10
- package/dist/components/sidebar/base.js +1 -2
- package/dist/components/tabs.d.ts +9 -4
- package/dist/components/tabs.js +12 -13
- package/dist/components/toc/clerk.js +65 -29
- package/dist/components/toc/default.js +5 -3
- package/dist/components/toc/index.d.ts +4 -2
- package/dist/components/toc/index.js +36 -18
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/collapsible.js +1 -1
- package/dist/components/ui/navigation-menu.d.ts +24 -12
- package/dist/components/ui/navigation-menu.js +47 -32
- package/dist/components/ui/popover.d.ts +7 -1
- package/dist/components/ui/popover.js +13 -13
- package/dist/components/ui/scroll-area.d.ts +15 -4
- package/dist/components/ui/scroll-area.js +26 -27
- package/dist/layouts/docs/page/slots/toc.js +3 -3
- package/dist/layouts/docs/slots/sidebar.js +9 -19
- package/dist/layouts/flux/page/slots/toc.js +3 -3
- package/dist/layouts/flux/slots/sidebar.js +8 -13
- package/dist/layouts/home/index.js +6 -1
- package/dist/layouts/home/navbar.d.ts +2 -4
- package/dist/layouts/home/navbar.js +6 -9
- package/dist/layouts/home/slots/header.d.ts +2 -3
- package/dist/layouts/home/slots/header.js +122 -112
- package/dist/layouts/notebook/page/slots/toc.js +3 -3
- package/dist/layouts/notebook/slots/sidebar.js +9 -19
- package/dist/style.css +302 -60
- package/package.json +4 -4
package/dist/components/tabs.js
CHANGED
|
@@ -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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})
|
|
25
|
-
|
|
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,
|
|
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,
|
|
29
|
-
|
|
30
|
-
|
|
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__ */
|
|
50
|
-
|
|
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(
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
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:
|
|
89
|
-
className: "absolute -top-1.5
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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__ */
|
|
18
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(TocThumb, {
|
|
19
19
|
containerRef,
|
|
20
|
-
|
|
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
|
|
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
|
-
}:
|
|
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
|
-
|
|
51
|
-
element
|
|
52
|
-
element.style.setProperty("--fd-
|
|
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
|
-
|
|
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
|
-
|
|
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?: "
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 {
|
|
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
|
|
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
|
|
8
|
-
const NavigationMenuList = NavigationMenu.List;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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 {
|
|
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
|
|
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
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}) })
|
|
20
|
-
|
|
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
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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__ */
|
|
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
|
}
|