@fumadocs/base-ui 16.7.2 → 16.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +59 -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 +66 -30
- package/dist/components/toc/default.js +2 -2
- 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 +4 -2
- package/dist/layouts/docs/slots/sidebar.js +9 -19
- package/dist/layouts/flux/page/slots/toc.js +4 -2
- 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 +4 -2
- package/dist/layouts/notebook/slots/sidebar.js +9 -19
- package/dist/style.css +228 -60
- package/package.json +5 -5
|
@@ -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 transition-[clip-path]",
|
|
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,32 +88,48 @@ 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 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);
|
|
81
113
|
return /* @__PURE__ */ jsxs(Primitive.TOCItem, {
|
|
82
114
|
href: item.url,
|
|
83
115
|
style: { paddingInlineStart: getItemOffset(item.depth) },
|
|
84
|
-
className: "prose relative py-1.5 text-sm text-fd-muted-foreground hover:text-fd-accent-foreground transition-colors wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary",
|
|
116
|
+
className: "prose relative py-1.5 text-sm scroll-m-4 text-fd-muted-foreground hover:text-fd-accent-foreground transition-colors wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary",
|
|
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", {
|
|
@@ -17,7 +17,7 @@ function TOCItems({ ref, className, ...props }) {
|
|
|
17
17
|
});
|
|
18
18
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(TocThumb, {
|
|
19
19
|
containerRef,
|
|
20
|
-
className: "absolute top-(--fd-top) h-(--fd-height)
|
|
20
|
+
className: "absolute top-(--fd-top) inset-s-0 w-0.5 h-(--fd-height) rounded-e-full bg-fd-primary transition-[top,height]"
|
|
21
21
|
}), /* @__PURE__ */ jsx("div", {
|
|
22
22
|
ref: mergeRefs(ref, containerRef),
|
|
23
23
|
className: cn("flex flex-col border-s border-fd-foreground/10", className),
|
|
@@ -28,7 +28,7 @@ function TOCItems({ ref, className, ...props }) {
|
|
|
28
28
|
function TOCItem({ item }) {
|
|
29
29
|
return /* @__PURE__ */ jsx(Primitive.TOCItem, {
|
|
30
30
|
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"),
|
|
31
|
+
className: cn("prose py-1.5 text-sm text-fd-muted-foreground scroll-m-4 transition-colors wrap-anywhere first:pt-0 last:pb-0 data-[active=true]:text-fd-primary hover:text-fd-accent-foreground", item.depth <= 2 && "ps-3", item.depth === 3 && "ps-6", item.depth >= 4 && "ps-8"),
|
|
32
32
|
children: item.title
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -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 };
|
|
@@ -153,8 +153,10 @@ function PageTOCPopoverContent(props) {
|
|
|
153
153
|
return /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
154
154
|
"data-toc-popover-content": "",
|
|
155
155
|
...props,
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
157
|
+
className: "flex flex-col px-4 max-h-[50vh] md:px-6",
|
|
158
|
+
children: props.children
|
|
159
|
+
})
|
|
158
160
|
});
|
|
159
161
|
}
|
|
160
162
|
//#endregion
|
|
@@ -6,8 +6,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/
|
|
|
6
6
|
import { SearchTrigger } from "../../shared/slots/search-trigger.js";
|
|
7
7
|
import { LinkItem } from "../../shared/client.js";
|
|
8
8
|
import { isLayoutTabActive } from "../../shared/index.js";
|
|
9
|
-
import {
|
|
10
|
-
import { SidebarCollapseTrigger as SidebarCollapseTrigger$1, SidebarContent as SidebarContent$1, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider as SidebarProvider$1, SidebarSeparator as SidebarSeparator$1, SidebarTrigger as SidebarTrigger$1, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
|
|
9
|
+
import { SidebarCollapseTrigger as SidebarCollapseTrigger$1, SidebarContent as SidebarContent$1, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider as SidebarProvider$1, SidebarSeparator as SidebarSeparator$1, SidebarTrigger as SidebarTrigger$1, SidebarViewport, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
|
|
11
10
|
import { createPageTreeRenderer } from "../../../components/sidebar/page-tree.js";
|
|
12
11
|
import { createLinkItemRenderer } from "../../../components/sidebar/link-item.js";
|
|
13
12
|
import { useDocsLayout } from "../client.js";
|
|
@@ -32,10 +31,13 @@ function SidebarProvider(props) {
|
|
|
32
31
|
function Sidebar({ footer, banner, collapsible = true, components, ...rest }) {
|
|
33
32
|
const { menuItems, slots, props: { tabs, nav, tabMode } } = useDocsLayout();
|
|
34
33
|
const iconLinks = menuItems.filter((item) => item.type === "icon");
|
|
35
|
-
const viewport = /* @__PURE__ */
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
const viewport = /* @__PURE__ */ jsx(SidebarViewport, { children: /* @__PURE__ */ jsxs("div", {
|
|
35
|
+
className: "flex flex-col gap-0.5",
|
|
36
|
+
children: [menuItems.filter((v) => v.type !== "icon").map((item, i, list) => /* @__PURE__ */ jsx(SidebarLinkItem, {
|
|
37
|
+
item,
|
|
38
|
+
className: cn(i === list.length - 1 && "mb-4")
|
|
39
|
+
}, i)), /* @__PURE__ */ jsx(SidebarPageTree, { ...components })]
|
|
40
|
+
}) });
|
|
39
41
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(SidebarContent, {
|
|
40
42
|
...rest,
|
|
41
43
|
children: [
|
|
@@ -132,18 +134,6 @@ function SidebarFolder(props) {
|
|
|
132
134
|
function SidebarCollapseTrigger(props) {
|
|
133
135
|
return /* @__PURE__ */ jsx(SidebarCollapseTrigger$1, { ...props });
|
|
134
136
|
}
|
|
135
|
-
function SidebarViewport(props) {
|
|
136
|
-
const { className, ...rest } = props;
|
|
137
|
-
return /* @__PURE__ */ jsx(ScrollArea, {
|
|
138
|
-
...rest,
|
|
139
|
-
className: (state) => cn("min-h-0 flex-1", typeof className === "function" ? className(state) : className),
|
|
140
|
-
children: /* @__PURE__ */ jsx(ScrollViewport, {
|
|
141
|
-
className: "*:flex! *:flex-col! *:gap-0.5! p-4 overscroll-contain",
|
|
142
|
-
style: { maskImage: "linear-gradient(to bottom, transparent, white 12px, white calc(100% - 12px), transparent)" },
|
|
143
|
-
children: props.children
|
|
144
|
-
})
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
137
|
function SidebarTrigger(props) {
|
|
148
138
|
return /* @__PURE__ */ jsx(SidebarTrigger$1, { ...props });
|
|
149
139
|
}
|
|
@@ -245,7 +235,7 @@ function SidebarFolderLink({ className, style, ...props }) {
|
|
|
245
235
|
function SidebarFolderContent({ className, children, ...props }) {
|
|
246
236
|
const depth = useFolderDepth();
|
|
247
237
|
return /* @__PURE__ */ jsx(SidebarFolderContent$1, {
|
|
248
|
-
className: (state) => cn("relative flex flex-col gap-0.5
|
|
238
|
+
className: (state) => cn("relative flex flex-col gap-0.5 pt-0.5", depth === 1 && "before:content-[''] before:absolute before:w-px before:inset-y-1 before:bg-fd-border before:start-2.5", typeof className === "function" ? className(state) : className),
|
|
249
239
|
...props,
|
|
250
240
|
children
|
|
251
241
|
});
|