zudoku 0.4.4-dev.9 → 0.4.5-dev.0
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/client.d.ts +0 -5
- package/dist/config/validators/validate.d.ts +48 -110
- package/dist/config/validators/validate.js +1 -4
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/lib/components/Header.js +2 -1
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Layout.js +5 -3
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/MobileTopNavigation.d.ts +1 -0
- package/dist/lib/components/MobileTopNavigation.js +14 -0
- package/dist/lib/components/MobileTopNavigation.js.map +1 -0
- package/dist/lib/components/TopNavigation.js +1 -1
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/navigation/Sidebar.js +4 -2
- package/dist/lib/components/navigation/Sidebar.js.map +1 -1
- package/dist/lib/oas/graphql/index.js +2 -2
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/plugins/markdown/MdxPage.js +1 -1
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/graphql.d.ts +1 -1
- package/dist/lib/plugins/openapi/index.d.ts +2 -1
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +2 -5
- package/dist/lib/ui/Drawer.d.ts +26 -0
- package/dist/lib/ui/Drawer.js +23 -0
- package/dist/lib/ui/Drawer.js.map +1 -0
- package/dist/vite/plugin-api.js +23 -3
- package/dist/vite/plugin-api.js.map +1 -1
- package/lib/{Input-DH_IdyOP.js → Input-BtumfhQu.js} +374 -399
- package/lib/Input-BtumfhQu.js.map +1 -0
- package/lib/{MdxPage-DBmhggWT.js → MdxPage-C3VDc6a7.js} +6 -6
- package/lib/{MdxPage-DBmhggWT.js.map → MdxPage-C3VDc6a7.js.map} +1 -1
- package/lib/{OperationList-CTicz0GQ.js → OperationList-CLtN0fiZ.js} +5 -5
- package/lib/{OperationList-CTicz0GQ.js.map → OperationList-CLtN0fiZ.js.map} +1 -1
- package/lib/{Route-12T12Ml-.js → Route-Cfon6vDR.js} +2 -2
- package/lib/{Route-12T12Ml-.js.map → Route-Cfon6vDR.js.map} +1 -1
- package/lib/SidebarBadge-DMBr3H-a.js +498 -0
- package/lib/SidebarBadge-DMBr3H-a.js.map +1 -0
- package/lib/assets/{worker-BsNqC5G3.js → worker-BvD7B6MG.js} +2 -2
- package/lib/assets/{worker-BsNqC5G3.js.map → worker-BvD7B6MG.js.map} +1 -1
- package/lib/{index-0hAwyzGD.js → index-BfLQd6h_.js} +1862 -2087
- package/lib/index-BfLQd6h_.js.map +1 -0
- package/lib/{index-DFSdiG5J.js → index-CvPXovcL.js} +5 -5
- package/lib/{index-DFSdiG5J.js.map → index-CvPXovcL.js.map} +1 -1
- package/lib/{Combination-BDDQcRSU.js → index-KUt-5Yzq.js} +253 -228
- package/lib/index-KUt-5Yzq.js.map +1 -0
- package/lib/zudoku.components.js +1978 -861
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +2 -2
- package/lib/zudoku.openapi-worker.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +2 -2
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +2 -2
- package/package.json +2 -1
- package/src/lib/components/Header.tsx +6 -5
- package/src/lib/components/Layout.tsx +29 -14
- package/src/lib/components/MobileTopNavigation.tsx +52 -0
- package/src/lib/components/TopNavigation.tsx +1 -1
- package/src/lib/components/navigation/Sidebar.tsx +25 -10
- package/src/lib/oas/graphql/index.ts +2 -2
- package/src/lib/plugins/markdown/MdxPage.tsx +1 -1
- package/src/lib/plugins/openapi/graphql/graphql.ts +1 -1
- package/src/lib/plugins/openapi/index.tsx +3 -1
- package/src/lib/plugins/openapi/interfaces.ts +1 -4
- package/src/lib/ui/Drawer.tsx +119 -0
- package/lib/Combination-BDDQcRSU.js.map +0 -1
- package/lib/Input-DH_IdyOP.js.map +0 -1
- package/lib/SidebarBadge-YJxJ4aaV.js +0 -266
- package/lib/SidebarBadge-YJxJ4aaV.js.map +0 -1
- package/lib/index-0hAwyzGD.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-B6kdoens.js";
|
|
2
2
|
import { S as p, R as g } from "./SlotletProvider-CRKX9y2Z.js";
|
|
3
|
-
import { u as j, a as u, I as k, S as v, b as w, c as b, d as K, e as N, f as y } from "./Input-
|
|
3
|
+
import { u as j, a as u, I as k, S as v, b as w, c as b, d as K, e as N, f as y } from "./Input-BtumfhQu.js";
|
|
4
4
|
import { e as E, L as x, O as A } from "./index-ChhUJhLT.js";
|
|
5
5
|
import { u as m, t as C, j as S } from "./ZudokuContext-BHNQL3XO.js";
|
|
6
|
-
import { B as l, p as I } from "./
|
|
6
|
+
import { B as l, p as I } from "./index-KUt-5Yzq.js";
|
|
7
7
|
import { D as P } from "./DeveloperHint-Dim4dKeY.js";
|
|
8
8
|
import { useState as h } from "react";
|
|
9
9
|
import { c as d, a as D, C as R, g as q } from "./Markdown-Bg4SS0au.js";
|
|
@@ -4,7 +4,7 @@ const i = (t, e) => Object.entries(t).flatMap(([a, s]) => {
|
|
|
4
4
|
return o ? {
|
|
5
5
|
path: o,
|
|
6
6
|
lazy: async () => {
|
|
7
|
-
const { MdxPage: r } = await import("./MdxPage-
|
|
7
|
+
const { MdxPage: r } = await import("./MdxPage-C3VDc6a7.js"), { default: p, ...m } = await s();
|
|
8
8
|
return {
|
|
9
9
|
element: /* @__PURE__ */ c.jsx(
|
|
10
10
|
r,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./jsx-runtime-B6kdoens.js";
|
|
2
|
-
import { o as s } from "./index-
|
|
2
|
+
import { o as s } from "./index-BfLQd6h_.js";
|
|
3
3
|
import "./urql-YhcsXYy8.js";
|
|
4
4
|
import "./ZudokuContext-BHNQL3XO.js";
|
|
5
5
|
import "zudoku/openapi-worker";
|
|
6
|
-
import "./
|
|
6
|
+
import "./index-KUt-5Yzq.js";
|
|
7
7
|
import "./ErrorPage-XOZWbKDe.js";
|
|
8
8
|
import "./Markdown-Bg4SS0au.js";
|
|
9
9
|
import "./joinPath-B7kNnUX4.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zudoku",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5-dev.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -147,6 +147,7 @@
|
|
|
147
147
|
"ulidx": "^2.3.0",
|
|
148
148
|
"unist-util-visit": "5.0.0",
|
|
149
149
|
"urql": "4.1.0",
|
|
150
|
+
"vaul": "0.9.1",
|
|
150
151
|
"vite": "5.3.3",
|
|
151
152
|
"yaml": "2.5.0",
|
|
152
153
|
"yargs": "17.7.2",
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
import { cn } from "../util/cn.js";
|
|
20
20
|
import { useTheme } from "./context/ThemeContext.js";
|
|
21
21
|
import { useZudoku } from "./context/ZudokuContext.js";
|
|
22
|
+
import { MobileTopNavigation } from "./MobileTopNavigation.js";
|
|
22
23
|
import { Search } from "./Search.js";
|
|
23
24
|
import { Slotlet } from "./SlotletProvider.js";
|
|
24
25
|
import { TopNavigation } from "./TopNavigation.js";
|
|
@@ -58,9 +59,9 @@ export const Header = memo(function HeaderInner() {
|
|
|
58
59
|
const ThemeIcon = isDark ? MoonStarIcon : SunIcon;
|
|
59
60
|
|
|
60
61
|
return (
|
|
61
|
-
<header className="sticky top-0 z-10 bg-background/80 backdrop-blur w-full">
|
|
62
|
+
<header className="sticky lg:top-0 z-10 bg-background/80 backdrop-blur w-full">
|
|
62
63
|
<div className="max-w-screen-2xl mx-auto">
|
|
63
|
-
<div className="grid lg:grid-cols-[calc(var(--side-nav-width))_1fr] lg:gap-12 items-center border-b px-12 h-[--top-header-height]">
|
|
64
|
+
<div className="grid grid-cols-2 lg:grid-cols-[calc(var(--side-nav-width))_1fr] lg:gap-12 items-center border-b px-10 lg:px-12 h-[--top-header-height]">
|
|
64
65
|
<div className="flex">
|
|
65
66
|
<Link to="/">
|
|
66
67
|
<div className="flex items-center gap-3.5">
|
|
@@ -88,12 +89,13 @@ export const Header = memo(function HeaderInner() {
|
|
|
88
89
|
</div>
|
|
89
90
|
</Link>
|
|
90
91
|
</div>
|
|
91
|
-
<div className="grid grid-cols-[--sidecar-grid-cols] items-center gap-8">
|
|
92
|
+
<div className="grid grid-cols-2 md:grid-cols-[--sidecar-grid-cols] items-center gap-8">
|
|
92
93
|
<div className="w-full justify-center flex">
|
|
93
94
|
<Search />
|
|
94
95
|
</div>
|
|
95
96
|
|
|
96
|
-
<
|
|
97
|
+
<MobileTopNavigation />
|
|
98
|
+
<div className="hidden lg:flex items-center justify-self-end text-sm gap-2">
|
|
97
99
|
<Slotlet name="head-navigation-start" />
|
|
98
100
|
{isAuthEnabled && !isAuthenticated ? (
|
|
99
101
|
<Button variant="ghost" onClick={() => auth.login()}>
|
|
@@ -115,7 +117,6 @@ export const Header = memo(function HeaderInner() {
|
|
|
115
117
|
</DropdownMenu>
|
|
116
118
|
)
|
|
117
119
|
)}
|
|
118
|
-
|
|
119
120
|
<button
|
|
120
121
|
type="button"
|
|
121
122
|
aria-label={
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Helmet } from "@zudoku/react-helmet-async";
|
|
2
|
+
import { PanelLeftIcon } from "lucide-react";
|
|
2
3
|
import { Suspense, useEffect, useRef, type ReactNode } from "react";
|
|
3
4
|
import { Outlet, useLocation } from "react-router-dom";
|
|
5
|
+
import { Drawer, DrawerTrigger } from "../ui/Drawer.js";
|
|
4
6
|
import { cn } from "../util/cn.js";
|
|
5
7
|
import { useScrollToAnchor } from "../util/useScrollToAnchor.js";
|
|
6
8
|
import { useScrollToTop } from "../util/useScrollToTop.js";
|
|
@@ -56,20 +58,33 @@ export const Layout = ({ children }: { children?: ReactNode }) => {
|
|
|
56
58
|
</main>
|
|
57
59
|
}
|
|
58
60
|
>
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
61
|
+
<Drawer direction="left">
|
|
62
|
+
<Sidebar />
|
|
63
|
+
<div
|
|
64
|
+
className={cn(
|
|
65
|
+
"lg:hidden -mx-10 px-10 py-2 sticky bg-background/80 backdrop-blur z-10 top-0 left-0 right-0 border-b",
|
|
66
|
+
"peer-data-[navigation=false]:hidden",
|
|
67
|
+
)}
|
|
68
|
+
>
|
|
69
|
+
<DrawerTrigger className="flex items-center gap-2">
|
|
70
|
+
<PanelLeftIcon size={16} strokeWidth={1.5} />
|
|
71
|
+
<span className="text-sm">Menu</span>
|
|
72
|
+
</DrawerTrigger>
|
|
73
|
+
</div>
|
|
74
|
+
<main
|
|
75
|
+
className={cn(
|
|
76
|
+
"h-full dark:border-white/10 translate-x-0",
|
|
77
|
+
"lg:overflow-visible",
|
|
78
|
+
// This works in tandem with the `SidebarWrapper` component
|
|
79
|
+
"lg:peer-data-[navigation=true]:w-[calc(100%-var(--side-nav-width))]",
|
|
80
|
+
"lg:peer-data-[navigation=true]:translate-x-[--side-nav-width] lg:peer-data-[navigation=true]:pl-12",
|
|
81
|
+
)}
|
|
82
|
+
>
|
|
83
|
+
<Slotlet name="zudoku-before-content" />
|
|
84
|
+
{children ?? <Outlet />}
|
|
85
|
+
<Slotlet name="zudoku-after-content" />
|
|
86
|
+
</main>
|
|
87
|
+
</Drawer>
|
|
73
88
|
</Suspense>
|
|
74
89
|
</div>
|
|
75
90
|
</>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
|
2
|
+
import { cx } from "class-variance-authority";
|
|
3
|
+
import { MenuIcon } from "lucide-react";
|
|
4
|
+
import { NavLink } from "react-router-dom";
|
|
5
|
+
import {
|
|
6
|
+
Drawer,
|
|
7
|
+
DrawerClose,
|
|
8
|
+
DrawerContent,
|
|
9
|
+
DrawerTitle,
|
|
10
|
+
DrawerTrigger,
|
|
11
|
+
} from "../ui/Drawer.js";
|
|
12
|
+
import { useZudoku } from "./context/ZudokuContext.js";
|
|
13
|
+
|
|
14
|
+
export const MobileTopNavigation = () => {
|
|
15
|
+
const { topNavigation } = useZudoku();
|
|
16
|
+
return (
|
|
17
|
+
<Drawer direction="right">
|
|
18
|
+
<div className="flex lg:hidden justify-self-end">
|
|
19
|
+
<DrawerTrigger className="lg:hidden">
|
|
20
|
+
<MenuIcon size={22} />
|
|
21
|
+
</DrawerTrigger>
|
|
22
|
+
</div>
|
|
23
|
+
<DrawerContent
|
|
24
|
+
className="lg:hidden h-screen right-0 left-auto w-[320px] rounded-none"
|
|
25
|
+
aria-describedby={undefined}
|
|
26
|
+
>
|
|
27
|
+
<VisuallyHidden>
|
|
28
|
+
<DrawerTitle>Navigation</DrawerTitle>
|
|
29
|
+
</VisuallyHidden>
|
|
30
|
+
<ul className="flex flex-col items-center gap-4 p-4">
|
|
31
|
+
{topNavigation.map((item) => (
|
|
32
|
+
<li key={item.label}>
|
|
33
|
+
<NavLink
|
|
34
|
+
className={({ isActive }) =>
|
|
35
|
+
cx(
|
|
36
|
+
"block font-medium border-b-2",
|
|
37
|
+
isActive
|
|
38
|
+
? "border-primary text-foreground"
|
|
39
|
+
: "border-transparent text-foreground/75 hover:text-foreground hover:border-accent-foreground/25",
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
to={item.id}
|
|
43
|
+
>
|
|
44
|
+
<DrawerClose>{item.label}</DrawerClose>
|
|
45
|
+
</NavLink>
|
|
46
|
+
</li>
|
|
47
|
+
))}
|
|
48
|
+
</ul>
|
|
49
|
+
</DrawerContent>
|
|
50
|
+
</Drawer>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
@@ -12,7 +12,7 @@ export const TopNavigation = () => {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
|
-
<nav className="border-b text-sm px-12 h-[--top-nav-height]">
|
|
15
|
+
<nav className="hidden lg:block border-b text-sm px-12 h-[--top-nav-height]">
|
|
16
16
|
<ul className="flex flex-row items-center gap-8">
|
|
17
17
|
{topNavigation.map((item) => (
|
|
18
18
|
<li key={item.label}>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useRef } from "react";
|
|
2
2
|
|
|
3
|
+
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
|
4
|
+
import { DrawerContent, DrawerTitle } from "../../ui/Drawer.js";
|
|
3
5
|
import { useNavigation } from "../context/ZudokuContext.js";
|
|
4
6
|
import { Slotlet } from "../SlotletProvider.js";
|
|
5
7
|
import { SidebarItem } from "./SidebarItem.js";
|
|
@@ -10,15 +12,28 @@ export const Sidebar = () => {
|
|
|
10
12
|
const navigation = useNavigation();
|
|
11
13
|
|
|
12
14
|
return (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
<>
|
|
16
|
+
<SidebarWrapper
|
|
17
|
+
ref={navRef}
|
|
18
|
+
pushMainContent={navigation.data.items.length > 0}
|
|
19
|
+
>
|
|
20
|
+
<Slotlet name="zudoku-before-navigation" />
|
|
21
|
+
{navigation.data.items.map((item) => (
|
|
22
|
+
<SidebarItem key={item.label} item={item} />
|
|
23
|
+
))}
|
|
24
|
+
<Slotlet name="zudoku-after-navigation" />
|
|
25
|
+
</SidebarWrapper>
|
|
26
|
+
<DrawerContent
|
|
27
|
+
className="lg:hidden h-screen left-0 p-6 w-[320px] rounded-none"
|
|
28
|
+
aria-describedby={undefined}
|
|
29
|
+
>
|
|
30
|
+
<VisuallyHidden>
|
|
31
|
+
<DrawerTitle>Sidebar</DrawerTitle>
|
|
32
|
+
</VisuallyHidden>
|
|
33
|
+
{navigation.data.items.map((item) => (
|
|
34
|
+
<SidebarItem key={item.label} item={item} />
|
|
35
|
+
))}
|
|
36
|
+
</DrawerContent>
|
|
37
|
+
</>
|
|
23
38
|
);
|
|
24
39
|
};
|
|
@@ -76,7 +76,7 @@ const getAllTags = (schema: OpenAPIDocument): TagObject[] => {
|
|
|
76
76
|
.flatMap((path) => Object.values(path ?? {}))
|
|
77
77
|
.flatMap((operation) =>
|
|
78
78
|
typeof operation === "object" && "tags" in operation
|
|
79
|
-
? operation.tags ?? []
|
|
79
|
+
? (operation.tags ?? [])
|
|
80
80
|
: [],
|
|
81
81
|
);
|
|
82
82
|
|
|
@@ -422,7 +422,7 @@ const loadOpenAPISchema = async (input: NonNullable<unknown>) => {
|
|
|
422
422
|
};
|
|
423
423
|
|
|
424
424
|
const SchemaSource = builder.enumType("SchemaType", {
|
|
425
|
-
values: ["url", "
|
|
425
|
+
values: ["url", "file"] as const,
|
|
426
426
|
});
|
|
427
427
|
|
|
428
428
|
builder.queryType({
|
|
@@ -85,7 +85,7 @@ export const MdxPage = ({
|
|
|
85
85
|
{!hidePager && (
|
|
86
86
|
<>
|
|
87
87
|
<hr />
|
|
88
|
-
<div className="not-prose flex flex-wrap items-center justify-between gap-8">
|
|
88
|
+
<div className="not-prose flex flex-wrap items-center justify-between gap-2 lg:gap-8">
|
|
89
89
|
{prev ? (
|
|
90
90
|
<Link
|
|
91
91
|
to={prev.id}
|
|
@@ -68,8 +68,10 @@ const MethodColorMap: Record<string, keyof typeof ColorMap> = {
|
|
|
68
68
|
head: "gray",
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
export type OpenApiPluginOptions = OasPluginConfig & InternalOasPluginConfig;
|
|
72
|
+
|
|
71
73
|
export const openApiPlugin = (
|
|
72
|
-
config:
|
|
74
|
+
config: OpenApiPluginOptions,
|
|
73
75
|
): DevPortalPlugin => {
|
|
74
76
|
const basePath = joinPath(config.navigationId ?? "/reference");
|
|
75
77
|
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Drawer as DrawerPrimitive } from "vaul";
|
|
3
|
+
import { cn } from "../util/cn.js";
|
|
4
|
+
|
|
5
|
+
const Drawer = ({
|
|
6
|
+
shouldScaleBackground = true,
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
|
|
9
|
+
<DrawerPrimitive.Root
|
|
10
|
+
shouldScaleBackground={shouldScaleBackground}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
Drawer.displayName = "Drawer";
|
|
15
|
+
|
|
16
|
+
const DrawerTrigger = DrawerPrimitive.Trigger;
|
|
17
|
+
|
|
18
|
+
const DrawerPortal = DrawerPrimitive.Portal;
|
|
19
|
+
|
|
20
|
+
const DrawerClose = DrawerPrimitive.Close;
|
|
21
|
+
|
|
22
|
+
const DrawerOverlay = React.forwardRef<
|
|
23
|
+
React.ElementRef<typeof DrawerPrimitive.Overlay>,
|
|
24
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
|
|
25
|
+
>(({ className, ...props }, ref) => (
|
|
26
|
+
<DrawerPrimitive.Overlay
|
|
27
|
+
ref={ref}
|
|
28
|
+
className={cn("fixed inset-0 z-50 bg-black/80", className)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
));
|
|
32
|
+
DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
|
|
33
|
+
|
|
34
|
+
const DrawerContent = React.forwardRef<
|
|
35
|
+
React.ElementRef<typeof DrawerPrimitive.Content>,
|
|
36
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content> & {
|
|
37
|
+
hideBar?: boolean;
|
|
38
|
+
}
|
|
39
|
+
>(({ className, children, hideBar = true, ...props }, ref) => (
|
|
40
|
+
<DrawerPortal>
|
|
41
|
+
<DrawerOverlay />
|
|
42
|
+
<DrawerPrimitive.Content
|
|
43
|
+
ref={ref}
|
|
44
|
+
className={cn(
|
|
45
|
+
"fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
|
|
46
|
+
className,
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
>
|
|
50
|
+
{!hideBar && (
|
|
51
|
+
<div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" />
|
|
52
|
+
)}
|
|
53
|
+
{children}
|
|
54
|
+
</DrawerPrimitive.Content>
|
|
55
|
+
</DrawerPortal>
|
|
56
|
+
));
|
|
57
|
+
DrawerContent.displayName = "DrawerContent";
|
|
58
|
+
|
|
59
|
+
const DrawerHeader = ({
|
|
60
|
+
className,
|
|
61
|
+
...props
|
|
62
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
63
|
+
<div
|
|
64
|
+
className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
DrawerHeader.displayName = "DrawerHeader";
|
|
69
|
+
|
|
70
|
+
const DrawerFooter = ({
|
|
71
|
+
className,
|
|
72
|
+
...props
|
|
73
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
74
|
+
<div
|
|
75
|
+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
DrawerFooter.displayName = "DrawerFooter";
|
|
80
|
+
|
|
81
|
+
const DrawerTitle = React.forwardRef<
|
|
82
|
+
React.ElementRef<typeof DrawerPrimitive.Title>,
|
|
83
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
|
|
84
|
+
>(({ className, ...props }, ref) => (
|
|
85
|
+
<DrawerPrimitive.Title
|
|
86
|
+
ref={ref}
|
|
87
|
+
className={cn(
|
|
88
|
+
"text-lg font-semibold leading-none tracking-tight",
|
|
89
|
+
className,
|
|
90
|
+
)}
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
));
|
|
94
|
+
DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
|
|
95
|
+
|
|
96
|
+
const DrawerDescription = React.forwardRef<
|
|
97
|
+
React.ElementRef<typeof DrawerPrimitive.Description>,
|
|
98
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
|
|
99
|
+
>(({ className, ...props }, ref) => (
|
|
100
|
+
<DrawerPrimitive.Description
|
|
101
|
+
ref={ref}
|
|
102
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
));
|
|
106
|
+
DrawerDescription.displayName = DrawerPrimitive.Description.displayName;
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
Drawer,
|
|
110
|
+
DrawerClose,
|
|
111
|
+
DrawerContent,
|
|
112
|
+
DrawerDescription,
|
|
113
|
+
DrawerFooter,
|
|
114
|
+
DrawerHeader,
|
|
115
|
+
DrawerOverlay,
|
|
116
|
+
DrawerPortal,
|
|
117
|
+
DrawerTitle,
|
|
118
|
+
DrawerTrigger,
|
|
119
|
+
};
|