fumadocs-ui 14.5.6 → 14.6.1

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.
@@ -27,7 +27,7 @@ export const CodeBlock = forwardRef(({ title, allowCopy = true, keepBackground =
27
27
  ? {
28
28
  __html: icon,
29
29
  }
30
- : undefined, children: typeof icon !== 'string' ? icon : null })) : null, _jsx("figcaption", { className: "flex-1 truncate text-fd-muted-foreground", children: title }), allowCopy ? (_jsx(CopyButton, { className: "-me-2", onCopy: onCopy })) : null] })) : (allowCopy && (_jsx(CopyButton, { className: "absolute right-2 top-2 z-[2] backdrop-blur-md", onCopy: onCopy }))), _jsxs(ScrollArea, { ref: areaRef, dir: "ltr", children: [_jsx(ScrollViewport, { ...viewportProps, className: cn('max-h-[400px]', viewportProps?.className), children: props.children }), _jsx(ScrollBar, { orientation: "horizontal" })] })] }));
30
+ : undefined, children: typeof icon !== 'string' ? icon : null })) : null, _jsx("figcaption", { className: "flex-1 truncate text-fd-muted-foreground", children: title }), allowCopy ? (_jsx(CopyButton, { className: "-me-2", onCopy: onCopy })) : null] })) : (allowCopy && (_jsx(CopyButton, { className: "absolute right-2 top-2 z-[2] backdrop-blur-md", onCopy: onCopy }))), _jsxs(ScrollArea, { ref: areaRef, dir: "ltr", children: [_jsx(ScrollViewport, { ...viewportProps, className: cn('max-h-[600px]', viewportProps?.className), children: props.children }), _jsx(ScrollBar, { orientation: "horizontal" })] })] }));
31
31
  });
32
32
  CodeBlock.displayName = 'CodeBlock';
