fumadocs-ui 11.3.2 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2BHQGWSJ.js +261 -0
- package/dist/{chunk-TDTHXDET.js → chunk-34Z7WODD.js} +2 -1
- package/dist/{chunk-IN5NHEZV.js → chunk-3F57TIUQ.js} +20 -5
- package/dist/{chunk-UKE65HV3.js → chunk-5CZEA2KX.js} +2 -2
- package/dist/{chunk-PXDQVGII.js → chunk-7EMVRXMS.js} +10 -1
- package/dist/{chunk-PW7TBOIJ.js → chunk-CRYPD6UZ.js} +2 -1
- package/dist/{chunk-XXVXIK4M.js → chunk-E5OQ6FBQ.js} +1 -1
- package/dist/{chunk-WNKY4RA5.js → chunk-UBVEKNRF.js} +1 -1
- package/dist/components/accordion.js +2 -2
- package/dist/components/api.js +2 -2
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/codeblock.js +1 -1
- package/dist/components/dialog/search-algolia.js +3 -2
- package/dist/components/dialog/search-default.js +3 -2
- package/dist/components/dialog/search.js +3 -2
- package/dist/components/files.js +1 -1
- package/dist/components/heading.js +1 -1
- package/dist/components/layout/language-toggle.d.ts +6 -0
- package/dist/components/layout/language-toggle.js +58 -0
- package/dist/components/layout/root-toggle.d.ts +16 -0
- package/dist/components/layout/root-toggle.js +60 -0
- package/dist/components/roll-button.d.ts +1 -1
- package/dist/components/roll-button.js +22 -9
- package/dist/components/type-table.js +1 -1
- package/dist/docs.client.d.ts +19 -0
- package/dist/docs.client.js +406 -0
- package/dist/{i18n-K879Pt9h.d.ts → i18n-CE8z-AAs.d.ts} +1 -0
- package/dist/i18n.d.ts +3 -6
- package/dist/i18n.js +4 -102
- package/dist/{layout-WuS8Ab4e.d.ts → layout.client-Duq0TTke.d.ts} +23 -15
- package/dist/layout.client.d.ts +2 -8
- package/dist/layout.client.js +37 -590
- package/dist/layout.d.ts +1 -1
- package/dist/layout.js +45 -26
- package/dist/mdx.client.js +1 -1
- package/dist/mdx.js +2 -2
- package/dist/page.client.js +7 -7
- package/dist/page.js +17 -8
- package/dist/provider.d.ts +11 -12
- package/dist/provider.js +9 -10
- package/dist/style.css +1 -1
- package/dist/tailwind-plugin.cjs +21 -22
- package/dist/tailwind-plugin.js +21 -22
- package/dist/twoslash/popup.js +1 -1
- package/dist/twoslash.css +1 -1
- package/package.json +4 -5
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useTreeContext
|
|
4
|
+
} from "../chunk-34Z7WODD.js";
|
|
5
|
+
import "../chunk-AN2Y6MA2.js";
|
|
2
6
|
import {
|
|
3
7
|
buttonVariants
|
|
4
8
|
} from "../chunk-7GZKFBAP.js";
|
|
@@ -9,12 +13,19 @@ import "../chunk-MLKGABMK.js";
|
|
|
9
13
|
|
|
10
14
|
// src/components/roll-button.tsx
|
|
11
15
|
import { ChevronUp } from "lucide-react";
|
|
12
|
-
import { useEffect, useState } from "react";
|
|
13
|
-
import {
|
|
16
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
17
|
+
import { usePathname } from "next/navigation";
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
19
|
function RollButton({
|
|
15
|
-
percentage = 0.
|
|
20
|
+
percentage = 0.1
|
|
16
21
|
}) {
|
|
17
22
|
const [show, setShow] = useState(false);
|
|
23
|
+
const { navigation } = useTreeContext();
|
|
24
|
+
const pathname = usePathname();
|
|
25
|
+
const current = useMemo(
|
|
26
|
+
() => navigation.find((item) => item.url === pathname),
|
|
27
|
+
[pathname, navigation]
|
|
28
|
+
);
|
|
18
29
|
useEffect(() => {
|
|
19
30
|
const listener = () => {
|
|
20
31
|
const element = document.scrollingElement;
|
|
@@ -27,7 +38,7 @@ function RollButton({
|
|
|
27
38
|
window.removeEventListener("scroll", listener);
|
|
28
39
|
};
|
|
29
40
|
}, [percentage]);
|
|
30
|
-
return /* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ jsxs(
|
|
31
42
|
"button",
|
|
32
43
|
{
|
|
33
44
|
type: "button",
|
|
@@ -35,18 +46,20 @@ function RollButton({
|
|
|
35
46
|
className: twMerge(
|
|
36
47
|
buttonVariants({
|
|
37
48
|
color: "secondary",
|
|
38
|
-
|
|
39
|
-
className: "fixed bottom-8 p-3 right-8 z-50 shadow-md rounded-full transition-all"
|
|
49
|
+
className: "fixed top-16 [&_svg]:size-4 gap-1 left-1/2 translate-x-[-50%] z-10 shadow-md rounded-full transition-all md:top-4"
|
|
40
50
|
}),
|
|
41
51
|
!show && "translate-y-20 opacity-0"
|
|
42
52
|
),
|
|
43
|
-
onClick: () => {
|
|
53
|
+
onClick: useCallback(() => {
|
|
44
54
|
document.scrollingElement?.scrollTo({
|
|
45
55
|
top: 0,
|
|
46
56
|
behavior: "smooth"
|
|
47
57
|
});
|
|
48
|
-
},
|
|
49
|
-
children:
|
|
58
|
+
}, []),
|
|
59
|
+
children: [
|
|
60
|
+
current?.icon ?? /* @__PURE__ */ jsx(ChevronUp, {}),
|
|
61
|
+
current?.name
|
|
62
|
+
]
|
|
50
63
|
}
|
|
51
64
|
);
|
|
52
65
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { L as LinkItemType, S as SidebarProps, N as NavProps } from './layout.client-Duq0TTke.js';
|
|
2
|
+
export { a as Sidebar } from './layout.client-Duq0TTke.js';
|
|
3
|
+
export { T as TreeContextProvider } from './tree-CrKzI9Nz.js';
|
|
4
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
5
|
+
import 'fumadocs-core/server';
|
|
6
|
+
|
|
7
|
+
interface LinksMenuProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
8
|
+
items: LinkItemType[];
|
|
9
|
+
footer?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function LinksMenu({ items, footer, ...props }: LinksMenuProps): React.ReactElement;
|
|
12
|
+
|
|
13
|
+
declare function DynamicSidebar(props: SidebarProps): React.ReactElement;
|
|
14
|
+
|
|
15
|
+
declare function ThemeToggle({ className, ...props }: ButtonHTMLAttributes<HTMLButtonElement>): React.ReactElement;
|
|
16
|
+
|
|
17
|
+
declare function SubNav({ title, url, children, enableSearch, }: NavProps): React.ReactElement;
|
|
18
|
+
|
|
19
|
+
export { DynamicSidebar, LinksMenu, SubNav, ThemeToggle };
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
LargeSearchToggle,
|
|
4
|
+
LinkItem,
|
|
5
|
+
LinksMenu,
|
|
6
|
+
SearchToggle,
|
|
7
|
+
ThemeToggle
|
|
8
|
+
} from "./chunk-2BHQGWSJ.js";
|
|
9
|
+
import {
|
|
10
|
+
ScrollArea,
|
|
11
|
+
ScrollViewport
|
|
12
|
+
} from "./chunk-VYTHQTZE.js";
|
|
13
|
+
import "./chunk-UBVEKNRF.js";
|
|
14
|
+
import {
|
|
15
|
+
TreeContextProvider,
|
|
16
|
+
useTreeContext
|
|
17
|
+
} from "./chunk-34Z7WODD.js";
|
|
18
|
+
import {
|
|
19
|
+
hasActive,
|
|
20
|
+
isActive
|
|
21
|
+
} from "./chunk-AN2Y6MA2.js";
|
|
22
|
+
import {
|
|
23
|
+
useSidebar
|
|
24
|
+
} from "./chunk-3F57TIUQ.js";
|
|
25
|
+
import {
|
|
26
|
+
useSearchContext
|
|
27
|
+
} from "./chunk-FSPYEOFC.js";
|
|
28
|
+
import "./chunk-CRYPD6UZ.js";
|
|
29
|
+
import {
|
|
30
|
+
Collapsible,
|
|
31
|
+
CollapsibleContent,
|
|
32
|
+
CollapsibleTrigger
|
|
33
|
+
} from "./chunk-7XPZOMJ2.js";
|
|
34
|
+
import {
|
|
35
|
+
buttonVariants
|
|
36
|
+
} from "./chunk-7GZKFBAP.js";
|
|
37
|
+
import {
|
|
38
|
+
twMerge
|
|
39
|
+
} from "./chunk-TK3TM3MR.js";
|
|
40
|
+
import "./chunk-MLKGABMK.js";
|
|
41
|
+
|
|
42
|
+
// src/docs.client.tsx
|
|
43
|
+
import Link2 from "next/link";
|
|
44
|
+
import { SidebarTrigger } from "fumadocs-core/sidebar";
|
|
45
|
+
import { Menu, X } from "lucide-react";
|
|
46
|
+
|
|
47
|
+
// src/components/layout/sidebar.tsx
|
|
48
|
+
import { cva } from "class-variance-authority";
|
|
49
|
+
import { ChevronDown, ExternalLinkIcon } from "lucide-react";
|
|
50
|
+
import * as Base from "fumadocs-core/sidebar";
|
|
51
|
+
import { usePathname } from "next/navigation";
|
|
52
|
+
import {
|
|
53
|
+
createContext,
|
|
54
|
+
useCallback,
|
|
55
|
+
useContext,
|
|
56
|
+
useEffect,
|
|
57
|
+
useMemo,
|
|
58
|
+
useState
|
|
59
|
+
} from "react";
|
|
60
|
+
import Link from "fumadocs-core/link";
|
|
61
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
62
|
+
var itemVariants = cva(
|
|
63
|
+
"flex w-full flex-row items-center gap-2 rounded-md px-2 py-1.5 text-muted-foreground transition-colors duration-100 [&_svg]:size-4",
|
|
64
|
+
{
|
|
65
|
+
variants: {
|
|
66
|
+
active: {
|
|
67
|
+
true: "bg-primary/10 font-medium text-primary",
|
|
68
|
+
false: "hover:bg-accent/50 hover:text-accent-foreground/80 hover:transition-none"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
var defaultComponents = {
|
|
74
|
+
Folder: FolderNode,
|
|
75
|
+
Separator: SeparatorNode,
|
|
76
|
+
Item: PageNode
|
|
77
|
+
};
|
|
78
|
+
var Context = createContext({
|
|
79
|
+
defaultOpenLevel: 1,
|
|
80
|
+
components: defaultComponents
|
|
81
|
+
});
|
|
82
|
+
function Sidebar({
|
|
83
|
+
footer,
|
|
84
|
+
components,
|
|
85
|
+
defaultOpenLevel = 1,
|
|
86
|
+
banner,
|
|
87
|
+
items,
|
|
88
|
+
aside,
|
|
89
|
+
bannerProps,
|
|
90
|
+
footerProps
|
|
91
|
+
}) {
|
|
92
|
+
const context = useMemo(
|
|
93
|
+
() => ({
|
|
94
|
+
defaultOpenLevel,
|
|
95
|
+
components: { ...defaultComponents, ...components }
|
|
96
|
+
}),
|
|
97
|
+
[components, defaultOpenLevel]
|
|
98
|
+
);
|
|
99
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value: context, children: /* @__PURE__ */ jsxs(
|
|
100
|
+
Base.SidebarList,
|
|
101
|
+
{
|
|
102
|
+
id: "nd-sidebar",
|
|
103
|
+
blockScrollingWidth: 768,
|
|
104
|
+
...aside,
|
|
105
|
+
className: twMerge(
|
|
106
|
+
"z-30 flex w-full flex-col text-[15px] md:sticky md:top-0 md:h-dvh md:w-[240px] md:border-e md:bg-card md:text-sm xl:w-[260px]",
|
|
107
|
+
"max-md:fixed max-md:inset-0 max-md:bg-background/80 max-md:pt-16 max-md:backdrop-blur-md max-md:data-[open=false]:hidden",
|
|
108
|
+
aside?.className
|
|
109
|
+
),
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ jsxs(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
...bannerProps,
|
|
115
|
+
className: twMerge(
|
|
116
|
+
"flex flex-col gap-2 px-4 pt-2 md:px-3 md:pt-6",
|
|
117
|
+
bannerProps?.className
|
|
118
|
+
),
|
|
119
|
+
children: [
|
|
120
|
+
banner,
|
|
121
|
+
/* @__PURE__ */ jsx(LargeSearchToggle, { className: "rounded-lg max-md:hidden" })
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ jsx(ViewportContent, { children: items.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col md:hidden", children: items.map((item, i) => /* @__PURE__ */ jsx(LinkItem, { item, on: "menu" }, i)) }) }),
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
"div",
|
|
128
|
+
{
|
|
129
|
+
...footerProps,
|
|
130
|
+
className: twMerge(
|
|
131
|
+
"flex flex-row items-center border-t px-4 py-2 md:px-3",
|
|
132
|
+
footerProps?.className
|
|
133
|
+
),
|
|
134
|
+
children: footer
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
) });
|
|
140
|
+
}
|
|
141
|
+
function ViewportContent({
|
|
142
|
+
children
|
|
143
|
+
}) {
|
|
144
|
+
const { root } = useTreeContext();
|
|
145
|
+
return /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
146
|
+
ScrollViewport,
|
|
147
|
+
{
|
|
148
|
+
style: {
|
|
149
|
+
maskImage: "linear-gradient(to bottom, transparent 2px, white 16px, white calc(100% - 16px), transparent calc(100% - 2px))"
|
|
150
|
+
},
|
|
151
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-8 p-4 md:px-3", children: [
|
|
152
|
+
children,
|
|
153
|
+
/* @__PURE__ */ jsx(NodeList, { items: root.children })
|
|
154
|
+
] })
|
|
155
|
+
}
|
|
156
|
+
) });
|
|
157
|
+
}
|
|
158
|
+
function NodeList({
|
|
159
|
+
items,
|
|
160
|
+
level = 0,
|
|
161
|
+
...props
|
|
162
|
+
}) {
|
|
163
|
+
const { components } = useContext(Context);
|
|
164
|
+
return /* @__PURE__ */ jsx("div", { ...props, children: items.map((item) => {
|
|
165
|
+
const id = `${item.type}_${item.name}`;
|
|
166
|
+
switch (item.type) {
|
|
167
|
+
case "separator":
|
|
168
|
+
return /* @__PURE__ */ jsx(components.Separator, { item }, id);
|
|
169
|
+
case "folder":
|
|
170
|
+
return /* @__PURE__ */ jsx(components.Folder, { item, level: level + 1 }, id);
|
|
171
|
+
default:
|
|
172
|
+
return /* @__PURE__ */ jsx(components.Item, { item }, item.url);
|
|
173
|
+
}
|
|
174
|
+
}) });
|
|
175
|
+
}
|
|
176
|
+
function PageNode({
|
|
177
|
+
item: { icon, external = false, url, name }
|
|
178
|
+
}) {
|
|
179
|
+
const pathname = usePathname();
|
|
180
|
+
const { closeOnRedirect } = useSidebar();
|
|
181
|
+
const active = isActive(url, pathname, false);
|
|
182
|
+
return /* @__PURE__ */ jsxs(
|
|
183
|
+
Link,
|
|
184
|
+
{
|
|
185
|
+
href: url,
|
|
186
|
+
external,
|
|
187
|
+
className: twMerge(itemVariants({ active })),
|
|
188
|
+
onClick: useCallback(() => {
|
|
189
|
+
closeOnRedirect.current = !active;
|
|
190
|
+
}, [closeOnRedirect, active]),
|
|
191
|
+
children: [
|
|
192
|
+
icon ?? (external ? /* @__PURE__ */ jsx(ExternalLinkIcon, {}) : null),
|
|
193
|
+
name
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
function FolderNode({
|
|
199
|
+
item: { name, children, index, icon, defaultOpen = false },
|
|
200
|
+
level
|
|
201
|
+
}) {
|
|
202
|
+
const { defaultOpenLevel } = useContext(Context);
|
|
203
|
+
const { closeOnRedirect } = useSidebar();
|
|
204
|
+
const pathname = usePathname();
|
|
205
|
+
const active = index !== void 0 && isActive(index.url, pathname, false);
|
|
206
|
+
const childActive = useMemo(
|
|
207
|
+
() => hasActive(children, pathname),
|
|
208
|
+
[children, pathname]
|
|
209
|
+
);
|
|
210
|
+
const shouldExtend = active || childActive || defaultOpenLevel >= level || defaultOpen;
|
|
211
|
+
const [extend, setExtend] = useState(shouldExtend);
|
|
212
|
+
useEffect(() => {
|
|
213
|
+
if (shouldExtend) setExtend(true);
|
|
214
|
+
}, [shouldExtend]);
|
|
215
|
+
const onClick = useCallback(
|
|
216
|
+
(e) => {
|
|
217
|
+
if (e.target !== e.currentTarget || active) {
|
|
218
|
+
setExtend((prev) => !prev);
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
} else {
|
|
221
|
+
closeOnRedirect.current = !active;
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
[closeOnRedirect, active]
|
|
225
|
+
);
|
|
226
|
+
return /* @__PURE__ */ jsxs(Collapsible, { open: extend, onOpenChange: setExtend, children: [
|
|
227
|
+
index ? /* @__PURE__ */ jsxs(
|
|
228
|
+
Link,
|
|
229
|
+
{
|
|
230
|
+
className: twMerge(itemVariants({ active })),
|
|
231
|
+
href: index.url,
|
|
232
|
+
onClick,
|
|
233
|
+
children: [
|
|
234
|
+
icon,
|
|
235
|
+
name,
|
|
236
|
+
/* @__PURE__ */ jsx(
|
|
237
|
+
ChevronDown,
|
|
238
|
+
{
|
|
239
|
+
className: twMerge(
|
|
240
|
+
"ms-auto transition-transform",
|
|
241
|
+
!extend && "-rotate-90"
|
|
242
|
+
)
|
|
243
|
+
}
|
|
244
|
+
)
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
) : /* @__PURE__ */ jsxs(CollapsibleTrigger, { className: twMerge(itemVariants({ active })), children: [
|
|
248
|
+
icon,
|
|
249
|
+
name,
|
|
250
|
+
/* @__PURE__ */ jsx(
|
|
251
|
+
ChevronDown,
|
|
252
|
+
{
|
|
253
|
+
className: twMerge(
|
|
254
|
+
"ms-auto transition-transform",
|
|
255
|
+
!extend && "-rotate-90"
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
)
|
|
259
|
+
] }),
|
|
260
|
+
/* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx(
|
|
261
|
+
NodeList,
|
|
262
|
+
{
|
|
263
|
+
className: "ms-2 flex flex-col border-s py-2 ps-2",
|
|
264
|
+
items: children,
|
|
265
|
+
level
|
|
266
|
+
}
|
|
267
|
+
) })
|
|
268
|
+
] });
|
|
269
|
+
}
|
|
270
|
+
function SeparatorNode({
|
|
271
|
+
item
|
|
272
|
+
}) {
|
|
273
|
+
return /* @__PURE__ */ jsx("p", { className: "mb-2 mt-8 px-2 font-medium first:mt-0", children: item.name });
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// src/components/layout/dynamic-sidebar.tsx
|
|
277
|
+
import { useCallback as useCallback2, useRef, useState as useState2 } from "react";
|
|
278
|
+
import { SidebarIcon } from "lucide-react";
|
|
279
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
280
|
+
function DynamicSidebar(props) {
|
|
281
|
+
const { collapsed, setCollapsed } = useSidebar();
|
|
282
|
+
const [hover, setHover] = useState2(false);
|
|
283
|
+
const timerRef = useRef(0);
|
|
284
|
+
const onCollapse = useCallback2(() => {
|
|
285
|
+
setCollapsed(!collapsed);
|
|
286
|
+
}, [collapsed, setCollapsed]);
|
|
287
|
+
const onHover = useCallback2((e) => {
|
|
288
|
+
if (e.pointerType === "touch") return;
|
|
289
|
+
window.clearTimeout(timerRef.current);
|
|
290
|
+
setHover(true);
|
|
291
|
+
}, []);
|
|
292
|
+
const onLeave = useCallback2((e) => {
|
|
293
|
+
if (e.pointerType === "touch") return;
|
|
294
|
+
window.clearTimeout(timerRef.current);
|
|
295
|
+
timerRef.current = window.setTimeout(() => {
|
|
296
|
+
setHover(false);
|
|
297
|
+
}, 300);
|
|
298
|
+
}, []);
|
|
299
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
300
|
+
collapsed ? /* @__PURE__ */ jsx2(
|
|
301
|
+
"div",
|
|
302
|
+
{
|
|
303
|
+
className: "fixed inset-y-0 start-0 w-4 max-md:hidden xl:static xl:w-[260px]",
|
|
304
|
+
onPointerEnter: onHover,
|
|
305
|
+
onPointerLeave: onLeave
|
|
306
|
+
}
|
|
307
|
+
) : null,
|
|
308
|
+
collapsed ? /* @__PURE__ */ jsx2(
|
|
309
|
+
"button",
|
|
310
|
+
{
|
|
311
|
+
type: "button",
|
|
312
|
+
"aria-label": "Collapse Sidebar",
|
|
313
|
+
className: twMerge(
|
|
314
|
+
buttonVariants({
|
|
315
|
+
color: "secondary",
|
|
316
|
+
size: "icon",
|
|
317
|
+
className: "fixed start-4 bottom-4 z-10 max-md:hidden"
|
|
318
|
+
})
|
|
319
|
+
),
|
|
320
|
+
onClick: onCollapse,
|
|
321
|
+
children: /* @__PURE__ */ jsx2(SidebarIcon, {})
|
|
322
|
+
}
|
|
323
|
+
) : null,
|
|
324
|
+
/* @__PURE__ */ jsx2(
|
|
325
|
+
Sidebar,
|
|
326
|
+
{
|
|
327
|
+
...props,
|
|
328
|
+
aside: {
|
|
329
|
+
"data-collapse": collapsed,
|
|
330
|
+
"data-hover": hover,
|
|
331
|
+
onPointerEnter: onHover,
|
|
332
|
+
onPointerLeave: onLeave,
|
|
333
|
+
"aria-hidden": Boolean(collapsed && !hover),
|
|
334
|
+
className: twMerge(
|
|
335
|
+
"overflow-hidden md:transition-transform",
|
|
336
|
+
collapsed && "md:fixed md:inset-y-2 md:start-2 md:h-auto md:rounded-xl md:border md:shadow-md"
|
|
337
|
+
)
|
|
338
|
+
},
|
|
339
|
+
footer: /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
340
|
+
props.footer,
|
|
341
|
+
/* @__PURE__ */ jsx2(
|
|
342
|
+
"button",
|
|
343
|
+
{
|
|
344
|
+
type: "button",
|
|
345
|
+
"aria-label": "Collapse Sidebar",
|
|
346
|
+
className: twMerge(
|
|
347
|
+
buttonVariants({
|
|
348
|
+
color: "ghost",
|
|
349
|
+
size: "icon",
|
|
350
|
+
className: "max-md:hidden"
|
|
351
|
+
})
|
|
352
|
+
),
|
|
353
|
+
onClick: onCollapse,
|
|
354
|
+
children: /* @__PURE__ */ jsx2(SidebarIcon, {})
|
|
355
|
+
}
|
|
356
|
+
)
|
|
357
|
+
] })
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
] });
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// src/docs.client.tsx
|
|
364
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
365
|
+
function SubNav({
|
|
366
|
+
title,
|
|
367
|
+
url = "/",
|
|
368
|
+
children,
|
|
369
|
+
enableSearch = true
|
|
370
|
+
}) {
|
|
371
|
+
const { open } = useSidebar();
|
|
372
|
+
const { enabled } = useSearchContext();
|
|
373
|
+
return /* @__PURE__ */ jsxs3(
|
|
374
|
+
"nav",
|
|
375
|
+
{
|
|
376
|
+
id: "nd-subnav",
|
|
377
|
+
className: "sticky top-0 z-40 flex h-16 w-full flex-row items-center border-b bg-background/80 px-4 backdrop-blur-md md:hidden [&_svg]:size-5",
|
|
378
|
+
children: [
|
|
379
|
+
/* @__PURE__ */ jsx3(Link2, { href: url, className: "inline-flex items-center gap-3 font-semibold", children: title }),
|
|
380
|
+
children,
|
|
381
|
+
enabled && enableSearch ? /* @__PURE__ */ jsx3(SearchToggle, { className: "ms-auto" }) : null,
|
|
382
|
+
/* @__PURE__ */ jsx3(
|
|
383
|
+
SidebarTrigger,
|
|
384
|
+
{
|
|
385
|
+
className: twMerge(
|
|
386
|
+
buttonVariants({
|
|
387
|
+
color: "ghost",
|
|
388
|
+
size: "icon",
|
|
389
|
+
className: (!enabled || !enableSearch) && "ms-auto"
|
|
390
|
+
})
|
|
391
|
+
),
|
|
392
|
+
children: open ? /* @__PURE__ */ jsx3(X, {}) : /* @__PURE__ */ jsx3(Menu, {})
|
|
393
|
+
}
|
|
394
|
+
)
|
|
395
|
+
]
|
|
396
|
+
}
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
export {
|
|
400
|
+
DynamicSidebar,
|
|
401
|
+
LinksMenu,
|
|
402
|
+
Sidebar,
|
|
403
|
+
SubNav,
|
|
404
|
+
ThemeToggle,
|
|
405
|
+
TreeContextProvider
|
|
406
|
+
};
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { SelectProps } from '@radix-ui/react-select';
|
|
2
1
|
import { ReactNode } from 'react';
|
|
3
|
-
import { N as NamedTranslation } from './i18n-
|
|
4
|
-
export { T as Translations } from './i18n-
|
|
2
|
+
import { N as NamedTranslation } from './i18n-CE8z-AAs.js';
|
|
3
|
+
export { T as Translations } from './i18n-CE8z-AAs.js';
|
|
5
4
|
|
|
6
|
-
type LanguageSelectProps = Omit<SelectProps, 'value' | 'onValueChange'>;
|
|
7
|
-
declare function LanguageSelect({ ...props }: LanguageSelectProps): React.ReactElement;
|
|
8
5
|
interface I18nProviderProps {
|
|
9
6
|
/**
|
|
10
7
|
* Force a locale
|
|
@@ -18,4 +15,4 @@ interface I18nProviderProps {
|
|
|
18
15
|
}
|
|
19
16
|
declare function I18nProvider({ translations, locale: forceLocale, children, }: I18nProviderProps): React.ReactElement;
|
|
20
17
|
|
|
21
|
-
export { I18nProvider
|
|
18
|
+
export { I18nProvider };
|
package/dist/i18n.js
CHANGED
|
@@ -2,110 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
I18nContext,
|
|
4
4
|
useI18n
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import {
|
|
7
|
-
twMerge
|
|
8
|
-
} from "./chunk-TK3TM3MR.js";
|
|
5
|
+
} from "./chunk-CRYPD6UZ.js";
|
|
9
6
|
import "./chunk-MLKGABMK.js";
|
|
10
7
|
|
|
11
8
|
// src/i18n.tsx
|
|
12
9
|
import { useCallback } from "react";
|
|
13
10
|
import { useRouter, usePathname } from "next/navigation";
|
|
14
|
-
|
|
15
|
-
// src/components/ui/select.tsx
|
|
16
|
-
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
17
|
-
import { Check, ChevronDown } from "lucide-react";
|
|
18
|
-
import * as React from "react";
|
|
19
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
-
var Select = SelectPrimitive.Root;
|
|
21
|
-
var SelectValue = SelectPrimitive.Value;
|
|
22
|
-
var SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
23
|
-
SelectPrimitive.Trigger,
|
|
24
|
-
{
|
|
25
|
-
ref,
|
|
26
|
-
className: twMerge(
|
|
27
|
-
"flex h-10 w-full items-center justify-between rounded-lg border px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground",
|
|
28
|
-
className
|
|
29
|
-
),
|
|
30
|
-
...props,
|
|
31
|
-
children: [
|
|
32
|
-
children,
|
|
33
|
-
/* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4 opacity-50" }) })
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
));
|
|
37
|
-
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
38
|
-
var SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
39
|
-
SelectPrimitive.Content,
|
|
40
|
-
{
|
|
41
|
-
ref,
|
|
42
|
-
className: twMerge(
|
|
43
|
-
"relative z-50 min-w-32 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=closed]:animate-popover-out data-[state=open]:animate-popover-in",
|
|
44
|
-
className
|
|
45
|
-
),
|
|
46
|
-
position,
|
|
47
|
-
...props,
|
|
48
|
-
children: /* @__PURE__ */ jsx(
|
|
49
|
-
SelectPrimitive.Viewport,
|
|
50
|
-
{
|
|
51
|
-
className: twMerge(
|
|
52
|
-
"p-1",
|
|
53
|
-
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
54
|
-
),
|
|
55
|
-
children
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
) }));
|
|
60
|
-
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
61
|
-
var SelectLabel = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
62
|
-
SelectPrimitive.Label,
|
|
63
|
-
{
|
|
64
|
-
ref,
|
|
65
|
-
className: twMerge("py-1.5 pl-8 pr-2 text-sm font-semibold", className),
|
|
66
|
-
...props
|
|
67
|
-
}
|
|
68
|
-
));
|
|
69
|
-
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
70
|
-
var SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
71
|
-
SelectPrimitive.Item,
|
|
72
|
-
{
|
|
73
|
-
ref,
|
|
74
|
-
className: twMerge(
|
|
75
|
-
"relative flex w-full select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
76
|
-
className
|
|
77
|
-
),
|
|
78
|
-
...props,
|
|
79
|
-
children: [
|
|
80
|
-
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "size-4" }) }) }),
|
|
81
|
-
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
));
|
|
85
|
-
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
86
|
-
var SelectSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
87
|
-
SelectPrimitive.Separator,
|
|
88
|
-
{
|
|
89
|
-
ref,
|
|
90
|
-
className: twMerge("-mx-1 my-1 h-px bg-muted", className),
|
|
91
|
-
...props
|
|
92
|
-
}
|
|
93
|
-
));
|
|
94
|
-
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
95
|
-
|
|
96
|
-
// src/i18n.tsx
|
|
97
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
98
|
-
function LanguageSelect({
|
|
99
|
-
...props
|
|
100
|
-
}) {
|
|
101
|
-
const context = useI18n();
|
|
102
|
-
if (!context.translations) throw new Error("Missing prop `translations`");
|
|
103
|
-
const languages = Object.entries(context.translations);
|
|
104
|
-
return /* @__PURE__ */ jsxs2(Select, { value: context.locale, onValueChange: context.onChange, ...props, children: [
|
|
105
|
-
/* @__PURE__ */ jsx2(SelectTrigger, { children: /* @__PURE__ */ jsx2(SelectValue, { placeholder: context.text.chooseLanguage }) }),
|
|
106
|
-
/* @__PURE__ */ jsx2(SelectContent, { children: languages.map(([lang, { name }]) => /* @__PURE__ */ jsx2(SelectItem, { value: lang, children: name }, lang)) })
|
|
107
|
-
] });
|
|
108
|
-
}
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
109
12
|
function I18nProvider({
|
|
110
13
|
translations = {},
|
|
111
14
|
locale: forceLocale,
|
|
@@ -124,7 +27,7 @@ function I18nProvider({
|
|
|
124
27
|
},
|
|
125
28
|
[segments, router]
|
|
126
29
|
);
|
|
127
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
128
31
|
I18nContext.Provider,
|
|
129
32
|
{
|
|
130
33
|
value: {
|
|
@@ -141,6 +44,5 @@ function I18nProvider({
|
|
|
141
44
|
);
|
|
142
45
|
}
|
|
143
46
|
export {
|
|
144
|
-
I18nProvider
|
|
145
|
-
LanguageSelect
|
|
47
|
+
I18nProvider
|
|
146
48
|
};
|