fumadocs-ui 11.2.1 → 11.3.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.
@@ -3,6 +3,7 @@ import { createContext, useContext, useEffect, useMemo, useState } from "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  var SearchContext = createContext({
5
5
  enabled: false,
6
+ hotKey: [],
6
7
  setOpenSearch: () => void 0
7
8
  });
8
9
  function useSearchContext() {
@@ -13,12 +14,24 @@ function SearchProvider({
13
14
  children,
14
15
  preload = true,
15
16
  options,
17
+ hotKey = [
18
+ {
19
+ key: "k",
20
+ display: "K"
21
+ },
22
+ {
23
+ key: (e) => e.metaKey || e.ctrlKey,
24
+ display: "\u2318"
25
+ }
26
+ ],
16
27
  links
17
28
  }) {
18
29
  const [isOpen, setIsOpen] = useState(preload ? false : void 0);
19
30
  useEffect(() => {
20
31
  const handler = (e) => {
21
- if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
32
+ if (hotKey.every(
33
+ (v) => typeof v.key === "string" ? e.key === v.key : v.key(e)
34
+ )) {
22
35
  setIsOpen(true);
23
36
  e.preventDefault();
24
37
  }
@@ -27,23 +40,28 @@ function SearchProvider({
27
40
  return () => {
28
41
  window.removeEventListener("keydown", handler);
29
42
  };
30
- }, []);
31
- const ctx = useMemo(
32
- () => ({ enabled: true, setOpenSearch: setIsOpen }),
33
- []
43
+ }, [hotKey]);
44
+ return /* @__PURE__ */ jsxs(
45
+ SearchContext.Provider,
46
+ {
47
+ value: useMemo(
48
+ () => ({ enabled: true, hotKey, setOpenSearch: setIsOpen }),
49
+ [hotKey]
50
+ ),
51
+ children: [
52
+ isOpen !== void 0 && /* @__PURE__ */ jsx(
53
+ SearchDialog,
54
+ {
55
+ open: isOpen,
56
+ onOpenChange: setIsOpen,
57
+ links,
58
+ ...options
59
+ }
60
+ ),
61
+ children
62
+ ]
63
+ }
34
64
  );
35
- return /* @__PURE__ */ jsxs(SearchContext.Provider, { value: ctx, children: [
36
- isOpen !== void 0 && /* @__PURE__ */ jsx(
37
- SearchDialog,
38
- {
39
- open: isOpen,
40
- onOpenChange: setIsOpen,
41
- links,
42
- ...options
43
- }
44
- ),
45
- children
46
- ] });
47
65
  }
48
66
 
49
67
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useSearchContext
3
- } from "./chunk-2KA2UOM3.js";
3
+ } from "./chunk-FSPYEOFC.js";
4
4
  import {
5
5
  useI18n
6
6
  } from "./chunk-PW7TBOIJ.js";
@@ -0,0 +1,39 @@
1
+ // src/contexts/sidebar.tsx
2
+ import { createContext, useContext, useState, useMemo } from "react";
3
+ import { SidebarProvider as BaseProvider } from "fumadocs-core/sidebar";
4
+ import { jsx } from "react/jsx-runtime";
5
+ var SidebarContext = createContext(
6
+ void 0
7
+ );
8
+ function useSidebar() {
9
+ const ctx = useContext(SidebarContext);
10
+ if (!ctx)
11
+ throw new Error("Missing root provider");
12
+ return ctx;
13
+ }
14
+ function SidebarProvider({
15
+ children
16
+ }) {
17
+ const [open, setOpen] = useState(true);
18
+ const [collapsed, setCollapsed] = useState(false);
19
+ return /* @__PURE__ */ jsx(
20
+ SidebarContext.Provider,
21
+ {
22
+ value: useMemo(
23
+ () => ({
24
+ open,
25
+ setOpen,
26
+ collapsed,
27
+ setCollapsed
28
+ }),
29
+ [open, collapsed]
30
+ ),
31
+ children: /* @__PURE__ */ jsx(BaseProvider, { open, onOpenChange: setOpen, children })
32
+ }
33
+ );
34
+ }
35
+
36
+ export {
37
+ useSidebar,
38
+ SidebarProvider
39
+ };
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { HTMLAttributes, ReactNode } from 'react';
3
3
 
4
- declare const Callout: React.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "type" | "icon"> & {
4
+ declare const Callout: React.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "icon" | "type"> & {
5
5
  title?: ReactNode;
6
6
  /**
7
7
  * @defaultValue info
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  SearchDialog
4
- } from "../../chunk-HUXFUKD2.js";
5
- import "../../chunk-2KA2UOM3.js";
4
+ } from "../../chunk-PXDQVGII.js";
5
+ import "../../chunk-FSPYEOFC.js";
6
6
  import "../../chunk-PW7TBOIJ.js";
7
7
  import "../../chunk-7GZKFBAP.js";
8
8
  import "../../chunk-TK3TM3MR.js";
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  SearchDialog
4
- } from "../../chunk-HUXFUKD2.js";
5
- import "../../chunk-2KA2UOM3.js";
4
+ } from "../../chunk-PXDQVGII.js";
5
+ import "../../chunk-FSPYEOFC.js";
6
6
  import {
7
7
  useI18n
8
8
  } from "../../chunk-PW7TBOIJ.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SearchDialog
3
- } from "../../chunk-HUXFUKD2.js";
4
- import "../../chunk-2KA2UOM3.js";
3
+ } from "../../chunk-PXDQVGII.js";
4
+ import "../../chunk-FSPYEOFC.js";
5
5
  import "../../chunk-PW7TBOIJ.js";
6
6
  import "../../chunk-7GZKFBAP.js";
7
7
  import "../../chunk-TK3TM3MR.js";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
- useSidebarCollapse
4
- } from "./chunk-PLXR6QNH.js";
3
+ useSidebar
4
+ } from "./chunk-WPJ4ENAT.js";
5
5
  import {
6
6
  TreeContextProvider,
7
7
  useTreeContext
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-7F2LGCS6.js";
22
22
  import {
23
23
  useSearchContext
24
- } from "./chunk-2KA2UOM3.js";
24
+ } from "./chunk-FSPYEOFC.js";
25
25
  import {
26
26
  useI18n
27
27
  } from "./chunk-PW7TBOIJ.js";
@@ -42,7 +42,7 @@ import "./chunk-6C3VEZWH.js";
42
42
  import { MenuIcon, MoreVertical, SearchIcon, X } from "lucide-react";
43
43
  import Link2 from "fumadocs-core/link";
44
44
  import { SidebarTrigger } from "fumadocs-core/sidebar";
45
- import { useEffect, useState } from "react";
45
+ import { useCallback as useCallback2, useEffect, useState } from "react";
46
46
  import { usePathname as usePathname2 } from "next/navigation";
47
47
 
48
48
  // src/components/theme-toggle.tsx
@@ -296,7 +296,7 @@ function LinksMenu({ items, ...props }) {
296
296
  ),
297
297
  /* @__PURE__ */ jsxs3(PopoverContent, { className: "flex flex-col", children: [
298
298
  items.map((item, i) => /* @__PURE__ */ jsx3(LinkItem, { item, on: "menu" }, i)),
299
- /* @__PURE__ */ jsxs3("div", { className: "flex flex-row px-2 py-1 items-center justify-between", children: [
299
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-row items-center justify-between px-2 py-1", children: [
300
300
  /* @__PURE__ */ jsx3("p", { className: "font-medium", children: "Theme" }),
301
301
  /* @__PURE__ */ jsx3(ThemeToggle, {})
302
302
  ] })
@@ -304,11 +304,11 @@ function LinksMenu({ items, ...props }) {
304
304
  ] });
305
305
  }
306
306
  function SearchToggle() {
307
- const { setOpenSearch } = useSearchContext();
307
+ const { hotKey, setOpenSearch } = useSearchContext();
308
308
  const { text } = useI18n();
309
- const onClick = () => {
309
+ const onClick = useCallback2(() => {
310
310
  setOpenSearch(true);
311
- };
311
+ }, [setOpenSearch]);
312
312
  return /* @__PURE__ */ jsxs3(Fragment, { children: [
313
313
  /* @__PURE__ */ jsx3(
314
314
  "button",
@@ -335,7 +335,7 @@ function SearchToggle() {
335
335
  children: [
336
336
  /* @__PURE__ */ jsx3(SearchIcon, { className: "ms-1 size-4" }),
337
337
  text.search,
338
- /* @__PURE__ */ jsx3("div", { className: "ms-auto inline-flex gap-0.5 text-xs", children: ["\u2318", "K"].map((k) => /* @__PURE__ */ jsx3("kbd", { className: "rounded-md border bg-background px-1.5", children: k }, k)) })
338
+ /* @__PURE__ */ jsx3("div", { className: "ms-auto inline-flex gap-0.5 text-xs", children: hotKey.map((k, i) => /* @__PURE__ */ jsx3("kbd", { className: "rounded-md border bg-background px-1.5", children: k.display }, i)) })
339
339
  ]
340
340
  }
341
341
  )
@@ -349,7 +349,7 @@ import * as Base from "fumadocs-core/sidebar";
349
349
  import { usePathname as usePathname3 } from "next/navigation";
350
350
  import {
351
351
  createContext,
352
- useCallback as useCallback2,
352
+ useCallback as useCallback3,
353
353
  useContext,
354
354
  useEffect as useEffect2,
355
355
  useMemo,
@@ -396,14 +396,20 @@ function Sidebar({
396
396
  return /* @__PURE__ */ jsx4(SidebarContext.Provider, { value: context, children: /* @__PURE__ */ jsxs4(
397
397
  Base.SidebarList,
398
398
  {
399
- minWidth: 768,
399
+ blockScrollingWidth: 768,
400
400
  className: twMerge(
401
401
  "flex w-full flex-col text-[15px] md:sticky md:top-16 md:h-body md:w-[240px] md:text-sm xl:w-[260px]",
402
- "max-md:fixed max-md:inset-0 max-md:z-40 max-md:bg-background/80 max-md:pt-16 max-md:backdrop-blur-md max-md:data-[open=false]:hidden",
402
+ "max-md:fixed max-md:inset-0 max-md:z-40 max-md:pt-16 max-md:data-[open=false]:hidden",
403
403
  props.className
404
404
  ),
405
405
  children: [
406
- /* @__PURE__ */ jsx4("div", { id: "sidebar-background", className: "absolute z-[-1] size-full" }),
406
+ /* @__PURE__ */ jsx4(
407
+ "div",
408
+ {
409
+ id: "sidebar-background",
410
+ className: "absolute z-[-1] size-full max-md:bg-background/80 max-md:backdrop-blur-md"
411
+ }
412
+ ),
407
413
  /* @__PURE__ */ jsxs4(ViewportContent, { children: [
408
414
  banner,
409
415
  items.length > 0 && /* @__PURE__ */ jsx4("div", { className: "flex flex-col md:hidden", children: items.map((item, i) => /* @__PURE__ */ jsx4(LinkItem, { item, on: "menu" }, i)) })
@@ -429,7 +435,7 @@ function ViewportContent({
429
435
  children
430
436
  }) {
431
437
  const { root } = useTreeContext();
432
- return /* @__PURE__ */ jsx4(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsx4(ScrollViewport, { children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-8 pb-10 pt-4 px-4 md:px-3 md:pt-10", children: [
438
+ return /* @__PURE__ */ jsx4(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsx4(ScrollViewport, { children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-8 p-4 pb-10 md:px-3 md:pt-10", children: [
433
439
  children,
434
440
  /* @__PURE__ */ jsx4(NodeList, { items: root.children })
435
441
  ] }) }) });
@@ -488,7 +494,7 @@ function FolderNode({
488
494
  if (shouldExtend)
489
495
  setExtend(true);
490
496
  }, [shouldExtend]);
491
- const onClick = useCallback2(
497
+ const onClick = useCallback3(
492
498
  (e) => {
493
499
  if (e.target !== e.currentTarget || active) {
494
500
  setExtend((prev) => !prev);
@@ -548,23 +554,23 @@ function SeparatorNode({
548
554
  }
549
555
 
550
556
  // src/components/dynamic-sidebar.tsx
551
- import { useCallback as useCallback3, useRef, useState as useState3 } from "react";
557
+ import { useCallback as useCallback4, useRef, useState as useState3 } from "react";
552
558
  import { SidebarIcon } from "lucide-react";
553
559
  import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
554
560
  function DynamicSidebar(props) {
555
- const [open, setOpen] = useSidebarCollapse();
561
+ const { collapsed, setCollapsed } = useSidebar();
556
562
  const [hover, setHover] = useState3(false);
557
563
  const timerRef = useRef(0);
558
- const onCollapse = () => {
559
- setOpen(!open);
560
- };
561
- const onHover = useCallback3((e) => {
564
+ const onCollapse = useCallback4(() => {
565
+ setCollapsed(!collapsed);
566
+ }, [collapsed, setCollapsed]);
567
+ const onHover = useCallback4((e) => {
562
568
  if (e.pointerType === "touch")
563
569
  return;
564
570
  window.clearTimeout(timerRef.current);
565
571
  setHover(true);
566
572
  }, []);
567
- const onLeave = useCallback3((e) => {
573
+ const onLeave = useCallback4((e) => {
568
574
  if (e.pointerType === "touch")
569
575
  return;
570
576
  window.clearTimeout(timerRef.current);
@@ -573,7 +579,7 @@ function DynamicSidebar(props) {
573
579
  }, 300);
574
580
  }, []);
575
581
  return /* @__PURE__ */ jsxs5(Fragment2, { children: [
576
- !open ? /* @__PURE__ */ jsx5(
582
+ collapsed ? /* @__PURE__ */ jsx5(
577
583
  "div",
578
584
  {
579
585
  className: "fixed bottom-0 start-0 top-16 max-md:hidden",
@@ -586,11 +592,11 @@ function DynamicSidebar(props) {
586
592
  }
587
593
  }
588
594
  ) : null,
589
- !open ? /* @__PURE__ */ jsx5(
595
+ collapsed ? /* @__PURE__ */ jsx5(
590
596
  "button",
591
597
  {
592
598
  type: "button",
593
- "aria-label": "Trigger Sidebar",
599
+ "aria-label": "Collapse Sidebar",
594
600
  className: twMerge(
595
601
  buttonVariants({
596
602
  color: "secondary",
@@ -606,27 +612,27 @@ function DynamicSidebar(props) {
606
612
  "div",
607
613
  {
608
614
  id: "dynamic-sidebar",
609
- "data-open": open,
615
+ "data-open": !collapsed,
610
616
  "data-hover": hover,
611
617
  onPointerEnter: onHover,
612
618
  onPointerLeave: onLeave,
613
- "aria-hidden": !open && !hover,
619
+ "aria-hidden": Boolean(collapsed && !hover),
614
620
  className: twMerge(
615
621
  "z-40 transition-transform max-md:absolute",
616
- !open && "md:fixed md:bottom-2 md:start-2 md:top-16 md:overflow-hidden md:rounded-xl md:border md:bg-background md:shadow-md"
622
+ collapsed && "md:fixed md:bottom-2 md:start-2 md:top-16 md:overflow-hidden md:rounded-xl md:border md:bg-background md:shadow-md"
617
623
  ),
618
624
  children: /* @__PURE__ */ jsx5(
619
625
  Sidebar,
620
626
  {
621
627
  ...props,
622
- className: twMerge(!open && "md:h-full"),
628
+ className: twMerge(collapsed && "md:h-full"),
623
629
  footer: /* @__PURE__ */ jsxs5(Fragment2, { children: [
624
630
  props.footer,
625
631
  /* @__PURE__ */ jsx5(
626
632
  "button",
627
633
  {
628
634
  type: "button",
629
- "aria-label": "Trigger Sidebar",
635
+ "aria-label": "Collapse Sidebar",
630
636
  className: twMerge(
631
637
  buttonVariants({
632
638
  color: "ghost",
package/dist/page.d.ts CHANGED
@@ -45,5 +45,11 @@ interface TOCProps {
45
45
  * Add typography styles
46
46
  */
47
47
  declare const DocsBody: React$1.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
48
+ /**
49
+ * For separate MDX page
50
+ */
51
+ declare function withArticle({ children, }: {
52
+ children: React.ReactNode;
53
+ }): React.ReactElement;
48
54
 
49
- export { DocsBody, DocsPage, type DocsPageProps };
55
+ export { DocsBody, DocsPage, type DocsPageProps, withArticle };
package/dist/page.js CHANGED
@@ -50,7 +50,13 @@ function Toc(props) {
50
50
  }
51
51
  var DocsBody = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: twMerge("prose", className), ...props }));
52
52
  DocsBody.displayName = "DocsBody";
53
+ function withArticle({
54
+ children
55
+ }) {
56
+ return /* @__PURE__ */ jsx("main", { className: "container py-12", children: /* @__PURE__ */ jsx("article", { className: "prose", children }) });
57
+ }
53
58
  export {
54
59
  DocsBody,
55
- DocsPage
60
+ DocsPage,
61
+ withArticle
56
62
  };
@@ -1,5 +1,5 @@
1
- import * as React$1 from 'react';
2
1
  import { ReactNode } from 'react';
2
+ import { ThemeProviderProps } from 'next-themes/dist/types';
3
3
  import { DefaultSearchDialogProps } from './components/dialog/search-default.js';
4
4
  import { SearchLink, SharedProps } from './components/dialog/search.js';
5
5
  export { u as useI18n } from './i18n-p5QWhj_3.js';
@@ -7,6 +7,13 @@ export { u as useTreeContext } from './tree-cqNEopxM.js';
7
7
  import 'fumadocs-core/search/shared';
8
8
  import 'fumadocs-core/server';
9
9
 
10
+ interface HotKey {
11
+ display: React.ReactNode;
12
+ /**
13
+ * Key code or a function determining whether the key is pressed.
14
+ */
15
+ key: string | ((e: KeyboardEvent) => boolean);
16
+ }
10
17
  interface SearchProviderProps {
11
18
  /**
12
19
  * Preload search dialog before opening it
@@ -19,30 +26,37 @@ interface SearchProviderProps {
19
26
  */
20
27
  links?: SearchLink[];
21
28
  /**
22
- * The shortcuts to trigger search dialog
29
+ * Hotkeys for triggering search dialog
30
+ *
31
+ * @defaultValue K + Meta/Ctrl
23
32
  */
24
- hotKey?: string[];
33
+ hotKey?: HotKey[];
25
34
  /**
26
35
  * Replace default search dialog, allowing you to use other solutions such as Algolia Search
27
36
  *
28
37
  * It receives the `open` and `onOpenChange` prop, can be lazy loaded with `next/dynamic`
29
38
  */
30
- SearchDialog: React$1.ComponentType<SharedProps>;
39
+ SearchDialog: React.ComponentType<SharedProps>;
31
40
  /**
32
41
  * Additional props to the dialog
33
42
  */
34
43
  options?: Partial<SharedProps>;
35
- children?: React$1.ReactNode;
44
+ children?: React.ReactNode;
36
45
  }
37
46
  interface SearchContextType {
38
47
  enabled: boolean;
48
+ hotKey: HotKey[];
39
49
  setOpenSearch: (value: boolean) => void;
40
50
  }
41
51
  declare function useSearchContext(): SearchContextType;
42
52
 
43
- type SidebarCollapseContext = [open: boolean, setOpen: (v: boolean) => void];
44
- declare const SidebarCollapseContext: React$1.Context<SidebarCollapseContext | undefined>;
45
- declare function useSidebarCollapse(): SidebarCollapseContext;
53
+ interface SidebarCollapseContext {
54
+ open: boolean;
55
+ setOpen: (v: boolean) => void;
56
+ collapsed: boolean;
57
+ setCollapsed: (v: boolean) => void;
58
+ }
59
+ declare function useSidebar(): SidebarCollapseContext;
46
60
 
47
61
  interface SearchOptions extends Omit<SearchProviderProps, 'options' | 'children'> {
48
62
  options?: Partial<DefaultSearchDialogProps> | SearchProviderProps['options'];
@@ -66,10 +80,22 @@ interface RootProviderProps {
66
80
  * Wrap the body in `ThemeProvider` (next-themes)
67
81
  *
68
82
  * @defaultValue true
83
+ * @deprecated Use `theme.enable` instead
69
84
  */
70
85
  enableThemeProvider?: boolean;
86
+ /**
87
+ * Customise options of `next-themes`
88
+ */
89
+ theme?: Partial<ThemeProviderProps> & {
90
+ /**
91
+ * Enable `next-themes`
92
+ *
93
+ * @defaultValue true
94
+ */
95
+ enabled?: boolean;
96
+ };
71
97
  children: ReactNode;
72
98
  }
73
- declare function RootProvider({ children, dir, enableThemeProvider, search, }: RootProviderProps): React.ReactElement;
99
+ declare function RootProvider({ children, dir, enableThemeProvider, theme: { enabled, ...theme }, search, }: RootProviderProps): React.ReactElement;
74
100
 
75
- export { RootProvider, type RootProviderProps, useSearchContext, useSidebarCollapse };
101
+ export { RootProvider, type RootProviderProps, useSearchContext, useSidebar };
package/dist/provider.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
- SidebarCollapseProvider,
4
- useSidebarCollapse
5
- } from "./chunk-PLXR6QNH.js";
3
+ SidebarProvider,
4
+ useSidebar
5
+ } from "./chunk-WPJ4ENAT.js";
6
6
  import {
7
7
  useTreeContext
8
8
  } from "./chunk-C4PI62MH.js";
@@ -10,14 +10,13 @@ import "./chunk-7F2LGCS6.js";
10
10
  import {
11
11
  SearchProvider,
12
12
  useSearchContext
13
- } from "./chunk-2KA2UOM3.js";
13
+ } from "./chunk-FSPYEOFC.js";
14
14
  import {
15
15
  useI18n
16
16
  } from "./chunk-PW7TBOIJ.js";
17
17
  import "./chunk-6C3VEZWH.js";
18
18
 
19
19
  // src/provider.tsx
20
- import { SidebarProvider } from "fumadocs-core/sidebar";
21
20
  import { ThemeProvider } from "next-themes";
22
21
  import dynamic from "next/dynamic";
23
22
  import { DirectionProvider } from "@radix-ui/react-direction";
@@ -30,12 +29,13 @@ function RootProvider({
30
29
  children,
31
30
  dir,
32
31
  enableThemeProvider = true,
32
+ theme: { enabled = true, ...theme } = {},
33
33
  search
34
34
  }) {
35
- let body = /* @__PURE__ */ jsx(SidebarProvider, { children: /* @__PURE__ */ jsx(SidebarCollapseProvider, { children }) });
35
+ let body = /* @__PURE__ */ jsx(DirectionProvider, { dir: dir ?? "ltr", children: /* @__PURE__ */ jsx(SidebarProvider, { children }) });
36
36
  if (search?.enabled !== false)
37
37
  body = /* @__PURE__ */ jsx(SearchProvider, { SearchDialog: DefaultSearchDialog, ...search, children: body });
38
- if (enableThemeProvider)
38
+ if (enabled && enableThemeProvider)
39
39
  body = /* @__PURE__ */ jsx(
40
40
  ThemeProvider,
41
41
  {
@@ -43,17 +43,16 @@ function RootProvider({
43
43
  defaultTheme: "system",
44
44
  enableSystem: true,
45
45
  disableTransitionOnChange: true,
46
+ ...theme,
46
47
  children: body
47
48
  }
48
49
  );
49
- if (dir)
50
- body = /* @__PURE__ */ jsx(DirectionProvider, { dir, children: body });
51
50
  return body;
52
51
  }
53
52
  export {
54
53
  RootProvider,
55
54
  useI18n,
56
55
  useSearchContext,
57
- useSidebarCollapse,
56
+ useSidebar,
58
57
  useTreeContext
59
58
  };
@@ -162,7 +162,7 @@ var neutral = {
162
162
  "--muted-foreground": "0 0% 30%"
163
163
  },
164
164
  "#sidebar-background": {
165
- background: "hsl(var(--secondary))",
165
+ background: "hsl(var(--secondary)/.8)",
166
166
  borderRight: "1px solid",
167
167
  borderRightColor: "theme(borderColor.border)"
168
168
  },
@@ -128,7 +128,7 @@ var neutral = {
128
128
  "--muted-foreground": "0 0% 30%"
129
129
  },
130
130
  "#sidebar-background": {
131
- background: "hsl(var(--secondary))",
131
+ background: "hsl(var(--secondary)/.8)",
132
132
  borderRight: "1px solid",
133
133
  borderRightColor: "theme(borderColor.border)"
134
134
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "11.2.1",
3
+ "version": "11.3.0",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -92,16 +92,16 @@
92
92
  "@tailwindcss/typography": "^0.5.13",
93
93
  "class-variance-authority": "^0.7.0",
94
94
  "cmdk": "^1.0.0",
95
- "lucide-react": "^0.378.0",
95
+ "lucide-react": "^0.379.0",
96
96
  "next-themes": "^0.3.0",
97
97
  "react-medium-image-zoom": "^5.2.4",
98
98
  "tailwind-merge": "^2.3.0",
99
- "fumadocs-core": "11.2.1"
99
+ "fumadocs-core": "11.3.0"
100
100
  },
101
101
  "devDependencies": {
102
102
  "@algolia/client-search": "^4.23.3",
103
103
  "@next/eslint-plugin-next": "^14.2.3",
104
- "@types/react": "^18.3.2",
104
+ "@types/react": "^18.3.3",
105
105
  "@types/react-dom": "^18.3.0",
106
106
  "algoliasearch": "^4.23.3",
107
107
  "next": "^14.2.3",
@@ -1,21 +0,0 @@
1
- // src/contexts/sidebar.tsx
2
- import { createContext, useContext, useState } from "react";
3
- import { jsx } from "react/jsx-runtime";
4
- var SidebarCollapseContext = createContext(void 0);
5
- function useSidebarCollapse() {
6
- const ctx = useContext(SidebarCollapseContext);
7
- if (!ctx)
8
- throw new Error("Missing root provider");
9
- return ctx;
10
- }
11
- function SidebarCollapseProvider({
12
- children
13
- }) {
14
- const [open, setOpen] = useState(true);
15
- return /* @__PURE__ */ jsx(SidebarCollapseContext.Provider, { value: [open, setOpen], children });
16
- }
17
-
18
- export {
19
- useSidebarCollapse,
20
- SidebarCollapseProvider
21
- };