@jxrstudios/jxr 1.0.10 → 1.1.11

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 (87) hide show
  1. package/bin/jxr.js +6 -0
  2. package/dist/index.js +57 -2
  3. package/dist/jxr-server-manager.d.ts.map +1 -1
  4. package/package.json +1 -1
  5. package/src/jxr-server-manager.ts +65 -2
  6. package/zzz_react_template/App.tsx +43 -156
  7. package/zzz_react_template/components/ErrorBoundary.tsx +62 -0
  8. package/zzz_react_template/components/ManusDialog.tsx +85 -0
  9. package/zzz_react_template/components/Map.tsx +155 -0
  10. package/zzz_react_template/components/jxr/CodeEditor.tsx +313 -0
  11. package/zzz_react_template/components/jxr/FileExplorer.tsx +230 -0
  12. package/zzz_react_template/components/jxr/IDEShell.tsx +159 -0
  13. package/zzz_react_template/components/jxr/LandingPage.tsx +414 -0
  14. package/zzz_react_template/components/jxr/LivePreview.tsx +169 -0
  15. package/zzz_react_template/components/jxr/PerformanceDashboard.tsx +379 -0
  16. package/zzz_react_template/components/jxr/TopBar.tsx +149 -0
  17. package/zzz_react_template/components/ui/accordion.tsx +64 -0
  18. package/zzz_react_template/components/ui/alert-dialog.tsx +155 -0
  19. package/zzz_react_template/components/ui/alert.tsx +66 -0
  20. package/zzz_react_template/components/ui/aspect-ratio.tsx +9 -0
  21. package/zzz_react_template/components/ui/avatar.tsx +51 -0
  22. package/zzz_react_template/components/ui/badge.tsx +46 -0
  23. package/zzz_react_template/components/ui/breadcrumb.tsx +109 -0
  24. package/zzz_react_template/components/ui/button-group.tsx +83 -0
  25. package/zzz_react_template/components/ui/button.tsx +60 -0
  26. package/zzz_react_template/components/ui/calendar.tsx +211 -0
  27. package/zzz_react_template/components/ui/card.tsx +92 -0
  28. package/zzz_react_template/components/ui/carousel.tsx +239 -0
  29. package/zzz_react_template/components/ui/chart.tsx +355 -0
  30. package/zzz_react_template/components/ui/checkbox.tsx +30 -0
  31. package/zzz_react_template/components/ui/collapsible.tsx +31 -0
  32. package/zzz_react_template/components/ui/command.tsx +184 -0
  33. package/zzz_react_template/components/ui/context-menu.tsx +250 -0
  34. package/zzz_react_template/components/ui/dialog.tsx +209 -0
  35. package/zzz_react_template/components/ui/drawer.tsx +133 -0
  36. package/zzz_react_template/components/ui/dropdown-menu.tsx +255 -0
  37. package/zzz_react_template/components/ui/empty.tsx +104 -0
  38. package/zzz_react_template/components/ui/field.tsx +242 -0
  39. package/zzz_react_template/components/ui/form.tsx +168 -0
  40. package/zzz_react_template/components/ui/hover-card.tsx +42 -0
  41. package/zzz_react_template/components/ui/input-group.tsx +168 -0
  42. package/zzz_react_template/components/ui/input-otp.tsx +75 -0
  43. package/zzz_react_template/components/ui/input.tsx +70 -0
  44. package/zzz_react_template/components/ui/item.tsx +193 -0
  45. package/zzz_react_template/components/ui/kbd.tsx +28 -0
  46. package/zzz_react_template/components/ui/label.tsx +22 -0
  47. package/zzz_react_template/components/ui/menubar.tsx +274 -0
  48. package/zzz_react_template/components/ui/navigation-menu.tsx +168 -0
  49. package/zzz_react_template/components/ui/pagination.tsx +127 -0
  50. package/zzz_react_template/components/ui/popover.tsx +46 -0
  51. package/zzz_react_template/components/ui/progress.tsx +29 -0
  52. package/zzz_react_template/components/ui/radio-group.tsx +43 -0
  53. package/zzz_react_template/components/ui/resizable.tsx +54 -0
  54. package/zzz_react_template/components/ui/scroll-area.tsx +56 -0
  55. package/zzz_react_template/components/ui/select.tsx +185 -0
  56. package/zzz_react_template/components/ui/separator.tsx +26 -0
  57. package/zzz_react_template/components/ui/sheet.tsx +139 -0
  58. package/zzz_react_template/components/ui/sidebar.tsx +734 -0
  59. package/zzz_react_template/components/ui/skeleton.tsx +13 -0
  60. package/zzz_react_template/components/ui/slider.tsx +61 -0
  61. package/zzz_react_template/components/ui/sonner.tsx +23 -0
  62. package/zzz_react_template/components/ui/spinner.tsx +16 -0
  63. package/zzz_react_template/components/ui/switch.tsx +29 -0
  64. package/zzz_react_template/components/ui/table.tsx +114 -0
  65. package/zzz_react_template/components/ui/tabs.tsx +64 -0
  66. package/zzz_react_template/components/ui/textarea.tsx +67 -0
  67. package/zzz_react_template/components/ui/toggle-group.tsx +73 -0
  68. package/zzz_react_template/components/ui/toggle.tsx +45 -0
  69. package/zzz_react_template/components/ui/tooltip.tsx +59 -0
  70. package/zzz_react_template/const.ts +17 -0
  71. package/zzz_react_template/contexts/JXRContext.tsx +264 -0
  72. package/zzz_react_template/contexts/ThemeContext.tsx +64 -0
  73. package/zzz_react_template/hooks/useComposition.ts +81 -0
  74. package/zzz_react_template/hooks/useMobile.tsx +21 -0
  75. package/zzz_react_template/hooks/usePersistFn.ts +20 -0
  76. package/zzz_react_template/index.css +518 -11
  77. package/zzz_react_template/lib/jxr-runtime/index.ts +201 -0
  78. package/zzz_react_template/lib/jxr-runtime/module-resolver.ts +520 -0
  79. package/zzz_react_template/lib/jxr-runtime/moq-transport.ts +267 -0
  80. package/zzz_react_template/lib/jxr-runtime/web-crypto.ts +279 -0
  81. package/zzz_react_template/lib/jxr-runtime/worker-pool.ts +321 -0
  82. package/zzz_react_template/lib/utils.ts +6 -0
  83. package/zzz_react_template/main.tsx +4 -9
  84. package/zzz_react_template/pages/Docs.tsx +955 -0
  85. package/zzz_react_template/pages/Home.tsx +1080 -0
  86. package/zzz_react_template/pages/NotFound.tsx +105 -0
  87. package/zzz_react_template/tsconfig.json +24 -0
