@fumadocs/base-ui 16.6.0 → 16.6.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.
- package/css/generated/notebook.css +0 -1
- package/css/generated/shared.css +10 -5
- package/dist/components/dialog/search.d.ts.map +1 -1
- package/dist/components/dialog/search.js +5 -3
- package/dist/components/dialog/search.js.map +1 -1
- package/dist/components/sidebar/base.d.ts +6 -1
- package/dist/components/sidebar/base.d.ts.map +1 -1
- package/dist/components/sidebar/base.js +2 -7
- package/dist/components/sidebar/base.js.map +1 -1
- package/dist/components/sidebar/link-item.d.ts.map +1 -1
- package/dist/components/sidebar/link-item.js +6 -0
- package/dist/components/sidebar/link-item.js.map +1 -1
- package/dist/components/sidebar/page-tree.d.ts.map +1 -1
- package/dist/components/sidebar/page-tree.js +54 -40
- package/dist/components/sidebar/page-tree.js.map +1 -1
- package/dist/components/type-table.d.ts +6 -3
- package/dist/components/type-table.d.ts.map +1 -1
- package/dist/components/type-table.js +21 -12
- package/dist/components/type-table.js.map +1 -1
- package/dist/components/ui/navigation-menu.d.ts +2 -2
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/layouts/docs/page/client.js +1 -1
- package/dist/layouts/docs/page/client.js.map +1 -1
- package/dist/layouts/flux/page/client.js +1 -1
- package/dist/layouts/flux/page/client.js.map +1 -1
- package/dist/layouts/home/navbar.d.ts +1 -1
- package/dist/layouts/home/navbar.d.ts.map +1 -1
- package/dist/layouts/notebook/client.d.ts +1 -1
- package/dist/layouts/notebook/client.d.ts.map +1 -1
- package/dist/layouts/notebook/client.js.map +1 -1
- package/dist/layouts/notebook/page/client.js +1 -1
- package/dist/layouts/notebook/page/client.js.map +1 -1
- package/dist/layouts/shared/index.d.ts +3 -3
- package/dist/layouts/shared/index.d.ts.map +1 -1
- package/dist/layouts/shared/search-toggle.js +1 -1
- package/dist/layouts/shared/search-toggle.js.map +1 -1
- package/dist/style.css +21 -10
- package/dist/utils/link-item.d.ts +3 -2
- package/dist/utils/link-item.d.ts.map +1 -1
- package/dist/utils/link-item.js +8 -4
- package/dist/utils/link-item.js.map +1 -1
- package/dist/utils/urls.js +1 -1
- package/dist/utils/urls.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-toggle.js","names":[],"sources":["../../../src/layouts/shared/search-toggle.tsx"],"sourcesContent":["'use client';\nimport type { ComponentProps } from 'react';\nimport { Search } from 'lucide-react';\nimport { useSearchContext } from '@/contexts/search';\nimport { useI18n } from '@/contexts/i18n';\nimport { cn } from '@/utils/cn';\nimport { type ButtonProps, buttonVariants } from '@/components/ui/button';\n\ninterface SearchToggleProps extends Omit<ComponentProps<'button'>, 'color'>, ButtonProps {\n hideIfDisabled?: boolean;\n}\n\nexport function SearchToggle({\n hideIfDisabled,\n size = 'icon-sm',\n color = 'ghost',\n ...props\n}: SearchToggleProps) {\n const { setOpenSearch, enabled } = useSearchContext();\n if (hideIfDisabled && !enabled) return null;\n\n return (\n <button\n type=\"button\"\n className={cn(\n buttonVariants({\n size,\n color,\n }),\n props.className,\n )}\n data-search=\"\"\n aria-label=\"Open Search\"\n onClick={() => {\n setOpenSearch(true);\n }}\n >\n <Search />\n </button>\n );\n}\n\nexport function LargeSearchToggle({\n hideIfDisabled,\n ...props\n}: ComponentProps<'button'> & {\n hideIfDisabled?: boolean;\n}) {\n const { enabled, hotKey, setOpenSearch } = useSearchContext();\n const { text } = useI18n();\n if (hideIfDisabled && !enabled) return null;\n\n return (\n <button\n type=\"button\"\n data-search-full=\"\"\n {...props}\n className={cn(\n 'inline-flex items-center gap-2 rounded-lg border bg-fd-secondary/50 p-1.5 ps-2 text-sm text-fd-muted-foreground transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground',\n props.className,\n )}\n onClick={() => {\n setOpenSearch(true);\n }}\n >\n <Search className=\"size-4\" />\n {text.search}\n <div className=\"ms-auto inline-flex gap-0.5\">\n {hotKey.map((k, i) => (\n <kbd key={i} className=\"rounded-md border bg-fd-background px-1.5\">\n {k.display}\n </kbd>\n ))}\n </div>\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;AAYA,SAAgB,aAAa,EAC3B,gBACA,OAAO,WACP,QAAQ,SACR,GAAG,SACiB;CACpB,MAAM,EAAE,eAAe,YAAY,kBAAkB;AACrD,KAAI,kBAAkB,CAAC,QAAS,QAAO;AAEvC,QACE,oBAAC;EACC,MAAK;EACL,WAAW,GACT,eAAe;GACb;GACA;GACD,CAAC,EACF,MAAM,UACP;EACD,eAAY;EACZ,cAAW;EACX,eAAe;AACb,iBAAc,KAAK;;YAGrB,oBAAC,WAAS;GACH;;AAIb,SAAgB,kBAAkB,EAChC,gBACA,GAAG,SAGF;CACD,MAAM,EAAE,SAAS,QAAQ,kBAAkB,kBAAkB;CAC7D,MAAM,EAAE,SAAS,SAAS;AAC1B,KAAI,kBAAkB,CAAC,QAAS,QAAO;AAEvC,QACE,qBAAC;EACC,MAAK;EACL,oBAAiB;EACjB,GAAI;EACJ,WAAW,GACT,
|
|
1
|
+
{"version":3,"file":"search-toggle.js","names":[],"sources":["../../../src/layouts/shared/search-toggle.tsx"],"sourcesContent":["'use client';\nimport type { ComponentProps } from 'react';\nimport { Search } from 'lucide-react';\nimport { useSearchContext } from '@/contexts/search';\nimport { useI18n } from '@/contexts/i18n';\nimport { cn } from '@/utils/cn';\nimport { type ButtonProps, buttonVariants } from '@/components/ui/button';\n\ninterface SearchToggleProps extends Omit<ComponentProps<'button'>, 'color'>, ButtonProps {\n hideIfDisabled?: boolean;\n}\n\nexport function SearchToggle({\n hideIfDisabled,\n size = 'icon-sm',\n color = 'ghost',\n ...props\n}: SearchToggleProps) {\n const { setOpenSearch, enabled } = useSearchContext();\n if (hideIfDisabled && !enabled) return null;\n\n return (\n <button\n type=\"button\"\n className={cn(\n buttonVariants({\n size,\n color,\n }),\n props.className,\n )}\n data-search=\"\"\n aria-label=\"Open Search\"\n onClick={() => {\n setOpenSearch(true);\n }}\n >\n <Search />\n </button>\n );\n}\n\nexport function LargeSearchToggle({\n hideIfDisabled,\n ...props\n}: ComponentProps<'button'> & {\n hideIfDisabled?: boolean;\n}) {\n const { enabled, hotKey, setOpenSearch } = useSearchContext();\n const { text } = useI18n();\n if (hideIfDisabled && !enabled) return null;\n\n return (\n <button\n type=\"button\"\n data-search-full=\"\"\n {...props}\n className={cn(\n 'inline-flex items-center gap-2 rounded-lg border bg-fd-secondary/50 p-1.5 ps-2 text-sm text-fd-muted-foreground transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fd-ring',\n props.className,\n )}\n onClick={() => {\n setOpenSearch(true);\n }}\n >\n <Search className=\"size-4\" />\n {text.search}\n <div className=\"ms-auto inline-flex gap-0.5\">\n {hotKey.map((k, i) => (\n <kbd key={i} className=\"rounded-md border bg-fd-background px-1.5\">\n {k.display}\n </kbd>\n ))}\n </div>\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;AAYA,SAAgB,aAAa,EAC3B,gBACA,OAAO,WACP,QAAQ,SACR,GAAG,SACiB;CACpB,MAAM,EAAE,eAAe,YAAY,kBAAkB;AACrD,KAAI,kBAAkB,CAAC,QAAS,QAAO;AAEvC,QACE,oBAAC;EACC,MAAK;EACL,WAAW,GACT,eAAe;GACb;GACA;GACD,CAAC,EACF,MAAM,UACP;EACD,eAAY;EACZ,cAAW;EACX,eAAe;AACb,iBAAc,KAAK;;YAGrB,oBAAC,WAAS;GACH;;AAIb,SAAgB,kBAAkB,EAChC,gBACA,GAAG,SAGF;CACD,MAAM,EAAE,SAAS,QAAQ,kBAAkB,kBAAkB;CAC7D,MAAM,EAAE,SAAS,SAAS;AAC1B,KAAI,kBAAkB,CAAC,QAAS,QAAO;AAEvC,QACE,qBAAC;EACC,MAAK;EACL,oBAAiB;EACjB,GAAI;EACJ,WAAW,GACT,mQACA,MAAM,UACP;EACD,eAAe;AACb,iBAAc,KAAK;;;GAGrB,oBAAC,UAAO,WAAU,WAAW;GAC5B,KAAK;GACN,oBAAC;IAAI,WAAU;cACZ,OAAO,KAAK,GAAG,MACd,oBAAC;KAAY,WAAU;eACpB,EAAE;OADK,EAEJ,CACN;KACE;;GACC"}
|
package/dist/style.css
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
8
8
|
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
|
9
9
|
"Courier New", monospace;
|
|
10
|
-
--color-black: #000;
|
|
11
10
|
--spacing: 0.25rem;
|
|
12
11
|
--breakpoint-sm: 40rem;
|
|
13
12
|
--container-sm: 24rem;
|
|
@@ -66,6 +65,7 @@
|
|
|
66
65
|
--color-fd-diff-add-symbol: rgb(10, 200, 100);
|
|
67
66
|
--animate-fd-fade-in: fd-fade-in 300ms ease;
|
|
68
67
|
--animate-fd-fade-out: fd-fade-out 300ms ease;
|
|
68
|
+
--animate-fd-dialog-in: fd-dialog-in 300ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
69
69
|
--animate-fd-dialog-out: fd-dialog-out 300ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
70
70
|
--animate-fd-popover-in: fd-popover-in 100ms ease;
|
|
71
71
|
--animate-fd-popover-out: fd-popover-out 100ms ease;
|
|
@@ -1037,12 +1037,12 @@
|
|
|
1037
1037
|
.w-1\.5 {
|
|
1038
1038
|
width: calc(var(--spacing) * 1.5);
|
|
1039
1039
|
}
|
|
1040
|
+
.w-1\/4 {
|
|
1041
|
+
width: calc(1/4 * 100%);
|
|
1042
|
+
}
|
|
1040
1043
|
.w-4 {
|
|
1041
1044
|
width: calc(var(--spacing) * 4);
|
|
1042
1045
|
}
|
|
1043
|
-
.w-\[25\%\] {
|
|
1044
|
-
width: 25%;
|
|
1045
|
-
}
|
|
1046
1046
|
.w-\[85\%\] {
|
|
1047
1047
|
width: 85%;
|
|
1048
1048
|
}
|
|
@@ -1167,6 +1167,9 @@
|
|
|
1167
1167
|
.animate-pulse {
|
|
1168
1168
|
animation: var(--animate-pulse);
|
|
1169
1169
|
}
|
|
1170
|
+
.scroll-m-20 {
|
|
1171
|
+
scroll-margin: calc(var(--spacing) * 20);
|
|
1172
|
+
}
|
|
1170
1173
|
.scroll-m-24 {
|
|
1171
1174
|
scroll-margin: calc(var(--spacing) * 24);
|
|
1172
1175
|
}
|
|
@@ -1759,12 +1762,6 @@
|
|
|
1759
1762
|
--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
|
|
1760
1763
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
1761
1764
|
}
|
|
1762
|
-
.shadow-black\/50 {
|
|
1763
|
-
--tw-shadow-color: color-mix(in srgb, #000 50%, transparent);
|
|
1764
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
1765
|
-
--tw-shadow-color: color-mix(in oklab, color-mix(in oklab, var(--color-black) 50%, transparent) var(--tw-shadow-alpha), transparent);
|
|
1766
|
-
}
|
|
1767
|
-
}
|
|
1768
1765
|
.outline {
|
|
1769
1766
|
outline-style: var(--tw-outline-style);
|
|
1770
1767
|
outline-width: 1px;
|
|
@@ -2287,6 +2284,11 @@
|
|
|
2287
2284
|
transition-property: none;
|
|
2288
2285
|
}
|
|
2289
2286
|
}
|
|
2287
|
+
.data-open\:animate-fd-dialog-in {
|
|
2288
|
+
&[data-open] {
|
|
2289
|
+
animation: var(--animate-fd-dialog-in);
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2290
2292
|
.data-open\:animate-fd-fade-in {
|
|
2291
2293
|
&[data-open] {
|
|
2292
2294
|
animation: var(--animate-fd-fade-in);
|
|
@@ -3235,6 +3237,15 @@
|
|
|
3235
3237
|
transform: translateX(var(--fd-sidebar-drawer-offset));
|
|
3236
3238
|
}
|
|
3237
3239
|
}
|
|
3240
|
+
@keyframes fd-dialog-in {
|
|
3241
|
+
from {
|
|
3242
|
+
transform: scale(1.06);
|
|
3243
|
+
opacity: 0;
|
|
3244
|
+
}
|
|
3245
|
+
to {
|
|
3246
|
+
transform: scale(1);
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3238
3249
|
@keyframes fd-dialog-out {
|
|
3239
3250
|
from {
|
|
3240
3251
|
transform: scale(1);
|
|
@@ -79,8 +79,9 @@ declare function LinkItem({
|
|
|
79
79
|
item,
|
|
80
80
|
...props
|
|
81
81
|
}: Omit<ComponentProps<'a'>, 'href'> & {
|
|
82
|
-
item: WithHref;
|
|
82
|
+
item: LinkItemType & WithHref;
|
|
83
83
|
}): react_jsx_runtime0.JSX.Element;
|
|
84
|
+
declare function useLinkItemActive(link: LinkItemType): boolean;
|
|
84
85
|
//#endregion
|
|
85
|
-
export { ButtonItemType, CustomItemType, IconItemType, LinkItem, LinkItemType, MainItemType, MenuItemType };
|
|
86
|
+
export { ButtonItemType, CustomItemType, IconItemType, LinkItem, LinkItemType, MainItemType, MenuItemType, useLinkItemActive };
|
|
86
87
|
//# sourceMappingURL=link-item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-item.d.ts","names":[],"sources":["../../src/utils/link-item.tsx"],"mappings":";;;;UAMU,UAAA;;;AAL6C;;;EAWrD,EAAA;AAAA;AAAA,UAGQ,QAAA;EACR,GAAA;;;;;;EAMA,MAAA;EACA,QAAA;AAAA;AAAA,UAGe,YAAA,SAAqB,QAAA,EAAU,UAAA;EAC9C,IAAA;EACA,IAAA,GAAO,SAAA;EACP,IAAA,EAAM,SAAA;EACN,WAAA,GAAc,SAAA;AAAA;AAAA,UAGC,YAAA,SAAqB,QAAA,EAAU,UAAA;EAC9C,IAAA;EARwD;;;EAYxD,KAAA;EACA,IAAA,EAAM,SAAA;EACN,IAAA,EAAM,SAAA;EAXN;;;EAeA,SAAA;AAAA;AAAA,UAGe,cAAA,SAAuB,QAAA,EAAU,UAAA;EAChD,IAAA;EACA,IAAA,GAAO,SAAA;EACP,IAAA,EAAM,SAAA;EAXA;;;EAeN,SAAA;AAAA;AAAA,UAGe,YAAA,SAAqB,OAAA,CAAQ,QAAA,GAAW,UAAA;EACvD,IAAA;EACA,IAAA,GAAO,SAAA;EACP,IAAA,EAAM,SAAA;EAEN,KAAA,IACK,YAAA;IAxBL;;;IA4BM,IAAA,GAAO,cAAA;MACL,MAAA,GAAS,SAAA;IAAA;EAAA,KAGb,cAAA;EAxBW;;;EA8Bf,SAAA;AAAA;AAAA,UAGe,cAAA,SAAuB,UAAA;EACtC,IAAA;EAlC0D;;;EAsC1D,SAAA;EACA,QAAA,EAAU,SAAA;AAAA;AAAA,KAGA,YAAA,GACR,YAAA,GACA,YAAA,GACA,cAAA,GACA,YAAA,GACA,cAAA;AAAA,iBAEY,QAAA,CAAA;EACd,GAAA;EACA,IAAA;EAAA,GACG;AAAA,GACF,IAAA,CAAK,cAAA;EAAiC,IAAA,EAAM,QAAA;AAAA,IAAU,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
1
|
+
{"version":3,"file":"link-item.d.ts","names":[],"sources":["../../src/utils/link-item.tsx"],"mappings":";;;;UAMU,UAAA;;;AAL6C;;;EAWrD,EAAA;AAAA;AAAA,UAGQ,QAAA;EACR,GAAA;;;;;;EAMA,MAAA;EACA,QAAA;AAAA;AAAA,UAGe,YAAA,SAAqB,QAAA,EAAU,UAAA;EAC9C,IAAA;EACA,IAAA,GAAO,SAAA;EACP,IAAA,EAAM,SAAA;EACN,WAAA,GAAc,SAAA;AAAA;AAAA,UAGC,YAAA,SAAqB,QAAA,EAAU,UAAA;EAC9C,IAAA;EARwD;;;EAYxD,KAAA;EACA,IAAA,EAAM,SAAA;EACN,IAAA,EAAM,SAAA;EAXN;;;EAeA,SAAA;AAAA;AAAA,UAGe,cAAA,SAAuB,QAAA,EAAU,UAAA;EAChD,IAAA;EACA,IAAA,GAAO,SAAA;EACP,IAAA,EAAM,SAAA;EAXA;;;EAeN,SAAA;AAAA;AAAA,UAGe,YAAA,SAAqB,OAAA,CAAQ,QAAA,GAAW,UAAA;EACvD,IAAA;EACA,IAAA,GAAO,SAAA;EACP,IAAA,EAAM,SAAA;EAEN,KAAA,IACK,YAAA;IAxBL;;;IA4BM,IAAA,GAAO,cAAA;MACL,MAAA,GAAS,SAAA;IAAA;EAAA,KAGb,cAAA;EAxBW;;;EA8Bf,SAAA;AAAA;AAAA,UAGe,cAAA,SAAuB,UAAA;EACtC,IAAA;EAlC0D;;;EAsC1D,SAAA;EACA,QAAA,EAAU,SAAA;AAAA;AAAA,KAGA,YAAA,GACR,YAAA,GACA,YAAA,GACA,cAAA,GACA,YAAA,GACA,cAAA;AAAA,iBAEY,QAAA,CAAA;EACd,GAAA;EACA,IAAA;EAAA,GACG;AAAA,GACF,IAAA,CAAK,cAAA;EAAiC,IAAA,EAAM,YAAA,GAAe,QAAA;AAAA,IAAU,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAUxD,iBAAA,CAAkB,IAAA,EAAM,YAAA"}
|
package/dist/utils/link-item.js
CHANGED
|
@@ -7,9 +7,7 @@ import Link from "fumadocs-core/link";
|
|
|
7
7
|
|
|
8
8
|
//#region src/utils/link-item.tsx
|
|
9
9
|
function LinkItem({ ref, item, ...props }) {
|
|
10
|
-
const
|
|
11
|
-
const activeType = item.active ?? "url";
|
|
12
|
-
const active = activeType !== "none" && isActive(item.url, pathname, activeType === "nested-url");
|
|
10
|
+
const active = useLinkItemActive(item);
|
|
13
11
|
return /* @__PURE__ */ jsx(Link, {
|
|
14
12
|
ref,
|
|
15
13
|
href: item.url,
|
|
@@ -19,7 +17,13 @@ function LinkItem({ ref, item, ...props }) {
|
|
|
19
17
|
children: props.children
|
|
20
18
|
});
|
|
21
19
|
}
|
|
20
|
+
function useLinkItemActive(link) {
|
|
21
|
+
const pathname = usePathname();
|
|
22
|
+
if (link.type === "custom" || !link.url) return false;
|
|
23
|
+
if (link.active === "none") return false;
|
|
24
|
+
return isActive(link.url, pathname, link.active === "nested-url");
|
|
25
|
+
}
|
|
22
26
|
|
|
23
27
|
//#endregion
|
|
24
|
-
export { LinkItem };
|
|
28
|
+
export { LinkItem, useLinkItemActive };
|
|
25
29
|
//# sourceMappingURL=link-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-item.js","names":[],"sources":["../../src/utils/link-item.tsx"],"sourcesContent":["'use client';\nimport type { ComponentProps, ReactNode } from 'react';\nimport { usePathname } from 'fumadocs-core/framework';\nimport { isActive } from './urls';\nimport Link from 'fumadocs-core/link';\n\ninterface Filterable {\n /**\n * Restrict where the item is displayed\n *\n * @defaultValue 'all'\n */\n on?: 'menu' | 'nav' | 'all';\n}\n\ninterface WithHref {\n url: string;\n /**\n * When the item is marked as active\n *\n * @defaultValue 'url'\n */\n active?: 'url' | 'nested-url' | 'none';\n external?: boolean;\n}\n\nexport interface MainItemType extends WithHref, Filterable {\n type?: 'main';\n icon?: ReactNode;\n text: ReactNode;\n description?: ReactNode;\n}\n\nexport interface IconItemType extends WithHref, Filterable {\n type: 'icon';\n /**\n * `aria-label` of icon button\n */\n label?: string;\n icon: ReactNode;\n text: ReactNode;\n /**\n * @defaultValue true\n */\n secondary?: boolean;\n}\n\nexport interface ButtonItemType extends WithHref, Filterable {\n type: 'button';\n icon?: ReactNode;\n text: ReactNode;\n /**\n * @defaultValue false\n */\n secondary?: boolean;\n}\n\nexport interface MenuItemType extends Partial<WithHref>, Filterable {\n type: 'menu';\n icon?: ReactNode;\n text: ReactNode;\n\n items: (\n | (MainItemType & {\n /**\n * Options when displayed on navigation menu\n */\n menu?: ComponentProps<'a'> & {\n banner?: ReactNode;\n };\n })\n | CustomItemType\n )[];\n\n /**\n * @defaultValue false\n */\n secondary?: boolean;\n}\n\nexport interface CustomItemType extends Filterable {\n type: 'custom';\n /**\n * @defaultValue false\n */\n secondary?: boolean;\n children: ReactNode;\n}\n\nexport type LinkItemType =\n | MainItemType\n | IconItemType\n | ButtonItemType\n | MenuItemType\n | CustomItemType;\n\nexport function LinkItem({\n ref,\n item,\n ...props\n}: Omit<ComponentProps<'a'>, 'href'> & { item: WithHref }) {\n const
|
|
1
|
+
{"version":3,"file":"link-item.js","names":[],"sources":["../../src/utils/link-item.tsx"],"sourcesContent":["'use client';\nimport type { ComponentProps, ReactNode } from 'react';\nimport { usePathname } from 'fumadocs-core/framework';\nimport { isActive } from './urls';\nimport Link from 'fumadocs-core/link';\n\ninterface Filterable {\n /**\n * Restrict where the item is displayed\n *\n * @defaultValue 'all'\n */\n on?: 'menu' | 'nav' | 'all';\n}\n\ninterface WithHref {\n url: string;\n /**\n * When the item is marked as active\n *\n * @defaultValue 'url'\n */\n active?: 'url' | 'nested-url' | 'none';\n external?: boolean;\n}\n\nexport interface MainItemType extends WithHref, Filterable {\n type?: 'main';\n icon?: ReactNode;\n text: ReactNode;\n description?: ReactNode;\n}\n\nexport interface IconItemType extends WithHref, Filterable {\n type: 'icon';\n /**\n * `aria-label` of icon button\n */\n label?: string;\n icon: ReactNode;\n text: ReactNode;\n /**\n * @defaultValue true\n */\n secondary?: boolean;\n}\n\nexport interface ButtonItemType extends WithHref, Filterable {\n type: 'button';\n icon?: ReactNode;\n text: ReactNode;\n /**\n * @defaultValue false\n */\n secondary?: boolean;\n}\n\nexport interface MenuItemType extends Partial<WithHref>, Filterable {\n type: 'menu';\n icon?: ReactNode;\n text: ReactNode;\n\n items: (\n | (MainItemType & {\n /**\n * Options when displayed on navigation menu\n */\n menu?: ComponentProps<'a'> & {\n banner?: ReactNode;\n };\n })\n | CustomItemType\n )[];\n\n /**\n * @defaultValue false\n */\n secondary?: boolean;\n}\n\nexport interface CustomItemType extends Filterable {\n type: 'custom';\n /**\n * @defaultValue false\n */\n secondary?: boolean;\n children: ReactNode;\n}\n\nexport type LinkItemType =\n | MainItemType\n | IconItemType\n | ButtonItemType\n | MenuItemType\n | CustomItemType;\n\nexport function LinkItem({\n ref,\n item,\n ...props\n}: Omit<ComponentProps<'a'>, 'href'> & { item: LinkItemType & WithHref }) {\n const active = useLinkItemActive(item);\n\n return (\n <Link ref={ref} href={item.url} external={item.external} {...props} data-active={active}>\n {props.children}\n </Link>\n );\n}\n\nexport function useLinkItemActive(link: LinkItemType) {\n const pathname = usePathname();\n\n if (link.type === 'custom' || !link.url) return false;\n if (link.active === 'none') return false;\n\n return isActive(link.url, pathname, link.active === 'nested-url');\n}\n"],"mappings":";;;;;;;;AAgGA,SAAgB,SAAS,EACvB,KACA,MACA,GAAG,SACqE;CACxE,MAAM,SAAS,kBAAkB,KAAK;AAEtC,QACE,oBAAC;EAAU;EAAK,MAAM,KAAK;EAAK,UAAU,KAAK;EAAU,GAAI;EAAO,eAAa;YAC9E,MAAM;GACF;;AAIX,SAAgB,kBAAkB,MAAoB;CACpD,MAAM,WAAW,aAAa;AAE9B,KAAI,KAAK,SAAS,YAAY,CAAC,KAAK,IAAK,QAAO;AAChD,KAAI,KAAK,WAAW,OAAQ,QAAO;AAEnC,QAAO,SAAS,KAAK,KAAK,UAAU,KAAK,WAAW,aAAa"}
|
package/dist/utils/urls.js
CHANGED
|
@@ -6,7 +6,7 @@ function normalize(urlOrPath) {
|
|
|
6
6
|
/**
|
|
7
7
|
* @returns if `href` is matching the given pathname
|
|
8
8
|
*/
|
|
9
|
-
function isActive(href, pathname, nested =
|
|
9
|
+
function isActive(href, pathname, nested = false) {
|
|
10
10
|
href = normalize(href);
|
|
11
11
|
pathname = normalize(pathname);
|
|
12
12
|
return href === pathname || nested && pathname.startsWith(`${href}/`);
|
package/dist/utils/urls.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urls.js","names":[],"sources":["../../src/utils/urls.ts"],"sourcesContent":["export function normalize(urlOrPath: string) {\n if (urlOrPath.length > 1 && urlOrPath.endsWith('/')) return urlOrPath.slice(0, -1);\n return urlOrPath;\n}\n\n/**\n * @returns if `href` is matching the given pathname\n */\nexport function isActive(href: string, pathname: string, nested =
|
|
1
|
+
{"version":3,"file":"urls.js","names":[],"sources":["../../src/utils/urls.ts"],"sourcesContent":["export function normalize(urlOrPath: string) {\n if (urlOrPath.length > 1 && urlOrPath.endsWith('/')) return urlOrPath.slice(0, -1);\n return urlOrPath;\n}\n\n/**\n * @returns if `href` is matching the given pathname\n */\nexport function isActive(href: string, pathname: string, nested = false): boolean {\n href = normalize(href);\n pathname = normalize(pathname);\n\n return href === pathname || (nested && pathname.startsWith(`${href}/`));\n}\n"],"mappings":";AAAA,SAAgB,UAAU,WAAmB;AAC3C,KAAI,UAAU,SAAS,KAAK,UAAU,SAAS,IAAI,CAAE,QAAO,UAAU,MAAM,GAAG,GAAG;AAClF,QAAO;;;;;AAMT,SAAgB,SAAS,MAAc,UAAkB,SAAS,OAAgB;AAChF,QAAO,UAAU,KAAK;AACtB,YAAW,UAAU,SAAS;AAE9B,QAAO,SAAS,YAAa,UAAU,SAAS,WAAW,GAAG,KAAK,GAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fumadocs/base-ui",
|
|
3
|
-
"version": "16.6.
|
|
3
|
+
"version": "16.6.2",
|
|
4
4
|
"description": "The Base UI version of Fumadocs UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -94,10 +94,10 @@
|
|
|
94
94
|
"access": "public"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@base-ui/react": "^1.
|
|
97
|
+
"@base-ui/react": "^1.2.0",
|
|
98
98
|
"class-variance-authority": "^0.7.1",
|
|
99
99
|
"lucide-react": "^0.563.0",
|
|
100
|
-
"motion": "^12.
|
|
100
|
+
"motion": "^12.34.0",
|
|
101
101
|
"next-themes": "^0.4.6",
|
|
102
102
|
"react-medium-image-zoom": "^5.4.0",
|
|
103
103
|
"react-remove-scroll": "^2.7.2",
|
|
@@ -110,15 +110,15 @@
|
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@tailwindcss/cli": "^4.1.18",
|
|
112
112
|
"@types/hast": "^3.0.4",
|
|
113
|
-
"@types/node": "^25.2.
|
|
114
|
-
"@types/react": "^19.2.
|
|
113
|
+
"@types/node": "^25.2.3",
|
|
114
|
+
"@types/react": "^19.2.14",
|
|
115
115
|
"@types/react-dom": "^19.2.3",
|
|
116
116
|
"tailwindcss": "^4.1.18",
|
|
117
117
|
"tsdown": "^0.20.3",
|
|
118
118
|
"unified": "^11.0.5",
|
|
119
119
|
"@fumadocs/cli": "1.2.4",
|
|
120
120
|
"eslint-config-custom": "0.0.0",
|
|
121
|
-
"fumadocs-core": "16.6.
|
|
121
|
+
"fumadocs-core": "16.6.2",
|
|
122
122
|
"tsconfig": "0.0.0"
|
|
123
123
|
},
|
|
124
124
|
"peerDependencies": {
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"react": "^19.2.0",
|
|
128
128
|
"react-dom": "^19.2.0",
|
|
129
129
|
"tailwindcss": "^4.0.0",
|
|
130
|
-
"fumadocs-core": "16.6.
|
|
130
|
+
"fumadocs-core": "16.6.2"
|
|
131
131
|
},
|
|
132
132
|
"peerDependenciesMeta": {
|
|
133
133
|
"next": {
|