zudoku 0.4.4-dev.0 → 0.4.4-dev.10

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.
Files changed (77) hide show
  1. package/client.d.ts +6 -0
  2. package/dist/lib/components/Header.js +2 -1
  3. package/dist/lib/components/Header.js.map +1 -1
  4. package/dist/lib/components/Layout.js +5 -3
  5. package/dist/lib/components/Layout.js.map +1 -1
  6. package/dist/lib/components/MobileTopNavigation.d.ts +1 -0
  7. package/dist/lib/components/MobileTopNavigation.js +14 -0
  8. package/dist/lib/components/MobileTopNavigation.js.map +1 -0
  9. package/dist/lib/components/TopNavigation.js +1 -1
  10. package/dist/lib/components/TopNavigation.js.map +1 -1
  11. package/dist/lib/components/navigation/Sidebar.js +4 -2
  12. package/dist/lib/components/navigation/Sidebar.js.map +1 -1
  13. package/dist/lib/plugins/markdown/MdxPage.js +1 -1
  14. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  15. package/dist/lib/ui/Callout.js +1 -1
  16. package/dist/lib/ui/Callout.js.map +1 -1
  17. package/dist/lib/ui/Drawer.d.ts +26 -0
  18. package/dist/lib/ui/Drawer.js +23 -0
  19. package/dist/lib/ui/Drawer.js.map +1 -0
  20. package/dist/lib/util/MdxComponents.js +1 -1
  21. package/dist/lib/util/MdxComponents.js.map +1 -1
  22. package/dist/vite/html.js +2 -2
  23. package/lib/{CategoryHeading-DLCe0Use.js → CategoryHeading-BG0OI3O5.js} +2 -2
  24. package/lib/{CategoryHeading-DLCe0Use.js.map → CategoryHeading-BG0OI3O5.js.map} +1 -1
  25. package/lib/{DeveloperHint-CCKk5wYF.js → DeveloperHint-Dim4dKeY.js} +2 -2
  26. package/lib/{DeveloperHint-CCKk5wYF.js.map → DeveloperHint-Dim4dKeY.js.map} +1 -1
  27. package/lib/{ErrorPage-BUyRN_4w.js → ErrorPage-XOZWbKDe.js} +3 -3
  28. package/lib/{ErrorPage-BUyRN_4w.js.map → ErrorPage-XOZWbKDe.js.map} +1 -1
  29. package/lib/{Input-C81a88Ux.js → Input-BtumfhQu.js} +375 -400
  30. package/lib/Input-BtumfhQu.js.map +1 -0
  31. package/lib/{Markdown-DWiGXWrs.js → Markdown-Bg4SS0au.js} +4 -4
  32. package/lib/Markdown-Bg4SS0au.js.map +1 -0
  33. package/lib/{MdxPage-DKD6W5vO.js → MdxPage-C3VDc6a7.js} +40 -40
  34. package/lib/{MdxPage-DKD6W5vO.js.map → MdxPage-C3VDc6a7.js.map} +1 -1
  35. package/lib/{OperationList-EG2GsU0f.js → OperationList-CLtN0fiZ.js} +9 -9
  36. package/lib/{OperationList-EG2GsU0f.js.map → OperationList-CLtN0fiZ.js.map} +1 -1
  37. package/lib/{Route-R9dc2BqA.js → Route-Cfon6vDR.js} +2 -2
  38. package/lib/{Route-R9dc2BqA.js.map → Route-Cfon6vDR.js.map} +1 -1
  39. package/lib/SidebarBadge-DMBr3H-a.js +498 -0
  40. package/lib/SidebarBadge-DMBr3H-a.js.map +1 -0
  41. package/lib/{SlotletProvider-BOqq0WiS.js → SlotletProvider-CRKX9y2Z.js} +4 -4
  42. package/lib/{SlotletProvider-BOqq0WiS.js.map → SlotletProvider-CRKX9y2Z.js.map} +1 -1
  43. package/lib/{Spinner-D2_3rzdl.js → Spinner-BJ5wiTiz.js} +2 -2
  44. package/lib/{Spinner-D2_3rzdl.js.map → Spinner-BJ5wiTiz.js.map} +1 -1
  45. package/lib/{index-CcnRjD7X.js → index-BfLQd6h_.js} +1862 -2087
  46. package/lib/index-BfLQd6h_.js.map +1 -0
  47. package/lib/{index-sjtls4Rz.js → index-CvPXovcL.js} +5 -5
  48. package/lib/{index-sjtls4Rz.js.map → index-CvPXovcL.js.map} +1 -1
  49. package/lib/{Combination-B46-2_PR.js → index-KUt-5Yzq.js} +254 -229
  50. package/lib/index-KUt-5Yzq.js.map +1 -0
  51. package/lib/zudoku.auth-openid.js +4 -4
  52. package/lib/zudoku.components.js +1978 -861
  53. package/lib/zudoku.components.js.map +1 -1
  54. package/lib/zudoku.plugin-api-keys.js +5 -5
  55. package/lib/zudoku.plugin-custom-page.js +1 -1
  56. package/lib/zudoku.plugin-markdown.js +1 -1
  57. package/lib/zudoku.plugin-openapi.js +4 -4
  58. package/package.json +7 -2
  59. package/src/app/demo-cdn.html +4 -1
  60. package/src/app/demo.html +4 -1
  61. package/src/app/main.css +1 -1
  62. package/src/app/standalone.html +5 -2
  63. package/src/lib/components/Header.tsx +6 -5
  64. package/src/lib/components/Layout.tsx +29 -14
  65. package/src/lib/components/MobileTopNavigation.tsx +52 -0
  66. package/src/lib/components/TopNavigation.tsx +1 -1
  67. package/src/lib/components/navigation/Sidebar.tsx +25 -10
  68. package/src/lib/plugins/markdown/MdxPage.tsx +3 -3
  69. package/src/lib/ui/Callout.tsx +1 -1
  70. package/src/lib/ui/Drawer.tsx +119 -0
  71. package/src/lib/util/MdxComponents.tsx +2 -2
  72. package/lib/Combination-B46-2_PR.js.map +0 -1
  73. package/lib/Input-C81a88Ux.js.map +0 -1
  74. package/lib/Markdown-DWiGXWrs.js.map +0 -1
  75. package/lib/SidebarBadge-D7XZv6EH.js +0 -266
  76. package/lib/SidebarBadge-D7XZv6EH.js.map +0 -1
  77. package/lib/index-CcnRjD7X.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  import { j as e } from "./jsx-runtime-B6kdoens.js";