@@ -0,0 +1,250 @@
1
+ import * as React from "react";
2
+ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
3
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
4
+
5
+ import { cn } from "@/lib/utils";
6
+
7
+ function ContextMenu({
8
+ ...props
9
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
10
+ return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />;
11
+ }
12
+
13
+ function ContextMenuTrigger({
14
+ ...props
15
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
16
+ return (
17
+ <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />
18
+ );
19
+ }
20
+
21
+ function ContextMenuGroup({
22
+ ...props
23
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
24
+ return (
25
+ <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
26
+ );
27
+ }
28
+
29
+ function ContextMenuPortal({
30
+ ...props
31
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
32
+ return (
33
+ <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
34
+ );
35
+ }
36
+
37
+ function ContextMenuSub({
38
+ ...props
39
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
40
+ return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />;
41
+ }
42
+
43
+ function ContextMenuRadioGroup({
44
+ ...props
45
+ }: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
46
+ return (
47
+ <ContextMenuPrimitive.RadioGroup
48
+ data-slot="context-menu-radio-group"
49
+ {...props}
50
+ />
51
+ );
52
+ }
53
+
54
+ function ContextMenuSubTrigger({
55
+ className,
56
+ inset,
57
+ children,
58
+ ...props
59
+ }: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
60
+ inset?: boolean;
61
+ }) {
62
+ return (
63
+ <ContextMenuPrimitive.SubTrigger
64
+ data-slot="context-menu-sub-trigger"
65
+ data-inset={inset}
66
+ className={cn(
67
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
68
+ className
69
+ )}
70
+ {...props}
71
+ >
72
+ {children}
73
+ <ChevronRightIcon className="ml-auto" />
74
+ </ContextMenuPrimitive.SubTrigger>
75
+ );
76
+ }
77
+
78
+ function ContextMenuSubContent({
79
+ className,
80
+ ...props
81
+ }: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
82
+ return (
83
+ <ContextMenuPrimitive.SubContent
84
+ data-slot="context-menu-sub-content"
85
+ className={cn(
86
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
87
+ className
88
+ )}
89
+ {...props}
90
+ />
91
+ );
92
+ }
93
+
94
+ function ContextMenuContent({
95
+ className,
96
+ ...props
97
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
98
+ return (
99
+ <ContextMenuPrimitive.Portal>
100
+ <ContextMenuPrimitive.Content
101
+ data-slot="context-menu-content"
102
+ className={cn(
103
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
104
+ className
105
+ )}
106
+ {...props}
107
+ />
108
+ </ContextMenuPrimitive.Portal>
109
+ );
110
+ }
111
+
112
+ function ContextMenuItem({
113
+ className,
114
+ inset,
115
+ variant = "default",
116
+ ...props
117
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
118
+ inset?: boolean;
119
+ variant?: "default" | "destructive";
120
+ }) {
121
+ return (
122
+ <ContextMenuPrimitive.Item
123
+ data-slot="context-menu-item"
124
+ data-inset={inset}
125
+ data-variant={variant}
126
+ className={cn(
127
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
128
+ className
129
+ )}
130
+ {...props}
131
+ />
132
+ );
133
+ }
134
+
135
+ function ContextMenuCheckboxItem({
136
+ className,
137
+ children,
138
+ checked,
139
+ ...props
140
+ }: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
141
+ return (
142
+ <ContextMenuPrimitive.CheckboxItem
143
+ data-slot="context-menu-checkbox-item"
144
+ className={cn(
145
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
146
+ className
147
+ )}
148
+ checked={checked}
149
+ {...props}
150
+ >
151
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
152
+ <ContextMenuPrimitive.ItemIndicator>
153
+ <CheckIcon className="size-4" />
154
+ </ContextMenuPrimitive.ItemIndicator>
155
+ </span>
156
+ {children}
157
+ </ContextMenuPrimitive.CheckboxItem>
158
+ );
159
+ }
160
+
161
+ function ContextMenuRadioItem({
162
+ className,
163
+ children,
164
+ ...props
165
+ }: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
166
+ return (
167
+ <ContextMenuPrimitive.RadioItem
168
+ data-slot="context-menu-radio-item"
169
+ className={cn(
170
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
171
+ className
172
+ )}
173
+ {...props}
174
+ >
175
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
176
+ <ContextMenuPrimitive.ItemIndicator>
177
+ <CircleIcon className="size-2 fill-current" />
178
+ </ContextMenuPrimitive.ItemIndicator>
179
+ </span>
180
+ {children}
181
+ </ContextMenuPrimitive.RadioItem>
182
+ );
183
+ }
184
+
185
+ function ContextMenuLabel({
186
+ className,
187
+ inset,
188
+ ...props
189
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
190
+ inset?: boolean;
191
+ }) {
192
+ return (
193
+ <ContextMenuPrimitive.Label
194
+ data-slot="context-menu-label"
195
+ data-inset={inset}
196
+ className={cn(
197
+ "text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
198
+ className
199
+ )}
200
+ {...props}
201
+ />
202
+ );
203
+ }
204
+
205
+ function ContextMenuSeparator({
206
+ className,
207
+ ...props
208
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
209
+ return (
210
+ <ContextMenuPrimitive.Separator
211
+ data-slot="context-menu-separator"
212
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
213
+ {...props}
214
+ />
215
+ );
216
+ }
217
+
218
+ function ContextMenuShortcut({
219
+ className,
220
+ ...props
221
+ }: React.ComponentProps<"span">) {
222
+ return (
223
+ <span
224
+ data-slot="context-menu-shortcut"
225
+ className={cn(
226
+ "text-muted-foreground ml-auto text-xs tracking-widest",
227
+ className
228
+ )}
229
+ {...props}
230
+ />
231
+ );
232
+ }
233
+
234
+ export {
235
+ ContextMenu,
236
+ ContextMenuTrigger,
237
+ ContextMenuContent,
238
+ ContextMenuItem,
239
+ ContextMenuCheckboxItem,
240
+ ContextMenuRadioItem,
241
+ ContextMenuLabel,
242
+ ContextMenuSeparator,
243
+ ContextMenuShortcut,
244
+ ContextMenuGroup,
245
+ ContextMenuPortal,
246
+ ContextMenuSub,
247
+ ContextMenuSubContent,
248
+ ContextMenuSubTrigger,
249
+ ContextMenuRadioGroup,
250
+ };
@@ -0,0 +1,209 @@
1
+ import { cn } from "@/lib/utils";
2
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
3
+ import { XIcon } from "lucide-react";
4
+ import * as React from "react";
5
+
6
+ // Context to track composition state across dialog children
7
+ const DialogCompositionContext = React.createContext<{
8
+ isComposing: () => boolean;
9
+ setComposing: (composing: boolean) => void;
10
+ justEndedComposing: () => boolean;
11
+ markCompositionEnd: () => void;
12
+ }>({
13
+ isComposing: () => false,
14
+ setComposing: () => {},
15
+ justEndedComposing: () => false,
16
+ markCompositionEnd: () => {},
17
+ });
18
+
19
+ export const useDialogComposition = () =>
20
+ React.useContext(DialogCompositionContext);
21
+
22
+ function Dialog({
23
+ ...props
24
+ }: React.ComponentProps<typeof DialogPrimitive.Root>) {
25
+ const composingRef = React.useRef(false);
26
+ const justEndedRef = React.useRef(false);
27
+ const endTimerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
28
+
29
+ const contextValue = React.useMemo(
30
+ () => ({
31
+ isComposing: () => composingRef.current,
32
+ setComposing: (composing: boolean) => {
33
+ composingRef.current = composing;
34
+ },
35
+ justEndedComposing: () => justEndedRef.current,
36
+ markCompositionEnd: () => {
37
+ justEndedRef.current = true;
38
+ if (endTimerRef.current) {
39
+ clearTimeout(endTimerRef.current);
40
+ }
41
+ endTimerRef.current = setTimeout(() => {
42
+ justEndedRef.current = false;
43
+ }, 150);
44
+ },
45
+ }),
46
+ []
47
+ );
48
+
49
+ return (
50
+ <DialogCompositionContext.Provider value={contextValue}>
51
+ <DialogPrimitive.Root data-slot="dialog" {...props} />
52
+ </DialogCompositionContext.Provider>
53
+ );
54
+ }
55
+
56
+ function DialogTrigger({
57
+ ...props
58
+ }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
59
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
60
+ }
61
+
62
+ function DialogPortal({
63
+ ...props
64
+ }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
65
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
66
+ }
67
+
68
+ function DialogClose({
69
+ ...props
70
+ }: React.ComponentProps<typeof DialogPrimitive.Close>) {
71
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
72
+ }
73
+
74
+ function DialogOverlay({
75
+ className,
76
+ ...props
77
+ }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
78
+ return (
79
+ <DialogPrimitive.Overlay
80
+ data-slot="dialog-overlay"
81
+ className={cn(
82
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
83
+ className
84
+ )}
85
+ {...props}
86
+ />
87
+ );
88
+ }
89
+
90
+ DialogOverlay.displayName = "DialogOverlay";
91
+
92
+ function DialogContent({
93
+ className,
94
+ children,
95
+ showCloseButton = true,
96
+ onEscapeKeyDown,
97
+ ...props
98
+ }: React.ComponentProps<typeof DialogPrimitive.Content> & {
99
+ showCloseButton?: boolean;
100
+ }) {
101
+ const { isComposing } = useDialogComposition();
102
+
103
+ const handleEscapeKeyDown = React.useCallback(
104
+ (e: KeyboardEvent) => {
105
+ // Check both the native isComposing property and our context state
106
+ // This handles Safari's timing issues with composition events
107
+ const isCurrentlyComposing = (e as any).isComposing || isComposing();
108
+
109
+ // If IME is composing, prevent dialog from closing
110
+ if (isCurrentlyComposing) {
111
+ e.preventDefault();
112
+ return;
113
+ }
114
+
115
+ // Call user's onEscapeKeyDown if provided
116
+ onEscapeKeyDown?.(e);
117
+ },
118
+ [isComposing, onEscapeKeyDown]
119
+ );
120
+
121
+ return (
122
+ <DialogPortal data-slot="dialog-portal">
123
+ <DialogOverlay />
124
+ <DialogPrimitive.Content
125
+ data-slot="dialog-content"
126
+ className={cn(
127
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
128
+ className
129
+ )}
130
+ onEscapeKeyDown={handleEscapeKeyDown}
131
+ {...props}
132
+ >
133
+ {children}
134
+ {showCloseButton && (
135
+ <DialogPrimitive.Close
136
+ data-slot="dialog-close"
137
+ className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
138
+ >
139
+ <XIcon />
140
+ <span className="sr-only">Close</span>
141
+ </DialogPrimitive.Close>
142
+ )}
143
+ </DialogPrimitive.Content>
144
+ </DialogPortal>
145
+ );
146
+ }
147
+
148
+ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
149
+ return (
150
+ <div
151
+ data-slot="dialog-header"
152
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
153
+ {...props}
154
+ />
155
+ );
156
+ }
157
+
158
+ function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
159
+ return (
160
+ <div
161
+ data-slot="dialog-footer"
162
+ className={cn(
163
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
164
+ className
165
+ )}
166
+ {...props}
167
+ />
168
+ );
169
+ }
170
+
171
+ function DialogTitle({
172
+ className,
173
+ ...props
174
+ }: React.ComponentProps<typeof DialogPrimitive.Title>) {
175
+ return (
176
+ <DialogPrimitive.Title
177
+ data-slot="dialog-title"
178
+ className={cn("text-lg leading-none font-semibold", className)}
179
+ {...props}
180
+ />
181
+ );
182
+ }
183
+
184
+ function DialogDescription({
185
+ className,
186
+ ...props
187
+ }: React.ComponentProps<typeof DialogPrimitive.Description>) {
188
+ return (
189
+ <DialogPrimitive.Description
190
+ data-slot="dialog-description"
191
+ className={cn("text-muted-foreground text-sm", className)}
192
+ {...props}
193
+ />
194
+ );
195
+ }
196
+
197
+ export {
198
+ Dialog,
199
+ DialogClose,
200
+ DialogContent,
201
+ DialogDescription,
202
+ DialogFooter,
203
+ DialogHeader,
204
+ DialogOverlay,
205
+ DialogPortal,
206
+ DialogTitle,
207
+ DialogTrigger
208
+ };
209
+
@@ -0,0 +1,133 @@
1
+ import * as React from "react";
2
+ import { Drawer as DrawerPrimitive } from "vaul";
3
+
4
+ import { cn } from "@/lib/utils";
5
+
6
+ function Drawer({
7
+ ...props
8
+ }: React.ComponentProps<typeof DrawerPrimitive.Root>) {
9
+ return <DrawerPrimitive.Root data-slot="drawer" {...props} />;
10
+ }
11
+
12
+ function DrawerTrigger({
13
+ ...props
14
+ }: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
15
+ return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />;
16
+ }
17
+
18
+ function DrawerPortal({
19
+ ...props
20
+ }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
21
+ return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />;
22
+ }
23
+
24
+ function DrawerClose({
25
+ ...props
26
+ }: React.ComponentProps<typeof DrawerPrimitive.Close>) {
27
+ return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />;
28
+ }
29
+
30
+ function DrawerOverlay({
31
+ className,
32
+ ...props
33
+ }: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
34
+ return (
35
+ <DrawerPrimitive.Overlay
36
+ data-slot="drawer-overlay"
37
+ className={cn(
38
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
39
+ className
40
+ )}
41
+ {...props}
42
+ />
43
+ );
44
+ }
45
+
46
+ function DrawerContent({
47
+ className,
48
+ children,
49
+ ...props
50
+ }: React.ComponentProps<typeof DrawerPrimitive.Content>) {
51
+ return (
52
+ <DrawerPortal data-slot="drawer-portal">
53
+ <DrawerOverlay />
54
+ <DrawerPrimitive.Content
55
+ data-slot="drawer-content"
56
+ className={cn(
57
+ "group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
58
+ "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
59
+ "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
60
+ "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
61
+ "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
62
+ className
63
+ )}
64
+ {...props}
65
+ >
66
+ <div className="bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
67
+ {children}
68
+ </DrawerPrimitive.Content>
69
+ </DrawerPortal>
70
+ );
71
+ }
72
+
73
+ function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
74
+ return (
75
+ <div
76
+ data-slot="drawer-header"
77
+ className={cn(
78
+ "flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
79
+ className
80
+ )}
81
+ {...props}
82
+ />
83
+ );
84
+ }
85
+
86
+ function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
87
+ return (
88
+ <div
89
+ data-slot="drawer-footer"
90
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
91
+ {...props}
92
+ />
93
+ );
94
+ }
95
+
96
+ function DrawerTitle({
97
+ className,
98
+ ...props
99
+ }: React.ComponentProps<typeof DrawerPrimitive.Title>) {
100
+ return (
101
+ <DrawerPrimitive.Title
102
+ data-slot="drawer-title"
103
+ className={cn("text-foreground font-semibold", className)}
104
+ {...props}
105
+ />
106
+ );
107
+ }
108
+
109
+ function DrawerDescription({
110
+ className,
111
+ ...props
112
+ }: React.ComponentProps<typeof DrawerPrimitive.Description>) {
113
+ return (
114
+ <DrawerPrimitive.Description
115
+ data-slot="drawer-description"
116
+ className={cn("text-muted-foreground text-sm", className)}
117
+ {...props}
118
+ />
119
+ );
120
+ }
121
+
122
+ export {
123
+ Drawer,
124
+ DrawerPortal,
125
+ DrawerOverlay,
126
+ DrawerTrigger,
127
+ DrawerClose,
128
+ DrawerContent,
129
+ DrawerHeader,
130
+ DrawerFooter,
131
+ DrawerTitle,
132
+ DrawerDescription,
133
+ };