@fumadocs/base-ui 16.19.4 → 16.19.6
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/aspen.css +5 -5
- package/css/black.css +1 -1
- package/css/catppuccin.css +10 -6
- package/css/dusk.css +4 -4
- package/css/emerald.css +4 -4
- package/css/generated/docs.css +1 -1
- package/css/generated/flux.css +1 -1
- package/css/generated/glass.css +1 -1
- package/css/generated/home.css +1 -1
- package/css/generated/notebook.css +1 -1
- package/css/generated/shared.css +1 -1
- package/css/generated/spacious.css +1 -1
- package/css/lib/default-colors.css +2 -2
- package/css/ocean.css +1 -1
- package/css/purple.css +3 -3
- package/css/ruby.css +4 -4
- package/css/vitepress.css +2 -2
- package/dist/.translations/index.d.ts +0 -1
- package/dist/.translations/keys.json.js +0 -1
- package/dist/components/codeblock.js +1 -1
- package/dist/components/dialog/search-algolia.js +5 -5
- package/dist/components/dialog/search-default.js +5 -5
- package/dist/components/dialog/search.js +4 -4
- package/dist/components/github-info.js +1 -1
- package/dist/components/image-zoom.js +2 -2
- package/dist/components/tabs.js +1 -1
- package/dist/components/type-table.js +1 -1
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/layouts/docs/page/slots/toc.js +1 -1
- package/dist/layouts/flux/index.js +34 -30
- package/dist/layouts/flux/page/slots/toc.js +1 -1
- package/dist/layouts/flux/slots/sidebar.js +1 -0
- package/dist/layouts/glass/layout-tabs.js +1 -1
- package/dist/layouts/glass/page/slots/toc.js +8 -1
- package/dist/layouts/glass/slots/header.js +2 -0
- package/dist/layouts/glass/slots/sidebar.js +23 -7
- package/dist/layouts/home/slots/header.js +1 -1
- package/dist/layouts/notebook/page/slots/toc.js +1 -1
- package/dist/layouts/notebook/slots/header.js +1 -1
- package/dist/layouts/notebook/slots/sidebar.js +1 -0
- package/dist/layouts/shared/client.js +1 -1
- package/dist/layouts/shared/slots/language-select.js +7 -3
- package/dist/layouts/spacious/index.js +2 -2
- package/dist/layouts/spacious/page/slots/toc.js +2 -2
- package/dist/layouts/spacious/slots/actions.js +3 -3
- package/dist/layouts/spacious/slots/sidebar.js +10 -7
- package/dist/style.css +37 -50
- package/package.json +3 -3
|
@@ -115,7 +115,7 @@ function PageTOCPopoverTrigger({ className, ...props }) {
|
|
|
115
115
|
const path = useTreePath().at(-1);
|
|
116
116
|
const showItem = selectedIdx !== -1 && !open;
|
|
117
117
|
return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
118
|
-
className: cn("flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-
|
|
118
|
+
className: cn("flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-fd-ring [&_svg]:size-4 md:px-6", className),
|
|
119
119
|
"data-toc-popover-trigger": "",
|
|
120
120
|
...props,
|
|
121
121
|
children: [
|
|
@@ -55,38 +55,42 @@ function DocsLayout(props) {
|
|
|
55
55
|
children: /* @__PURE__ */ jsxs(slots.sidebar.provider, {
|
|
56
56
|
defaultOpenLevel,
|
|
57
57
|
prefetch,
|
|
58
|
-
children: [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
head: /* @__PURE__ */ jsxs(Fragment, { children: [slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: "inline-flex items-center gap-2.5 text-sm font-semibold" }), nav.children] }),
|
|
63
|
-
tabDropdown: slots.tabDropdown && tabs.length > 0 && /* @__PURE__ */ jsx(slots.tabDropdown, {
|
|
64
|
-
className: "flex-1",
|
|
65
|
-
tabs
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsx(slots.container, {
|
|
60
|
+
...containerProps,
|
|
61
|
+
children
|
|
66
62
|
}),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
slots.
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
renderNavigationPanel({
|
|
64
|
+
head: /* @__PURE__ */ jsxs(Fragment, { children: [slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: "inline-flex items-center gap-2.5 text-sm font-semibold" }), nav.children] }),
|
|
65
|
+
tabDropdown: slots.tabDropdown && tabs.length > 0 && /* @__PURE__ */ jsx(slots.tabDropdown, {
|
|
66
|
+
className: "flex-1",
|
|
67
|
+
tabs
|
|
72
68
|
}),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
69
|
+
tool: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
70
|
+
slots.languageSelect && /* @__PURE__ */ jsx(slots.languageSelect.root, { children: /* @__PURE__ */ jsx(Languages, { className: "size-4.5" }) }),
|
|
71
|
+
slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.sm, {
|
|
72
|
+
hideIfDisabled: true,
|
|
73
|
+
className: "rounded-lg"
|
|
74
|
+
}),
|
|
75
|
+
slots.sidebar && /* @__PURE__ */ jsx(slots.sidebar.trigger, { className: cn(buttonVariants({
|
|
76
|
+
variant: "ghost",
|
|
77
|
+
size: "icon-sm",
|
|
78
|
+
className: "overflow-hidden"
|
|
79
|
+
})) }),
|
|
80
|
+
slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, { className: "p-1 h-full ms-1 rounded-xl bg-fd-muted *:rounded-lg" })
|
|
81
|
+
] }),
|
|
82
|
+
link: linkItems.menuItems.filter((item) => item.type === "icon").map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
|
|
83
|
+
item,
|
|
84
|
+
className: cn(buttonVariants({
|
|
85
|
+
size: "icon-sm",
|
|
86
|
+
variant: "ghost"
|
|
87
|
+
})),
|
|
88
|
+
"aria-label": item.label,
|
|
89
|
+
children: item.icon
|
|
90
|
+
}, i))
|
|
91
|
+
}),
|
|
92
|
+
sidebarEnabled && /* @__PURE__ */ jsx(slots.sidebar.root, { ...sidebarProps })
|
|
93
|
+
]
|
|
90
94
|
})
|
|
91
95
|
})
|
|
92
96
|
});
|
|
@@ -108,7 +108,7 @@ function PageTOCPopoverTrigger({ className, ...props }) {
|
|
|
108
108
|
className: cn(open && "text-fd-popover-foreground")
|
|
109
109
|
};
|
|
110
110
|
return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
111
|
-
className: cn("flex w-full h-8.5 items-center text-sm text-fd-muted-foreground gap-2.5 px-2 text-start focus-visible:outline-
|
|
111
|
+
className: cn("flex w-full h-8.5 items-center text-sm text-fd-muted-foreground gap-2.5 px-2 text-start focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-fd-ring [&_svg]:size-4", className),
|
|
112
112
|
"data-toc-popover-trigger": "",
|
|
113
113
|
...props,
|
|
114
114
|
children: [
|
|
@@ -101,6 +101,7 @@ function SidebarContent({ ref: refProp, className, children, ...props }) {
|
|
|
101
101
|
enabled: blockScroll,
|
|
102
102
|
children: /* @__PURE__ */ jsx(motion.div, {
|
|
103
103
|
className: cn("fixed inset-0 py-10 z-30 backdrop-blur-md bg-fd-background/60", !open && "pointer-events-none"),
|
|
104
|
+
inert: !open,
|
|
104
105
|
initial: "hide",
|
|
105
106
|
variants: {
|
|
106
107
|
show: { opacity: 1 },
|
|
@@ -43,7 +43,7 @@ function LayoutTabsDropdown({ tabs: allTabs, className, size = "default", ...pro
|
|
|
43
43
|
className: "font-medium inline-flex items-center gap-2 [&_svg]:size-4",
|
|
44
44
|
children: [t.icon, t.title]
|
|
45
45
|
}), /* @__PURE__ */ jsx("p", {
|
|
46
|
-
className: cn("mt-1 text-xs text-fd-muted-foreground empty:hidden", selected === t && "text-fd-primary
|
|
46
|
+
className: cn("mt-1 text-xs text-fd-muted-foreground empty:hidden", selected === t && "text-fd-primary"),
|
|
47
47
|
children: t.description
|
|
48
48
|
})]
|
|
49
49
|
}, i);
|
|
@@ -22,10 +22,11 @@ function TOC({ container, header, footer }) {
|
|
|
22
22
|
const { props: { aiChat } } = useGlassLayout();
|
|
23
23
|
const [hover, setHover] = useState(false);
|
|
24
24
|
const [mobileOpen, setMobileOpen] = useState(false);
|
|
25
|
+
const [focused, setFocused] = useState(false);
|
|
25
26
|
const [inAnimation, setInAnimation] = useState(false);
|
|
26
27
|
const exitTimerRef = useRef(null);
|
|
27
28
|
const transitionTimerRef = useRef(null);
|
|
28
|
-
const open = hover || mobileOpen;
|
|
29
|
+
const open = hover || mobileOpen || focused;
|
|
29
30
|
useOnChange(open, () => {
|
|
30
31
|
setInAnimation(true);
|
|
31
32
|
if (transitionTimerRef.current) window.clearTimeout(transitionTimerRef.current);
|
|
@@ -48,6 +49,12 @@ function TOC({ container, header, footer }) {
|
|
|
48
49
|
id: "nd-toc",
|
|
49
50
|
...container,
|
|
50
51
|
className: cn("z-10 grid transition-[width,padding] duration-300 [grid-area:right]", aiChat?.open && aiChat.panel && "invisible", "xl:sticky xl:top-10 xl:h-[calc(100dvh---spacing(10))] md:layout:[--fd-right-width:12px] xl:layout:[--fd-right-width:240px] xl:items-center xl:pe-4", "max-xl:fixed max-xl:top-1/2 max-xl:-translate-y-1/2 max-xl:end-1 max-xl:bg-fd-popover max-xl:text-fd-popover-foreground max-xl:border max-xl:rounded-xl max-xl:shadow-md max-xl:mask-none max-xl:max-h-[calc(100dvh---spacing(32))] max-xl:grid-cols-[calc(240px---spacing(6))]", inAnimation && "overflow-y-hidden", open ? "max-xl:w-[240px] max-xl:p-3" : "max-md:w-4 max-md:ps-[calc(--spacing(1.5)-1px)] max-xl:w-6 max-xl:ps-[calc(--spacing(2.5)-1px)] max-xl:overflow-clip", container?.className),
|
|
52
|
+
onFocus: (e) => {
|
|
53
|
+
if (e.target.matches(":focus-visible")) setFocused(true);
|
|
54
|
+
},
|
|
55
|
+
onBlur: (e) => {
|
|
56
|
+
if (!e.currentTarget.contains(e.relatedTarget)) setFocused(false);
|
|
57
|
+
},
|
|
51
58
|
onPointerDown: (e) => {
|
|
52
59
|
if (!mobileOpen && (e.pointerType === "touch" || e.pointerType === "pen")) setMobileOpen(true);
|
|
53
60
|
},
|
|
@@ -19,6 +19,8 @@ function Header({ className, ...props }) {
|
|
|
19
19
|
children: [
|
|
20
20
|
sidebar.collapsible && sidebar.collapsed && /* @__PURE__ */ jsx("button", {
|
|
21
21
|
"aria-label": t("Show Sidebar", { note: "sidebar" }),
|
|
22
|
+
"aria-controls": "nd-sidebar",
|
|
23
|
+
"aria-expanded": false,
|
|
22
24
|
className: cn(buttonVariants({
|
|
23
25
|
size: "icon-sm",
|
|
24
26
|
variant: "secondary"
|
|
@@ -12,14 +12,15 @@ import { usePathname } from "fumadocs-core/framework";
|
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { ChevronDown, ChevronsUpDown, LanguagesIcon, MessageCircleIcon, SidebarIcon, XIcon } from "lucide-react";
|
|
14
14
|
import { cva } from "class-variance-authority";
|
|
15
|
-
import { cloneElement, createContext, use, useMemo, useState } from "react";
|
|
15
|
+
import { cloneElement, createContext, use, useId, useMemo, useState } from "react";
|
|
16
16
|
import { useTranslations } from "@fuma-translate/react";
|
|
17
|
+
import { flushSync } from "react-dom";
|
|
17
18
|
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
18
19
|
import { ScrollArea } from "@base-ui/react/scroll-area";
|
|
19
20
|
import { Drawer } from "@base-ui/react/drawer";
|
|
20
21
|
// src/layouts/glass/slots/sidebar.tsx
|
|
21
22
|
const drawerHandle = Drawer.createHandle();
|
|
22
|
-
const itemTriggerVariants = cva("inline-flex items-center gap-2 rounded-lg px-2.5 py-2 md:py-1.5 [&_svg]:size-4 outline-
|
|
23
|
+
const itemTriggerVariants = cva("inline-flex items-center gap-2 rounded-lg px-2.5 py-2 md:py-1.5 [&_svg]:size-4 outline-hidden focus-visible:ring-2 focus-visible:ring-fd-ring", { variants: { active: {
|
|
23
24
|
true: "bg-fd-primary/10 text-fd-primary",
|
|
24
25
|
false: "text-fd-muted-foreground hover:bg-fd-accent hover:text-fd-accent-foreground"
|
|
25
26
|
} } });
|
|
@@ -29,7 +30,7 @@ function SidebarProvider({ children, collapsible = true }) {
|
|
|
29
30
|
useHotKey((e) => {
|
|
30
31
|
if (!(e.metaKey || e.ctrlKey) || e.shiftKey || e.altKey || e.key !== "b") return;
|
|
31
32
|
e.preventDefault();
|
|
32
|
-
setCollapsed((prev) => !prev);
|
|
33
|
+
collapseWithFocus(() => setCollapsed((prev) => !prev));
|
|
33
34
|
}, {
|
|
34
35
|
enabled: collapsible,
|
|
35
36
|
ignoreTyping: true
|
|
@@ -38,11 +39,17 @@ function SidebarProvider({ children, collapsible = true }) {
|
|
|
38
39
|
value: useMemo(() => ({
|
|
39
40
|
collapsible,
|
|
40
41
|
collapsed,
|
|
41
|
-
setCollapsed
|
|
42
|
+
setCollapsed: (value) => collapseWithFocus(() => setCollapsed(value))
|
|
42
43
|
}), [collapsible, collapsed]),
|
|
43
44
|
children
|
|
44
45
|
});
|
|
45
46
|
}
|
|
47
|
+
/** applies a collapse change, the focus moves to the visible sidebar trigger when the change hid the focused element */
|
|
48
|
+
function collapseWithFocus(update) {
|
|
49
|
+
const active = document.activeElement;
|
|
50
|
+
flushSync(update);
|
|
51
|
+
if (active && (!active.isConnected || active.matches("[inert] *"))) document.querySelector("[aria-controls=\"nd-sidebar\"]:not([inert] *)")?.focus();
|
|
52
|
+
}
|
|
46
53
|
function useSidebar() {
|
|
47
54
|
const v = use(Context);
|
|
48
55
|
if (!v) throw new Error("Missing <SidebarProvider />");
|
|
@@ -61,7 +68,7 @@ function SidebarDrawer({ contentProps }) {
|
|
|
61
68
|
className: "[--viewport-padding:0px] supports-[-webkit-touch-callout:none]:[--viewport-padding:0.625rem] fixed inset-0 flex items-stretch justify-end p-(--viewport-padding)",
|
|
62
69
|
children: /* @__PURE__ */ jsx(Drawer.Popup, {
|
|
63
70
|
id: "nd-mobile-sidebar",
|
|
64
|
-
className: cn("relative [--bleed:3rem] supports-[-webkit-touch-callout:none]:[--bleed:0px] w-[360px] h-full max-w-[calc(100vw-3rem+var(--bleed))] pr-(--bleed) -mr-(--bleed) border-l bg-fd-background text-fd-foreground text-[0.9375rem] outline-
|
|
71
|
+
className: cn("relative [--bleed:3rem] supports-[-webkit-touch-callout:none]:[--bleed:0px] w-[360px] h-full max-w-[calc(100vw-3rem+var(--bleed))] pr-(--bleed) -mr-(--bleed) border-l bg-fd-background text-fd-foreground text-[0.9375rem] outline-hidden shadow-md touch-auto [transform:translateX(var(--drawer-swipe-movement-x))] transition-transform duration-450 ease-[cubic-bezier(0.32,0.72,0,1)] data-swiping:select-none data-ending-style:[transform:translateX(calc(100%-var(--bleed)+var(--viewport-padding)+2px))] data-starting-style:[transform:translateX(calc(100%-var(--bleed)+var(--viewport-padding)+2px))] supports-[-webkit-touch-callout:none]:border supports-[-webkit-touch-callout:none]:rounded-xl", "[scrollbar-width:none] overflow-y-auto"),
|
|
65
72
|
children: /* @__PURE__ */ jsxs(Drawer.Content, {
|
|
66
73
|
...contentProps,
|
|
67
74
|
className: cn("flex flex-col min-h-full px-3", contentProps?.className),
|
|
@@ -124,6 +131,7 @@ function Sidebar({ className, children, ...props }) {
|
|
|
124
131
|
const t = useTranslations({ note: "sidebar" });
|
|
125
132
|
return /* @__PURE__ */ jsxs("aside", {
|
|
126
133
|
id: "nd-sidebar",
|
|
134
|
+
inert: collapsed,
|
|
127
135
|
className: cn("sticky flex flex-col transition-transform [grid-area:left] my-2 ms-2 z-30 top-2 border rounded-2xl bg-fd-popover/80 text-fd-popover-foreground text-sm backdrop-blur-sm shadow-sm h-[calc(100dvh---spacing(4))] max-md:hidden md:layout:[--fd-left-width:280px]", collapsed && "w-[calc(280px---spacing(2))] -translate-x-[280px] md:layout:[--fd-left-width:0px]", className),
|
|
128
136
|
...props,
|
|
129
137
|
children: [
|
|
@@ -132,12 +140,14 @@ function Sidebar({ className, children, ...props }) {
|
|
|
132
140
|
children: [/* @__PURE__ */ jsx(slots.navTitle, { className: "flex text-sm items-center font-semibold gap-2 me-auto" }), /* @__PURE__ */ jsxs("div", {
|
|
133
141
|
className: "flex -mt-1.5 -me-1.5 empty:hidden",
|
|
134
142
|
children: [menuItems.map((item, i) => item.type === "icon" && /* @__PURE__ */ jsx(SidebarIconLinkItem, { item }, i)), collapsible && /* @__PURE__ */ jsx("button", {
|
|
135
|
-
"aria-label":
|
|
143
|
+
"aria-label": t("Hide Sidebar"),
|
|
144
|
+
"aria-controls": "nd-sidebar",
|
|
145
|
+
"aria-expanded": true,
|
|
136
146
|
className: cn(buttonVariants({
|
|
137
147
|
variant: "ghost",
|
|
138
148
|
size: "icon-sm"
|
|
139
149
|
}), "text-fd-muted-foreground"),
|
|
140
|
-
onClick: () => setCollapsed(
|
|
150
|
+
onClick: () => setCollapsed(true),
|
|
141
151
|
children: /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
142
152
|
})]
|
|
143
153
|
})]
|
|
@@ -185,6 +195,7 @@ function SidebarIconLinkItem({ item, className }) {
|
|
|
185
195
|
function SidebarLinkItem({ item, className }) {
|
|
186
196
|
const pathname = usePathname();
|
|
187
197
|
const [open, setOpen] = useState(true);
|
|
198
|
+
const linkId = useId();
|
|
188
199
|
switch (item.type) {
|
|
189
200
|
case "custom": return /* @__PURE__ */ jsx("div", {
|
|
190
201
|
className,
|
|
@@ -199,6 +210,7 @@ function SidebarLinkItem({ item, className }) {
|
|
|
199
210
|
children: [item.url ? /* @__PURE__ */ jsxs("div", {
|
|
200
211
|
className: "flex w-full px-2.5 py-1.5 font-medium",
|
|
201
212
|
children: [/* @__PURE__ */ jsxs(Link, {
|
|
213
|
+
id: linkId,
|
|
202
214
|
href: item.url,
|
|
203
215
|
external: item.external,
|
|
204
216
|
"aria-current": isLinkItemActive(item, pathname) ? "page" : void 0,
|
|
@@ -208,6 +220,7 @@ function SidebarLinkItem({ item, className }) {
|
|
|
208
220
|
},
|
|
209
221
|
children: [item.icon, item.text]
|
|
210
222
|
}), /* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
223
|
+
"aria-labelledby": linkId,
|
|
211
224
|
className: "flex-1",
|
|
212
225
|
children: rightIcon
|
|
213
226
|
})]
|
|
@@ -268,6 +281,7 @@ function SidebarFolder({ folder }) {
|
|
|
268
281
|
const shouldOpen = (folder.defaultOpen ?? true) || isNodeInPath(folder, path);
|
|
269
282
|
const [open, setOpen] = useState(shouldOpen);
|
|
270
283
|
const indexActive = folder.index ? isNodeInPath(folder.index, path) : false;
|
|
284
|
+
const linkId = useId();
|
|
271
285
|
useOnChange(shouldOpen, () => shouldOpen && setOpen(true));
|
|
272
286
|
if (folder.collapsible === false) return /* @__PURE__ */ jsxs(Fragment, { children: [folder.index ? /* @__PURE__ */ jsxs(Link, {
|
|
273
287
|
href: folder.index.url,
|
|
@@ -290,6 +304,7 @@ function SidebarFolder({ folder }) {
|
|
|
290
304
|
children: [folder.index ? /* @__PURE__ */ jsxs("div", {
|
|
291
305
|
className: "flex w-full px-2.5 py-1.5 font-medium",
|
|
292
306
|
children: [/* @__PURE__ */ jsxs(Link, {
|
|
307
|
+
id: linkId,
|
|
293
308
|
href: folder.index.url,
|
|
294
309
|
external: folder.index.external,
|
|
295
310
|
"aria-current": indexActive ? "page" : void 0,
|
|
@@ -299,6 +314,7 @@ function SidebarFolder({ folder }) {
|
|
|
299
314
|
},
|
|
300
315
|
children: [folder.icon, folder.name]
|
|
301
316
|
}), /* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
317
|
+
"aria-labelledby": linkId,
|
|
302
318
|
className: "flex-1",
|
|
303
319
|
children: rightIcon
|
|
304
320
|
})]
|
|
@@ -244,7 +244,7 @@ function MobileNavigationMenuLinkItem({ item, ...props }) {
|
|
|
244
244
|
return /* @__PURE__ */ jsxs(LinkItem, {
|
|
245
245
|
item,
|
|
246
246
|
className: cn({
|
|
247
|
-
main: "inline-flex items-center gap-2 py-1.5 transition-colors hover:text-fd-
|
|
247
|
+
main: "inline-flex items-center gap-2 py-1.5 transition-colors hover:text-fd-muted-foreground data-[active=true]:font-medium data-[active=true]:text-fd-primary [&_svg]:size-4",
|
|
248
248
|
icon: buttonVariants({
|
|
249
249
|
size: "icon",
|
|
250
250
|
variant: "ghost"
|
|
@@ -115,7 +115,7 @@ function PageTOCPopoverTrigger({ className, ...props }) {
|
|
|
115
115
|
const path = useTreePath().at(-1);
|
|
116
116
|
const showItem = selectedIdx !== -1 && !open;
|
|
117
117
|
return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
118
|
-
className: cn("flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-
|
|
118
|
+
className: cn("flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-fd-ring [&_svg]:size-4 md:px-6", className),
|
|
119
119
|
"data-toc-popover-trigger": "",
|
|
120
120
|
...props,
|
|
121
121
|
children: [
|
|
@@ -179,7 +179,7 @@ function NavbarLinkItemMenu({ item, hoverDelay = 50, className, ...props }) {
|
|
|
179
179
|
if (freezeUntil.current === null || Date.now() >= freezeUntil.current) setOpen(value);
|
|
180
180
|
},
|
|
181
181
|
children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
182
|
-
className: cn("inline-flex items-center gap-1.5 p-1 text-sm text-fd-muted-foreground transition-colors has-data-[active=true]:text-fd-primary data-[popup-open]:text-fd-accent-foreground focus-visible:outline-
|
|
182
|
+
className: cn("inline-flex items-center gap-1.5 p-1 rounded-md text-sm text-fd-muted-foreground transition-colors has-data-[active=true]:text-fd-primary data-[popup-open]:text-fd-accent-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-fd-ring", className),
|
|
183
183
|
onPointerEnter,
|
|
184
184
|
onPointerLeave,
|
|
185
185
|
...props,
|
|
@@ -48,6 +48,7 @@ function SidebarContent({ ref: refProp, className, children, ...props }) {
|
|
|
48
48
|
ref: mergeRefs(ref, refProp, asideRef),
|
|
49
49
|
"data-collapsed": collapsed,
|
|
50
50
|
"data-hovered": collapsed && hovered,
|
|
51
|
+
inert: collapsed && !hovered,
|
|
51
52
|
className: cn("absolute flex flex-col w-full start-0 inset-y-0 items-end text-sm duration-250 *:w-(--fd-sidebar-width)", navMode === "auto" && "bg-fd-card border-e", collapsed && ["inset-y-2 rounded-xl bg-fd-card transition-transform border w-(--fd-sidebar-width)", hovered ? "shadow-lg translate-x-2 rtl:-translate-x-2" : "-translate-x-(--fd-sidebar-width) rtl:translate-x-full"], ref.current && ref.current.getAttribute("data-collapsed") === "true" !== collapsed && "transition-[width,inset-block,translate,background-color]", className),
|
|
52
53
|
...props,
|
|
53
54
|
...rest,
|
|
@@ -119,7 +119,7 @@ function SkipToContent() {
|
|
|
119
119
|
const t = useTranslations({ note: "skip link" });
|
|
120
120
|
return /* @__PURE__ */ jsx("a", {
|
|
121
121
|
href: "#nd-page",
|
|
122
|
-
className: "sr-only",
|
|
122
|
+
className: cn(buttonVariants({ variant: "secondary" }), "fixed top-2 start-2 z-50 rounded-lg px-3 shadow-lg not-focus-visible:sr-only"),
|
|
123
123
|
children: t("Skip to Content")
|
|
124
124
|
});
|
|
125
125
|
}
|
|
@@ -11,17 +11,20 @@ function LanguageSelect({ className, variant = "ghost", children, ...rest }) {
|
|
|
11
11
|
const t = useTranslations({ note: "language switcher" });
|
|
12
12
|
if (!context.locales) throw new Error("Missing `<I18nProvider />`");
|
|
13
13
|
const chooseLanguage = t("Choose a language");
|
|
14
|
-
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */
|
|
15
|
-
"aria-label": t("Choose a language", { note: "aria-label" }),
|
|
14
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
16
15
|
className: (s) => cn(buttonVariants({ variant }), "gap-1.5 p-1.5", s.open && "bg-fd-accent", className),
|
|
17
16
|
...rest,
|
|
18
|
-
children
|
|
17
|
+
children: [children, /* @__PURE__ */ jsx("span", {
|
|
18
|
+
className: "sr-only",
|
|
19
|
+
children: chooseLanguage
|
|
20
|
+
})]
|
|
19
21
|
}), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
20
22
|
className: "flex flex-col gap-0.5 p-1",
|
|
21
23
|
children: [/* @__PURE__ */ jsx("p", {
|
|
22
24
|
className: "p-2 text-xs font-medium text-fd-muted-foreground",
|
|
23
25
|
children: chooseLanguage
|
|
24
26
|
}), context.locales.map((item) => /* @__PURE__ */ jsx(PopoverClose, {
|
|
27
|
+
lang: item.locale,
|
|
25
28
|
className: cn("px-2 py-1.5 text-start text-sm rounded-lg transition-colors", item.locale === context.locale ? "bg-fd-primary/10 text-fd-primary" : "text-fd-muted-foreground hover:bg-fd-accent hover:text-fd-accent-foreground"),
|
|
26
29
|
onClick: () => {
|
|
27
30
|
context.onChange?.(item.locale);
|
|
@@ -34,6 +37,7 @@ function LanguageSelectText(props) {
|
|
|
34
37
|
const { locales, locale } = useI18n();
|
|
35
38
|
const text = locales?.find((item) => item.locale === locale)?.name;
|
|
36
39
|
return /* @__PURE__ */ jsx("span", {
|
|
40
|
+
lang: locale,
|
|
37
41
|
...props,
|
|
38
42
|
children: text
|
|
39
43
|
});
|
|
@@ -64,13 +64,13 @@ function DocsLayout(props) {
|
|
|
64
64
|
/* @__PURE__ */ jsx(SkipToContent, {}),
|
|
65
65
|
/* @__PURE__ */ jsx(slots.sidebar.main, {}),
|
|
66
66
|
/* @__PURE__ */ jsx(slots.header, {}),
|
|
67
|
+
/* @__PURE__ */ jsx(slots.sidebar.drawer, {}),
|
|
67
68
|
children,
|
|
68
69
|
aiChat?.panel && /* @__PURE__ */ jsx(AIChatPanel, {
|
|
69
70
|
open: aiChat.open,
|
|
70
71
|
className: cn("[grid-area:right] xl:my-2 xl:rounded-2xl xl:border xl:bg-fd-background xl:shadow-sm", aiChat.open && "xl:me-2"),
|
|
71
72
|
children: aiChat.panel
|
|
72
|
-
})
|
|
73
|
-
/* @__PURE__ */ jsx(slots.sidebar.drawer, {})
|
|
73
|
+
})
|
|
74
74
|
]
|
|
75
75
|
})
|
|
76
76
|
})
|
|
@@ -69,7 +69,7 @@ function TOCPopover({ container, trigger, content, header, footer, ...props }) {
|
|
|
69
69
|
className: "bg-fd-card",
|
|
70
70
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
71
71
|
...trigger,
|
|
72
|
-
className: cn("flex w-full h-10 items-center gap-2.5 px-4 text-start text-sm text-fd-muted-foreground focus-visible:outline-
|
|
72
|
+
className: cn("flex w-full h-10 items-center gap-2.5 px-4 text-start text-sm text-fd-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-fd-ring", trigger?.className),
|
|
73
73
|
children: [
|
|
74
74
|
/* @__PURE__ */ jsx(TOCProgress, {
|
|
75
75
|
size: 18,
|
|
@@ -123,7 +123,7 @@ function TOCDropdown({ trigger, content, header, footer, ...props }) {
|
|
|
123
123
|
className: "z-50",
|
|
124
124
|
children: /* @__PURE__ */ jsxs(Popover.Popup, {
|
|
125
125
|
...content,
|
|
126
|
-
className: cn("flex flex-col w-88 max-w-(--available-width) max-h-[min(28rem,var(--available-height))] p-3 rounded-2xl border bg-fd-popover text-fd-popover-foreground shadow-xl outline-
|
|
126
|
+
className: cn("flex flex-col w-88 max-w-(--available-width) max-h-[min(28rem,var(--available-height))] p-3 rounded-2xl border bg-fd-popover text-fd-popover-foreground shadow-xl outline-hidden origin-(--transform-origin) transition-[opacity,scale] duration-150 ease-[cubic-bezier(0.22,1,0.36,1)] data-starting-style:opacity-0 data-starting-style:scale-95 data-ending-style:opacity-0 data-ending-style:scale-95 motion-reduce:transition-none", content?.className),
|
|
127
127
|
children: [
|
|
128
128
|
header,
|
|
129
129
|
/* @__PURE__ */ jsx(TOCList, {
|
|
@@ -12,8 +12,8 @@ import { useTheme } from "next-themes";
|
|
|
12
12
|
import { flushSync } from "react-dom";
|
|
13
13
|
import { Menu } from "@base-ui/react/menu";
|
|
14
14
|
// src/layouts/spacious/slots/actions.tsx
|
|
15
|
-
const popupClass = "flex flex-col max-h-(--available-height) overflow-y-auto rounded-2xl border bg-fd-popover text-sm text-fd-popover-foreground shadow-lg outline-
|
|
16
|
-
const itemClass = "flex w-full min-h-9 items-center gap-3 rounded-lg px-2.5 py-1.5 text-start outline-
|
|
15
|
+
const popupClass = "flex flex-col max-h-(--available-height) overflow-y-auto rounded-2xl border bg-fd-popover text-sm text-fd-popover-foreground shadow-lg outline-hidden origin-(--transform-origin) transition-[opacity,scale] duration-150 ease-[cubic-bezier(0.22,1,0.36,1)] data-starting-style:opacity-0 data-starting-style:scale-95 data-ending-style:opacity-0 data-ending-style:scale-97 data-ending-style:duration-100 motion-reduce:transition-none";
|
|
16
|
+
const itemClass = "flex w-full min-h-9 items-center gap-3 rounded-lg px-2.5 py-1.5 text-start outline-hidden transition-colors duration-100 data-highlighted:bg-fd-accent data-highlighted:text-fd-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0";
|
|
17
17
|
function IconLinks({ className }) {
|
|
18
18
|
const { menuItems } = useSpaciousLayout();
|
|
19
19
|
return menuItems.map((item, i) => item.type === "icon" && /* @__PURE__ */ jsx(LinkItem, {
|
|
@@ -213,7 +213,7 @@ function ThemeSegments() {
|
|
|
213
213
|
}), themes.map(([key, Icon, turn]) => /* @__PURE__ */ jsx(Menu.RadioItem, {
|
|
214
214
|
value: key,
|
|
215
215
|
"aria-label": labels[key],
|
|
216
|
-
className: cn("relative flex items-center justify-center size-7 rounded-full outline-
|
|
216
|
+
className: cn("relative flex items-center justify-center size-7 rounded-full outline-hidden transition-colors duration-150 hover:text-fd-foreground focus-visible:ring-2 focus-visible:ring-fd-ring data-highlighted:text-fd-foreground [&_svg]:size-3.5", key === theme ? "text-fd-foreground" : "text-fd-muted-foreground data-highlighted:bg-fd-accent"),
|
|
217
217
|
onClick: (e) => onPick(e, turn),
|
|
218
218
|
children: /* @__PURE__ */ jsx(Icon, {})
|
|
219
219
|
}, key))]
|
|
@@ -18,7 +18,7 @@ import { ScrollArea } from "@base-ui/react/scroll-area";
|
|
|
18
18
|
import { Menu } from "@base-ui/react/menu";
|
|
19
19
|
// src/layouts/spacious/slots/sidebar.tsx
|
|
20
20
|
/** the hover fill comes from the gliding block of `SidebarItems` */
|
|
21
|
-
const itemVariants = cva("relative flex w-full items-center gap-3 rounded-lg px-2.5 py-2 text-start wrap-anywhere outline-
|
|
21
|
+
const itemVariants = cva("relative flex w-full items-center gap-3 rounded-lg px-2.5 py-2 text-start wrap-anywhere outline-hidden transition-colors focus-visible:ring-2 focus-visible:ring-fd-ring [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
22
22
|
variants: { active: {
|
|
23
23
|
true: "bg-fd-primary/10 text-fd-primary",
|
|
24
24
|
false: "text-fd-muted-foreground hover:text-fd-accent-foreground"
|
|
@@ -122,17 +122,20 @@ function TabsMenus() {
|
|
|
122
122
|
const start = Math.max(0, groups.findLastIndex((group) => typeof group.active?.root !== "string"));
|
|
123
123
|
if (start >= groups.length) return;
|
|
124
124
|
return /* @__PURE__ */ jsx("div", {
|
|
125
|
-
className: "flex flex-col rounded-xl border bg-fd-secondary/50
|
|
126
|
-
children: groups.map((group, i) => i >= start && /* @__PURE__ */ jsx(TabsMenu, {
|
|
125
|
+
className: "flex flex-col rounded-xl border bg-fd-secondary/50 overflow-clip",
|
|
126
|
+
children: groups.map((group, i) => i >= start && /* @__PURE__ */ jsx(TabsMenu, {
|
|
127
|
+
options: group.options,
|
|
128
|
+
className: i > start ? "border-t" : void 0
|
|
129
|
+
}, i))
|
|
127
130
|
});
|
|
128
131
|
}
|
|
129
|
-
function TabsMenu({ options }) {
|
|
132
|
+
function TabsMenu({ options, className }) {
|
|
130
133
|
const t = useTranslations();
|
|
131
134
|
const pathname = usePathname();
|
|
132
135
|
const path = useTreePath();
|
|
133
136
|
const selected = options.findLast((tab) => isLayoutTabActive(tab, path, pathname));
|
|
134
137
|
return /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsxs(Menu.Trigger, {
|
|
135
|
-
className: "flex w-full h-10 items-center gap-3 ps-[calc(--spacing(2.5)-1px)] pe-2.5 text-start font-medium outline-
|
|
138
|
+
className: cn("flex w-full h-10 items-center gap-3 ps-[calc(--spacing(2.5)-1px)] pe-2.5 text-start font-medium outline-hidden transition-colors hover:bg-fd-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-fd-ring data-popup-open:bg-fd-accent [&_svg]:size-4 [&_svg]:shrink-0", className),
|
|
136
139
|
children: [
|
|
137
140
|
selected && /* @__PURE__ */ jsx(TabIcon, { tab: selected }),
|
|
138
141
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -148,7 +151,7 @@ function TabsMenu({ options }) {
|
|
|
148
151
|
positionMethod: "fixed",
|
|
149
152
|
className: "z-50",
|
|
150
153
|
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
151
|
-
className: "flex flex-col w-[calc(var(--anchor-width)+--spacing(2))] max-h-(--available-height) overflow-y-auto p-1 rounded-2xl border bg-fd-popover text-sm text-fd-popover-foreground shadow-lg outline-
|
|
154
|
+
className: "flex flex-col w-[calc(var(--anchor-width)+--spacing(2))] max-h-(--available-height) overflow-y-auto p-1 rounded-2xl border bg-fd-popover text-sm text-fd-popover-foreground shadow-lg outline-hidden origin-(--transform-origin) transition-[opacity,scale] duration-150 ease-[cubic-bezier(0.22,1,0.36,1)] data-starting-style:opacity-0 data-starting-style:scale-95 data-ending-style:opacity-0 data-ending-style:scale-97 data-ending-style:duration-100 motion-reduce:transition-none",
|
|
152
155
|
children: options.map((tab, i) => {
|
|
153
156
|
if (tab.unlisted && tab !== selected) return;
|
|
154
157
|
return /* @__PURE__ */ jsxs(Menu.LinkItem, {
|
|
@@ -157,7 +160,7 @@ function TabsMenu({ options }) {
|
|
|
157
160
|
href: tab.url,
|
|
158
161
|
...tab.props
|
|
159
162
|
}),
|
|
160
|
-
className: cn("flex w-full min-h-9 items-start gap-3 rounded-lg px-[calc(--spacing(2.5)-1px)] py-2 text-start outline-
|
|
163
|
+
className: cn("flex w-full min-h-9 items-start gap-3 rounded-lg px-[calc(--spacing(2.5)-1px)] py-2 text-start outline-hidden transition-colors duration-100 data-highlighted:bg-fd-accent data-highlighted:text-fd-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0", tab.props?.className),
|
|
161
164
|
children: [
|
|
162
165
|
/* @__PURE__ */ jsx(TabIcon, {
|
|
163
166
|
tab,
|