2
- import { S as p, R as g } from "./SlotletProvider-BOqq0WiS.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-C81a88Ux.js";
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-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 "./Combination-B46-2_PR.js";
7
- import { D as P } from "./DeveloperHint-CCKk5wYF.js";
6
+ import { B as l, p as I } from "./index-KUt-5Yzq.js";
7
+ import { D as P } from "./DeveloperHint-Dim4dKeY.js";
8
8
  import { useState as h } from "react";
9
- import { c as d, a as D, C as R, g as q } from "./Markdown-DWiGXWrs.js";
9
+ import { c as d, a as D, C as R, g as q } from "./Markdown-Bg4SS0au.js";
10
10
  /**
11
11
  * @license lucide-react v0.378.0 - ISC
12
12
  *
@@ -1,5 +1,5 @@
1
1
  import { j as m } from "./jsx-runtime-B6kdoens.js";
2
- import { P as o } from "./Markdown-DWiGXWrs.js";
2
+ import { P as o } from "./Markdown-Bg4SS0au.js";
3
3
  const l = (s) => ({
4
4
  getRoutes: () => s.map(({ path: e, element: t }) => ({
5
5
  path: e,
@@ -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-DKD6W5vO.js"), { default: p, ...m } = await s();
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,11 +1,11 @@
1
1
  import "./jsx-runtime-B6kdoens.js";
2
- import { o as s } from "./index-CcnRjD7X.js";
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 "./Combination-B46-2_PR.js";
7
- import "./ErrorPage-BUyRN_4w.js";
8
- import "./Markdown-DWiGXWrs.js";
6
+ import "./index-KUt-5Yzq.js";
7
+ import "./ErrorPage-XOZWbKDe.js";
8
+ import "./Markdown-Bg4SS0au.js";
9
9
  import "./joinPath-B7kNnUX4.js";
10
10
  import "./router-BiRCp01d.js";
11
11
  import "./index-ChhUJhLT.js";
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "zudoku",
3
- "version": "0.4.4-dev.0",
3
+ "version": "0.4.4-dev.10",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
7
7
  "lib",
8
8
  "cli.js",
9
9
  "src/lib",
10
- "src/app"
10
+ "src/app",
11
+ "client.d.ts"
11
12
  ],
12
13
  "bin": {
13
14
  "zudoku": "./cli.js"
@@ -17,6 +18,9 @@
17
18
  "import": "./dist/index.js",
18
19
  "types": "./dist/index.d.ts"
19
20
  },
21
+ "./client": {
22
+ "types": "./client.d.ts"
23
+ },
20
24
  "./internal": {
21
25
  "import": "./dist/internal.js"
22
26
  },
@@ -143,6 +147,7 @@
143
147
  "ulidx": "^2.3.0",
144
148
  "unist-util-visit": "5.0.0",
145
149
  "urql": "4.1.0",
150
+ "vaul": "0.9.1",
146
151
  "vite": "5.3.3",
147
152
  "yaml": "2.5.0",
148
153
  "yargs": "17.7.2",
@@ -7,7 +7,10 @@
7
7
  type="image/svg+xml"
8
8
  href="https://cdn.zudoku.dev/logos/favicon.svg"
9
9
  />
10
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
10
+ <meta
11
+ name="viewport"
12
+ content="width=device-width, initial-scale=1.0, minimum-scale=1.0"
13
+ />
11
14
  <title>Zudoku Demo</title>
12
15
  <script
13
16
  type="module"
package/src/app/demo.html CHANGED
@@ -7,7 +7,10 @@
7
7
  type="image/svg+xml"
8
8
  href="https://cdn.zudoku.dev/logos/favicon.svg"
9
9
  />
10
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
10
+ <meta
11
+ name="viewport"
12
+ content="width=device-width, initial-scale=1.0, minimum-scale=1.0"
13
+ />
11
14
  <title>Zudoku Demo</title>
12
15
  <script type="module" crossorigin src="./demo.js"></script>
13
16
  <link rel="stylesheet" crossorigin href="./style.css" />
package/src/app/main.css CHANGED
@@ -96,7 +96,7 @@
96
96
  }
97
97
 
98
98
  #root {
99
- @apply min-h-screen grid grid-rows-[var(--header-height)_1fr] w-full;
99
+ @apply min-h-screen w-full;
100
100
  }
101
101
  * {
102
102
  @apply border-border;
@@ -7,8 +7,11 @@
7
7
  type="image/svg+xml"
8
8
  href="https://cdn.zudoku.dev/logos/favicon.svg"
9
9
  />
10
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
11
- <title>Dev Portal</title>
10
+ <meta
11
+ name="viewport"
12
+ content="width=device-width, initial-scale=1.0, minimum-scale=1.0"
13
+ />
14
+ <title>Zudoku</title>
12
15
  <script type="module" crossorigin src="./main.js"></script>
13
16
  <link rel="stylesheet" crossorigin href="./style.css" />
14
17
  </head>
@@ -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 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
- <div className="items-center justify-self-end text-sm hidden lg:flex gap-2">
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
- <Sidebar />
60
- <main
61
- className={cn(
62
- "h-full dark:border-white/10 translate-x-0",
63
- "lg:overflow-visible",
64
- // This works in tandem with the `SidebarWrapper` component
65
- "lg:peer-data-[navigation=true]:w-[calc(100%-var(--side-nav-width))]",
66
- "lg:peer-data-[navigation=true]:translate-x-[--side-nav-width] lg:peer-data-[navigation=true]:pl-12",
67
- )}
68
- >
69
- <Slotlet name="zudoku-before-content" />
70
- {children ?? <Outlet />}
71
- <Slotlet name="zudoku-after-content" />
72
- </main>
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
- <SidebarWrapper
14
- ref={navRef}
15
- pushMainContent={navigation.data.items.length > 0}
16
- >
17
- <Slotlet name="zudoku-before-navigation" />
18
- {navigation.data.items.map((item) => (
19
- <SidebarItem key={item.label} item={item} />
20
- ))}
21
- <Slotlet name="zudoku-after-navigation" />
22
- </SidebarWrapper>
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
  };
@@ -85,11 +85,11 @@ export const MdxPage = ({
85
85
  {!hidePager && (
86
86
  <>
87
87
  <hr />
88
- <div className="not-prose flex 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}
92
- className="flex flex-col items-stretch gap-2 flex-1 truncate border rounded px-6 py-4 text-start hover:border-primary/85 transition shadow-sm hover:shadow-md"
92
+ className="flex flex-col items-stretch gap-2 flex-1 min-w-max border rounded px-6 py-4 text-start hover:border-primary/85 transition shadow-sm hover:shadow-md"
93
93
  title={prev.label}
94
94
  >
95
95
  <div className="text-sm text-muted-foreground">
@@ -105,7 +105,7 @@ export const MdxPage = ({
105
105
  {next ? (
106
106
  <Link
107
107
  to={next.id}
108
- className="flex flex-col items-stretch gap-2 flex-1 truncate border rounded px-6 py-4 text-end hover:border-primary/85 transition shadow-sm hover:shadow-md"
108
+ className="flex flex-col items-stretch gap-2 flex-1 min-w-max border rounded px-6 py-4 text-end hover:border-primary/85 transition shadow-sm hover:shadow-md"
109
109
  title={next.label}
110
110
  >
111
111
  <div className="text-sm text-muted-foreground">
@@ -66,7 +66,7 @@ export const Callout = ({ type, children, title, className }: CalloutProps) => {
66
66
  className={cn(
67
67
  "not-prose grid grid-cols-[min-content_1fr] grid-rows-[fit-content_1fr] gap-x-4 gap-y-2 text-md rounded-md border p-4",
68
68
  "[&_a]:underline [&_a]:decoration-current [&_a]:decoration-from-font [&_a]:underline-offset-4 hover:[&_a]:decoration-1",
69
- "[&_code]:!bg-gray-50 [&_code]:dark:!bg-gray-800 [&_code]:!border-none",
69
+ "[&_code]:!bg-gray-50 [&_code]:dark:!bg-gray-800 [&_code]:!border-none my-2",
70
70
  title && "items-center",
71
71
  border,
72
72
  bg,
@@ -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
+ };
@@ -77,8 +77,8 @@ export const MdxComponents = {
77
77
 
78
78
  return (
79
79
  <SyntaxHighlight
80
- language={match?.[1] ?? "markup"}
81
- className="rounded-xl overflow-x-auto p-4 border dark:!bg-foreground/10 dark:border-transparent"
80
+ language={match?.[1]}
81
+ className="rounded-xl p-4 border dark:!bg-foreground/10 dark:border-transparent"
82
82
  showLanguageIndicator
83
83
  code={String(children).trim()}
84
84
  />