fumadocs-ui 15.0.4 → 15.0.5

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 +1 @@
1
- {"version":3,"file":"theme-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/layout/theme-toggle.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAA6B,MAAM,OAAO,CAAC;AAYvE,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,IAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAC/B,IAAI,CAAC,EAAE,YAAY,GAAG,mBAAmB,CAAC;CAC3C,2CAiDA"}
1
+ {"version":3,"file":"theme-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/layout/theme-toggle.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAA6B,MAAM,OAAO,CAAC;AAkBvE,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,IAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAC/B,IAAI,CAAC,EAAE,YAAY,GAAG,mBAAmB,CAAC;CAC3C,2CAsDA"}
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { cva } from 'class-variance-authority';
4
4
  import { Moon, Sun, Airplay } from 'lucide-react';
5
5
  import { useTheme } from 'next-themes';
@@ -13,6 +13,11 @@ const itemVariants = cva('size-7 rounded-full p-1.5 text-fd-muted-foreground', {
13
13
  },
14
14
  },
15
15
  });
16
+ const full = [
17
+ ['light', Sun],
18
+ ['dark', Moon],
19
+ ['system', Airplay],
20
+ ];
16
21
  export function ThemeToggle({ className, mode = 'light-dark', ...props }) {
17
22
  const { setTheme, theme, resolvedTheme } = useTheme();
18
23
  const [mounted, setMounted] = useState(false);
@@ -22,12 +27,12 @@ export function ThemeToggle({ className, mode = 'light-dark', ...props }) {
22
27
  const container = cn('inline-flex items-center rounded-full border p-[3px]', className);
23
28
  if (mode === 'light-dark') {
24
29
  const value = mounted ? resolvedTheme : null;
25
- return (_jsxs("button", { className: container, onClick: () => setTheme(value === 'light' ? 'dark' : 'light'), "data-theme-toggle": "", ...props, children: [_jsx(Sun, { className: cn(itemVariants({ active: value === 'light' })) }), _jsx(Moon, { className: cn(itemVariants({ active: value === 'dark' })) })] }));
30
+ return (_jsx("button", { className: container, "aria-label": `Toggle Theme`, onClick: () => setTheme(value === 'light' ? 'dark' : 'light'), "data-theme-toggle": "", ...props, children: full.map(([key, Icon]) => {
31
+ if (key === 'system')
32
+ return;
33
+ return (_jsx(Icon, { className: cn(itemVariants({ active: value === key })) }, key));
34
+ }) }));
26
35
  }
27
36
  const value = mounted ? theme : null;
28
- return (_jsx("div", { className: container, "data-theme-toggle": "", ...props, children: [
29
- ['light', Sun],
30
- ['dark', Moon],
31
- ['system', Airplay],
32
- ].map(([key, Icon]) => (_jsx("button", { "aria-label": key, className: cn(itemVariants({ active: value === key })), onClick: () => setTheme(key), children: _jsx(Icon, { className: "size-full" }) }, key))) }));
37
+ return (_jsx("div", { className: container, "data-theme-toggle": "", ...props, children: full.map(([key, Icon]) => (_jsx("button", { "aria-label": key, className: cn(itemVariants({ active: value === key })), onClick: () => setTheme(key), children: _jsx(Icon, { className: "size-full" }) }, key))) }));
33
38
  }
@@ -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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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"}
@@ -5,7 +5,7 @@ import { cva } from 'class-variance-authority';
5
5
  import Link from 'fumadocs-core/link';
6
6
  import { cn } from '../../utils/cn.js';
7
7
  import { BaseLinkItem } from '../../layouts/links.js';
8
- import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuTrigger, NavigationMenuViewport, } from '../../components/ui/navigation-menu.js';
8
+ import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, } from '../../components/ui/navigation-menu.js';
9
9
  import { useNav } from '../../components/layout/nav.js';
10
10
  import { buttonVariants } from '../../components/ui/button.js';
11
11
  const navItemVariants = cva('inline-flex items-center gap-1 p-2 text-fd-muted-foreground transition-colors hover:text-fd-accent-foreground data-[active=true]:text-fd-primary [&_svg]:size-4');
@@ -13,7 +13,7 @@ export function Navbar(props) {
13
13
  const [value, setValue] = useState('');
14
14
  const { isTransparent } = useNav();
15
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
- '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, {})] }) }));
16
+ 'bg-fd-background/80 backdrop-blur-lg', props.className), children: [_jsx(NavigationMenuList, { className: "flex h-14 w-full flex-row items-center px-4 lg:h-12", asChild: true, children: _jsx("nav", { children: props.children }) }), _jsx(NavigationMenuViewport, {})] }) }));
17
17
  }
18
18
  export const NavbarMenu = NavigationMenuItem;
