@vx-oss/docs-react 1.0.3
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/LICENSE +21 -0
- package/README.md +5 -0
- package/css/aspen.css +39 -0
- package/css/black.css +39 -0
- package/css/catppuccin.css +49 -0
- package/css/dusk.css +47 -0
- package/css/emerald.css +39 -0
- package/css/generated/docs.css +1 -0
- package/css/generated/flux.css +1 -0
- package/css/generated/glass.css +1 -0
- package/css/generated/home.css +1 -0
- package/css/generated/notebook.css +1 -0
- package/css/generated/shared.css +1 -0
- package/css/lib/base.css +296 -0
- package/css/lib/default-colors.css +51 -0
- package/css/lib/shiki.css +108 -0
- package/css/neutral.css +7 -0
- package/css/ocean.css +44 -0
- package/css/preset-legacy.css +43 -0
- package/css/preset.css +11 -0
- package/css/purple.css +39 -0
- package/css/ruby.css +39 -0
- package/css/shadcn.css +36 -0
- package/css/solar.css +65 -0
- package/css/style.css +9 -0
- package/css/vitepress.css +72 -0
- package/dist/.translations/index.d.ts +55 -0
- package/dist/.translations/keys.js +55 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/accordion.d.ts +10 -0
- package/dist/components/accordion.js +68 -0
- package/dist/components/banner.d.ts +25 -0
- package/dist/components/banner.js +85 -0
- package/dist/components/callout.d.ts +21 -0
- package/dist/components/callout.js +60 -0
- package/dist/components/card.d.ts +13 -0
- package/dist/components/card.js +39 -0
- package/dist/components/codeblock.d.ts +45 -0
- package/dist/components/codeblock.js +126 -0
- package/dist/components/codeblock.rsc.d.ts +15 -0
- package/dist/components/codeblock.rsc.js +22 -0
- package/dist/components/dialog/search-algolia.d.ts +27 -0
- package/dist/components/dialog/search-algolia.js +64 -0
- package/dist/components/dialog/search-default.d.ts +29 -0
- package/dist/components/dialog/search-default.js +66 -0
- package/dist/components/dialog/search-orama.d.ts +32 -0
- package/dist/components/dialog/search-orama.js +69 -0
- package/dist/components/dialog/search.d.ts +76 -0
- package/dist/components/dialog/search.js +351 -0
- package/dist/components/dynamic-codeblock.core.d.ts +26 -0
- package/dist/components/dynamic-codeblock.core.js +51 -0
- package/dist/components/dynamic-codeblock.d.ts +8 -0
- package/dist/components/dynamic-codeblock.js +17 -0
- package/dist/components/files.d.ts +21 -0
- package/dist/components/files.js +40 -0
- package/dist/components/github-info.d.ts +20 -0
- package/dist/components/github-info.js +75 -0
- package/dist/components/heading.d.ts +9 -0
- package/dist/components/heading.js +38 -0
- package/dist/components/image-zoom.d.ts +18 -0
- package/dist/components/image-zoom.js +32 -0
- package/dist/components/image-zoom2.css +71 -0
- package/dist/components/inline-toc.d.ts +10 -0
- package/dist/components/inline-toc.js +28 -0
- package/dist/components/sidebar/base.d.ts +85 -0
- package/dist/components/sidebar/base.js +277 -0
- package/dist/components/sidebar/link-item.d.ts +12 -0
- package/dist/components/sidebar/link-item.js +37 -0
- package/dist/components/sidebar/page-tree.d.ts +20 -0
- package/dist/components/sidebar/page-tree.js +69 -0
- package/dist/components/sidebar/tabs/dropdown.d.ts +15 -0
- package/dist/components/sidebar/tabs/dropdown.js +83 -0
- package/dist/components/sidebar/tabs/index.d.ts +8 -0
- package/dist/components/sidebar/tabs/index.js +46 -0
- package/dist/components/steps.d.ts +10 -0
- package/dist/components/steps.js +16 -0
- package/dist/components/tabs.d.ts +33 -0
- package/dist/components/tabs.js +95 -0
- package/dist/components/toc/clerk.d.ts +11 -0
- package/dist/components/toc/clerk.js +227 -0
- package/dist/components/toc/default.d.ts +13 -0
- package/dist/components/toc/default.js +260 -0
- package/dist/components/toc/index.d.ts +10 -0
- package/dist/components/toc/index.js +45 -0
- package/dist/components/type-table.d.ts +37 -0
- package/dist/components/type-table.js +117 -0
- package/dist/components/ui/accordion.d.ts +10 -0
- package/dist/components/ui/accordion.js +42 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +20 -0
- package/dist/components/ui/collapsible.d.ts +11 -0
- package/dist/components/ui/collapsible.js +21 -0
- package/dist/components/ui/navigation-menu.d.ts +14 -0
- package/dist/components/ui/navigation-menu.js +41 -0
- package/dist/components/ui/popover.d.ts +9 -0
- package/dist/components/ui/popover.js +20 -0
- package/dist/components/ui/scroll-area.d.ts +9 -0
- package/dist/components/ui/scroll-area.js +34 -0
- package/dist/components/ui/tabs.d.ts +23 -0
- package/dist/components/ui/tabs.js +102 -0
- package/dist/contexts/i18n.d.ts +34 -0
- package/dist/contexts/i18n.js +37 -0
- package/dist/contexts/search.d.ts +64 -0
- package/dist/contexts/search.js +68 -0
- package/dist/contexts/tree.d.ts +29 -0
- package/dist/contexts/tree.js +91 -0
- package/dist/i18n.d.ts +15 -0
- package/dist/i18n.js +38 -0
- package/dist/layouts/docs/client.d.ts +33 -0
- package/dist/layouts/docs/client.js +94 -0
- package/dist/layouts/docs/index.d.ts +32 -0
- package/dist/layouts/docs/index.js +23 -0
- package/dist/layouts/docs/page/index.d.ts +76 -0
- package/dist/layouts/docs/page/index.js +124 -0
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/docs/page/slots/container.d.ts +5 -0
- package/dist/layouts/docs/page/slots/container.js +22 -0
- package/dist/layouts/docs/page/slots/footer.d.ts +16 -0
- package/dist/layouts/docs/page/slots/footer.js +56 -0
- package/dist/layouts/docs/page/slots/toc.d.ts +47 -0
- package/dist/layouts/docs/page/slots/toc.js +182 -0
- package/dist/layouts/docs/slots/container.d.ts +5 -0
- package/dist/layouts/docs/slots/container.js +36 -0
- package/dist/layouts/docs/slots/header.d.ts +5 -0
- package/dist/layouts/docs/slots/header.js +38 -0
- package/dist/layouts/docs/slots/sidebar.d.ts +22 -0
- package/dist/layouts/docs/slots/sidebar.js +268 -0
- package/dist/layouts/flux/index.d.ts +61 -0
- package/dist/layouts/flux/index.js +146 -0
- package/dist/layouts/flux/page/index.d.ts +67 -0
- package/dist/layouts/flux/page/index.js +104 -0
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/flux/page/slots/container.d.ts +5 -0
- package/dist/layouts/flux/page/slots/container.js +22 -0
- package/dist/layouts/flux/page/slots/footer.d.ts +16 -0
- package/dist/layouts/flux/page/slots/footer.js +56 -0
- package/dist/layouts/flux/page/slots/toc.d.ts +29 -0
- package/dist/layouts/flux/page/slots/toc.js +181 -0
- package/dist/layouts/flux/slots/container.d.ts +5 -0
- package/dist/layouts/flux/slots/container.js +13 -0
- package/dist/layouts/flux/slots/sidebar.d.ts +16 -0
- package/dist/layouts/flux/slots/sidebar.js +243 -0
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +10 -0
- package/dist/layouts/flux/slots/tab-dropdown.js +88 -0
- package/dist/layouts/glass/index.d.ts +39 -0
- package/dist/layouts/glass/index.js +70 -0
- package/dist/layouts/glass/layout-tabs.js +54 -0
- package/dist/layouts/glass/page/index.d.ts +31 -0
- package/dist/layouts/glass/page/index.js +92 -0
- package/dist/layouts/glass/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/glass/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/glass/page/slots/footer.d.ts +16 -0
- package/dist/layouts/glass/page/slots/footer.js +56 -0
- package/dist/layouts/glass/page/slots/toc.d.ts +19 -0
- package/dist/layouts/glass/page/slots/toc.js +108 -0
- package/dist/layouts/glass/slots/header.d.ts +6 -0
- package/dist/layouts/glass/slots/header.js +68 -0
- package/dist/layouts/glass/slots/sidebar.d.ts +21 -0
- package/dist/layouts/glass/slots/sidebar.js +267 -0
- package/dist/layouts/home/index.d.ts +27 -0
- package/dist/layouts/home/index.js +40 -0
- package/dist/layouts/home/navbar.d.ts +9 -0
- package/dist/layouts/home/navbar.js +34 -0
- package/dist/layouts/home/not-found.d.ts +7 -0
- package/dist/layouts/home/not-found.js +41 -0
- package/dist/layouts/home/slots/container.d.ts +5 -0
- package/dist/layouts/home/slots/container.js +13 -0
- package/dist/layouts/home/slots/header.d.ts +8 -0
- package/dist/layouts/home/slots/header.js +239 -0
- package/dist/layouts/notebook/client.d.ts +35 -0
- package/dist/layouts/notebook/client.js +69 -0
- package/dist/layouts/notebook/index.d.ts +26 -0
- package/dist/layouts/notebook/index.js +23 -0
- package/dist/layouts/notebook/page/index.d.ts +76 -0
- package/dist/layouts/notebook/page/index.js +124 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/notebook/page/slots/container.d.ts +5 -0
- package/dist/layouts/notebook/page/slots/container.js +22 -0
- package/dist/layouts/notebook/page/slots/footer.d.ts +16 -0
- package/dist/layouts/notebook/page/slots/footer.js +56 -0
- package/dist/layouts/notebook/page/slots/toc.d.ts +47 -0
- package/dist/layouts/notebook/page/slots/toc.js +181 -0
- package/dist/layouts/notebook/slots/container.d.ts +5 -0
- package/dist/layouts/notebook/slots/container.js +38 -0
- package/dist/layouts/notebook/slots/header.d.ts +5 -0
- package/dist/layouts/notebook/slots/header.js +204 -0
- package/dist/layouts/notebook/slots/sidebar.d.ts +23 -0
- package/dist/layouts/notebook/slots/sidebar.js +240 -0
- package/dist/layouts/shared/client.d.ts +37 -0
- package/dist/layouts/shared/client.js +85 -0
- package/dist/layouts/shared/index.d.ts +169 -0
- package/dist/layouts/shared/index.js +98 -0
- package/dist/layouts/shared/page-actions.d.ts +27 -0
- package/dist/layouts/shared/page-actions.js +199 -0
- package/dist/layouts/shared/slots/language-select.d.ts +12 -0
- package/dist/layouts/shared/slots/language-select.js +43 -0
- package/dist/layouts/shared/slots/search-trigger.d.ts +13 -0
- package/dist/layouts/shared/slots/search-trigger.js +53 -0
- package/dist/layouts/shared/slots/theme-switch.d.ts +8 -0
- package/dist/layouts/shared/slots/theme-switch.js +70 -0
- package/dist/legacy/layout.d.ts +29 -0
- package/dist/legacy/layout.js +44 -0
- package/dist/legacy/sidebar.d.ts +14 -0
- package/dist/legacy/sidebar.js +34 -0
- package/dist/mdx.d.ts +44 -0
- package/dist/mdx.js +70 -0
- package/dist/mdx.server.d.ts +14 -0
- package/dist/mdx.server.js +20 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.d.ts +30 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.js +461 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/index.d.ts +3 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +6 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.js +17 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +53 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +25 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +12 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +45 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +10 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +57 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +21 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +14 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +22 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +27 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +31 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +75 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +4 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +7 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +5 -0
- package/dist/og/takumi.d.ts +15 -0
- package/dist/og/takumi.js +91 -0
- package/dist/og.d.ts +16 -0
- package/dist/og.js +91 -0
- package/dist/page.d.ts +29 -0
- package/dist/page.js +33 -0
- package/dist/provider/astro.d.ts +29 -0
- package/dist/provider/astro.js +20 -0
- package/dist/provider/base.d.ts +48 -0
- package/dist/provider/base.js +73 -0
- package/dist/provider/next.d.ts +16 -0
- package/dist/provider/next.js +17 -0
- package/dist/provider/react-router.d.ts +16 -0
- package/dist/provider/react-router.js +17 -0
- package/dist/provider/tanstack.d.ts +16 -0
- package/dist/provider/tanstack.js +17 -0
- package/dist/provider/waku.d.ts +16 -0
- package/dist/provider/waku.js +17 -0
- package/dist/style.css +3640 -0
- package/dist/tailwind/typography.d.ts +2 -0
- package/dist/tailwind/typography.js +2 -0
- package/dist/utils/cn.js +2 -0
- package/dist/utils/merge-refs.js +11 -0
- package/dist/utils/urls.js +15 -0
- package/dist/utils/use-copy-button.d.ts +5 -0
- package/dist/utils/use-copy-button.js +26 -0
- package/dist/utils/use-footer-items.d.ts +8 -0
- package/dist/utils/use-footer-items.js +24 -0
- package/dist/utils/use-is-scroll-top.d.ts +6 -0
- package/dist/utils/use-is-scroll-top.js +20 -0
- package/package.json +212 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { useTreeContext, useTreePath } from "../../../../contexts/tree.js";
|
|
4
|
+
import Link from "@vx-oss/docs-core/link";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { ChevronRight } from "lucide-react";
|
|
7
|
+
import { Fragment as Fragment$1, useMemo } from "react";
|
|
8
|
+
import { getBreadcrumbItemsFromPath } from "@vx-oss/docs-core/breadcrumb";
|
|
9
|
+
//#region src/layouts/flux/page/slots/breadcrumb.tsx
|
|
10
|
+
function Breadcrumb({ includeRoot, includeSeparator, includePage, ...props }) {
|
|
11
|
+
const path = useTreePath();
|
|
12
|
+
const { root } = useTreeContext();
|
|
13
|
+
const items = useMemo(() => {
|
|
14
|
+
return getBreadcrumbItemsFromPath(root, path, {
|
|
15
|
+
includePage,
|
|
16
|
+
includeSeparator,
|
|
17
|
+
includeRoot
|
|
18
|
+
});
|
|
19
|
+
}, [
|
|
20
|
+
includePage,
|
|
21
|
+
includeRoot,
|
|
22
|
+
includeSeparator,
|
|
23
|
+
path,
|
|
24
|
+
root
|
|
25
|
+
]);
|
|
26
|
+
if (items.length === 0) return null;
|
|
27
|
+
return /* @__PURE__ */ jsx("div", {
|
|
28
|
+
...props,
|
|
29
|
+
className: cn("flex items-center gap-1.5 text-sm text-fd-muted-foreground", props.className),
|
|
30
|
+
children: items.map((item, i) => {
|
|
31
|
+
const className = cn("truncate", i === items.length - 1 && "text-fd-primary font-medium");
|
|
32
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [i !== 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 shrink-0" }), item.url ? /* @__PURE__ */ jsx(Link, {
|
|
33
|
+
href: item.url,
|
|
34
|
+
className: cn(className, "transition-opacity hover:opacity-80"),
|
|
35
|
+
children: item.name
|
|
36
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
37
|
+
className,
|
|
38
|
+
children: item.name
|
|
39
|
+
})] }, i);
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Breadcrumb };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { useDocsPage } from "../index.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/layouts/flux/page/slots/container.tsx
|
|
6
|
+
function Container(props) {
|
|
7
|
+
const { full } = useDocsPage();
|
|
8
|
+
return /* @__PURE__ */ jsx("main", {
|
|
9
|
+
className: "grid [grid-area:main] justify-items-center",
|
|
10
|
+
"data-layout-main": "",
|
|
11
|
+
children: /* @__PURE__ */ jsx("article", {
|
|
12
|
+
id: "nd-page",
|
|
13
|
+
"data-layout-content": "",
|
|
14
|
+
"data-full": full,
|
|
15
|
+
...props,
|
|
16
|
+
className: cn("flex flex-col min-w-0 w-full max-w-[900px] px-4 py-6 gap-4 md:px-6 md:pt-8 xl:px-8 xl:pt-14", full && "max-w-[1200px]", props.className),
|
|
17
|
+
children: props.children
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Container };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import * as PageTree from "@vx-oss/docs-core/page-tree";
|
|
3
|
+
//#region src/layouts/flux/page/slots/footer.d.ts
|
|
4
|
+
type Item = Pick<PageTree.Item, 'name' | 'description' | 'url'>;
|
|
5
|
+
interface FooterProps extends ComponentProps<'div'> {
|
|
6
|
+
/**
|
|
7
|
+
* Items including information for the next and previous page
|
|
8
|
+
*/
|
|
9
|
+
items?: {
|
|
10
|
+
previous?: Item;
|
|
11
|
+
next?: Item;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
declare function Footer({ items, children, className, ...props }: FooterProps): import("react").JSX.Element;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Footer, FooterProps };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { isActive } from "../../../../utils/urls.js";
|
|
4
|
+
import { useFooterItems } from "../../../../utils/use-footer-items.js";
|
|
5
|
+
import Link from "@vx-oss/docs-core/link";
|
|
6
|
+
import { usePathname } from "@vx-oss/docs-core/framework";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
9
|
+
import { useMemo } from "react";
|
|
10
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
11
|
+
//#region src/layouts/flux/page/slots/footer.tsx
|
|
12
|
+
function Footer({ items, children, className, ...props }) {
|
|
13
|
+
const footerList = useFooterItems();
|
|
14
|
+
const pathname = usePathname();
|
|
15
|
+
const { previous, next } = useMemo(() => {
|
|
16
|
+
if (items) return items;
|
|
17
|
+
const idx = footerList.findIndex((item) => isActive(item.url, pathname));
|
|
18
|
+
if (idx === -1) return {};
|
|
19
|
+
return {
|
|
20
|
+
previous: footerList[idx - 1],
|
|
21
|
+
next: footerList[idx + 1]
|
|
22
|
+
};
|
|
23
|
+
}, [
|
|
24
|
+
footerList,
|
|
25
|
+
items,
|
|
26
|
+
pathname
|
|
27
|
+
]);
|
|
28
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: cn("@container grid gap-4", previous && next ? "grid-cols-2" : "grid-cols-1", className),
|
|
30
|
+
...props,
|
|
31
|
+
children: [previous && /* @__PURE__ */ jsx(FooterItem, {
|
|
32
|
+
item: previous,
|
|
33
|
+
index: 0
|
|
34
|
+
}), next && /* @__PURE__ */ jsx(FooterItem, {
|
|
35
|
+
item: next,
|
|
36
|
+
index: 1
|
|
37
|
+
})]
|
|
38
|
+
}), children] });
|
|
39
|
+
}
|
|
40
|
+
function FooterItem({ item, index }) {
|
|
41
|
+
const t = useTranslations({ note: "pagination" });
|
|
42
|
+
const Icon = index === 0 ? ChevronLeft : ChevronRight;
|
|
43
|
+
return /* @__PURE__ */ jsxs(Link, {
|
|
44
|
+
href: item.url,
|
|
45
|
+
className: cn("flex flex-col gap-2 rounded-lg border p-4 text-sm transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground @max-lg:col-span-full", index === 1 && "text-end"),
|
|
46
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
47
|
+
className: cn("inline-flex items-center gap-1.5 font-medium", index === 1 && "flex-row-reverse"),
|
|
48
|
+
children: [/* @__PURE__ */ jsx(Icon, { className: "-mx-1 size-4 shrink-0 rtl:rotate-180" }), /* @__PURE__ */ jsx("p", { children: item.name })]
|
|
49
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
50
|
+
className: "text-fd-muted-foreground truncate",
|
|
51
|
+
children: item.description ?? (index === 0 ? t("Previous Page") : t("Next Page"))
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { Footer };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TOCItemsProps } from "../../../../components/toc/clerk.js";
|
|
2
|
+
import { TOCItemsProps as TOCItemsProps$1 } from "../../../../components/toc/default.js";
|
|
3
|
+
import { TOCProvider as TOCProvider$1, TOCProviderProps as TOCProviderProps$1 } from "../../../../components/toc/index.js";
|
|
4
|
+
import { ComponentProps, ReactNode } from "react";
|
|
5
|
+
//#region src/layouts/flux/page/slots/toc.d.ts
|
|
6
|
+
type TOCProviderProps = TOCProviderProps$1;
|
|
7
|
+
declare const TOCProvider: typeof TOCProvider$1;
|
|
8
|
+
type TOCProps = {
|
|
9
|
+
container?: ComponentProps<'div'>;
|
|
10
|
+
trigger?: ComponentProps<'button'>;
|
|
11
|
+
content?: ComponentProps<'div'>;
|
|
12
|
+
/**
|
|
13
|
+
* Custom content in TOC container, before the main TOC
|
|
14
|
+
*/
|
|
15
|
+
header?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Custom content in TOC container, after the main TOC
|
|
18
|
+
*/
|
|
19
|
+
footer?: ReactNode;
|
|
20
|
+
} & ({
|
|
21
|
+
style?: 'normal';
|
|
22
|
+
list?: TOCItemsProps$1;
|
|
23
|
+
} | {
|
|
24
|
+
style: 'clerk';
|
|
25
|
+
list?: TOCItemsProps;
|
|
26
|
+
});
|
|
27
|
+
declare function TOC({ container, trigger, content, header, footer, style, list }: TOCProps): import("react").JSX.Element | undefined;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { TOC, TOCProps, TOCProvider, TOCProviderProps };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { TOCScrollArea, toc_exports, useItems, useTOCItems } from "../../../../components/toc/index.js";
|
|
4
|
+
import { default_exports } from "../../../../components/toc/default.js";
|
|
5
|
+
import { clerk_exports } from "../../../../components/toc/clerk.js";
|
|
6
|
+
import { useTreePath } from "../../../../contexts/tree.js";
|
|
7
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../components/ui/collapsible.js";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { ChevronDown } from "lucide-react";
|
|
10
|
+
import { createContext, use, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
|
|
11
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
12
|
+
import { createPortal } from "react-dom";
|
|
13
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
14
|
+
//#region src/layouts/flux/page/slots/toc.tsx
|
|
15
|
+
const TocPopoverContext = createContext(null);
|
|
16
|
+
const { TOCProvider } = toc_exports;
|
|
17
|
+
function TOC({ container, trigger, content, header, footer, style = "normal", list }) {
|
|
18
|
+
const items = useTOCItems();
|
|
19
|
+
const { TOCItems, TOCEmpty, TOCItem } = style === "clerk" ? clerk_exports : default_exports;
|
|
20
|
+
if (items.length === 0 && !header && !footer) return;
|
|
21
|
+
return /* @__PURE__ */ jsxs(PageTOCPopover, {
|
|
22
|
+
...container,
|
|
23
|
+
children: [/* @__PURE__ */ jsxs(PageTOCPopoverContent, {
|
|
24
|
+
...content,
|
|
25
|
+
children: [
|
|
26
|
+
header,
|
|
27
|
+
/* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
|
|
28
|
+
...list,
|
|
29
|
+
children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))]
|
|
30
|
+
}) }),
|
|
31
|
+
footer
|
|
32
|
+
]
|
|
33
|
+
}), /* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger })]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function PageTOCPopover(props) {
|
|
37
|
+
const [container, setContainer] = useState(null);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const element = document.getElementById("flux-layout-slot");
|
|
40
|
+
if (!element) return;
|
|
41
|
+
setContainer(element);
|
|
42
|
+
}, []);
|
|
43
|
+
if (!container) return;
|
|
44
|
+
return createPortal(/* @__PURE__ */ jsx(PageTOCPopoverPhysical, { ...props }), container);
|
|
45
|
+
}
|
|
46
|
+
function PageTOCPopoverPhysical({ className, children, ...rest }) {
|
|
47
|
+
const ref = useRef(null);
|
|
48
|
+
const [open, setOpen] = useState(false);
|
|
49
|
+
const onClick = useEffectEvent((e) => {
|
|
50
|
+
if (!open) return;
|
|
51
|
+
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
52
|
+
});
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
window.addEventListener("click", onClick);
|
|
55
|
+
return () => {
|
|
56
|
+
window.removeEventListener("click", onClick);
|
|
57
|
+
};
|
|
58
|
+
}, []);
|
|
59
|
+
return /* @__PURE__ */ jsx(TocPopoverContext, {
|
|
60
|
+
value: useMemo(() => ({
|
|
61
|
+
open,
|
|
62
|
+
setOpen
|
|
63
|
+
}), [setOpen, open]),
|
|
64
|
+
children: /* @__PURE__ */ jsx(Collapsible, {
|
|
65
|
+
open,
|
|
66
|
+
onOpenChange: setOpen,
|
|
67
|
+
"data-toc-popover": "",
|
|
68
|
+
className: cn("relative h-9 animate-fd-fade-in", className),
|
|
69
|
+
...rest,
|
|
70
|
+
children: /* @__PURE__ */ jsx("header", {
|
|
71
|
+
ref,
|
|
72
|
+
className: cn("absolute w-full bottom-0 border rounded-xl transition-colors bg-fd-secondary text-fd-secondary-foreground backdrop-blur-sm", open && "shadow-lg bg-fd-popover/80 text-fd-popover-foreground"),
|
|
73
|
+
children
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function PageTOCPopoverTrigger({ className, ...props }) {
|
|
79
|
+
const t = useTranslations({ note: "table of contents" });
|
|
80
|
+
const { open } = use(TocPopoverContext);
|
|
81
|
+
const items = useItems();
|
|
82
|
+
const selectedIdx = items.findIndex((item) => item.active);
|
|
83
|
+
const path = useTreePath().at(-1);
|
|
84
|
+
const spanProps = {
|
|
85
|
+
transition: { duration: .1 },
|
|
86
|
+
initial: {
|
|
87
|
+
opacity: 0,
|
|
88
|
+
y: 10
|
|
89
|
+
},
|
|
90
|
+
animate: {
|
|
91
|
+
opacity: 1,
|
|
92
|
+
y: 0
|
|
93
|
+
},
|
|
94
|
+
exit: {
|
|
95
|
+
opacity: 0,
|
|
96
|
+
y: -10
|
|
97
|
+
},
|
|
98
|
+
className: cn(open && "text-fd-popover-foreground")
|
|
99
|
+
};
|
|
100
|
+
return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
101
|
+
className: cn("flex w-full h-8.5 items-center text-sm text-fd-muted-foreground gap-2.5 px-2 text-start focus-visible:outline-none [&_svg]:size-4", className),
|
|
102
|
+
"data-toc-popover-trigger": "",
|
|
103
|
+
...props,
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsx(ProgressCircle, {
|
|
106
|
+
value: (items.findLastIndex((item) => item.active) + 1) / Math.max(1, items.length),
|
|
107
|
+
max: 1,
|
|
108
|
+
className: cn("shrink-0", open && "text-fd-primary")
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ jsx(AnimatePresence, {
|
|
111
|
+
mode: "wait",
|
|
112
|
+
children: items[selectedIdx] && !open ? /* @__PURE__ */ jsx(motion.span, {
|
|
113
|
+
...spanProps,
|
|
114
|
+
children: items[selectedIdx].original.title
|
|
115
|
+
}, selectedIdx) : path ? /* @__PURE__ */ jsx(motion.span, {
|
|
116
|
+
...spanProps,
|
|
117
|
+
children: path.name
|
|
118
|
+
}, path.$id ?? ":pathId") : /* @__PURE__ */ jsx(motion.span, {
|
|
119
|
+
...spanProps,
|
|
120
|
+
children: t("On this page")
|
|
121
|
+
}, ":toc")
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: cn("ms-auto shrink-0 transition-transform", open && "rotate-180") })
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function clamp(input, min, max) {
|
|
128
|
+
if (input < min) return min;
|
|
129
|
+
if (input > max) return max;
|
|
130
|
+
return input;
|
|
131
|
+
}
|
|
132
|
+
function ProgressCircle({ value, strokeWidth = 1.5, size = 18, min = 0, max = 100, style, ...restSvgProps }) {
|
|
133
|
+
const normalizedValue = clamp(value, min, max);
|
|
134
|
+
const radius = size / 2 - strokeWidth;
|
|
135
|
+
const circumference = 2 * Math.PI * radius;
|
|
136
|
+
const progress = normalizedValue / max * circumference;
|
|
137
|
+
const circleProps = {
|
|
138
|
+
cx: size / 2,
|
|
139
|
+
cy: size / 2,
|
|
140
|
+
r: radius,
|
|
141
|
+
fill: "none",
|
|
142
|
+
strokeWidth
|
|
143
|
+
};
|
|
144
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
145
|
+
role: "progressbar",
|
|
146
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
147
|
+
"aria-valuenow": normalizedValue,
|
|
148
|
+
"aria-valuemin": min,
|
|
149
|
+
"aria-valuemax": max,
|
|
150
|
+
style: {
|
|
151
|
+
width: size,
|
|
152
|
+
height: size,
|
|
153
|
+
...style
|
|
154
|
+
},
|
|
155
|
+
...restSvgProps,
|
|
156
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
157
|
+
...circleProps,
|
|
158
|
+
className: "stroke-current/25"
|
|
159
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
160
|
+
...circleProps,
|
|
161
|
+
stroke: "currentColor",
|
|
162
|
+
strokeDasharray: circumference,
|
|
163
|
+
strokeDashoffset: circumference - progress,
|
|
164
|
+
strokeLinecap: "round",
|
|
165
|
+
transform: `rotate(-90 ${size / 2} ${size / 2})`,
|
|
166
|
+
className: "transition-all"
|
|
167
|
+
})]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function PageTOCPopoverContent(props) {
|
|
171
|
+
return /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
172
|
+
"data-toc-popover-content": "",
|
|
173
|
+
...props,
|
|
174
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
175
|
+
className: "flex flex-col px-2 max-h-[50vh]",
|
|
176
|
+
children: props.children
|
|
177
|
+
})
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
181
|
+
export { TOC, TOCProvider };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/layouts/flux/slots/container.tsx
|
|
5
|
+
function Container(props) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
id: "nd-flux-layout",
|
|
8
|
+
...props,
|
|
9
|
+
className: cn("flex flex-col items-center pb-24 overflow-x-clip", props.className)
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Container };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SidebarProviderProps as SidebarProviderProps$1, useSidebar as useSidebar$1 } from "../../../components/sidebar/base.js";
|
|
2
|
+
import { SidebarPageTreeComponents } from "../../../components/sidebar/page-tree.js";
|
|
3
|
+
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
//#region src/layouts/flux/slots/sidebar.d.ts
|
|
5
|
+
interface SidebarProps extends ComponentProps<'aside'> {
|
|
6
|
+
components?: Partial<SidebarPageTreeComponents>;
|
|
7
|
+
banner?: ReactNode;
|
|
8
|
+
footer?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
type SidebarProviderProps = SidebarProviderProps$1;
|
|
11
|
+
declare const useSidebar: typeof useSidebar$1;
|
|
12
|
+
declare function SidebarProvider(props: SidebarProviderProps): import("react").JSX.Element;
|
|
13
|
+
declare function Sidebar({ footer, banner, components, ...rest }: SidebarProps): import("react").JSX.Element;
|
|
14
|
+
declare function SidebarTrigger(props: ComponentProps<'button'>): import("react").JSX.Element;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Sidebar, SidebarProps, SidebarProvider, SidebarProviderProps, SidebarTrigger, useSidebar };
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { mergeRefs } from "../../../utils/merge-refs.js";
|
|
4
|
+
import { SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider as SidebarProvider$1, SidebarSeparator as SidebarSeparator$1, SidebarViewport, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
|
|
5
|
+
import { createPageTreeRenderer } from "../../../components/sidebar/page-tree.js";
|
|
6
|
+
import { createLinkItemRenderer } from "../../../components/sidebar/link-item.js";
|
|
7
|
+
import { useFluxLayout } from "../index.js";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { SidebarIcon, XIcon } from "lucide-react";
|
|
10
|
+
import { cva } from "class-variance-authority";
|
|
11
|
+
import { useEffect, useEffectEvent, useRef, useState } from "react";
|
|
12
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
13
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
14
|
+
import { RemoveScroll } from "react-remove-scroll";
|
|
15
|
+
//#region src/layouts/flux/slots/sidebar.tsx
|
|
16
|
+
const MotionSidebarItem = motion.create(SidebarItem$1);
|
|
17
|
+
const MotionSidebarFolderTrigger = motion.create(SidebarFolderTrigger$1);
|
|
18
|
+
const MotionSidebarFolderLink = motion.create(SidebarFolderLink$1);
|
|
19
|
+
const MotionSidebarFolderContent = motion.create(SidebarFolderContent$1);
|
|
20
|
+
const itemVariants = cva("relative flex flex-row items-center gap-2 rounded-lg p-2 text-start text-fd-muted-foreground wrap-anywhere [&_svg]:size-4 [&_svg]:shrink-0", { variants: {
|
|
21
|
+
variant: {
|
|
22
|
+
link: "transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none data-[active=true]:bg-fd-primary/10 data-[active=true]:text-fd-primary data-[active=true]:hover:transition-colors",
|
|
23
|
+
button: "transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none"
|
|
24
|
+
},
|
|
25
|
+
highlight: { true: "data-[active=true]:before:content-[''] data-[active=true]:before:bg-fd-primary data-[active=true]:before:absolute data-[active=true]:before:w-px data-[active=true]:before:inset-y-2.5 data-[active=true]:before:start-2.5" }
|
|
26
|
+
} });
|
|
27
|
+
function getItemOffset(depth) {
|
|
28
|
+
return `calc(${2 + 3 * depth} * var(--spacing))`;
|
|
29
|
+
}
|
|
30
|
+
const { useSidebar } = base_exports;
|
|
31
|
+
function SidebarProvider(props) {
|
|
32
|
+
return /* @__PURE__ */ jsx(SidebarProvider$1, { ...props });
|
|
33
|
+
}
|
|
34
|
+
function Sidebar({ footer, banner, components, ...rest }) {
|
|
35
|
+
const { menuItems } = useFluxLayout();
|
|
36
|
+
return /* @__PURE__ */ jsxs(SidebarContent, {
|
|
37
|
+
...rest,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsx("div", {
|
|
40
|
+
className: "flex flex-col gap-3 p-4 pb-2 empty:hidden",
|
|
41
|
+
children: banner
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ jsxs(SidebarViewport, {
|
|
44
|
+
viewport: { className: "*:gap-0!" },
|
|
45
|
+
children: [menuItems.filter((v) => v.type !== "icon").map((item, i, list) => /* @__PURE__ */ jsx(SidebarLinkItem, {
|
|
46
|
+
item,
|
|
47
|
+
className: cn(i === list.length - 1 && "mb-4")
|
|
48
|
+
}, i)), /* @__PURE__ */ jsx(SidebarPageTree, { ...components })]
|
|
49
|
+
}),
|
|
50
|
+
footer
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function SidebarTrigger(props) {
|
|
55
|
+
const { open, setOpen } = useSidebar();
|
|
56
|
+
const t = useTranslations({ note: "sidebar" });
|
|
57
|
+
return /* @__PURE__ */ jsx("button", {
|
|
58
|
+
type: "button",
|
|
59
|
+
"aria-label": open ? t("Close Sidebar", { note: "aria-label" }) : t("Open Sidebar", { note: "aria-label" }),
|
|
60
|
+
"aria-expanded": open,
|
|
61
|
+
"aria-controls": "nd-sidebar",
|
|
62
|
+
onClick: () => setOpen((prev) => !prev),
|
|
63
|
+
...props,
|
|
64
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
65
|
+
mode: "wait",
|
|
66
|
+
children: /* @__PURE__ */ jsx(motion.span, {
|
|
67
|
+
transition: { duration: .2 },
|
|
68
|
+
initial: {
|
|
69
|
+
y: "100%",
|
|
70
|
+
opacity: 0
|
|
71
|
+
},
|
|
72
|
+
animate: {
|
|
73
|
+
y: 0,
|
|
74
|
+
opacity: 1
|
|
75
|
+
},
|
|
76
|
+
exit: {
|
|
77
|
+
y: "100%",
|
|
78
|
+
opacity: 0
|
|
79
|
+
},
|
|
80
|
+
children: open ? /* @__PURE__ */ jsx(XIcon, {}) : /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
81
|
+
}, open ? "open" : "closed")
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function SidebarContent({ ref: refProp, className, children, ...props }) {
|
|
86
|
+
const ref = useRef(null);
|
|
87
|
+
const [blockScroll, setBlockScroll] = useState(false);
|
|
88
|
+
const { open, setOpen } = useSidebar();
|
|
89
|
+
const listener = useEffectEvent((e) => {
|
|
90
|
+
if (open && e.key === "Escape") {
|
|
91
|
+
setOpen(false);
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
window.addEventListener("keydown", listener);
|
|
97
|
+
return () => {
|
|
98
|
+
window.removeEventListener("keydown", listener);
|
|
99
|
+
};
|
|
100
|
+
}, []);
|
|
101
|
+
if (open && !blockScroll) setBlockScroll(true);
|
|
102
|
+
return /* @__PURE__ */ jsx(RemoveScroll, {
|
|
103
|
+
enabled: blockScroll,
|
|
104
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
105
|
+
className: cn("fixed inset-0 py-10 z-30 backdrop-blur-md bg-fd-background/60", !open && "pointer-events-none"),
|
|
106
|
+
initial: "hide",
|
|
107
|
+
variants: {
|
|
108
|
+
show: { opacity: 1 },
|
|
109
|
+
hide: { opacity: 0 }
|
|
110
|
+
},
|
|
111
|
+
animate: open ? "show" : "hide",
|
|
112
|
+
exit: "hide",
|
|
113
|
+
onClick: () => {
|
|
114
|
+
setOpen(false);
|
|
115
|
+
},
|
|
116
|
+
onAnimationComplete: (definition) => {
|
|
117
|
+
if (definition === "hide") setBlockScroll(false);
|
|
118
|
+
},
|
|
119
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
120
|
+
className: "absolute top-0 min-h-0 inset-x-0 bottom-26 overflow-y-auto fd-scroll-container pr-(--removed-body-scroll-bar-size,0) py-16 mask-[linear-gradient(to_bottom,transparent,white_--spacing(14),white_calc(100%---spacing(14)),transparent)] lg:text-sm",
|
|
121
|
+
variants: {
|
|
122
|
+
show: {
|
|
123
|
+
y: 0,
|
|
124
|
+
opacity: 1
|
|
125
|
+
},
|
|
126
|
+
hide: {
|
|
127
|
+
y: "80%",
|
|
128
|
+
opacity: 0
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
transition: {
|
|
132
|
+
duration: .4,
|
|
133
|
+
ease: [
|
|
134
|
+
.16,
|
|
135
|
+
1,
|
|
136
|
+
.3,
|
|
137
|
+
1
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
children: /* @__PURE__ */ jsx(motion.aside, {
|
|
141
|
+
id: "nd-sidebar",
|
|
142
|
+
ref: mergeRefs(ref, refProp),
|
|
143
|
+
className: cn("mx-auto sm:max-w-[400px]", className),
|
|
144
|
+
onClick: (e) => e.stopPropagation(),
|
|
145
|
+
...props,
|
|
146
|
+
children
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function SidebarFolder(props) {
|
|
153
|
+
return /* @__PURE__ */ jsx(SidebarFolder$1, { ...props });
|
|
154
|
+
}
|
|
155
|
+
function SidebarSeparator({ className, style, children, ...props }) {
|
|
156
|
+
const depth = useFolderDepth();
|
|
157
|
+
return /* @__PURE__ */ jsx(SidebarSeparator$1, {
|
|
158
|
+
className: cn("inline-flex items-center gap-2 mb-1.5 px-2 mt-6 empty:mb-0 [&_svg]:size-4 [&_svg]:shrink-0", depth === 0 && "first:mt-0", className),
|
|
159
|
+
style: {
|
|
160
|
+
paddingInlineStart: getItemOffset(depth),
|
|
161
|
+
...style
|
|
162
|
+
},
|
|
163
|
+
...props,
|
|
164
|
+
children
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function SidebarItem({ className, style, children, ...props }) {
|
|
168
|
+
const depth = useFolderDepth();
|
|
169
|
+
return /* @__PURE__ */ jsx(MotionSidebarItem, {
|
|
170
|
+
className: cn(itemVariants({
|
|
171
|
+
variant: "link",
|
|
172
|
+
highlight: depth >= 1
|
|
173
|
+
}), className),
|
|
174
|
+
style: {
|
|
175
|
+
paddingInlineStart: getItemOffset(depth),
|
|
176
|
+
...style
|
|
177
|
+
},
|
|
178
|
+
...props,
|
|
179
|
+
children
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function SidebarFolderTrigger({ className, style, ...props }) {
|
|
183
|
+
const { depth, collapsible } = useFolder();
|
|
184
|
+
return /* @__PURE__ */ jsx(MotionSidebarFolderTrigger, {
|
|
185
|
+
className: cn(itemVariants({ variant: collapsible ? "button" : null }), "w-full", className),
|
|
186
|
+
style: {
|
|
187
|
+
paddingInlineStart: getItemOffset(depth - 1),
|
|
188
|
+
...style
|
|
189
|
+
},
|
|
190
|
+
...props,
|
|
191
|
+
children: props.children
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function SidebarFolderLink({ className, style, ...props }) {
|
|
195
|
+
const depth = useFolderDepth();
|
|
196
|
+
return /* @__PURE__ */ jsx(MotionSidebarFolderLink, {
|
|
197
|
+
className: cn(itemVariants({
|
|
198
|
+
variant: "link",
|
|
199
|
+
highlight: depth > 1
|
|
200
|
+
}), "w-full", className),
|
|
201
|
+
style: {
|
|
202
|
+
paddingInlineStart: getItemOffset(depth - 1),
|
|
203
|
+
...style
|
|
204
|
+
},
|
|
205
|
+
...props,
|
|
206
|
+
children: props.children
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function SidebarFolderContent({ className, children, ...props }) {
|
|
210
|
+
const depth = useFolderDepth();
|
|
211
|
+
const { open } = useFolder();
|
|
212
|
+
return /* @__PURE__ */ jsx(MotionSidebarFolderContent, {
|
|
213
|
+
className: cn("relative", depth === 1 && "before:content-[''] before:absolute before:w-px before:inset-y-1 before:bg-fd-border before:start-2.5", className),
|
|
214
|
+
...props,
|
|
215
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
216
|
+
initial: "hide",
|
|
217
|
+
animate: open ? "show" : "hide",
|
|
218
|
+
exit: "hide",
|
|
219
|
+
variants: {
|
|
220
|
+
show: { opacity: 1 },
|
|
221
|
+
hide: { opacity: 0 }
|
|
222
|
+
},
|
|
223
|
+
children
|
|
224
|
+
})
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
const SidebarPageTree = createPageTreeRenderer({
|
|
228
|
+
SidebarFolder,
|
|
229
|
+
SidebarFolderContent,
|
|
230
|
+
SidebarSeparator,
|
|
231
|
+
SidebarFolderLink,
|
|
232
|
+
SidebarFolderTrigger,
|
|
233
|
+
SidebarItem
|
|
234
|
+
});
|
|
235
|
+
const SidebarLinkItem = createLinkItemRenderer({
|
|
236
|
+
SidebarFolder,
|
|
237
|
+
SidebarFolderContent,
|
|
238
|
+
SidebarFolderLink,
|
|
239
|
+
SidebarFolderTrigger,
|
|
240
|
+
SidebarItem
|
|
241
|
+
});
|
|
242
|
+
//#endregion
|
|
243
|
+
export { Sidebar, SidebarProvider, SidebarTrigger, useSidebar };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LayoutTab } from "../../shared/index.js";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
//#region src/layouts/flux/slots/tab-dropdown.d.ts
|
|
4
|
+
interface TabDropdownProps extends ComponentProps<'button'> {
|
|
5
|
+
placeholder?: ReactNode;
|
|
6
|
+
tabs: LayoutTab[];
|
|
7
|
+
}
|
|
8
|
+
declare function TabDropdown({ tabs: allTabs, placeholder, className, ...props }: TabDropdownProps): import("react").JSX.Element | undefined;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { TabDropdown, TabDropdownProps };
|