fumadocs-ui 14.7.2 → 14.7.4

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,5 +1,9 @@
1
1
  import { type HTMLAttributes } from 'react';
2
- export declare function Banner({ id, variant, changeLayout, ...props }: HTMLAttributes<HTMLDivElement> & {
2
+ export declare function Banner({ id, variant, changeLayout, height, ...props }: HTMLAttributes<HTMLDivElement> & {
3
+ /**
4
+ * @defaultValue 3rem
5
+ */
6
+ height?: string;
3
7
  /**
4
8
  * @defaultValue 'normal'
5
9
  */
@@ -10,5 +14,5 @@ export declare function Banner({ id, variant, changeLayout, ...props }: HTMLAttr
10
14
  * @defaultValue true
11
15
  */
12
16
  changeLayout?: boolean;
13
- }): React.ReactElement;
17
+ }): import("react/jsx-runtime").JSX.Element | null;
14
18
  //# sourceMappingURL=banner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../src/components/banner.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAoC,MAAM,OAAO,CAAC;AAK9E,wBAAgB,MAAM,CAAC,EACrB,EAAE,EACF,OAAkB,EAClB,YAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAE/B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,KAAK,CAAC,YAAY,CA6DrB"}
1
+ {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../src/components/banner.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAoC,MAAM,OAAO,CAAC;AAK9E,wBAAgB,MAAM,CAAC,EACrB,EAAE,EACF,OAAkB,EAClB,YAAmB,EACnB,MAAe,EACf,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAE/B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,kDAoEA"}
@@ -4,9 +4,9 @@ import { useCallback, useEffect, useState } from 'react';
4
4
  import { X } from 'lucide-react';
5
5
  import { cn } from '../utils/cn';
6
6
  import { buttonVariants } from '../components/ui/button';
7
- export function Banner({ id, variant = 'normal', changeLayout = true, ...props }) {
7
+ export function Banner({ id, variant = 'normal', changeLayout = true, height = '3rem', ...props }) {
8
8
  const [open, setOpen] = useState(true);
9
- const globalKey = id ? `nd-banner-${id}` : undefined;
9
+ const globalKey = id ? `nd-banner-${id}` : null;
10
10
  useEffect(() => {
11
11
  if (globalKey)
12
12
  setOpen(localStorage.getItem(globalKey) !== 'true');
@@ -16,9 +16,13 @@ export function Banner({ id, variant = 'normal', changeLayout = true, ...props }
16
16
  if (globalKey)
17
17
  localStorage.setItem(globalKey, 'true');
18
18
  }, [globalKey]);
19
- return (_jsxs("div", { id: id, ...props, className: cn('sticky top-0 z-40 flex h-12 flex-row items-center justify-center bg-fd-secondary px-4 text-center text-sm font-medium', variant === 'rainbow' && 'bg-fd-background', !open && 'hidden', props.className), children: [changeLayout && open ? (_jsx("style", { children: `
20
- :root:not(.${globalKey ?? 'nd-banner-never'}) { --fd-banner-height: 3rem; }
21
- ` })) : null, globalKey ? (_jsx("style", { children: `.${globalKey} #${id} { display: none; }` })) : null, id ? (_jsx("script", { dangerouslySetInnerHTML: {
19
+ if (!open)
20
+ return null;
21
+ return (_jsxs("div", { id: id, ...props, className: cn('sticky top-0 z-40 flex flex-row items-center justify-center bg-fd-secondary px-4 text-center text-sm font-medium', variant === 'rainbow' && 'bg-fd-background', !open && 'hidden', props.className), style: {
22
+ height,
23
+ }, children: [changeLayout && open ? (_jsx("style", { children: globalKey
24
+ ? `:root:not(.${globalKey}) { --fd-banner-height: ${height}; }`
25
+ : `:root { --fd-banner-height: ${height}; }` })) : null, globalKey ? (_jsx("style", { children: `.${globalKey} #${id} { display: none; }` })) : null, globalKey ? (_jsx("script", { dangerouslySetInnerHTML: {
22
26
  __html: `if (localStorage.getItem('${globalKey}') === 'true') document.documentElement.classList.add('${globalKey}');`,
23
27
  } })) : null, variant === 'rainbow' ? rainbowLayer : null, props.children, id ? (_jsx("button", { type: "button", "aria-label": "Close Banner", onClick: onClick, className: cn(buttonVariants({
24
28
  color: 'ghost',
@@ -10,7 +10,7 @@ export interface Option {
10
10
  /**
11
11
  * Detect from a list of urls
12
12
  */
13
- urls?: string[];
13
+ urls?: Set<string>;
14
14
  props?: HTMLAttributes<HTMLElement>;
15
15
  }
16
16
  export declare function RootToggle({ options, placeholder, ...props }: {
@@ -1 +1 @@
1
- {"version":3,"file":"root-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/layout/root-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAQ/E,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB,KAAK,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;CACrC;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,WAAW,EACX,GAAG,KAAK,EACT,EAAE;IACD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,cAAc,CAAC,iBAAiB,CAAC,2CAuDpC"}
1
+ {"version":3,"file":"root-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/layout/root-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAQ/E,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAEnB,KAAK,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;CACrC;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,WAAW,EACX,GAAG,KAAK,EACT,EAAE;IACD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,cAAc,CAAC,iBAAiB,CAAC,2CAyDpC"}
@@ -14,7 +14,7 @@ export function RootToggle({ options, placeholder, ...props }) {
14
14
  const pathname = usePathname();
15
15
  const selected = useMemo(() => {
16
16
  return options.findLast((item) => item.urls
17
- ? item.urls.includes(pathname)
17
+ ? item.urls.has(pathname.endsWith('/') ? pathname.slice(0, -1) : pathname)
18
18
  : isActive(item.url, pathname, true));
19
19
  }, [options, pathname]);
20
20
  const onClick = () => {
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import * as Primitive from '@radix-ui/react-navigation-menu';
3
3
  declare const NavigationMenu: React.ForwardRefExoticComponent<Primitive.NavigationMenuProps & React.RefAttributes<HTMLElement>>;
4
4
  declare const NavigationMenuList: React.ForwardRefExoticComponent<Primitive.NavigationMenuListProps & React.RefAttributes<HTMLUListElement>>;
5
- declare const NavigationMenuItem: React.ForwardRefExoticComponent<Primitive.NavigationMenuItemProps & React.RefAttributes<HTMLLIElement>>;
5
+ declare const NavigationMenuItem: React.ForwardRefExoticComponent<Omit<Primitive.NavigationMenuItemProps & React.RefAttributes<HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
6
6
  declare const NavigationMenuTrigger: React.ForwardRefExoticComponent<Omit<Primitive.NavigationMenuTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
7
7
  declare const NavigationMenuContent: React.ForwardRefExoticComponent<Omit<Primitive.NavigationMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
8
  declare const NavigationMenuLink: React.ForwardRefExoticComponent<Primitive.NavigationMenuLinkProps & React.RefAttributes<HTMLAnchorElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"navigation-menu.d.ts","sourceRoot":"","sources":["../../../src/components/ui/navigation-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,SAAS,MAAM,iCAAiC,CAAC;AAG7D,QAAA,MAAM,cAAc,mGAAiB,CAAC;AAEtC,QAAA,MAAM,kBAAkB,4GAAiB,CAAC;AAE1C,QAAA,MAAM,kBAAkB,yGAAiB,CAAC;AAE1C,QAAA,MAAM,qBAAqB,sKAWzB,CAAC;AAGH,QAAA,MAAM,qBAAqB,gKAYzB,CAAC;AAGH,QAAA,MAAM,kBAAkB,6GAAiB,CAAC;AAE1C,QAAA,MAAM,sBAAsB,iKAa1B,CAAC;AAGH,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,GACvB,CAAC"}
1
+ {"version":3,"file":"navigation-menu.d.ts","sourceRoot":"","sources":["../../../src/components/ui/navigation-menu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,SAAS,MAAM,iCAAiC,CAAC;AAG7D,QAAA,MAAM,cAAc,mGAAiB,CAAC;AAEtC,QAAA,MAAM,kBAAkB,4GAAiB,CAAC;AAE1C,QAAA,MAAM,kBAAkB,2JAWtB,CAAC;AAIH,QAAA,MAAM,qBAAqB,sKAWzB,CAAC;AAGH,QAAA,MAAM,qBAAqB,gKAYzB,CAAC;AAGH,QAAA,MAAM,kBAAkB,6GAAiB,CAAC;AAE1C,QAAA,MAAM,sBAAsB,iKAa1B,CAAC;AAGH,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,GACvB,CAAC"}
@@ -1,10 +1,12 @@
1
+ 'use client';
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import * as React from 'react';
3
4
  import * as Primitive from '@radix-ui/react-navigation-menu';
4
5
  import { cn } from '../../utils/cn';
5
6
  const NavigationMenu = Primitive.Root;
6
7
  const NavigationMenuList = Primitive.List;
7
- const NavigationMenuItem = Primitive.Item;
8
+ const NavigationMenuItem = React.forwardRef(({ className, children, ...props }, ref) => (_jsx(Primitive.NavigationMenuItem, { ref: ref, className: cn('list-none', className), ...props, children: children })));
9
+ NavigationMenuItem.displayName = Primitive.NavigationMenuItem.displayName;
8
10
  const NavigationMenuTrigger = React.forwardRef(({ className, children, ...props }, ref) => (_jsx(Primitive.Trigger, { ref: ref, className: cn('data-[state=open]:bg-fd-accent/50', className), ...props, children: children })));
9
11
  NavigationMenuTrigger.displayName = Primitive.Trigger.displayName;
10
12
  const NavigationMenuContent = React.forwardRef(({ className, ...props }, ref) => (_jsx(Primitive.Content, { ref: ref, className: cn('absolute inset-x-0 top-0 data-[motion=from-end]:animate-fd-enterFromRight data-[motion=from-start]:animate-fd-enterFromLeft data-[motion=to-end]:animate-fd-exitToRight data-[motion=to-start]:animate-fd-exitToLeft', className), ...props })));
@@ -59,7 +59,7 @@ function getSidebarTabs(pageTree, { transform = defaultTransform } = {}) {
59
59
  title: node.name,
60
60
  icon: node.icon,
61
61
  description: node.description,
62
- urls: getFolderUrls(node),
62
+ urls: getFolderUrls(node, new Set()),
63
63
  };
64
64
  const mapped = transform ? transform(option, node) : option;
65
65
  if (mapped)
@@ -74,15 +74,14 @@ function getSidebarTabs(pageTree, { transform = defaultTransform } = {}) {
74
74
  }
75
75
  return findOptions(pageTree);
76
76
  }
77
- function getFolderUrls(folder) {
78
- const results = [];
77
+ function getFolderUrls(folder, output) {
79
78
  if (folder.index)
80
- results.push(folder.index.url);
79
+ output.add(folder.index.url);
81
80
  for (const child of folder.children) {
82
81
  if (child.type === 'page')
83
- results.push(child.url);
82
+ output.add(child.url);
84
83
  if (child.type === 'folder')
85
- results.push(...getFolderUrls(child));
84
+ getFolderUrls(child, output);
86
85
  }
87
- return results;
86
+ return output;
88
87
  }
@@ -1,6 +1,16 @@
1
1
  import { type LinkItemType } from '../../layouts/links';
2
+ import { NavigationMenuContent, NavigationMenuTrigger } from '../../components/ui/navigation-menu';
3
+ import type { ComponentPropsWithoutRef } from 'react';
2
4
  export declare function MenuLinkItem({ item, ...props }: {
3
5
  item: LinkItemType;
4
6
  className?: string;
5
7
  }): import("react/jsx-runtime").JSX.Element;
8
+ export declare const Menu: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-navigation-menu").NavigationMenuItemProps & import("react").RefAttributes<HTMLLIElement>, "ref"> & import("react").RefAttributes<HTMLLIElement>>;
9
+ export declare function MenuTrigger({ enableHover, ...props }: ComponentPropsWithoutRef<typeof NavigationMenuTrigger> & {
10
+ /**
11
+ * Enable hover to trigger
12
+ */
13
+ enableHover?: boolean;
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ export declare function MenuContent(props: ComponentPropsWithoutRef<typeof NavigationMenuContent>): import("react/jsx-runtime").JSX.Element;
6
16
  //# sourceMappingURL=menu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA0BlE,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,GAAG,KAAK,EACT,EAAE;IACD,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CA2CA"}
1
+ {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,EACL,qBAAqB,EAGrB,qBAAqB,EACtB,MAAM,iCAAiC,CAAC;AAIzC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAqBtD,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,GAAG,KAAK,EACT,EAAE;IACD,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CA6CA;AAED,eAAO,MAAM,IAAI,yNAAqB,CAAC;AAEvC,wBAAgB,WAAW,CAAC,EAC1B,WAAmB,EACnB,GAAG,KAAK,EACT,EAAE,wBAAwB,CAAC,OAAO,qBAAqB,CAAC,GAAG;IAC1D;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,2CAgBA;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,wBAAwB,CAAC,OAAO,qBAAqB,CAAC,2CAU9D"}
@@ -1,8 +1,8 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { BaseLinkItem } from '../../layouts/links';
4
4
  import { cn } from '../../utils/cn';
5
- import { NavigationMenuLink } from '../../components/ui/navigation-menu';
5
+ import { NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuTrigger, } from '../../components/ui/navigation-menu';
6
6
  import Link from 'fumadocs-core/link';
7
7
  import { cva } from 'class-variance-authority';
8
8
  import { buttonVariants } from '../../components/ui/button';
@@ -27,7 +27,19 @@ const menuItemVariants = cva('', {
27
27
  export function MenuLinkItem({ item, ...props }) {
28
28
  if (item.type === 'custom')
29
29
  return _jsx("div", { className: cn('grid', props.className), children: item.children });
30
- if (item.type === 'menu')
31
- return (_jsxs("div", { className: cn('mb-4 flex flex-col', props.className), children: [_jsx("p", { className: "mb-1 text-sm text-fd-muted-foreground", children: item.url ? (_jsx(NavigationMenuLink, { asChild: true, children: _jsxs(Link, { href: item.url, children: [item.icon, item.text] }) })) : (_jsxs(_Fragment, { children: [item.icon, item.text] })) }), item.items.map((child, i) => (_jsx(MenuLinkItem, { item: child }, i)))] }));
30
+ if (item.type === 'menu') {
31
+ const header = (_jsxs(_Fragment, { children: [item.icon, item.text] }));
32
+ return (_jsxs("div", { className: cn('mb-4 flex flex-col', props.className), children: [_jsx("p", { className: "mb-1 text-sm text-fd-muted-foreground", children: item.url ? (_jsx(NavigationMenuLink, { asChild: true, children: _jsx(Link, { href: item.url, children: header }) })) : (header) }), item.items.map((child, i) => (_jsx(MenuLinkItem, { item: child }, i)))] }));
33
+ }
32
34
  return (_jsx(NavigationMenuLink, { asChild: true, children: _jsxs(BaseLinkItem, { item: item, className: cn(menuItemVariants({ variant: item.type }), props.className), "aria-label": item.type === 'icon' ? item.label : undefined, children: [item.icon, item.type === 'icon' ? undefined : item.text] }) }));
33
35
  }
36
+ export const Menu = NavigationMenuItem;
37
+ export function MenuTrigger({ enableHover = false, ...props }) {
38
+ return (_jsx(NavigationMenuTrigger, { ...props, onPointerMove: enableHover ? undefined : (e) => e.preventDefault(), className: cn(buttonVariants({
39
+ size: 'icon',
40
+ color: 'ghost',
41
+ }), props.className), children: props.children }));
42
+ }
43
+ export function MenuContent(props) {
44
+ return (_jsx(NavigationMenuContent, { ...props, className: cn('flex flex-col p-4', props.className), children: props.children }));
45
+ }
@@ -4,13 +4,13 @@ import { type LinkProps } from 'fumadocs-core/link';
4
4
  import { BaseLinkItem } from '../../layouts/links';
5
5
  import type { NavigationMenuContentProps, NavigationMenuTriggerProps } from '@radix-ui/react-navigation-menu';
6
6
  export declare function Navbar(props: HTMLAttributes<HTMLElement>): import("react/jsx-runtime").JSX.Element;
7
- export declare const NavbarMenu: import("react").ForwardRefExoticComponent<import("@radix-ui/react-navigation-menu").NavigationMenuItemProps & import("react").RefAttributes<HTMLLIElement>>;
7
+ export declare const NavbarMenu: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-navigation-menu").NavigationMenuItemProps & import("react").RefAttributes<HTMLLIElement>, "ref"> & import("react").RefAttributes<HTMLLIElement>>;
8
8
  export declare function NavbarMenuContent(props: NavigationMenuContentProps): import("react/jsx-runtime").JSX.Element;
9
9
  export declare function NavbarMenuTrigger(props: NavigationMenuTriggerProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function NavbarMenuLink(props: LinkProps): import("react/jsx-runtime").JSX.Element;
10
11
  declare const linkVariants: (props?: ({
11
12
  variant?: "button" | "main" | "icon" | null | undefined;
12
13
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
13
14
  export declare function NavbarLink({ item, variant, ...props }: ComponentProps<typeof BaseLinkItem> & VariantProps<typeof linkVariants>): import("react/jsx-runtime").JSX.Element;
14
- export declare function NavbarMenuItem(props: LinkProps): import("react/jsx-runtime").JSX.Element;
15
15
  export {};
16
16
  //# sourceMappingURL=navbar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/navbar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAY,MAAM,OAAO,CAAC;AAC3E,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,iCAAiC,CAAC;AAOzC,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAwBxD;AAED,eAAO,MAAM,UAAU,6JAAqB,CAAC;AAE7C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,0BAA0B,2CAYlE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,0BAA0B,2CASlE;AAED,QAAA,MAAM,YAAY;;8EAiBhB,CAAC;AAEH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,EACP,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,YAAY,CAAC,GAAG,YAAY,CAAC,OAAO,YAAY,CAAC,2CAczE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,2CAY9C"}
1
+ {"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/navbar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAY,MAAM,OAAO,CAAC;AAC3E,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,iCAAiC,CAAC;AAOzC,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAwBxD;AAED,eAAO,MAAM,UAAU,yNAAqB,CAAC;AAE7C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,0BAA0B,2CAYlE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,0BAA0B,2CASlE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,2CAc9C;AAED,QAAA,MAAM,YAAY;;8EAiBhB,CAAC;AAEH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,EACP,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,YAAY,CAAC,GAAG,YAAY,CAAC,OAAO,YAAY,CAAC,2CAczE"}
@@ -12,7 +12,7 @@ const navItemVariants = cva('inline-flex items-center gap-1 p-2 text-fd-muted-fo
12
12
  export function Navbar(props) {
13
13
  const [value, setValue] = useState('');
14
14
  const { isTransparent } = useNav();
15
- return (_jsx(NavigationMenu, { value: value, onValueChange: setValue, asChild: true, children: _jsxs("header", { id: "nd-nav", ...props, className: cn('fixed left-1/2 top-[var(--fd-banner-height)] z-40 w-full max-w-fd-container -translate-x-1/2 border-b border-fd-foreground/10 transition-colors lg:mt-2 lg:w-[calc(100%-1rem)] lg:rounded-2xl lg:border', value.length > 0 ? 'shadow-lg' : 'shadow-sm', (!isTransparent || value.length > 0) &&
15
+ return (_jsx(NavigationMenu, { value: value, onValueChange: setValue, asChild: true, children: _jsxs("header", { id: "nd-nav", ...props, className: cn('fixed left-1/2 top-[var(--fd-banner-height)] z-40 box-content w-full max-w-fd-container -translate-x-1/2 border-b border-fd-foreground/10 transition-colors lg:mt-2 lg:w-[calc(100%-1rem)] lg:rounded-2xl lg:border', value.length > 0 ? 'shadow-lg' : 'shadow-sm', (!isTransparent || value.length > 0) &&
16
16
  'bg-fd-background/80 backdrop-blur-lg', props.className), children: [_jsx("nav", { className: "flex h-14 w-full flex-row items-center gap-6 px-4 lg:h-12", children: props.children }), _jsx(NavigationMenuViewport, {})] }) }));
17
17
  }
18
18
  export const NavbarMenu = NavigationMenuItem;
@@ -22,7 +22,10 @@ export function NavbarMenuContent(props) {
22
22
  export function NavbarMenuTrigger(props) {
23
23
  return (_jsx(NavigationMenuTrigger, { ...props, className: cn(navItemVariants(), 'rounded-md', props.className), children: props.children }));
24
24
  }
25
- const linkVariants = cva(undefined, {
25
+ export function NavbarMenuLink(props) {
26
+ return (_jsx(NavigationMenuLink, { asChild: true, children: _jsx(Link, { ...props, className: cn('flex flex-col gap-2 rounded-lg border bg-fd-card p-3 transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground', props.className), children: props.children }) }));
27
+ }
28
+ const linkVariants = cva('', {
26
29
  variants: {
27
30
  variant: {
28
31
  main: navItemVariants(),
@@ -41,8 +44,5 @@ const linkVariants = cva(undefined, {
41
44
  },
42
45
  });
43
46
  export function NavbarLink({ item, variant, ...props }) {
44
- return (_jsx(NavigationMenuItem, { className: "list-none", children: _jsx(NavigationMenuLink, { asChild: true, children: _jsx(BaseLinkItem, { ...props, item: item, className: cn(linkVariants({ variant }), props.className), children: props.children }) }) }));
45
- }
46
- export function NavbarMenuItem(props) {
47
- return (_jsx(NavigationMenuLink, { asChild: true, children: _jsx(Link, { ...props, className: cn('flex flex-col gap-2 rounded-lg border bg-fd-card p-3 transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground', props.className) }) }));
47
+ return (_jsx(NavigationMenuItem, { children: _jsx(NavigationMenuLink, { asChild: true, children: _jsx(BaseLinkItem, { ...props, item: item, className: cn(linkVariants({ variant }), props.className), children: props.children }) }) }));
48
48
  }
@@ -1,5 +1,13 @@
1
1
  import type { HTMLAttributes } from 'react';
2
+ import { type NavOptions } from '../layouts/shared';
2
3
  import { type BaseLayoutProps } from './shared';
3
- export type HomeLayoutProps = BaseLayoutProps & HTMLAttributes<HTMLElement>;
4
+ export interface HomeLayoutProps extends BaseLayoutProps, HTMLAttributes<HTMLElement> {
5
+ nav?: Partial<NavOptions & {
6
+ /**
7
+ * Open mobile menu when hovering the trigger
8
+ */
9
+ enableHoverToOpen?: boolean;
10
+ }>;
11
+ }
4
12
  export declare function HomeLayout(props: HomeLayoutProps): import("react/jsx-runtime").JSX.Element;
5
13
  //# sourceMappingURL=home.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/layouts/home.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAgC1D,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;AAE5E,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CA0ChD"}
1
+ {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/layouts/home.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AA+B1D,MAAM,WAAW,eACf,SAAQ,eAAe,EACrB,cAAc,CAAC,WAAW,CAAC;IAC7B,GAAG,CAAC,EAAE,OAAO,CACX,UAAU,GAAG;QACX;;WAEG;QACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAC7B,CACF,CAAC;CACH;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CA0BhD"}
@@ -1,24 +1,21 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { replaceOrDefault } from '../layouts/shared';
3
3
  import { cn } from '../utils/cn';
4
4
  import { getLinks } from './shared';
5
5
  import { NavProvider, Title } from '../components/layout/nav';
6
- import { NavigationMenuContent, NavigationMenuItem, NavigationMenuList, NavigationMenuTrigger, } from '../components/ui/navigation-menu';
7
- import { Navbar, NavbarLink, NavbarMenu, NavbarMenuContent, NavbarMenuItem, NavbarMenuTrigger, } from '../layouts/home/navbar';
6
+ import { NavigationMenuList } from '../components/ui/navigation-menu';
7
+ import { Navbar, NavbarLink, NavbarMenu, NavbarMenuContent, NavbarMenuLink, NavbarMenuTrigger, } from '../layouts/home/navbar';
8
8
  import { LargeSearchToggle, SearchToggle, } from '../components/layout/search-toggle';
9
9
  import { ThemeToggle } from '../components/layout/theme-toggle';
10
10
  import { LanguageToggle, LanguageToggleText, } from '../components/layout/language-toggle';
11
11
  import { ChevronDown, Languages } from 'lucide-react';
12
- import { buttonVariants } from '../components/ui/button';
13
12
  import { SearchOnly } from '../contexts/search';
14
13
  import Link from 'fumadocs-core/link';
15
- import { MenuLinkItem } from '../layouts/home/menu';
14
+ import { Menu, MenuContent, MenuLinkItem, MenuTrigger, } from '../layouts/home/menu';
16
15
  export function HomeLayout(props) {
17
16
  const { nav, links, githubUrl, i18n: _i18n, disableThemeSwitch: _disableThemeSwitch, ...rest } = props;
18
17
  const finalLinks = getLinks(links, githubUrl);
19
- return (_jsx(NavProvider, { transparentMode: nav?.transparentMode, children: _jsxs("main", { id: "nd-home-layout", ...rest, className: cn('flex flex-1 flex-col pt-[var(--fd-nav-height)] [--fd-nav-height:56px]', rest.className), children: [replaceOrDefault(nav, _jsxs(_Fragment, { children: [_jsx("div", { "aria-hidden": "true", className: "fixed inset-x-0 top-[var(--fd-banner-height)] z-40 h-6 bg-fd-background", style: {
20
- maskImage: 'linear-gradient(to bottom,white,transparent)',
21
- } }), _jsx(Header, { finalLinks: finalLinks, ...props })] }), {
18
+ return (_jsx(NavProvider, { transparentMode: nav?.transparentMode, children: _jsxs("main", { id: "nd-home-layout", ...rest, className: cn('flex flex-1 flex-col pt-14', rest.className), children: [replaceOrDefault(nav, _jsx(Header, { finalLinks: finalLinks, ...props }), {
22
19
  items: finalLinks,
23
20
  }), props.children] }) }));
24
21
  }
@@ -27,10 +24,7 @@ function Header({ nav: { enableSearch = true, ...nav } = {}, i18n = false, final
27
24
  const menuItems = finalLinks.filter((item) => ['menu', 'all'].includes(item.on ?? 'all'));
28
25
  return (_jsxs(Navbar, { children: [_jsx(Title, { title: nav.title, url: nav.url }), nav.children, _jsx(NavigationMenuList, { className: "flex flex-row items-center gap-2 max-sm:hidden", children: navItems
29
26
  .filter((item) => !isSecondary(item))
30
- .map((item, i) => (_jsx(NavbarLinkItem, { item: item, className: "text-sm" }, i))) }), _jsxs("div", { className: "flex flex-1 flex-row items-center justify-end lg:gap-1.5", children: [enableSearch ? (_jsxs(SearchOnly, { children: [_jsx(SearchToggle, { className: "lg:hidden" }), _jsx(LargeSearchToggle, { className: "w-full max-w-[240px] max-lg:hidden" })] })) : null, !disableThemeSwitch ? _jsx(ThemeToggle, { className: "max-lg:hidden" }) : null, i18n ? (_jsx(LanguageToggle, { className: "-me-1.5 max-lg:hidden", children: _jsx(Languages, { className: "size-5" }) })) : null, navItems.filter(isSecondary).map((item, i) => (_jsx(NavbarLinkItem, { item: item, className: "-me-1.5 list-none max-lg:hidden" }, i))), _jsxs(NavigationMenuItem, { className: "list-none lg:hidden", children: [_jsx(NavigationMenuTrigger, { className: cn(buttonVariants({
31
- size: 'icon',
32
- color: 'ghost',
33
- }), 'group -me-2'), children: _jsx(ChevronDown, { className: "size-3 transition-transform duration-300 group-data-[state=open]:rotate-180" }) }), _jsxs(NavigationMenuContent, { className: "flex flex-col p-4 sm:flex-row sm:items-center sm:justify-end", children: [menuItems
27
+ .map((item, i) => (_jsx(NavbarLinkItem, { item: item, className: "text-sm" }, i))) }), _jsxs("div", { className: "flex flex-1 flex-row items-center justify-end lg:gap-1.5", children: [enableSearch ? (_jsxs(SearchOnly, { children: [_jsx(SearchToggle, { className: "lg:hidden" }), _jsx(LargeSearchToggle, { className: "w-full max-w-[240px] max-lg:hidden" })] })) : null, !disableThemeSwitch ? _jsx(ThemeToggle, { className: "max-lg:hidden" }) : null, i18n ? (_jsx(LanguageToggle, { className: "-me-1.5 max-lg:hidden", children: _jsx(Languages, { className: "size-5" }) })) : null, navItems.filter(isSecondary).map((item, i) => (_jsx(NavbarLinkItem, { item: item, className: "-me-1.5 max-lg:hidden" }, i))), _jsxs(Menu, { className: "lg:hidden", children: [_jsx(MenuTrigger, { className: "group -me-2", enableHover: nav.enableHoverToOpen, children: _jsx(ChevronDown, { className: "size-3 transition-transform duration-300 group-data-[state=open]:rotate-180" }) }), _jsxs(MenuContent, { className: "sm:flex-row sm:items-center sm:justify-end", children: [menuItems
34
28
  .filter((item) => !isSecondary(item))
35
29
  .map((item, i) => (_jsx(MenuLinkItem, { item: item, className: "sm:hidden" }, i))), _jsxs("div", { className: "-ms-1.5 flex flex-row items-center gap-1.5 max-sm:mt-2", children: [menuItems.filter(isSecondary).map((item, i) => (_jsx(MenuLinkItem, { item: item, className: "-me-1.5" }, i))), _jsx("div", { role: "separator", className: "flex-1" }), i18n ? (_jsxs(LanguageToggle, { children: [_jsx(Languages, { className: "size-5" }), _jsx(LanguageToggleText, {}), _jsx(ChevronDown, { className: "size-3 text-fd-muted-foreground" })] })) : null, !disableThemeSwitch ? _jsx(ThemeToggle, {}) : null] })] })] })] })] }));
36
30
  }
@@ -42,7 +36,7 @@ function NavbarLinkItem({ item, ...props }) {
42
36
  if (child.type === 'custom')
43
37
  return _jsx("div", { children: child.children }, j);
44
38
  const { banner, footer, ...rest } = child.menu ?? {};
45
- return (_jsxs(NavbarMenuItem, { href: child.url, ...rest, children: [banner ??
39
+ return (_jsxs(NavbarMenuLink, { href: child.url, ...rest, children: [banner ??
46
40
  (child.icon ? (_jsx("div", { className: "w-fit rounded-md border bg-fd-muted p-1 [&_svg]:size-4", children: child.icon })) : null), _jsx("p", { className: "-mb-1 text-sm font-medium", children: child.text }), child.description ? (_jsx("p", { className: "text-[13px] text-fd-muted-foreground", children: child.description })) : null, footer] }, j));
47
41
  });
48
42
  return (_jsxs(NavbarMenu, { children: [_jsx(NavbarMenuTrigger, { ...props, children: item.url ? _jsx(Link, { href: item.url, children: item.text }) : item.text }), _jsx(NavbarMenuContent, { children: children })] }));
package/dist/mdx.d.ts CHANGED
@@ -21,19 +21,5 @@ declare const defaultMdxComponents: {
21
21
  icon?: import("react").ReactNode;
22
22
  } & import("react").RefAttributes<HTMLDivElement>>;
23
23
  };
24
- /**
25
- * **Server Component Only**
26
- *
27
- * Sometimes, if you directly pass a client component to MDX Components, it will throw an error
28
- *
29
- * To solve this, you can re-create the component in a server component like: `(props) => <Component {...props} />`
30
- *
31
- * This function does that for you
32
- *
33
- * @param c - MDX Components
34
- * @returns MDX Components with re-created client components
35
- * @deprecated no longer used
36
- */
37
- export declare function createComponents<Components extends Record<string, FC<unknown>>>(c: Components): Components;
38
24
  export { defaultMdxComponents as default };
39
25
  //# sourceMappingURL=mdx.d.ts.map
package/dist/mdx.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,EAAE,EACF,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAMhD,iBAAS,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,2CAQxD;AAED,iBAAS,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,2CAM1D;AAED,QAAA,MAAM,oBAAoB;SACZ,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;;;OAGnC,EAAE,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;;gBAE1C,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;;;;;;;CAK/C,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAC9C,CAAC,EAAE,UAAU,GAAG,UAAU,CAU3B;AAED,OAAO,EAAE,oBAAoB,IAAI,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,EAAE,EACF,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAMhD,iBAAS,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,2CAQxD;AAED,iBAAS,KAAK,CAAC,KAAK,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,2CAM1D;AAED,QAAA,MAAM,oBAAoB;SACZ,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;;;OAGnC,EAAE,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;;gBAE1C,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;gBAGlC,cAAc,CAAC,kBAAkB,CAAC;;;;;;;CAK/C,CAAC;AAEF,OAAO,EAAE,oBAAoB,IAAI,OAAO,EAAE,CAAC"}
package/dist/mdx.js CHANGED
@@ -27,27 +27,4 @@ const defaultMdxComponents = {
27
27
  table: Table,
28
28
  Callout,
29
29
  };
30
- /**
31
- * **Server Component Only**
32
- *
33
- * Sometimes, if you directly pass a client component to MDX Components, it will throw an error
34
- *
35
- * To solve this, you can re-create the component in a server component like: `(props) => <Component {...props} />`
36
- *
37
- * This function does that for you
38
- *
39
- * @param c - MDX Components
40
- * @returns MDX Components with re-created client components
41
- * @deprecated no longer used
42
- */
43
- export function createComponents(c) {
44
- const mapped = Object.entries(c).map(([k, V]) => {
45
- // Client components are empty objects
46
- return [
47
- k,
48
- Object.keys(V).length === 0 ? (props) => _jsx(V, { ...props }) : V,
49
- ];
50
- });
51
- return Object.fromEntries(mapped);
52
- }
53
30
  export { defaultMdxComponents as default };
@@ -1 +1 @@
1
- {"version":3,"file":"page.client.d.ts","sourceRoot":"","sources":["../src/page.client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EAIpB,MAAM,OAAO,CAAC;AAWf,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAGlC,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CA2B3D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAY7D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAe7D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,2CAc/C;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;QACzC,IAAI,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;KACtC,CAAC;CACH;AAiCD,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,WAAW,2CA8C5C;AAED,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEhD,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,kDAiClD"}
1
+ {"version":3,"file":"page.client.d.ts","sourceRoot":"","sources":["../src/page.client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EAIpB,MAAM,OAAO,CAAC;AAWf,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAIlC,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CA2B3D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAY7D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAe7D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,2CAc/C;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;QACzC,IAAI,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;KACtC,CAAC;CACH;AAiCD,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,WAAW,2CA8C5C;AAED,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEhD,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,kDAiClD"}
@@ -12,6 +12,7 @@ import { usePathname } from 'next/navigation';
12
12
  import { useNav } from './components/layout/nav';
13
13
  import { getBreadcrumbItemsFromPath, } from 'fumadocs-core/breadcrumb';
14
14
  import { usePageStyles } from './contexts/layout';
15
+ import { isActive } from './utils/is-active';
15
16
  export function TocNav(props) {
16
17
  const { open } = useSidebar();
17
18
  const { tocNav } = usePageStyles();
@@ -67,7 +68,7 @@ export function Footer({ items }) {
67
68
  const cached = listCache.get(root);
68
69
  const list = cached ?? scanNavigationList(root.children);
69
70
  listCache.set(root, list);
70
- const idx = list.findIndex((item) => item.url === pathname);
71
+ const idx = list.findIndex((item) => isActive(item.url, pathname, false));
71
72
  if (idx === -1)
72
73
  return {};
73
74
  return {
package/dist/style.css CHANGED
@@ -1181,6 +1181,9 @@ body {
1181
1181
  .mt-auto {
1182
1182
  margin-top: auto;
1183
1183
  }
1184
+ .box-content {
1185
+ box-sizing: content-box;
1186
+ }
1184
1187
  .block {
1185
1188
  display: block;
1186
1189
  }
@@ -1226,15 +1229,9 @@ body {
1226
1229
  .h-1\.5 {
1227
1230
  height: 0.375rem;
1228
1231
  }
1229
- .h-12 {
1230
- height: 3rem;
1231
- }
1232
1232
  .h-14 {
1233
1233
  height: 3.5rem;
1234
1234
  }
1235
- .h-6 {
1236
- height: 1.5rem;
1237
- }
1238
1235
  .h-\[var\(--fd-height\)\] {
1239
1236
  height: var(--fd-height);
1240
1237
  }
@@ -1691,6 +1688,9 @@ body {
1691
1688
  .pt-12 {
1692
1689
  padding-top: 3rem;
1693
1690
  }
1691
+ .pt-14 {
1692
+ padding-top: 3.5rem;
1693
+ }
1694
1694
  .pt-2 {
1695
1695
  padding-top: 0.5rem;
1696
1696
  }
@@ -1700,9 +1700,6 @@ body {
1700
1700
  .pt-8 {
1701
1701
  padding-top: 2rem;
1702
1702
  }
1703
- .pt-\[var\(--fd-nav-height\)\] {
1704
- padding-top: var(--fd-nav-height);
1705
- }
1706
1703
  .text-center {
1707
1704
  text-align: center;
1708
1705
  }
@@ -1902,9 +1899,6 @@ body {
1902
1899
  .\[--fd-nav-height\:3\.5rem\] {
1903
1900
  --fd-nav-height: 3.5rem;
1904
1901
  }
1905
- .\[--fd-nav-height\:56px\] {
1906
- --fd-nav-height: 56px;
1907
- }
1908
1902
  .\[--fd-tocnav-height\:36px\] {
1909
1903
  --fd-tocnav-height: 36px;
1910
1904
  }
@@ -1 +1 @@
1
- {"version":3,"file":"is-active.d.ts","sourceRoot":"","sources":["../../src/utils/is-active.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,UAAO,GACZ,OAAO,CAET"}
1
+ {"version":3,"file":"is-active.d.ts","sourceRoot":"","sources":["../../src/utils/is-active.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,UAAO,GACZ,OAAO,CAKT"}
@@ -1,3 +1,7 @@
1
1
  export function isActive(url, pathname, nested = true) {
2
+ if (url.endsWith('/'))
3
+ url = url.slice(0, -1);
4
+ if (pathname.endsWith('/'))
5
+ pathname = pathname.slice(0, -1);
2
6
  return url === pathname || (nested && pathname.startsWith(`${url}/`));
3
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "14.7.2",
3
+ "version": "14.7.4",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -63,26 +63,26 @@
63
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.469.0",
66
+ "lucide-react": "^0.471.1",
67
67
  "next-themes": "^0.4.4",
68
68
  "postcss-selector-parser": "^7.0.0",
69
69
  "react-medium-image-zoom": "^5.2.13",
70
70
  "tailwind-merge": "^2.6.0"
71
71
  },
72
72
  "devDependencies": {
73
- "@next/eslint-plugin-next": "^15.1.3",
73
+ "@next/eslint-plugin-next": "^15.1.4",
74
74
  "@types/lodash.merge": "^4.6.9",
75
- "@types/react": "^19.0.2",
76
- "@types/react-dom": "^19.0.2",
75
+ "@types/react": "^19.0.7",
76
+ "@types/react-dom": "^19.0.3",
77
77
  "autoprefixer": "^10.4.20",
78
- "next": "15.1.3",
79
- "postcss": "^8.4.49",
78
+ "next": "15.1.4",
79
+ "postcss": "^8.5.1",
80
80
  "postcss-cli": "^11.0.0",
81
81
  "tailwindcss": "^3.4.17",
82
82
  "tsc-alias": "^1.8.10",
83
- "fumadocs-core": "14.7.2",
83
+ "@fumadocs/cli": "0.0.7",
84
84
  "eslint-config-custom": "0.0.0",
85
- "@fumadocs/cli": "0.0.6",
85
+ "fumadocs-core": "14.7.4",
86
86
  "tsconfig": "0.0.0"
87
87
  },
88
88
  "peerDependencies": {
@@ -90,7 +90,7 @@
90
90
  "react": "18.x.x || 19.x.x",
91
91
  "react-dom": "18.x.x || 19.x.x",
92
92
  "tailwindcss": "^3.4.14",
93
- "fumadocs-core": "14.7.2"
93
+ "fumadocs-core": "14.7.4"
94
94
  },
95
95
  "peerDependenciesMeta": {
96
96
  "tailwindcss": {