@moontra/moonui 2.0.7 → 2.0.9
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/package.json +26 -19
- package/src/__tests__/use-intersection-observer.test.tsx +216 -0
- package/src/__tests__/use-local-storage.test.tsx +174 -0
- package/src/__tests__/use-pro-access.test.tsx +183 -0
- package/src/components/ui/__tests__/accordion.test.tsx +571 -0
- package/src/components/ui/__tests__/alert.test.tsx +484 -0
- package/src/components/ui/__tests__/aspect-ratio.test.tsx +492 -0
- package/src/components/ui/__tests__/avatar.test.tsx +382 -0
- package/src/components/ui/__tests__/badge.test.tsx +364 -0
- package/src/components/ui/__tests__/breadcrumb.test.tsx +687 -0
- package/src/components/ui/__tests__/button.test.tsx +91 -0
- package/src/components/ui/__tests__/card.test.tsx +104 -0
- package/src/components/ui/__tests__/checkbox.test.tsx +591 -0
- package/src/components/ui/__tests__/collapsible.test.tsx +592 -0
- package/src/components/ui/__tests__/color-picker.test.tsx +365 -0
- package/src/components/ui/__tests__/command.test.tsx +677 -0
- package/src/components/ui/__tests__/data-table.test.tsx +256 -0
- package/src/components/ui/__tests__/date-picker.test.tsx +320 -0
- package/src/components/ui/__tests__/dialog.test.tsx +764 -0
- package/src/components/ui/__tests__/input.test.tsx +318 -0
- package/src/components/ui/__tests__/label.test.tsx +103 -0
- package/src/components/ui/__tests__/popover.test.tsx +637 -0
- package/src/components/ui/__tests__/progress.test.tsx +382 -0
- package/src/components/ui/__tests__/radio-group.test.tsx +555 -0
- package/src/components/ui/__tests__/select.test.tsx +705 -0
- package/src/components/ui/__tests__/skeleton.test.tsx +253 -0
- package/src/components/ui/__tests__/slider.test.tsx +493 -0
- package/src/components/ui/__tests__/switch.test.tsx +372 -0
- package/src/components/ui/__tests__/table.test.tsx +824 -0
- package/src/components/ui/__tests__/tabs.test.tsx +887 -0
- package/src/components/ui/__tests__/toast.test.tsx +458 -0
- package/src/components/ui/__tests__/tooltip.test.tsx +583 -0
- package/src/components/ui/accordion.tsx +63 -0
- package/src/components/ui/alert.tsx +130 -0
- package/src/components/ui/aspect-ratio.tsx +72 -0
- package/src/components/ui/avatar.tsx +135 -0
- package/src/components/ui/badge.tsx +225 -0
- package/src/components/ui/breadcrumb.tsx +207 -0
- package/src/components/ui/button.stories.tsx +162 -0
- package/src/components/ui/button.tsx +221 -0
- package/src/components/ui/calendar.tsx +262 -0
- package/src/components/ui/card.stories.tsx +208 -0
- package/src/components/ui/card.tsx +141 -0
- package/src/components/ui/checkbox.tsx +256 -0
- package/src/components/ui/collapsible.tsx +129 -0
- package/src/components/ui/color-picker.tsx +664 -0
- package/src/components/ui/command.tsx +218 -0
- package/src/components/ui/data-table.stories.tsx +509 -0
- package/src/components/ui/data-table.tsx +623 -0
- package/src/components/ui/date-picker.stories.tsx +321 -0
- package/src/components/ui/date-picker.tsx +603 -0
- package/src/components/ui/dialog.tsx +332 -0
- package/src/components/ui/dropdown-menu.tsx +200 -0
- package/src/components/ui/file-upload.tsx +400 -0
- package/src/components/ui/github-stars.tsx +201 -0
- package/src/components/ui/index.ts +12 -0
- package/src/components/ui/input.stories.tsx +255 -0
- package/src/components/ui/input.tsx +219 -0
- package/src/components/ui/label.tsx +26 -0
- package/src/components/ui/locked-component.tsx +215 -0
- package/src/components/ui/moon-logo.tsx +97 -0
- package/src/components/ui/pagination.tsx +116 -0
- package/src/components/ui/popover.tsx +183 -0
- package/src/components/ui/progress.tsx +182 -0
- package/src/components/ui/radio-group.tsx +243 -0
- package/src/components/ui/select.tsx +273 -0
- package/src/components/ui/separator.tsx +140 -0
- package/src/components/ui/simple-editor.tsx +652 -0
- package/src/components/ui/skeleton.tsx +351 -0
- package/src/components/ui/slider.tsx +351 -0
- package/src/components/ui/switch.tsx +83 -0
- package/src/components/ui/table.tsx +322 -0
- package/src/components/ui/tabs.tsx +195 -0
- package/src/components/ui/textarea.tsx +46 -0
- package/src/components/ui/toast.tsx +313 -0
- package/src/components/ui/toggle.tsx +47 -0
- package/src/components/ui/tooltip.tsx +152 -0
- package/src/docs/theme-system.md +1194 -0
- package/src/index.tsx +39 -0
- package/src/lib/micro-interactions.ts +255 -0
- package/src/lib/theme.tsx +398 -0
- package/src/lib/utils.ts +69 -0
- package/src/styles/design-system.css +365 -0
- package/src/styles/index.css +4 -0
- package/src/styles/tailwind.css +6 -0
- package/src/styles/tokens.css +453 -0
- package/src/use-intersection-observer.tsx +154 -0
- package/src/use-local-storage.tsx +71 -0
- package/src/use-paddle.ts +138 -0
- package/src/use-performance-optimizer.ts +379 -0
- package/src/use-pro-access.ts +141 -0
- package/src/use-scroll-animation.ts +221 -0
- package/src/use-subscription.ts +37 -0
- package/src/use-toast.ts +32 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
|
+
import { Check, Loader2, X } from "lucide-react";
|
|
7
|
+
|
|
8
|
+
import { cn } from "../../lib/utils";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Premium Dialog Component
|
|
12
|
+
*
|
|
13
|
+
* Modern, accessible and customizable modal dialog component.
|
|
14
|
+
* Enhances user experience with variants, sizes and rich features.
|
|
15
|
+
* Provides a premium appearance with dark and light mode compatibility and fluid animations.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const Dialog = DialogPrimitive.Root;
|
|
19
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
20
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
21
|
+
const DialogClose = DialogPrimitive.Close;
|
|
22
|
+
|
|
23
|
+
const overlayVariants = cva(
|
|
24
|
+
"fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
25
|
+
{
|
|
26
|
+
variants: {
|
|
27
|
+
variant: {
|
|
28
|
+
default: "bg-black/80",
|
|
29
|
+
subtle: "bg-black/60",
|
|
30
|
+
blur: "bg-black/40 backdrop-blur-md",
|
|
31
|
+
minimal: "bg-black/20 backdrop-blur-sm",
|
|
32
|
+
},
|
|
33
|
+
animation: {
|
|
34
|
+
default: "duration-200",
|
|
35
|
+
slow: "duration-300",
|
|
36
|
+
fast: "duration-100",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
variant: "default",
|
|
41
|
+
animation: "default",
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
interface DialogOverlayProps
|
|
47
|
+
extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>,
|
|
48
|
+
VariantProps<typeof overlayVariants> {}
|
|
49
|
+
|
|
50
|
+
const DialogOverlay = React.forwardRef<
|
|
51
|
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
52
|
+
DialogOverlayProps
|
|
53
|
+
>(({ className, variant, animation, ...props }, ref) => (
|
|
54
|
+
<DialogPrimitive.Overlay
|
|
55
|
+
ref={ref}
|
|
56
|
+
className={cn(overlayVariants({ variant, animation }), className)}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
));
|
|
60
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
61
|
+
|
|
62
|
+
const dialogContentVariants = cva(
|
|
63
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background shadow-lg",
|
|
64
|
+
{
|
|
65
|
+
variants: {
|
|
66
|
+
variant: {
|
|
67
|
+
default: "border-gray-200 dark:border-gray-700",
|
|
68
|
+
primary: "border-primary/20 dark:border-primary/30",
|
|
69
|
+
secondary: "border-gray-300 dark:border-gray-600",
|
|
70
|
+
ghost: "border-transparent shadow-xl",
|
|
71
|
+
destructive: "border-error/20 dark:border-error/30",
|
|
72
|
+
},
|
|
73
|
+
size: {
|
|
74
|
+
xs: "max-w-xs p-4",
|
|
75
|
+
sm: "max-w-sm p-5",
|
|
76
|
+
default: "max-w-lg p-6",
|
|
77
|
+
md: "max-w-md p-6",
|
|
78
|
+
lg: "max-w-2xl p-7",
|
|
79
|
+
xl: "max-w-4xl p-8",
|
|
80
|
+
full: "max-w-[95vw] max-h-[95vh] p-6",
|
|
81
|
+
},
|
|
82
|
+
radius: {
|
|
83
|
+
none: "rounded-none",
|
|
84
|
+
sm: "rounded-md",
|
|
85
|
+
default: "rounded-lg",
|
|
86
|
+
lg: "rounded-xl",
|
|
87
|
+
xl: "rounded-2xl",
|
|
88
|
+
full: "rounded-3xl",
|
|
89
|
+
},
|
|
90
|
+
animation: {
|
|
91
|
+
default:
|
|
92
|
+
"duration-200 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",
|
|
93
|
+
fade: "duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
94
|
+
zoom: "duration-200 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",
|
|
95
|
+
slide: "duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
96
|
+
none: "",
|
|
97
|
+
},
|
|
98
|
+
position: {
|
|
99
|
+
default: "top-[50%]",
|
|
100
|
+
top: "top-[5%]",
|
|
101
|
+
bottom: "bottom-[5%] top-auto translate-y-0",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
defaultVariants: {
|
|
105
|
+
variant: "default",
|
|
106
|
+
size: "default",
|
|
107
|
+
radius: "default",
|
|
108
|
+
animation: "default",
|
|
109
|
+
position: "default",
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
interface DialogContentProps
|
|
115
|
+
extends Omit<React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, 'title'>,
|
|
116
|
+
VariantProps<typeof dialogContentVariants> {
|
|
117
|
+
/** X butonunu gizle */
|
|
118
|
+
hideCloseButton?: boolean;
|
|
119
|
+
/** Overlay varyantı */
|
|
120
|
+
overlayVariant?: VariantProps<typeof overlayVariants>["variant"];
|
|
121
|
+
/** Overlay animasyonu */
|
|
122
|
+
overlayAnimation?: VariantProps<typeof overlayVariants>["animation"];
|
|
123
|
+
/** İçerik başlığı (hızlı kullanım için) */
|
|
124
|
+
title?: React.ReactNode;
|
|
125
|
+
/** İçerik açıklaması (hızlı kullanım için) */
|
|
126
|
+
description?: React.ReactNode;
|
|
127
|
+
/** Başlık ikonu */
|
|
128
|
+
icon?: React.ReactNode;
|
|
129
|
+
/** Yükleniyor durumu */
|
|
130
|
+
loading?: boolean;
|
|
131
|
+
/** Success durumu */
|
|
132
|
+
success?: boolean;
|
|
133
|
+
/** Özel onClose handler */
|
|
134
|
+
onClose?: () => void;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const DialogContent = React.forwardRef<
|
|
138
|
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
139
|
+
DialogContentProps
|
|
140
|
+
>(
|
|
141
|
+
(
|
|
142
|
+
{
|
|
143
|
+
className,
|
|
144
|
+
children,
|
|
145
|
+
variant,
|
|
146
|
+
size,
|
|
147
|
+
radius,
|
|
148
|
+
animation,
|
|
149
|
+
position,
|
|
150
|
+
overlayVariant = "default",
|
|
151
|
+
overlayAnimation = "default",
|
|
152
|
+
hideCloseButton = false,
|
|
153
|
+
title,
|
|
154
|
+
description,
|
|
155
|
+
icon,
|
|
156
|
+
loading = false,
|
|
157
|
+
success = false,
|
|
158
|
+
onClose,
|
|
159
|
+
...props
|
|
160
|
+
},
|
|
161
|
+
ref
|
|
162
|
+
) => {
|
|
163
|
+
// Capturing the close function through the Radix Dialog API
|
|
164
|
+
const handleClose = () => {
|
|
165
|
+
if (onClose) {
|
|
166
|
+
onClose();
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<DialogPortal>
|
|
172
|
+
<DialogOverlay
|
|
173
|
+
variant={overlayVariant}
|
|
174
|
+
animation={overlayAnimation}
|
|
175
|
+
onClick={hideCloseButton ? undefined : handleClose}
|
|
176
|
+
/>
|
|
177
|
+
<DialogPrimitive.Content
|
|
178
|
+
ref={ref}
|
|
179
|
+
onEscapeKeyDown={hideCloseButton ? undefined : handleClose}
|
|
180
|
+
onInteractOutside={
|
|
181
|
+
hideCloseButton ? undefined : handleClose
|
|
182
|
+
}
|
|
183
|
+
className={cn(
|
|
184
|
+
dialogContentVariants({
|
|
185
|
+
variant,
|
|
186
|
+
size,
|
|
187
|
+
radius,
|
|
188
|
+
animation,
|
|
189
|
+
position,
|
|
190
|
+
}),
|
|
191
|
+
"outline-none",
|
|
192
|
+
loading && "pointer-events-none",
|
|
193
|
+
success && "border-success/40",
|
|
194
|
+
className
|
|
195
|
+
)}
|
|
196
|
+
{...props}
|
|
197
|
+
>
|
|
198
|
+
{/* Başlık ve açıklama varsa otomatik olarak DialogHeader oluştur */}
|
|
199
|
+
{(title || description || icon) && (
|
|
200
|
+
<DialogHeader className="flex gap-4">
|
|
201
|
+
{/* İkon veya loading/success durumları */}
|
|
202
|
+
{(icon || loading || success) && (
|
|
203
|
+
<div className="flex shrink-0 items-center justify-center">
|
|
204
|
+
{loading && (
|
|
205
|
+
<Loader2 className="h-5 w-5 animate-spin text-primary" />
|
|
206
|
+
)}
|
|
207
|
+
{success && (
|
|
208
|
+
<Check className="h-5 w-5 text-success" />
|
|
209
|
+
)}
|
|
210
|
+
{!loading && !success && icon && (
|
|
211
|
+
<span className="text-primary">
|
|
212
|
+
{icon}
|
|
213
|
+
</span>
|
|
214
|
+
)}
|
|
215
|
+
</div>
|
|
216
|
+
)}
|
|
217
|
+
<div className="flex-1">
|
|
218
|
+
{title && <DialogTitle>{title}</DialogTitle>}
|
|
219
|
+
{description && (
|
|
220
|
+
<DialogDescription>
|
|
221
|
+
{description}
|
|
222
|
+
</DialogDescription>
|
|
223
|
+
)}
|
|
224
|
+
</div>
|
|
225
|
+
</DialogHeader>
|
|
226
|
+
)}
|
|
227
|
+
|
|
228
|
+
{/* Main content */}
|
|
229
|
+
{children}
|
|
230
|
+
|
|
231
|
+
{/* Close button */}
|
|
232
|
+
{!hideCloseButton && (
|
|
233
|
+
<DialogPrimitive.Close
|
|
234
|
+
onClick={handleClose}
|
|
235
|
+
className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:ring-offset-2 disabled:pointer-events-none dark:text-gray-300 dark:hover:text-white"
|
|
236
|
+
>
|
|
237
|
+
<X className="h-4 w-4" />
|
|
238
|
+
<span className="sr-only">Close</span>
|
|
239
|
+
</DialogPrimitive.Close>
|
|
240
|
+
)}
|
|
241
|
+
</DialogPrimitive.Content>
|
|
242
|
+
</DialogPortal>
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
247
|
+
|
|
248
|
+
const DialogHeader = ({
|
|
249
|
+
className,
|
|
250
|
+
...props
|
|
251
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
252
|
+
<div
|
|
253
|
+
className={cn(
|
|
254
|
+
"flex flex-col space-y-2 text-center sm:text-left",
|
|
255
|
+
className
|
|
256
|
+
)}
|
|
257
|
+
{...props}
|
|
258
|
+
/>
|
|
259
|
+
);
|
|
260
|
+
DialogHeader.displayName = "DialogHeader";
|
|
261
|
+
|
|
262
|
+
const DialogFooter = ({
|
|
263
|
+
className,
|
|
264
|
+
...props
|
|
265
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
266
|
+
<div
|
|
267
|
+
className={cn(
|
|
268
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end sm:space-x-2 mt-6",
|
|
269
|
+
className
|
|
270
|
+
)}
|
|
271
|
+
{...props}
|
|
272
|
+
/>
|
|
273
|
+
);
|
|
274
|
+
DialogFooter.displayName = "DialogFooter";
|
|
275
|
+
|
|
276
|
+
const DialogTitle = React.forwardRef<
|
|
277
|
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
278
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
279
|
+
>(({ className, ...props }, ref) => (
|
|
280
|
+
<DialogPrimitive.Title
|
|
281
|
+
ref={ref}
|
|
282
|
+
className={cn(
|
|
283
|
+
"text-xl font-semibold leading-snug tracking-tight dark:text-white",
|
|
284
|
+
className
|
|
285
|
+
)}
|
|
286
|
+
{...props}
|
|
287
|
+
/>
|
|
288
|
+
));
|
|
289
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
290
|
+
|
|
291
|
+
const DialogDescription = React.forwardRef<
|
|
292
|
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
293
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
294
|
+
>(({ className, ...props }, ref) => (
|
|
295
|
+
<DialogPrimitive.Description
|
|
296
|
+
ref={ref}
|
|
297
|
+
className={cn(
|
|
298
|
+
"text-sm text-muted-foreground leading-normal dark:text-gray-400",
|
|
299
|
+
className
|
|
300
|
+
)}
|
|
301
|
+
{...props}
|
|
302
|
+
/>
|
|
303
|
+
));
|
|
304
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Dialog-Form integration for use with form support
|
|
308
|
+
* Used to integrate form submission processes into the modal
|
|
309
|
+
*/
|
|
310
|
+
const DialogForm = React.forwardRef<
|
|
311
|
+
HTMLFormElement,
|
|
312
|
+
React.HTMLAttributes<HTMLFormElement>
|
|
313
|
+
>(({ className, ...props }, ref) => (
|
|
314
|
+
<form
|
|
315
|
+
ref={ref}
|
|
316
|
+
className={cn("flex flex-col gap-4", className)}
|
|
317
|
+
{...props}
|
|
318
|
+
/>
|
|
319
|
+
));
|
|
320
|
+
DialogForm.displayName = "DialogForm";
|
|
321
|
+
|
|
322
|
+
export {
|
|
323
|
+
Dialog,
|
|
324
|
+
DialogTrigger,
|
|
325
|
+
DialogContent,
|
|
326
|
+
DialogHeader,
|
|
327
|
+
DialogFooter,
|
|
328
|
+
DialogTitle,
|
|
329
|
+
DialogDescription,
|
|
330
|
+
DialogClose,
|
|
331
|
+
DialogForm,
|
|
332
|
+
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
5
|
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "../../lib/utils"
|
|
8
|
+
|
|
9
|
+
const DropdownMenu = DropdownMenuPrimitive.Root
|
|
10
|
+
|
|
11
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
|
12
|
+
|
|
13
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group
|
|
14
|
+
|
|
15
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
|
|
16
|
+
|
|
17
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub
|
|
18
|
+
|
|
19
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
|
|
20
|
+
|
|
21
|
+
const DropdownMenuSubTrigger = React.forwardRef<
|
|
22
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
|
|
23
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
24
|
+
inset?: boolean
|
|
25
|
+
}
|
|
26
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
27
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
28
|
+
ref={ref}
|
|
29
|
+
className={cn(
|
|
30
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
|
31
|
+
inset && "pl-8",
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
<ChevronRight className="ml-auto h-4 w-4" />
|
|
38
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
39
|
+
))
|
|
40
|
+
DropdownMenuSubTrigger.displayName =
|
|
41
|
+
DropdownMenuPrimitive.SubTrigger.displayName
|
|
42
|
+
|
|
43
|
+
const DropdownMenuSubContent = React.forwardRef<
|
|
44
|
+
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
|
|
45
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
|
|
46
|
+
>(({ className, ...props }, ref) => (
|
|
47
|
+
<DropdownMenuPrimitive.SubContent
|
|
48
|
+
ref={ref}
|
|
49
|
+
className={cn(
|
|
50
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",
|
|
51
|
+
className
|
|
52
|
+
)}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
))
|
|
56
|
+
DropdownMenuSubContent.displayName =
|
|
57
|
+
DropdownMenuPrimitive.SubContent.displayName
|
|
58
|
+
|
|
59
|
+
const DropdownMenuContent = React.forwardRef<
|
|
60
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
|
|
61
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
|
|
62
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
63
|
+
<DropdownMenuPrimitive.Portal>
|
|
64
|
+
<DropdownMenuPrimitive.Content
|
|
65
|
+
ref={ref}
|
|
66
|
+
sideOffset={sideOffset}
|
|
67
|
+
className={cn(
|
|
68
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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",
|
|
69
|
+
className
|
|
70
|
+
)}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
</DropdownMenuPrimitive.Portal>
|
|
74
|
+
))
|
|
75
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
|
|
76
|
+
|
|
77
|
+
const DropdownMenuItem = React.forwardRef<
|
|
78
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
|
|
79
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
|
|
80
|
+
inset?: boolean
|
|
81
|
+
}
|
|
82
|
+
>(({ className, inset, ...props }, ref) => (
|
|
83
|
+
<DropdownMenuPrimitive.Item
|
|
84
|
+
ref={ref}
|
|
85
|
+
className={cn(
|
|
86
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
87
|
+
inset && "pl-8",
|
|
88
|
+
className
|
|
89
|
+
)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
))
|
|
93
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
|
|
94
|
+
|
|
95
|
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
96
|
+
React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
|
|
97
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
|
|
98
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
99
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
100
|
+
ref={ref}
|
|
101
|
+
className={cn(
|
|
102
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
103
|
+
className
|
|
104
|
+
)}
|
|
105
|
+
checked={checked}
|
|
106
|
+
{...props}
|
|
107
|
+
>
|
|
108
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
109
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
110
|
+
<Check className="h-4 w-4" />
|
|
111
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
112
|
+
</span>
|
|
113
|
+
{children}
|
|
114
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
115
|
+
))
|
|
116
|
+
DropdownMenuCheckboxItem.displayName =
|
|
117
|
+
DropdownMenuPrimitive.CheckboxItem.displayName
|
|
118
|
+
|
|
119
|
+
const DropdownMenuRadioItem = React.forwardRef<
|
|
120
|
+
React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
|
|
121
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
|
|
122
|
+
>(({ className, children, ...props }, ref) => (
|
|
123
|
+
<DropdownMenuPrimitive.RadioItem
|
|
124
|
+
ref={ref}
|
|
125
|
+
className={cn(
|
|
126
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
127
|
+
className
|
|
128
|
+
)}
|
|
129
|
+
{...props}
|
|
130
|
+
>
|
|
131
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
132
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
133
|
+
<Circle className="h-2 w-2 fill-current" />
|
|
134
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
135
|
+
</span>
|
|
136
|
+
{children}
|
|
137
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
138
|
+
))
|
|
139
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
|
|
140
|
+
|
|
141
|
+
const DropdownMenuLabel = React.forwardRef<
|
|
142
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
|
|
143
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
|
|
144
|
+
inset?: boolean
|
|
145
|
+
}
|
|
146
|
+
>(({ className, inset, ...props }, ref) => (
|
|
147
|
+
<DropdownMenuPrimitive.Label
|
|
148
|
+
ref={ref}
|
|
149
|
+
className={cn(
|
|
150
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
151
|
+
inset && "pl-8",
|
|
152
|
+
className
|
|
153
|
+
)}
|
|
154
|
+
{...props}
|
|
155
|
+
/>
|
|
156
|
+
))
|
|
157
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
|
|
158
|
+
|
|
159
|
+
const DropdownMenuSeparator = React.forwardRef<
|
|
160
|
+
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
|
|
161
|
+
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
|
|
162
|
+
>(({ className, ...props }, ref) => (
|
|
163
|
+
<DropdownMenuPrimitive.Separator
|
|
164
|
+
ref={ref}
|
|
165
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
166
|
+
{...props}
|
|
167
|
+
/>
|
|
168
|
+
))
|
|
169
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
|
|
170
|
+
|
|
171
|
+
const DropdownMenuShortcut = ({
|
|
172
|
+
className,
|
|
173
|
+
...props
|
|
174
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
175
|
+
return (
|
|
176
|
+
<span
|
|
177
|
+
className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
|
|
178
|
+
{...props}
|
|
179
|
+
/>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
|
|
183
|
+
|
|
184
|
+
export {
|
|
185
|
+
DropdownMenu,
|
|
186
|
+
DropdownMenuTrigger,
|
|
187
|
+
DropdownMenuContent,
|
|
188
|
+
DropdownMenuItem,
|
|
189
|
+
DropdownMenuCheckboxItem,
|
|
190
|
+
DropdownMenuRadioItem,
|
|
191
|
+
DropdownMenuLabel,
|
|
192
|
+
DropdownMenuSeparator,
|
|
193
|
+
DropdownMenuShortcut,
|
|
194
|
+
DropdownMenuGroup,
|
|
195
|
+
DropdownMenuPortal,
|
|
196
|
+
DropdownMenuSub,
|
|
197
|
+
DropdownMenuSubContent,
|
|
198
|
+
DropdownMenuSubTrigger,
|
|
199
|
+
DropdownMenuRadioGroup,
|
|
200
|
+
}
|