@fumadocs/base-ui 16.16.1 → 16.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/generated/docs.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/dist/components/callout.js +1 -1
- package/dist/components/codeblock.js +1 -1
- package/dist/components/dialog/search-algolia.js +5 -8
- package/dist/components/dialog/search-default.js +3 -5
- package/dist/components/dialog/search-orama.js +5 -8
- package/dist/components/dialog/search.d.ts +50 -27
- package/dist/components/dialog/search.js +149 -97
- package/dist/components/sidebar/base.d.ts +7 -1
- package/dist/components/sidebar/base.js +10 -1
- package/dist/components/tabs.js +2 -7
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/components/ui/tabs.js +44 -25
- package/dist/contexts/search.js +3 -8
- package/dist/contexts/tree.js +4 -4
- package/dist/layouts/docs/client.js +1 -0
- package/dist/layouts/flux/slots/sidebar.d.ts +1 -1
- package/dist/layouts/flux/slots/sidebar.js +9 -11
- package/dist/layouts/glass/slots/sidebar.js +9 -0
- package/dist/layouts/notebook/client.js +1 -0
- package/dist/layouts/shared/client.js +1 -1
- package/dist/layouts/spacious/index.js +1 -1
- package/dist/layouts/spacious/page/index.js +35 -36
- package/dist/layouts/spacious/page/slots/toc.js +4 -4
- package/dist/layouts/spacious/slots/actions.js +5 -6
- package/dist/layouts/spacious/slots/header.js +1 -1
- package/dist/layouts/spacious/slots/sidebar.d.ts +1 -1
- package/dist/layouts/spacious/slots/sidebar.js +3 -3
- package/dist/provider/base.js +3 -25
- package/dist/style.css +203 -40
- package/dist/utils/hotkey.js +29 -0
- package/package.json +8 -11
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../../../utils/cn.js";
|
|
3
3
|
import { mergeRefs } from "../../../utils/merge-refs.js";
|
|
4
|
+
import { useHotKey } from "../../../utils/hotkey.js";
|
|
4
5
|
import { 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, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
|
|
5
6
|
import { createPageTreeRenderer } from "../../../components/sidebar/page-tree.js";
|
|
6
7
|
import { createLinkItemRenderer } from "../../../components/sidebar/link-item.js";
|
|
@@ -8,7 +9,7 @@ import { useFluxLayout } from "../index.js";
|
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { SidebarIcon, XIcon } from "lucide-react";
|
|
10
11
|
import { cva } from "class-variance-authority";
|
|
11
|
-
import {
|
|
12
|
+
import { useRef, useState } from "react";
|
|
12
13
|
import { useTranslations } from "@fuma-translate/react";
|
|
13
14
|
import { AnimatePresence, motion } from "motion/react";
|
|
14
15
|
import { RemoveScroll } from "react-remove-scroll";
|
|
@@ -29,7 +30,10 @@ function getItemOffset(depth) {
|
|
|
29
30
|
}
|
|
30
31
|
const { useSidebar } = base_exports;
|
|
31
32
|
function SidebarProvider(props) {
|
|
32
|
-
return /* @__PURE__ */ jsx(SidebarProvider$1, {
|
|
33
|
+
return /* @__PURE__ */ jsx(SidebarProvider$1, {
|
|
34
|
+
...props,
|
|
35
|
+
collapsible: false
|
|
36
|
+
});
|
|
33
37
|
}
|
|
34
38
|
function Sidebar({ footer, banner, components, ...rest }) {
|
|
35
39
|
const { menuItems } = useFluxLayout();
|
|
@@ -86,18 +90,12 @@ function SidebarContent({ ref: refProp, className, children, ...props }) {
|
|
|
86
90
|
const ref = useRef(null);
|
|
87
91
|
const [blockScroll, setBlockScroll] = useState(false);
|
|
88
92
|
const { open, setOpen } = useSidebar();
|
|
89
|
-
|
|
90
|
-
if (
|
|
93
|
+
useHotKey((e) => {
|
|
94
|
+
if (e.key === "Escape") {
|
|
91
95
|
setOpen(false);
|
|
92
96
|
e.preventDefault();
|
|
93
97
|
}
|
|
94
|
-
});
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
window.addEventListener("keydown", listener);
|
|
97
|
-
return () => {
|
|
98
|
-
window.removeEventListener("keydown", listener);
|
|
99
|
-
};
|
|
100
|
-
}, []);
|
|
98
|
+
}, { enabled: open });
|
|
101
99
|
if (open && !blockScroll) setBlockScroll(true);
|
|
102
100
|
return /* @__PURE__ */ jsx(RemoveScroll, {
|
|
103
101
|
enabled: blockScroll,
|
|
@@ -3,6 +3,7 @@ import { cn } from "../../../utils/cn.js";
|
|
|
3
3
|
import { buttonVariants } from "../../../components/ui/button.js";
|
|
4
4
|
import { useTreeContext, useTreePath } from "../../../contexts/tree.js";
|
|
5
5
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../components/ui/collapsible.js";
|
|
6
|
+
import { useHotKey } from "../../../utils/hotkey.js";
|
|
6
7
|
import { isLinkItemActive } from "../../shared/index.js";
|
|
7
8
|
import { LayoutTabsDropdown } from "../layout-tabs.js";
|
|
8
9
|
import { useGlassLayout } from "../index.js";
|
|
@@ -25,6 +26,14 @@ const itemTriggerVariants = cva("inline-flex items-center gap-2 rounded-lg px-2.
|
|
|
25
26
|
const Context = createContext(null);
|
|
26
27
|
function SidebarProvider({ children, collapsible = true }) {
|
|
27
28
|
const [collapsed, setCollapsed] = useState(false);
|
|
29
|
+
useHotKey((e) => {
|
|
30
|
+
if (!(e.metaKey || e.ctrlKey) || e.shiftKey || e.altKey || e.key !== "b") return;
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
setCollapsed((prev) => !prev);
|
|
33
|
+
}, {
|
|
34
|
+
enabled: collapsible,
|
|
35
|
+
ignoreTyping: true
|
|
36
|
+
});
|
|
28
37
|
return /* @__PURE__ */ jsx(Context, {
|
|
29
38
|
value: useMemo(() => ({
|
|
30
39
|
collapsible,
|
|
@@ -29,7 +29,7 @@ function AIChatPanel({ open, className, children }) {
|
|
|
29
29
|
const [mounted, setMounted] = useState(open);
|
|
30
30
|
if (open && !mounted) setMounted(true);
|
|
31
31
|
return /* @__PURE__ */ jsx("aside", {
|
|
32
|
-
className: cn("z-40 overflow-clip bg-fd-card text-fd-card-foreground layout:[--fd-ai-chat-width:min(--spacing(100),100vw---spacing(4))] transition-[width,margin,translate
|
|
32
|
+
className: cn("z-40 overflow-clip bg-fd-card text-fd-card-foreground layout:[--fd-ai-chat-width:min(--spacing(100),100vw---spacing(4))] transition-[width,margin,translate] duration-300 ease-in-out motion-reduce:transition-none max-xl:fixed max-xl:inset-y-2 max-xl:end-2 max-xl:w-(--fd-ai-chat-width) max-xl:rounded-2xl max-xl:border max-xl:shadow-xl", open ? "w-(--fd-ai-chat-width)" : "invisible w-0 transition-[width,margin,translate,visibility] max-xl:translate-x-[calc(100%+--spacing(2))] rtl:max-xl:-translate-x-[calc(100%+--spacing(2))]", className),
|
|
33
33
|
children: /* @__PURE__ */ jsx("div", {
|
|
34
34
|
className: "flex flex-col size-full xl:w-(--fd-ai-chat-width)",
|
|
35
35
|
children: mounted && children
|
|
@@ -58,7 +58,7 @@ function DocsLayout(props) {
|
|
|
58
58
|
id: "fd-spacious-layout",
|
|
59
59
|
className: "relative grid min-h-(--fd-layout-height) bg-fd-card transition-[grid-template-columns] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none [--fd-layout-height:calc(100dvh-var(--fd-banner-height,0px))] [--fd-header-height:--spacing(14)] [--fd-page-width:760px] [--fd-sidebar-width:0px] [--fd-sidebar-col:var(--fd-sidebar-width)] [--fd-toc-width:0px] max-md:[--fd-docs-row-3:calc(var(--fd-banner-height,0px)+var(--fd-header-height)+var(--fd-toc-popover-height,0px))] md:h-(--fd-layout-height) md:overflow-clip print:h-auto print:overflow-visible",
|
|
60
60
|
style: { gridTemplate: `"sidebar header right" auto
|
|
61
|
-
"sidebar toc-popover right"
|
|
61
|
+
"sidebar toc-popover right" var(--fd-toc-popover-height, 0px)
|
|
62
62
|
"sidebar main right" 1fr / var(--fd-sidebar-col) minmax(0, 1fr) auto` },
|
|
63
63
|
children: [
|
|
64
64
|
/* @__PURE__ */ jsx(slots.sidebar.main, {}),
|
|
@@ -43,45 +43,44 @@ function DocsPage({ full = false, toc = [], tableOfContent: { enabled: tocEnable
|
|
|
43
43
|
children: /* @__PURE__ */ jsxs(slots.toc.provider, {
|
|
44
44
|
single,
|
|
45
45
|
toc: tocEnabled || tocPopoverEnabled ? toc : [],
|
|
46
|
-
children: [
|
|
47
|
-
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
47
|
+
className: "sticky top-[calc(var(--fd-banner-height,0px)+var(--fd-header-height))] z-30 [grid-area:toc-popover] self-start md:hidden",
|
|
48
|
+
children: [tocPopoverEnabled && /* @__PURE__ */ jsx(slots.toc.popover, { ...tocPopoverProps }), /* @__PURE__ */ jsx("div", { className: "absolute inset-x-2 top-full h-[calc(var(--fd-layout-height)-var(--fd-header-height)-100%)] rounded-t-2xl border-x border-t outline-8 outline-fd-card [clip-path:inset(0_-8px_-8px)] bg-origin-border bg-linear-to-b from-fd-background to-transparent to-[16px] pointer-events-none" })]
|
|
49
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
50
|
+
id: "nd-page-panel",
|
|
51
|
+
className: "@container relative flex flex-col min-w-0 min-h-0 [grid-area:main] mx-2 bg-fd-background md:ms-0 md:my-2 md:overflow-clip md:rounded-2xl md:border md:shadow-sm print:overflow-visible",
|
|
52
|
+
children: [/* @__PURE__ */ jsxs("header", {
|
|
53
|
+
className: cn("absolute inset-x-0 top-0 z-10 flex items-center gap-1.5 h-(--fd-header-height) ps-6 pe-4 bg-linear-to-b from-fd-background to-transparent pointer-events-none *:pointer-events-auto max-md:hidden", hasFolders || tocPopoverEnabled ? "from-50%" : "to-40%"),
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx(ExpandSidebar, {}),
|
|
56
|
+
breadcrumbEnabled && /* @__PURE__ */ jsx(slots.breadcrumb, { ...breadcrumb }),
|
|
57
|
+
tocPopoverEnabled && /* @__PURE__ */ jsxs("div", {
|
|
58
|
+
className: cn("flex items-center gap-1.5 min-w-0 transition-[opacity,visibility] duration-300 motion-reduce:transition-none", tocEnabled && !(aiChat?.open && aiChat.panel) && "invisible opacity-0 @max-5xl:visible @max-5xl:opacity-100 @max-5xl:transition-none"),
|
|
59
|
+
children: [hasFolders && /* @__PURE__ */ jsx("span", {
|
|
60
|
+
className: "text-sm text-fd-muted-foreground/50",
|
|
61
|
+
children: "/"
|
|
62
|
+
}), /* @__PURE__ */ jsx(slots.toc.dropdown, { ...tocPopoverProps })]
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ jsx(layout.slots.actions, { className: "ms-auto" })
|
|
65
|
+
]
|
|
66
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
67
|
+
className: "flex flex-1 items-start px-4 md:min-h-0 md:pt-(--fd-header-height) md:px-[max(--spacing(6),calc((100%-var(--fd-page-width)-var(--fd-toc-width))/2))] md:overflow-y-auto md:overscroll-y-contain md:scrollbar-thin md:scrollbar-gutter-stable",
|
|
68
|
+
children: [/* @__PURE__ */ jsxs("article", {
|
|
69
|
+
id: "nd-page",
|
|
70
|
+
"data-full": full,
|
|
71
|
+
className: cn("flex flex-col gap-4 w-full min-w-0 max-w-(--fd-page-width) pt-6 pb-8", full && "layout:[--fd-page-width:1200px]", className),
|
|
72
|
+
...props,
|
|
53
73
|
children: [
|
|
54
|
-
/* @__PURE__ */ jsx(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
className: cn("flex items-center gap-1.5 min-w-0 transition-[opacity,visibility] duration-300 motion-reduce:transition-none", tocEnabled && !(aiChat?.open && aiChat.panel) && "invisible opacity-0 @max-5xl:visible @max-5xl:opacity-100 @max-5xl:transition-none"),
|
|
58
|
-
children: [hasFolders && /* @__PURE__ */ jsx("span", {
|
|
59
|
-
className: "text-sm text-fd-muted-foreground/50",
|
|
60
|
-
children: "/"
|
|
61
|
-
}), /* @__PURE__ */ jsx(slots.toc.dropdown, { ...tocPopoverProps })]
|
|
74
|
+
breadcrumbEnabled && /* @__PURE__ */ jsx(slots.breadcrumb, {
|
|
75
|
+
...breadcrumb,
|
|
76
|
+
className: cn("md:hidden", breadcrumb.className)
|
|
62
77
|
}),
|
|
63
|
-
|
|
78
|
+
children,
|
|
79
|
+
footerEnabled && /* @__PURE__ */ jsx(slots.footer, { ...footer })
|
|
64
80
|
]
|
|
65
|
-
}), /* @__PURE__ */
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
id: "nd-page",
|
|
69
|
-
"data-full": full,
|
|
70
|
-
className: cn("flex flex-col gap-4 w-full min-w-0 max-w-(--fd-page-width) pt-6 pb-8 md:pb-16", full && "layout:[--fd-page-width:1200px]", className),
|
|
71
|
-
...props,
|
|
72
|
-
children: [
|
|
73
|
-
breadcrumbEnabled && /* @__PURE__ */ jsx(slots.breadcrumb, {
|
|
74
|
-
...breadcrumb,
|
|
75
|
-
className: cn("md:hidden", breadcrumb.className)
|
|
76
|
-
}),
|
|
77
|
-
children,
|
|
78
|
-
footerEnabled && /* @__PURE__ */ jsx(slots.footer, { ...footer })
|
|
79
|
-
]
|
|
80
|
-
}), tocEnabled && /* @__PURE__ */ jsx(slots.toc.main, { ...tocProps })]
|
|
81
|
-
})]
|
|
82
|
-
}, pathname),
|
|
83
|
-
/* @__PURE__ */ jsx("div", { className: "fixed inset-x-2 bottom-0 top-(--fd-docs-row-3) supports-[top:anchor(--a_bottom)]:top-[anchor(--fd-top-bar_bottom)] z-20 rounded-t-2xl border-x border-t outline-8 outline-fd-card bg-origin-border bg-[linear-gradient(var(--color-fd-background),transparent_16px)] pointer-events-none md:hidden" })
|
|
84
|
-
]
|
|
81
|
+
}), tocEnabled && /* @__PURE__ */ jsx(slots.toc.main, { ...tocProps })]
|
|
82
|
+
})]
|
|
83
|
+
}, pathname)]
|
|
85
84
|
})
|
|
86
85
|
});
|
|
87
86
|
}
|
|
@@ -32,7 +32,7 @@ function TOC({ container, header, footer, ...props }) {
|
|
|
32
32
|
return /* @__PURE__ */ jsxs("div", {
|
|
33
33
|
id: "nd-toc",
|
|
34
34
|
...container,
|
|
35
|
-
className: cn("sticky top-0 flex flex-col shrink-0 w-(--fd-toc-width) h-full ps-16 pt-
|
|
35
|
+
className: cn("sticky top-0 flex flex-col shrink-0 w-(--fd-toc-width) h-full ps-16 pt-8 pb-4 overflow-clip *:min-w-[calc(var(--fd-toc-width)---spacing(16))] layout:[--fd-toc-width:--spacing(76)] transition-[width,padding,opacity,visibility] duration-300 ease-in-out motion-reduce:transition-none max-md:hidden", aiChat?.open && aiChat.panel ? "invisible w-0 ps-0 opacity-0" : "@max-5xl:invisible @max-5xl:w-0 @max-5xl:ps-0 @max-5xl:opacity-0 @max-5xl:transition-none", container?.className),
|
|
36
36
|
children: [
|
|
37
37
|
header,
|
|
38
38
|
/* @__PURE__ */ jsxs("h3", {
|
|
@@ -62,10 +62,10 @@ function TOCPopover({ container, trigger, content, header, footer, ...props }) {
|
|
|
62
62
|
open,
|
|
63
63
|
onOpenChange: setOpen,
|
|
64
64
|
...container,
|
|
65
|
-
className: cn("
|
|
65
|
+
className: cn("max-md:layout:[--fd-toc-popover-height:--spacing(10)]", container?.className),
|
|
66
66
|
children: /* @__PURE__ */ jsxs("header", {
|
|
67
67
|
ref,
|
|
68
|
-
className: "bg-fd-card
|
|
68
|
+
className: "bg-fd-card",
|
|
69
69
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
70
70
|
...trigger,
|
|
71
71
|
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-none", trigger?.className),
|
|
@@ -122,7 +122,7 @@ function TOCDropdown({ trigger, content, header, footer, ...props }) {
|
|
|
122
122
|
className: "z-50",
|
|
123
123
|
children: /* @__PURE__ */ jsxs(Popover.Popup, {
|
|
124
124
|
...content,
|
|
125
|
-
className: cn("flex flex-col w-
|
|
125
|
+
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-none 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),
|
|
126
126
|
children: [
|
|
127
127
|
header,
|
|
128
128
|
/* @__PURE__ */ jsx(TOCList, {
|
|
@@ -12,7 +12,7 @@ import { useTheme } from "next-themes";
|
|
|
12
12
|
import { flushSync } from "react-dom";
|
|
13
13
|
import { Menu } from "@base-ui/react/menu";
|
|
14
14
|
//#region 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-none 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-
|
|
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-none 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
16
|
const itemClass = "flex w-full min-h-9 items-center gap-3 rounded-lg px-2.5 py-1.5 text-start outline-none 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();
|
|
@@ -34,11 +34,10 @@ function HeaderActions({ className, ...props }) {
|
|
|
34
34
|
className: cn("flex items-center gap-0.5 rounded-lg bg-fd-background", className),
|
|
35
35
|
...props,
|
|
36
36
|
children: [
|
|
37
|
-
aiChat && /* @__PURE__ */ jsxs("button", {
|
|
37
|
+
aiChat && !aiChat.open && /* @__PURE__ */ jsxs("button", {
|
|
38
38
|
type: "button",
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
onClick: () => aiChat.onOpenChange(!aiChat.open),
|
|
39
|
+
className: cn(buttonVariants({ variant: "ghost" }), "h-7.5 gap-1.5 px-2 text-fd-muted-foreground max-lg:hidden"),
|
|
40
|
+
onClick: () => aiChat.onOpenChange(true),
|
|
42
41
|
children: [/* @__PURE__ */ jsx(MessageCircleIcon, { className: "size-4" }), t("Ask AI")]
|
|
43
42
|
}),
|
|
44
43
|
slots.languageSelect && /* @__PURE__ */ jsxs(slots.languageSelect.root, {
|
|
@@ -209,7 +208,7 @@ function ThemeSegments() {
|
|
|
209
208
|
className: "relative flex rounded-full border bg-fd-secondary p-0.5",
|
|
210
209
|
children: [index !== -1 && /* @__PURE__ */ jsx("span", {
|
|
211
210
|
"aria-hidden": true,
|
|
212
|
-
className: "absolute top-0.5 start-0.5 size-7 rounded-full bg-fd-background shadow-sm ring-1 ring-fd-border translate-x-[calc(var(--index)*100%)] rtl:-translate-x-[calc(var(--index)*100%)] transition-
|
|
211
|
+
className: "absolute top-0.5 start-0.5 size-7 rounded-full bg-fd-background shadow-sm ring-1 ring-fd-border translate-x-[calc(var(--index)*100%)] rtl:-translate-x-[calc(var(--index)*100%)] transition-transform duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",
|
|
213
212
|
style: { "--index": index }
|
|
214
213
|
}), themes.map(([key, Icon, turn]) => /* @__PURE__ */ jsx(Menu.RadioItem, {
|
|
215
214
|
value: key,
|
|
@@ -11,7 +11,7 @@ function Header({ className, ...props }) {
|
|
|
11
11
|
const { slots } = useSpaciousLayout();
|
|
12
12
|
return /* @__PURE__ */ jsxs("header", {
|
|
13
13
|
id: "nd-subnav",
|
|
14
|
-
className: cn("sticky top-(--fd-banner-height,0px) z-30 [grid-area:header] flex items-center h-(--fd-header-height) ps-4 pe-2.5 bg-fd-card
|
|
14
|
+
className: cn("sticky top-(--fd-banner-height,0px) z-30 [grid-area:header] flex items-center h-(--fd-header-height) ps-4 pe-2.5 bg-fd-card md:hidden", className),
|
|
15
15
|
...props,
|
|
16
16
|
children: [
|
|
17
17
|
/* @__PURE__ */ jsx(slots.navTitle, { className: "inline-flex items-center gap-2.5 me-auto font-semibold" }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SidebarProviderProps as SidebarProviderProps$1, base_d_exports } from "../../../components/sidebar/base.js";
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
3
|
//#region src/layouts/spacious/slots/sidebar.d.ts
|
|
4
|
-
export type SidebarProviderProps = SidebarProviderProps$1
|
|
4
|
+
export type SidebarProviderProps = Omit<SidebarProviderProps$1, 'collapsible'>;
|
|
5
5
|
export type SidebarProps = ComponentProps<'aside'>;
|
|
6
6
|
export declare function SidebarProvider(props: SidebarProviderProps): import("react").JSX.Element;
|
|
7
7
|
export declare function Sidebar({ className, ...props }: SidebarProps): import("react").JSX.Element | undefined;
|
|
@@ -69,7 +69,7 @@ function SidebarDrawer() {
|
|
|
69
69
|
const { slots, menuItems, props: { aiChat } } = useSpaciousLayout();
|
|
70
70
|
const t = useTranslations({ note: "AI chat button" });
|
|
71
71
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SidebarDrawerOverlay, { className: "fixed z-40 inset-0 backdrop-blur-xs data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out" }), /* @__PURE__ */ jsxs(SidebarDrawerContent, {
|
|
72
|
-
className: "fixed z-40 inset-e-0 inset-y-0 flex flex-col w-[85%] max-w-
|
|
72
|
+
className: "fixed z-40 inset-e-0 inset-y-0 flex flex-col w-[85%] max-w-95 text-[0.9375rem] bg-fd-background border-s shadow-lg data-[state=open]:animate-fd-sidebar-in data-[state=closed]:animate-fd-sidebar-out",
|
|
73
73
|
children: [
|
|
74
74
|
/* @__PURE__ */ jsxs("div", {
|
|
75
75
|
className: "flex items-center gap-1.5 h-(--fd-header-height) ps-3.5 pe-2.5 text-fd-muted-foreground",
|
|
@@ -140,7 +140,7 @@ function TabsMenu() {
|
|
|
140
140
|
positionMethod: "fixed",
|
|
141
141
|
className: "z-50",
|
|
142
142
|
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
143
|
-
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-none 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-
|
|
143
|
+
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-none 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",
|
|
144
144
|
children: options.map((tab, i) => {
|
|
145
145
|
if (tab.unlisted && tab !== selected) return;
|
|
146
146
|
return /* @__PURE__ */ jsxs(Menu.LinkItem, {
|
|
@@ -182,7 +182,7 @@ function SidebarViewport() {
|
|
|
182
182
|
return /* @__PURE__ */ jsxs(ScrollArea.Root, {
|
|
183
183
|
className: "min-h-0 flex-1 mt-2",
|
|
184
184
|
children: [/* @__PURE__ */ jsx(ScrollArea.Viewport, {
|
|
185
|
-
className: "size-full overscroll-contain px-3 pt-4 pb-8 mask-[
|
|
185
|
+
className: "size-full overscroll-contain px-3 pt-4 pb-8 mask-t-from-[calc(100%-16px)] mask-b-from-[calc(100%-32px)]",
|
|
186
186
|
children: /* @__PURE__ */ jsx(SidebarItems, {})
|
|
187
187
|
}), /* @__PURE__ */ jsx(ScrollArea.Scrollbar, {
|
|
188
188
|
className: (s) => cn("flex w-1.5 py-2 select-none transition-opacity", !s.hovering && "opacity-0"),
|
package/dist/provider/base.js
CHANGED
|
@@ -1,46 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { I18nProvider } from "../contexts/i18n.js";
|
|
3
|
+
import { useHotKey } from "../utils/hotkey.js";
|
|
3
4
|
import { SearchProvider } from "../contexts/search.js";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { useEffect, useEffectEvent } from "react";
|
|
6
6
|
import { ThemeProvider, useTheme, useTheme as useTheme$1 } from "next-themes";
|
|
7
7
|
import { flushSync } from "react-dom";
|
|
8
8
|
import { DirectionProvider } from "@base-ui/react/direction-provider";
|
|
9
9
|
//#region src/provider/base.tsx
|
|
10
10
|
/**
|
|
11
|
-
* Whether the event should be ignored because the user is interacting with an editable element,
|
|
12
|
-
* or an opened dialog (e.g. the search dialog).
|
|
13
|
-
*/
|
|
14
|
-
function isTypingTarget(target) {
|
|
15
|
-
if (!(target instanceof HTMLElement)) return false;
|
|
16
|
-
if (target.isContentEditable) return true;
|
|
17
|
-
if ([
|
|
18
|
-
"INPUT",
|
|
19
|
-
"TEXTAREA",
|
|
20
|
-
"SELECT"
|
|
21
|
-
].includes(target.tagName)) return true;
|
|
22
|
-
return target.closest("[role=\"dialog\"]") !== null;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
11
|
* Toggle between light/dark mode with a hotkey, must be placed under `next-themes` provider.
|
|
26
12
|
*/
|
|
27
13
|
function ThemeHotKey({ hotKey }) {
|
|
28
14
|
const { setTheme, resolvedTheme } = useTheme$1();
|
|
29
|
-
|
|
30
|
-
if (e.defaultPrevented || e.isComposing || e.keyCode === 229) return;
|
|
31
|
-
if (isTypingTarget(e.target)) return;
|
|
15
|
+
useHotKey((e) => {
|
|
32
16
|
if (!(typeof hotKey === "string" ? !e.metaKey && !e.ctrlKey && !e.altKey && e.key.toLowerCase() === hotKey.toLowerCase() : hotKey(e))) return;
|
|
33
17
|
e.preventDefault();
|
|
34
18
|
const next = resolvedTheme === "dark" ? "light" : "dark";
|
|
35
19
|
if (document?.startViewTransition) document.startViewTransition(() => flushSync(() => setTheme(next)));
|
|
36
20
|
else setTheme(next);
|
|
37
|
-
});
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
window.addEventListener("keydown", onKeyDown);
|
|
40
|
-
return () => {
|
|
41
|
-
window.removeEventListener("keydown", onKeyDown);
|
|
42
|
-
};
|
|
43
|
-
}, []);
|
|
21
|
+
}, { ignoreTyping: true });
|
|
44
22
|
return null;
|
|
45
23
|
}
|
|
46
24
|
function RootProvider({ children, dir = "ltr", theme = {}, search, i18n }) {
|