33
33
  function CopyButton({ className, onCopy, ...props }) {
@@ -1,6 +1,9 @@
1
- import type { SortedResult } from 'fumadocs-core/server';
2
1
  import { type ReactNode } from 'react';
2
+ import type { SortedResult } from 'fumadocs-core/server';
3
3
  export type SearchLink = [name: string, href: string];
4
+ type ReactSortedResult = SortedResult & {
5
+ content: ReactNode;
6
+ };
4
7
  export interface SharedProps {
5
8
  open: boolean;
6
9
  onOpenChange: (open: boolean) => void;
@@ -10,7 +13,7 @@ export interface SharedProps {
10
13
  links?: SearchLink[];
11
14
  }
12
15
  type SearchDialogProps = SharedProps & SearchValueProps & Omit<SearchResultProps, 'items'> & {
13
- results: SortedResult[] | 'empty';
16
+ results: ReactSortedResult[] | 'empty';
14
17
  footer?: ReactNode;
15
18
  };
16
19
  interface SearchValueProps {
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAaf,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEtD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEtC;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,KAAK,iBAAiB,GAAG,WAAW,GAClC,gBAAgB,GAChB,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG;IACjC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAElC,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AAEJ,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,KAAU,EACV,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAoCnB"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search.tsx"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAYf,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEtD,KAAK,iBAAiB,GAAG,YAAY,GAAG;IACtC,OAAO,EAAE,SAAS,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEtC;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,KAAK,iBAAiB,GAAG,WAAW,GAClC,gBAAgB,GAChB,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG;IACjC,OAAO,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IAEvC,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AAEJ,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,KAAU,EACV,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAoCnB"}
@@ -46,8 +46,7 @@ function SearchList({ items, hideResults = false }) {
46
46
  (!active || items.every((item) => item.id !== active))) {
47
47
  setActive(items[0].id);
48
48
  }
49
- const listenerRef = useRef();
50
- listenerRef.current = (e) => {
49
+ function onKey(e) {
51
50
  if (e.key === 'ArrowDown' || e.key == 'ArrowUp') {
52
51
  setActive((cur) => {
53
52
  const idx = items.findIndex((item) => item.id === cur);
@@ -63,11 +62,11 @@ function SearchList({ items, hideResults = false }) {
63
62
  onOpen(selected.url);
64
63
  e.preventDefault();
65
64
  }
66
- };
65
+ }
66
+ const listenerRef = useRef(onKey);
67
+ listenerRef.current = onKey;
67
68
  useEffect(() => {
68
- const listener = (e) => {
69
- listenerRef.current?.(e);
70
- };
69
+ const listener = (e) => listenerRef.current?.(e);
71
70
  window.addEventListener('keydown', listener);
72
71
  return () => {
73
72
  window.removeEventListener('keydown', listener);
@@ -0,0 +1,7 @@
1
+ import type { HighlightOptions } from 'fumadocs-core/server';
2
+ export declare function DynamicCodeBlock({ lang, code, options, }: {
3
+ lang: string;
4
+ code: string;
5
+ options?: Omit<HighlightOptions, 'lang'>;
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=dynamic-codeblock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-codeblock.d.ts","sourceRoot":"","sources":["../../src/components/dynamic-codeblock.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAc7D,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,IAAI,EACJ,OAAO,GACR,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;CAC1C,2CAuBA"}
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { CodeBlock, Pre } from '../components/codeblock';
4
+ import { PrerenderScript, useShiki } from 'fumadocs-core/utils/use-shiki';
5
+ import { useId } from 'react';
6
+ const components = {
7
+ pre(props) {
8
+ return (_jsx(CodeBlock, { ...props, children: _jsx(Pre, { children: props.children }) }));
9
+ },
10
+ };
11
+ export function DynamicCodeBlock({ lang, code, options, }) {
12
+ const scriptKey = useId();
13
+ const shikiOptions = {
14
+ lang,
15
+ scriptKey,
16
+ ...options,
17
+ components: {
18
+ ...components,
19
+ ...options?.components,
20
+ },
21
+ };
22
+ const children = useShiki(code, shikiOptions);
23
+ return (_jsxs(_Fragment, { children: [_jsx(PrerenderScript, { scriptKey: scriptKey, code: code, options: shikiOptions }), children] }));
24
+ }
@@ -1,6 +1,6 @@
1
1
  import { type HTMLAttributes, type ReactNode, type RefObject } from 'react';
2
2
  export type TOCThumb = [top: number, height: number];
3
3
  export declare function TocThumb({ containerRef, ...props }: HTMLAttributes<HTMLDivElement> & {
4
- containerRef: RefObject<HTMLElement>;
4
+ containerRef: RefObject<HTMLElement | null>;
5
5
  }): ReactNode;
6
6
  //# sourceMappingURL=toc-thumb.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toc-thumb.d.ts","sourceRoot":"","sources":["../../../src/components/layout/toc-thumb.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAIf,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAgCrD,wBAAgB,QAAQ,CAAC,EACvB,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG;IAClC,YAAY,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;CACtC,GAAG,SAAS,CAgCZ"}
1
+ {"version":3,"file":"toc-thumb.d.ts","sourceRoot":"","sources":["../../../src/components/layout/toc-thumb.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAIf,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAgCrD,wBAAgB,QAAQ,CAAC,EACvB,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG;IAClC,YAAY,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC7C,GAAG,SAAS,CAgCZ"}
@@ -21,5 +21,11 @@ export interface TabsProps extends BaseProps {
21
21
  updateAnchor?: boolean;
22
22
  }
23
23
  export declare function Tabs({ groupId, items, persist, defaultIndex, updateAnchor, ...props }: TabsProps): import("react/jsx-runtime").JSX.Element;
24
- export declare function Tab({ value, className, ...props }: TabsContentProps): import("react/jsx-runtime").JSX.Element;
24
+ export type TabProps = Omit<TabsContentProps, 'value'> & {
25
+ /**
26
+ * Value of tab, detect from index if unspecified.
27
+ */
28
+ value?: TabsContentProps['value'];
29
+ };
30
+ export declare function Tab({ value, className, ...props }: TabProps): import("react/jsx-runtime").JSX.Element;
25
31
  //# sourceMappingURL=tabs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/components/tabs.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,IAAI,SAAS,EACvB,MAAM,sBAAsB,CAAC;AAW9B,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,CAAC;AAmBrB,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAEjB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAMD,wBAAgB,IAAI,CAAC,EACnB,OAAO,EACP,KAAU,EACV,OAAe,EACf,YAAgB,EAChB,YAAoB,EACpB,GAAG,KAAK,EACT,EAAE,SAAS,2CA+EX;AAMD,wBAAgB,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAkBnE"}
1
+ {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/components/tabs.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,IAAI,SAAS,EACvB,MAAM,sBAAsB,CAAC;AAY9B,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,CAAC;AAmBrB,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAEjB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAQD,wBAAgB,IAAI,CAAC,EACnB,OAAO,EACP,KAAU,EACV,OAAe,EACf,YAAgB,EAChB,YAAoB,EACpB,GAAG,KAAK,EACT,EAAE,SAAS,2CAqFX;AAMD,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,GAAG;IACvD;;OAEG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,wBAAgB,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,QAAQ,2CA6B3D"}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useMemo, useState, useCallback, createContext, useContext, useRef, useLayoutEffect, } from 'react';
3
+ import { useMemo, useState, createContext, useContext, useRef, useLayoutEffect, useId, useEffect, } from 'react';
4
4
  import { cn } from '../utils/cn';
5
5
  import * as Primitive from './ui/tabs';
6
6
  export { Primitive };
@@ -14,20 +14,23 @@ function removeChangeListener(id, listener) {
14
14
  const list = listeners.get(id) ?? [];
15
15
  listeners.set(id, list.filter((item) => item !== listener));
16
16
  }
17
- const ValueToMapContext = createContext(undefined);
17
+ const TabsContext = createContext(null);
18
18
  export function Tabs({ groupId, items = [], persist = false, defaultIndex = 0, updateAnchor = false, ...props }) {
19
19
  const values = useMemo(() => items.map((item) => toValue(item)), [items]);
20
20
  const [value, setValue] = useState(values[defaultIndex]);
21
- const valueToIdMapRef = useRef(new Map());
22
- const onChangeRef = useRef();
23
- onChangeRef.current = (v) => {
21
+ const valueToIdMap = useMemo(() => new Map(), []);
22
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- re-reconstruct the collection if items changed
23
+ const collection = useMemo(() => createCollection(), [items]);
24
+ const onChange = (v) => {
24
25
  if (values.includes(v))
25
26
  setValue(v);
26
27
  };
28
+ const onChangeRef = useRef(onChange);
29
+ onChangeRef.current = onChange;
27
30
  useLayoutEffect(() => {
28
31
  if (!groupId)
29
32
  return;
30
- const onUpdate = (v) => onChangeRef.current?.(v);
33
+ const onUpdate = (v) => onChangeRef.current(v);
31
34
  const previous = persist
32
35
  ? localStorage.getItem(groupId)
33
36
  : sessionStorage.getItem(groupId);
@@ -42,40 +45,83 @@ export function Tabs({ groupId, items = [], persist = false, defaultIndex = 0, u
42
45
  const hash = window.location.hash.slice(1);
43
46
  if (!hash)
44
47
  return;
45
- const entry = Array.from(valueToIdMapRef.current.entries()).find(([_, id]) => id === hash);
46
- if (entry)
47
- setValue(entry[0]);
48
- }, []);
49
- const onValueChange = useCallback((v) => {
50
- if (updateAnchor) {
51
- const id = valueToIdMapRef.current.get(v);
52
- if (id) {
53
- window.history.replaceState(null, '', `#${id}`);
48
+ for (const [value, id] of valueToIdMap.entries()) {
49
+ if (id === hash) {
50
+ setValue(value);
51
+ break;
54
52
  }
55
53
  }
56
- if (groupId) {
57
- listeners.get(groupId)?.forEach((item) => {
58
- item(v);
59
- });
60
- if (persist)
61
- localStorage.setItem(groupId, v);
62
- else
63
- sessionStorage.setItem(groupId, v);
64
- }
65
- else {
66
- setValue(v);
67
- }
68
- }, [groupId, persist, updateAnchor]);
69
- return (_jsxs(Primitive.Tabs, { value: value, onValueChange: onValueChange, ...props, className: cn('my-4', props.className), children: [_jsx(Primitive.TabsList, { children: values.map((v, i) => (_jsx(Primitive.TabsTrigger, { value: v, children: items[i] }, v))) }), _jsx(ValueToMapContext.Provider, { value: valueToIdMapRef.current, children: props.children })] }));
54
+ }, [valueToIdMap]);
55
+ return (_jsxs(Primitive.Tabs, { value: value, onValueChange: (v) => {
56
+ if (updateAnchor) {
57
+ const id = valueToIdMap.get(v);
58
+ if (id) {
59
+ window.history.replaceState(null, '', `#${id}`);
60
+ }
61
+ }
62
+ if (groupId) {
63
+ listeners.get(groupId)?.forEach((item) => {
64
+ item(v);
65
+ });
66
+ if (persist)
67
+ localStorage.setItem(groupId, v);
68
+ else
69
+ sessionStorage.setItem(groupId, v);
70
+ }
71
+ else {
72
+ setValue(v);
73
+ }
74
+ }, ...props, className: cn('my-4', props.className), children: [_jsx(Primitive.TabsList, { children: values.map((v, i) => (_jsx(Primitive.TabsTrigger, { value: v, children: items[i] }, v))) }), _jsx(TabsContext.Provider, { value: useMemo(() => ({ items, valueToIdMap, collection }), [valueToIdMap, collection, items]), children: props.children })] }));
70
75
  }
71
76
  function toValue(v) {
72
77
  return v.toLowerCase().replace(/\s/, '-');
73
78
  }
74
79
  export function Tab({ value, className, ...props }) {
75
- const v = toValue(value);
76
- const valueToIdMap = useContext(ValueToMapContext);
77
- if (props.id) {
78
- valueToIdMap?.set(v, props.id);
80
+ const ctx = useContext(TabsContext);
81
+ const resolvedValue = value ??
82
+ // eslint-disable-next-line react-hooks/rules-of-hooks -- `value` is not supposed to change
83
+ ctx?.items.at(useCollectionIndex());
84
+ if (!resolvedValue)
85
+ throw new Error('Failed to resolve tab `value`, please pass a `value` prop to the Tab component.');
86
+ const v = toValue(resolvedValue);
87
+ if (props.id && ctx) {
88
+ ctx.valueToIdMap.set(v, props.id);
89
+ }
90
+ return (_jsx(Primitive.TabsContent, { value: v, className: cn('prose-no-margin [&>figure:only-child]:-m-4 [&>figure:only-child]:rounded-none [&>figure:only-child]:border-none', className), ...props, children: props.children }));
91
+ }
92
+ function createCollection() {
93
+ return [];
94
+ }
95
+ /**
96
+ * Inspired by Headless UI.
97
+ *
98
+ * Return the index of children, this is made possible by registering the order of render from children using React context.
99
+ * This is supposed by work with pre-rendering & pure client-side rendering.
100
+ */
101
+ function useCollectionIndex() {
102
+ const key = useId();
103
+ const ctx = useContext(TabsContext);
104
+ if (!ctx)
105
+ throw new Error('You must wrap your component in <Tabs>');
106
+ const list = ctx.collection;
107
+ function register() {
108
+ if (!list.includes(key))
109
+ list.push(key);
110
+ }
111
+ function unregister() {
112
+ const idx = list.indexOf(key);
113
+ if (idx !== -1)
114
+ list.splice(idx, 1);
79
115
  }
80
- return (_jsx(Primitive.TabsContent, { value: v, className: cn('prose-no-margin [&>figure:only-child]:-m-4 [&>figure:only-child]:rounded-none [&>figure:only-child]:border-none', className), ...props }));
116
+ useMemo(() => {
117
+ // re-order the item to the bottom if registered
118
+ unregister();
119
+ register();
120
+ // eslint-disable-next-line -- register
121
+ }, [list]);
122
+ useEffect(() => {
123
+ return unregister;
124
+ // eslint-disable-next-line -- clean up only
125
+ }, []);
126
+ return list.indexOf(key);
81
127
  }
@@ -36,6 +36,6 @@ export interface SidebarComponents {
36
36
  }
37
37
  export declare function SidebarLinkItem({ item }: {
38
38
  item: LinkItemType;
39
- }): string | number | bigint | boolean | Iterable<ReactNode> | Promise<import("react").AwaitedReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
39
+ }): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
40
40
  export declare function getSidebarTabsFromOptions(options: SidebarOptions['tabs'], tree: PageTree.Root): Option[] | undefined;
41
41
  //# sourceMappingURL=shared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/layouts/docs/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IAErB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAExC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,GAAG,KAAK,CAAC;IAErC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAA;KAAE,CAAC,CAAC;IAClC,MAAM,EAAE,EAA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;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAA;KAAE,CAAC,CAAC;IAClC,MAAM,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrD,SAAS,EAAE,EAAE,CAAC;QAAE,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;CAC7C;AAED,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,2UA+C/D;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAC/B,IAAI,EAAE,QAAQ,CAAC,IAAI,wBASpB"}
@@ -115,7 +115,7 @@ export function SidebarFolderLink(props) {
115
115
  }, prefetch: prefetch, children: [props.children, _jsx(ChevronDown, { "data-icon": true, className: cn('ms-auto transition-transform', !open && '-rotate-90') })] }));
116
116
  }
117
117
  export function SidebarFolderContent(props) {
118
- return (_jsx(CollapsibleContent, { ...props, children: _jsx("div", { className: "ms-3 border-s py-1.5 ps-1.5 md:ms-2 md:ps-2", children: props.children }) }));
118
+ return (_jsx(CollapsibleContent, { ...props, children: _jsx("div", { className: "ms-3 border-s py-1.5 ps-1.5 md:ms-2", children: props.children }) }));
119
119
  }
120
120
  export function SidebarCollapseTrigger(props) {
121
121
  const { collapsed, setCollapsed } = useSidebar();
@@ -25,7 +25,7 @@ export function DocsLayout({ nav: { enabled: navEnabled = true, component: navRe
25
25
  if (props.tree === undefined)
26
26
  notFound();
27
27
  const tabs = getSidebarTabsFromOptions(tabOptions, props.tree) ?? [];
28
- return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsxs(NavProvider, { transparentMode: transparentMode, children: [replaceOrDefault({ enabled: navEnabled, component: navReplace }, _jsxs(Navbar, { id: "nd-subnav", className: "h-14 md:hidden", children: [_jsx(Title, { url: nav.url, title: nav.title }), _jsx("div", { className: "flex flex-1 flex-row items-center gap-1", children: nav.children }), _jsx(SearchOnly, { children: _jsx(SearchToggle, {}) }), _jsx(NavbarSidebarTrigger, { className: "-me-2 md:hidden" })] }), nav), _jsxs(LayoutBody, { id: "nd-docs-layout", ...props.containerProps, className: cn('flex flex-1 flex-row md:[--fd-sidebar-width:260px] xl:[--fd-toc-width:260px] [&_#nd-toc]:max-xl:hidden [&_#nd-tocnav]:xl:hidden max-xl:[&_article]:mx-0', !navReplace && navEnabled
28
+ return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsxs(NavProvider, { transparentMode: transparentMode, children: [replaceOrDefault({ enabled: navEnabled, component: navReplace }, _jsxs(Navbar, { id: "nd-subnav", className: "h-14 md:hidden", children: [_jsx(Title, { url: nav.url, title: nav.title }), _jsx("div", { className: "flex flex-1 flex-row items-center gap-1", children: nav.children }), _jsx(SearchOnly, { children: _jsx(SearchToggle, {}) }), _jsx(NavbarSidebarTrigger, { className: "-me-2 md:hidden" })] }), nav), _jsxs(LayoutBody, { id: "nd-docs-layout", ...props.containerProps, className: cn('flex flex-1 flex-row md:[--fd-sidebar-width:260px] xl:[--fd-toc-width:260px] [&_#nd-toc]:max-xl:hidden [&_#nd-tocnav]:xl:hidden', !navReplace && navEnabled
29
29
  ? '[--fd-nav-height:3.5rem] md:[--fd-nav-height:0px]'
30
30
  : null, props.containerProps?.className), children: [collapsible ? (_jsx(SidebarCollapseTrigger, { className: "fixed bottom-3 start-2 z-40 transition-opacity data-[collapsed=false]:pointer-events-none data-[collapsed=false]:opacity-0 max-md:hidden" })) : null, replaceOrDefault({ enabled: sidebarEnabled, component: sidebarReplace }, _jsxs(Aside, { ...sidebar, className: "md:flex-1 md:data-[collapsed=true]:flex-initial", children: [_jsxs(SidebarHeader, { children: [_jsx(SidebarHeaderItems, { ...nav, links: links }), sidebarBanner, tabs.length > 0 ? (_jsx(RootToggle, { options: tabs, className: "-mx-2" })) : null, _jsx(SearchOnly, { children: _jsx(LargeSearchToggle, { className: "rounded-lg max-md:hidden" }) })] }), _jsxs(SidebarViewport, { children: [_jsx("div", { className: "px-2 pt-4 empty:hidden md:hidden", children: links
31
31
  .filter((v) => v.type !== 'icon')
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,mBAAmB,CAAC;AAI7E,OAAO,EAEL,KAAK,WAAW,EAIhB,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAML,KAAK,QAAQ,EACd,MAAM,yBAAyB,CAAC;AAMjC,KAAK,qBAAqB,GAAG,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,CAAC,GAC/D,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,GAAG;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC5B,CAAC;AAEJ,KAAK,4BAA4B,GAAG,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;AAE1E,UAAU,mBACR,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,GAAG,CAAC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CACrB;AAED,wBAAgB,QAAQ,CAAC,EACvB,GAAQ,EACR,IAAY,EACZ,qBAAqB,EAAE,EACrB,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,iBAAiB,EAC5B,GAAG,iBAAiB,EAChB,EACN,cAAc,EAAE,EACd,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,UAAU,EACrB,GAAG,UAAU,EACT,EACN,GAAG,KAAK,EACT,EAAE,aAAa,GAAG,SAAS,CA4G3B;AA+BD;;GAEG;AACH,eAAO,MAAM,QAAQ,2HAKnB,CAAC;AAIH,eAAO,MAAM,eAAe,uIAgB1B,CAAC;AAIH,eAAO,MAAM,SAAS,mIAapB,CAAC;AAwBH,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,IAAI,EACJ,IAAI,EAAE,UAAU,EAChB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG;IAClC,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC;CACtB,kDAiCA;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,GAAG,SAAS,CAM5E"}
package/dist/page.js CHANGED
@@ -10,20 +10,22 @@ import { buttonVariants } from './components/ui/button';
10
10
  import { Edit, Text } from 'lucide-react';
11
11
  import { I18nLabel } from './contexts/i18n';
12
12
  import ClerkTOCItems from './components/layout/toc-clerk';
13
- export function DocsPage({ toc = [], full = false, tableOfContentPopover: { enabled: tocPopoverEnabled = true, component: tocPopoverReplace, ...tocPopoverOptions } = {}, tableOfContent: {
14
- // disable TOC on full mode, you can still enable it with `enabled` option.
15
- enabled: tocEnabled, component: tocReplace, ...tocOptions } = {}, ...props }) {
16
- tocEnabled ?? (tocEnabled = !full &&
17
- (toc.length > 0 ||
18
- tocOptions.footer !== undefined ||
19
- tocOptions.header !== undefined));
13
+ export function DocsPage({ toc = [], full = false, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopoverReplace, ...tocPopoverOptions } = {}, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions } = {}, ...props }) {
14
+ const isTocRequired = toc.length > 0 ||
15
+ tocOptions.footer !== undefined ||
16
+ tocOptions.header !== undefined;
17
+ // disable TOC on full mode, you can still enable it with `enabled` option.
18
+ tocEnabled ?? (tocEnabled = !full && isTocRequired);
19
+ tocPopoverEnabled ?? (tocPopoverEnabled = toc.length > 0 ||
20
+ tocPopoverOptions.header !== undefined ||
21
+ tocPopoverOptions.footer !== undefined);
20
22
  const fullWidth = full && !tocEnabled;
21
23
  return (_jsxs(AnchorProvider, { toc: toc, single: tocOptions.single, children: [_jsxs("div", { id: "nd-page", ...props.container, className: cn('flex w-full min-w-0 flex-col md:transition-[max-width]', props.container?.className), style: {
22
24
  '--fd-toc-width': fullWidth ? '0px' : undefined,
23
25
  }, children: [replaceOrDefault({ enabled: tocPopoverEnabled, component: tocPopoverReplace }, _jsx(PageHeader, { id: "nd-tocnav", children: _jsxs(TocPopover, { children: [_jsx(TocPopoverTrigger, { className: "size-full", items: toc }), _jsxs(TocPopoverContent, { children: [tocPopoverOptions.header, tocPopoverOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc, isMenu: true })) : (_jsx(TOCItems, { items: toc, isMenu: true })), tocPopoverOptions.footer] })] }) }), {
24
26
  items: toc,
25
27
  ...tocPopoverOptions,
26
- }), _jsxs("article", { ...props.article, className: cn('mx-auto flex w-full flex-1 flex-col gap-6 px-4 pt-8 md:pt-12 lg:px-8', fullWidth ? 'max-w-[1120px]' : 'max-w-[860px]', props.article?.className), children: [replaceOrDefault(props.breadcrumb, _jsx(Breadcrumb, { includePage: props.breadcrumb?.full, ...props.breadcrumb })), props.children, _jsx("div", { role: "none", className: "flex-1" }), _jsxs("div", { className: "flex flex-row flex-wrap items-center justify-between gap-4 empty:hidden", children: [props.editOnGithub ? (_jsx(EditOnGitHub, { ...props.editOnGithub })) : null, props.lastUpdate ? (_jsx(LastUpdate, { date: new Date(props.lastUpdate) })) : null] }), replaceOrDefault(props.footer, _jsx(Footer, { items: props.footer?.items }))] })] }), replaceOrDefault({ enabled: tocEnabled, component: tocReplace }, _jsx(Toc, { id: "nd-toc", children: _jsxs("div", { className: "flex h-full w-[var(--fd-toc-width)] max-w-full flex-col gap-3 pe-2", children: [tocOptions.header, _jsxs("h3", { className: "-ms-0.5 inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [_jsx(Text, { className: "size-4" }), _jsx(I18nLabel, { label: "toc" })] }), tocOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc })) : (_jsx(TOCItems, { items: toc })), tocOptions.footer] }) }), {
28
+ }), _jsxs("article", { ...props.article, className: cn('mx-auto flex w-full flex-1 flex-col gap-6 px-4 pt-8 max-xl:mx-0 md:pt-12 lg:px-8', fullWidth ? 'max-w-[1120px]' : 'max-w-[860px]', props.article?.className), children: [replaceOrDefault(props.breadcrumb, _jsx(Breadcrumb, { includePage: props.breadcrumb?.full, ...props.breadcrumb })), props.children, _jsx("div", { role: "none", className: "flex-1" }), _jsxs("div", { className: "flex flex-row flex-wrap items-center justify-between gap-4 empty:hidden", children: [props.editOnGithub ? (_jsx(EditOnGitHub, { ...props.editOnGithub })) : null, props.lastUpdate ? (_jsx(LastUpdate, { date: new Date(props.lastUpdate) })) : null] }), replaceOrDefault(props.footer, _jsx(Footer, { items: props.footer?.items }))] })] }), replaceOrDefault({ enabled: tocEnabled, component: tocReplace }, _jsx(Toc, { id: "nd-toc", children: _jsxs("div", { className: "flex h-full w-[var(--fd-toc-width)] max-w-full flex-col gap-3 pe-2", children: [tocOptions.header, _jsxs("h3", { className: "-ms-0.5 inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [_jsx(Text, { className: "size-4" }), _jsx(I18nLabel, { label: "toc" })] }), tocOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc })) : (_jsx(TOCItems, { items: toc })), tocOptions.footer] }) }), {
27
29
  items: toc,
28
30
  ...tocOptions,
29
31
  }, _jsx("div", { role: "none", className: "flex-1" }))] }));
package/dist/style.css CHANGED
@@ -522,6 +522,7 @@ video {
522
522
  --fd-layout-width: 100vw;
523
523
  --fd-banner-height: 0px;
524
524
  --fd-nav-height: 0px;
525
+ --fd-tocnav-height: 0px;
525
526
  --fd-diff-remove-color: rgba(200,10,100,0.12);
526
527
  --fd-diff-remove-symbol-color: rgb(230,10,100);
527
528
  --fd-diff-add-color: rgba(14,180,100,0.12);
@@ -529,7 +530,7 @@ video {
529
530
  }
530
531
 
531
532
  .dark {
532
- --background: 0 0% 8.9%;
533
+ --background: 0 0% 8.6%;
533
534
  --foreground: 0 0% 92%;
534
535
  --muted: 0 0% 12.9%;
535
536
  --muted-foreground: 0 0% 60.9%;
@@ -1250,6 +1251,9 @@ body {
1250
1251
  .max-h-\[460px\] {
1251
1252
  max-height: 460px;
1252
1253
  }
1254
+ .max-h-\[600px\] {
1255
+ max-height: 600px;
1256
+ }
1253
1257
  .max-h-\[var\(--radix-popover-content-available-height\)\] {
1254
1258
  max-height: var(--radix-popover-content-available-height);
1255
1259
  }
@@ -2342,6 +2346,14 @@ body {
2342
2346
  color: hsl(var(--muted-foreground) / var(--tw-text-opacity, 1));
2343
2347
  }
2344
2348
 
2349
+ @media not all and (min-width: 1280px) {
2350
+
2351
+ .max-xl\:mx-0 {
2352
+ margin-left: 0px;
2353
+ margin-right: 0px;
2354
+ }
2355
+ }
2356
+
2345
2357
  @media not all and (min-width: 1024px) {
2346
2358
 
2347
2359
  .max-lg\:hidden {
@@ -2501,10 +2513,6 @@ body {
2501
2513
  padding-inline-end: 0.375rem;
2502
2514
  }
2503
2515
 
2504
- .md\:ps-2 {
2505
- padding-inline-start: 0.5rem;
2506
- }
2507
-
2508
2516
  .md\:ps-\[var\(--fd-layout-offset\)\] {
2509
2517
  padding-inline-start: var(--fd-layout-offset);
2510
2518
  }
@@ -2668,14 +2676,6 @@ body {
2668
2676
  }
2669
2677
  }
2670
2678
 
2671
- @media not all and (min-width: 1280px) {
2672
-
2673
- .max-xl\:\[\&_article\]\:mx-0 article {
2674
- margin-left: 0px;
2675
- margin-right: 0px;
2676
- }
2677
- }
2678
-
2679
2679
  .\[\&_svg\]\:size-3\.5 svg {
2680
2680
  width: 0.875rem;
2681
2681
  height: 0.875rem;
@@ -1 +1 @@
1
- {"version":3,"file":"tailwind-plugin.d.ts","sourceRoot":"","sources":["../src/tailwind-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EACL,KAAK,OAAO,IAAI,iBAAiB,EACjC,UAAU,EACX,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,iBAAiB,EAAE,qBAAqB,CAAC;IACtD;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,OAAO,OAAO,GAAG,MAAM,CAAC;IAEvC,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC;AAED,KAAK,IAAI,GACL,YAAY,GACZ,YAAY,GACZ,OAAO,GACP,kBAAkB,GAClB,SAAS,GACT,oBAAoB,GACpB,MAAM,GACN,iBAAiB,GACjB,QAAQ,GACR,SAAS,GACT,oBAAoB,GACpB,WAAW,GACX,sBAAsB,GACtB,QAAQ,GACR,mBAAmB,GACnB,MAAM,CAAC;AAEX,KAAK,KAAK,GAAG,M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GACtB,QAAQ,GACR,mBAAmB,GACnB,MAAM,CAAC;AAEX,KAAK,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAElC,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAkDD,eAAO,MAAM,MAAM;;;cApHH,CAAC;;;CAyQhB,CAAC;AAEF,wBAAgB,YAAY,CAAC,OAAO,GAAE,aAAkB,GAAG,aAAa,CAWvE;AAED,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
@@ -48,6 +48,7 @@ export const docsUi = plugin.withOptions(({ cssPrefix = '', preset = 'default',
48
48
  '--fd-layout-width': layoutWidth,
49
49
  '--fd-banner-height': '0px',
50
50
  '--fd-nav-height': '0px',
51
+ '--fd-tocnav-height': '0px',
51
52
  '--fd-diff-remove-color': 'rgba(200,10,100,0.12)',
52
53
  '--fd-diff-remove-symbol-color': 'rgb(230,10,100)',
53
54
  '--fd-diff-add-color': 'rgba(14,180,100,0.12)',
@@ -100,7 +100,7 @@ const neutral = {
100
100
  ring: '0 0% 63.9%',
101
101
  },
102
102
  dark: {
103
- background: '0 0% 8.9%',
103
+ background: '0 0% 8.6%',
104
104
  foreground: '0 0% 92%',
105
105
  muted: '0 0% 12.9%',
106
106
  'muted-foreground': '0 0% 60.9%',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "14.5.6",
3
+ "version": "14.6.1",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -52,31 +52,31 @@
52
52
  "dist/*"
53
53
  ],
54
54
  "dependencies": {
55
- "@radix-ui/react-accordion": "^1.2.1",
56
- "@radix-ui/react-collapsible": "^1.1.1",
57
- "@radix-ui/react-dialog": "^1.1.2",
55
+ "@radix-ui/react-accordion": "^1.2.2",
56
+ "@radix-ui/react-collapsible": "^1.1.2",
57
+ "@radix-ui/react-dialog": "^1.1.3",
58
58
  "@radix-ui/react-direction": "^1.1.0",
59
- "@radix-ui/react-navigation-menu": "^1.2.1",
60
- "@radix-ui/react-popover": "^1.1.2",
61
- "@radix-ui/react-scroll-area": "^1.2.1",
62
- "@radix-ui/react-slot": "^1.1.0",
63
- "@radix-ui/react-tabs": "^1.1.1",
59
+ "@radix-ui/react-navigation-menu": "^1.2.2",
60
+ "@radix-ui/react-popover": "^1.1.3",
61
+ "@radix-ui/react-scroll-area": "^1.2.2",
62
+ "@radix-ui/react-slot": "^1.1.1",
63
+ "@radix-ui/react-tabs": "^1.1.2",
64
64
  "class-variance-authority": "^0.7.1",
65
65
  "lodash.merge": "^4.6.2",
66
- "lucide-react": "^0.465.0",
67
- "next-themes": "^0.4.3",
66
+ "lucide-react": "^0.468.0",
67
+ "next-themes": "^0.4.4",
68
68
  "postcss-selector-parser": "^7.0.0",
69
- "react-medium-image-zoom": "^5.2.11",
69
+ "react-medium-image-zoom": "^5.2.12",
70
70
  "tailwind-merge": "^2.5.5",
71
- "fumadocs-core": "14.5.6"
71
+ "fumadocs-core": "14.6.1"
72
72
  },
73
73
  "devDependencies": {
74
- "@next/eslint-plugin-next": "^15.0.3",
74
+ "@next/eslint-plugin-next": "^15.1.0",
75
75
  "@types/lodash.merge": "^4.6.9",
76
- "@types/react": "^18.3.12",
77
- "@types/react-dom": "^18.3.1",
76
+ "@types/react": "^19.0.1",
77
+ "@types/react-dom": "^19.0.2",
78
78
  "autoprefixer": "^10.4.20",
79
- "next": "15.0.3",
79
+ "next": "15.1.0",
80
80
  "postcss": "^8.4.49",
81
81
  "postcss-cli": "^11.0.0",
82
82
  "tailwindcss": "^3.4.16",
@@ -87,8 +87,8 @@
87
87
  },
88
88
  "peerDependencies": {
89
89
  "next": "14.x.x || 15.x.x",
90
- "react": ">= 18",
91
- "react-dom": ">= 18",
90
+ "react": "18.x.x || 19.x.x",
91
+ "react-dom": "18.x.x || 19.x.x",
92
92
  "tailwindcss": "^3.4.14"
93
93
  },
94
94
  "peerDependenciesMeta": {