fumadocs-ui 11.2.1 → 11.2.2

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.
@@ -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
@@ -399,11 +399,17 @@ function Sidebar({
399
399
  minWidth: 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
  ] }) }) });
@@ -555,9 +561,9 @@ function DynamicSidebar(props) {
555
561
  const [open, setOpen] = useSidebarCollapse();
556
562
  const [hover, setHover] = useState3(false);
557
563
  const timerRef = useRef(0);
558
- const onCollapse = () => {
564
+ const onCollapse = useCallback3(() => {
559
565
  setOpen(!open);
560
- };
566
+ }, [open, setOpen]);
561
567
  const onHover = useCallback3((e) => {
562
568
  if (e.pointerType === "touch")
563
569
  return;
@@ -2,6 +2,7 @@ import * as React$1 from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { DefaultSearchDialogProps } from './components/dialog/search-default.js';
4
4
  import { SearchLink, SharedProps } from './components/dialog/search.js';
5
+ import { ThemeProviderProps } from 'next-themes/dist/types';
5
6
  export { u as useI18n } from './i18n-p5QWhj_3.js';
6
7
  export { u as useTreeContext } from './tree-cqNEopxM.js';
7
8
  import 'fumadocs-core/search/shared';
@@ -18,10 +19,6 @@ interface SearchProviderProps {
18
19
  * Custom links to be displayed if search is empty
19
20
  */
20
21
  links?: SearchLink[];
21
- /**
22
- * The shortcuts to trigger search dialog
23
- */
24
- hotKey?: string[];
25
22
  /**
26
23
  * Replace default search dialog, allowing you to use other solutions such as Algolia Search
27
24
  *
@@ -66,10 +63,22 @@ interface RootProviderProps {
66
63
  * Wrap the body in `ThemeProvider` (next-themes)
67
64
  *
68
65
  * @defaultValue true
66
+ * @deprecated Use `theme.enable` instead
69
67
  */
70
68
  enableThemeProvider?: boolean;
69
+ /**
70
+ * Customise options of `next-themes`
71
+ */
72
+ theme?: Partial<ThemeProviderProps> & {
73
+ /**
74
+ * Enable `next-themes`
75
+ *
76
+ * @defaultValue true
77
+ */
78
+ enabled?: boolean;
79
+ };
71
80
  children: ReactNode;
72
81
  }
73
- declare function RootProvider({ children, dir, enableThemeProvider, search, }: RootProviderProps): React.ReactElement;
82
+ declare function RootProvider({ children, dir, enableThemeProvider, theme: { enabled, ...theme }, search, }: RootProviderProps): React.ReactElement;
74
83
 
75
84
  export { RootProvider, type RootProviderProps, useSearchContext, useSidebarCollapse };
package/dist/provider.js CHANGED
@@ -30,12 +30,13 @@ function RootProvider({
30
30
  children,
31
31
  dir,
32
32
  enableThemeProvider = true,
33
+ theme: { enabled = true, ...theme } = {},
33
34
  search
34
35
  }) {
35
36
  let body = /* @__PURE__ */ jsx(SidebarProvider, { children: /* @__PURE__ */ jsx(SidebarCollapseProvider, { children }) });
36
37
  if (search?.enabled !== false)
37
38
  body = /* @__PURE__ */ jsx(SearchProvider, { SearchDialog: DefaultSearchDialog, ...search, children: body });
38
- if (enableThemeProvider)
39
+ if (enabled && enableThemeProvider)
39
40
  body = /* @__PURE__ */ jsx(
40
41
  ThemeProvider,
41
42
  {
@@ -43,6 +44,7 @@ function RootProvider({
43
44
  defaultTheme: "system",
44
45
  enableSystem: true,
45
46
  disableTransitionOnChange: true,
47
+ ...theme,
46
48
  children: body
47
49
  }
48
50
  );
@@ -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.2.2",
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.2.2"
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",