19
19
  export function NavbarMenuContent(props) {
@@ -1,4 +1,4 @@
1
- import type { HTMLAttributes } from 'react';
1
+ import { type HTMLAttributes } from 'react';
2
2
  import { type NavOptions } from '../layouts/shared.js';
3
3
  import { type BaseLayoutProps } from './shared.js';
4
4
  export interface HomeLayoutProps extends BaseLayoutProps, HTMLAttributes<HTMLElement> {
@@ -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;AAC5C,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AA8B1D,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
+ {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/layouts/home.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AA6B1D,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,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Fragment } from 'react';
2
3
  import { replaceOrDefault } from '../layouts/shared.js';
3
4
  import { cn } from '../utils/cn.js';
4
5
  import { getLinks } from './shared.js';
5
6
  import { NavProvider, Title } from '../components/layout/nav.js';
6
- import { NavigationMenuList } from '../components/ui/navigation-menu.js';
7
7
  import { Navbar, NavbarLink, NavbarMenu, NavbarMenuContent, NavbarMenuLink, NavbarMenuTrigger, } from '../layouts/home/navbar.js';
8
8
  import { LargeSearchToggle, SearchToggle, } from '../components/layout/search-toggle.js';
9
9
  import { ThemeToggle } from '../components/layout/theme-toggle.js';
@@ -21,19 +21,19 @@ export function HomeLayout(props) {
21
21
  function Header({ nav: { enableSearch = true, ...nav } = {}, i18n = false, finalLinks, disableThemeSwitch, }) {
22
22
  const navItems = finalLinks.filter((item) => ['nav', 'all'].includes(item.on ?? 'all'));
23
23
  const menuItems = finalLinks.filter((item) => ['menu', 'all'].includes(item.on ?? 'all'));
24
- 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
24
+ return (_jsxs(Navbar, { children: [_jsx(Title, { title: nav.title, url: nav.url }), nav.children, _jsx("ul", { className: "flex flex-row items-center gap-2 px-6 max-sm:hidden", children: navItems
25
25
  .filter((item) => !isSecondary(item))
26
- .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(_Fragment, { children: [_jsx(SearchToggle, { className: "lg:hidden", hideIfDisabled: true }), _jsx(LargeSearchToggle, { className: "w-full max-w-[240px] max-lg:hidden", hideIfDisabled: true })] })) : 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
26
+ .map((item, i) => (_jsx(NavbarLinkItem, { item: item, className: "text-sm" }, i))) }), _jsxs("div", { className: "flex flex-row items-center justify-end gap-1.5 flex-1", children: [enableSearch ? (_jsxs(_Fragment, { children: [_jsx(SearchToggle, { className: "lg:hidden", hideIfDisabled: true }), _jsx(LargeSearchToggle, { className: "w-full max-w-[240px] max-lg:hidden", hideIfDisabled: true })] })) : null, !disableThemeSwitch ? _jsx(ThemeToggle, { className: "max-lg:hidden" }) : null, i18n ? (_jsx(LanguageToggle, { className: "max-lg:hidden", children: _jsx(Languages, { className: "size-5" }) })) : null] }), _jsxs("ul", { className: "flex flex-row items-center", children: [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, { "aria-label": "Toggle Menu", 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
27
27
  .filter((item) => !isSecondary(item))
28
28
  .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] })] })] })] })] }));
29
29
  }
30
30
  function NavbarLinkItem({ item, ...props }) {
31
31
  if (item.type === 'custom')
32
- return _jsx("div", { ...props, children: item.children });
32
+ return item.children;
33
33
  if (item.type === 'menu') {
34
34
  const children = item.items.map((child, j) => {
35
35
  if (child.type === 'custom')
36
- return _jsx("div", { children: child.children }, j);
36
+ return _jsx(Fragment, { children: child.children }, j);
37
37
  const { banner, footer, ...rest } = child.menu ?? {};
38
38
  return (_jsxs(NavbarMenuLink, { href: child.url, ...rest, children: [banner ??
39
39
  (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));
package/dist/style.css CHANGED
@@ -1564,6 +1564,9 @@
1564
1564
  .px-4 {
1565
1565
  padding-inline: calc(var(--spacing) * 4);
1566
1566
  }
1567
+ .px-6 {
1568
+ padding-inline: calc(var(--spacing) * 6);
1569
+ }
1567
1570
  .py-0\.5 {
1568
1571
  padding-block: calc(var(--spacing) * 0.5);
1569
1572
  }
@@ -2272,11 +2275,6 @@
2272
2275
  grid-template-columns: repeat(3, minmax(0, 1fr));
2273
2276
  }
2274
2277
  }
2275
- .lg\:gap-1\.5 {
2276
- @media (width >= 64rem) {
2277
- gap: calc(var(--spacing) * 1.5);
2278
- }
2279
- }
2280
2278
  .lg\:rounded-2xl {
2281
2279
  @media (width >= 64rem) {
2282
2280
  border-radius: var(--radius-2xl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-ui",
3
- "version": "15.0.4",
3
+ "version": "15.0.5",
4
4
  "description": "The framework for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -81,7 +81,7 @@
81
81
  "tsc-alias": "^1.8.10",
82
82
  "@fumadocs/cli": "0.0.8",
83
83
  "eslint-config-custom": "0.0.0",
84
- "fumadocs-core": "15.0.4",
84
+ "fumadocs-core": "15.0.5",
85
85
  "tsconfig": "0.0.0"
86
86
  },
87
87
  "peerDependencies": {
@@ -89,7 +89,7 @@
89
89
  "react": "18.x.x || 19.x.x",
90
90
  "react-dom": "18.x.x || 19.x.x",
91
91
  "tailwindcss": "^3.4.14 || ^4.0.0",
92
- "fumadocs-core": "15.0.4"
92
+ "fumadocs-core": "15.0.5"
93
93
  },
94
94
  "peerDependenciesMeta": {
95
95
  "tailwindcss": {