@moontra/moonui-pro 2.20.2 → 2.20.3

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 (153) hide show
  1. package/package.json +8 -3
  2. package/plugin/index.d.ts +86 -0
  3. package/plugin/index.js +308 -0
  4. package/scripts/postinstall.js +176 -23
  5. package/src/components/advanced-chart/index.tsx +0 -1246
  6. package/src/components/advanced-forms/index.tsx +0 -585
  7. package/src/components/animated-button/index.tsx +0 -385
  8. package/src/components/calendar/event-dialog.tsx +0 -377
  9. package/src/components/calendar/index.tsx +0 -1220
  10. package/src/components/calendar-pro/index.tsx +0 -1697
  11. package/src/components/color-picker/index.tsx +0 -432
  12. package/src/components/credit-card-input/index.tsx +0 -406
  13. package/src/components/dashboard/dashboard-grid.tsx +0 -480
  14. package/src/components/dashboard/demo.tsx +0 -425
  15. package/src/components/dashboard/index.tsx +0 -1046
  16. package/src/components/dashboard/time-range-picker.tsx +0 -336
  17. package/src/components/dashboard/types.ts +0 -225
  18. package/src/components/dashboard/widgets/activity-feed.tsx +0 -349
  19. package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
  20. package/src/components/dashboard/widgets/comparison-widget.tsx +0 -177
  21. package/src/components/dashboard/widgets/index.ts +0 -5
  22. package/src/components/dashboard/widgets/metric-card.tsx +0 -363
  23. package/src/components/dashboard/widgets/progress-widget.tsx +0 -113
  24. package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
  25. package/src/components/data-table/data-table-column-toggle.tsx +0 -169
  26. package/src/components/data-table/data-table-export.ts +0 -156
  27. package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
  28. package/src/components/data-table/index.tsx +0 -845
  29. package/src/components/draggable-list/index.tsx +0 -100
  30. package/src/components/error-boundary/index.tsx +0 -232
  31. package/src/components/file-upload/index.tsx +0 -1660
  32. package/src/components/floating-action-button/index.tsx +0 -206
  33. package/src/components/form-wizard/form-wizard-context.tsx +0 -335
  34. package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
  35. package/src/components/form-wizard/form-wizard-progress.tsx +0 -329
  36. package/src/components/form-wizard/form-wizard-step.tsx +0 -111
  37. package/src/components/form-wizard/index.tsx +0 -102
  38. package/src/components/form-wizard/types.ts +0 -77
  39. package/src/components/gesture-drawer/index.tsx +0 -551
  40. package/src/components/github-stars/github-api.ts +0 -426
  41. package/src/components/github-stars/hooks.ts +0 -517
  42. package/src/components/github-stars/index.tsx +0 -375
  43. package/src/components/github-stars/types.ts +0 -148
  44. package/src/components/github-stars/variants.tsx +0 -515
  45. package/src/components/health-check/index.tsx +0 -439
  46. package/src/components/hover-card-3d/index.tsx +0 -529
  47. package/src/components/index.ts +0 -130
  48. package/src/components/internal/index.ts +0 -78
  49. package/src/components/kanban/add-card-modal.tsx +0 -502
  50. package/src/components/kanban/card-detail-modal.tsx +0 -761
  51. package/src/components/kanban/index.ts +0 -13
  52. package/src/components/kanban/kanban.tsx +0 -1689
  53. package/src/components/kanban/types.ts +0 -168
  54. package/src/components/lazy-component/index.tsx +0 -823
  55. package/src/components/license-error/index.tsx +0 -31
  56. package/src/components/magnetic-button/index.tsx +0 -216
  57. package/src/components/memory-efficient-data/index.tsx +0 -1018
  58. package/src/components/moonui-quiz-form/index.tsx +0 -817
  59. package/src/components/navbar/index.tsx +0 -781
  60. package/src/components/optimized-image/index.tsx +0 -425
  61. package/src/components/performance-debugger/index.tsx +0 -613
  62. package/src/components/performance-monitor/index.tsx +0 -808
  63. package/src/components/phone-number-input/index.tsx +0 -343
  64. package/src/components/phone-number-input/phone-number-input-simple.tsx +0 -167
  65. package/src/components/pinch-zoom/index.tsx +0 -566
  66. package/src/components/quiz-form/index.tsx +0 -479
  67. package/src/components/rich-text-editor/index.tsx +0 -2322
  68. package/src/components/rich-text-editor/slash-commands-extension.ts +0 -230
  69. package/src/components/rich-text-editor/slash-commands.css +0 -35
  70. package/src/components/rich-text-editor/table-styles.css +0 -65
  71. package/src/components/sidebar/index.tsx +0 -884
  72. package/src/components/spotlight-card/index.tsx +0 -191
  73. package/src/components/swipeable-card/index.tsx +0 -100
  74. package/src/components/timeline/index.tsx +0 -1183
  75. package/src/components/ui/accordion.tsx +0 -581
  76. package/src/components/ui/alert-dialog.tsx +0 -141
  77. package/src/components/ui/alert.tsx +0 -141
  78. package/src/components/ui/aspect-ratio.tsx +0 -245
  79. package/src/components/ui/avatar.tsx +0 -155
  80. package/src/components/ui/badge.tsx +0 -230
  81. package/src/components/ui/breadcrumb.tsx +0 -216
  82. package/src/components/ui/button.tsx +0 -228
  83. package/src/components/ui/calendar.tsx +0 -387
  84. package/src/components/ui/card.tsx +0 -216
  85. package/src/components/ui/checkbox.tsx +0 -259
  86. package/src/components/ui/collapsible.tsx +0 -631
  87. package/src/components/ui/color-picker.tsx +0 -97
  88. package/src/components/ui/command.tsx +0 -948
  89. package/src/components/ui/dialog.tsx +0 -752
  90. package/src/components/ui/dropdown-menu.tsx +0 -706
  91. package/src/components/ui/gesture-drawer.tsx +0 -11
  92. package/src/components/ui/hover-card.tsx +0 -29
  93. package/src/components/ui/index.ts +0 -222
  94. package/src/components/ui/input.tsx +0 -224
  95. package/src/components/ui/label.tsx +0 -29
  96. package/src/components/ui/lightbox.tsx +0 -606
  97. package/src/components/ui/magnetic-button.tsx +0 -129
  98. package/src/components/ui/media-gallery.tsx +0 -611
  99. package/src/components/ui/navigation-menu.tsx +0 -130
  100. package/src/components/ui/pagination.tsx +0 -125
  101. package/src/components/ui/popover.tsx +0 -185
  102. package/src/components/ui/progress.tsx +0 -30
  103. package/src/components/ui/radio-group.tsx +0 -257
  104. package/src/components/ui/scroll-area.tsx +0 -47
  105. package/src/components/ui/select.tsx +0 -378
  106. package/src/components/ui/separator.tsx +0 -145
  107. package/src/components/ui/sheet.tsx +0 -139
  108. package/src/components/ui/skeleton.tsx +0 -20
  109. package/src/components/ui/slider.tsx +0 -354
  110. package/src/components/ui/spotlight-card.tsx +0 -119
  111. package/src/components/ui/switch.tsx +0 -86
  112. package/src/components/ui/table.tsx +0 -331
  113. package/src/components/ui/tabs-pro.tsx +0 -542
  114. package/src/components/ui/tabs.tsx +0 -54
  115. package/src/components/ui/textarea.tsx +0 -28
  116. package/src/components/ui/toast.tsx +0 -317
  117. package/src/components/ui/toggle.tsx +0 -119
  118. package/src/components/ui/tooltip.tsx +0 -151
  119. package/src/components/virtual-list/index.tsx +0 -668
  120. package/src/hooks/use-chart.ts +0 -205
  121. package/src/hooks/use-data-table.ts +0 -182
  122. package/src/hooks/use-docs-pro-access.ts +0 -13
  123. package/src/hooks/use-license-check.ts +0 -65
  124. package/src/hooks/use-subscription.ts +0 -19
  125. package/src/hooks/use-toast.ts +0 -15
  126. package/src/index.ts +0 -22
  127. package/src/lib/ai-providers.ts +0 -377
  128. package/src/lib/component-metadata.ts +0 -18
  129. package/src/lib/micro-interactions.ts +0 -255
  130. package/src/lib/paddle.ts +0 -17
  131. package/src/lib/utils.ts +0 -6
  132. package/src/patterns/login-form/index.tsx +0 -276
  133. package/src/patterns/login-form/types.ts +0 -67
  134. package/src/setupTests.ts +0 -41
  135. package/src/styles/advanced-chart.css +0 -239
  136. package/src/styles/calendar.css +0 -35
  137. package/src/styles/design-system.css +0 -363
  138. package/src/styles/index.css +0 -681
  139. package/src/styles/tailwind.css +0 -7
  140. package/src/styles/tokens.css +0 -455
  141. package/src/types/next-auth.d.ts +0 -21
  142. package/src/use-intersection-observer.tsx +0 -154
  143. package/src/use-local-storage.tsx +0 -71
  144. package/src/use-paddle.ts +0 -138
  145. package/src/use-performance-optimizer.ts +0 -389
  146. package/src/use-pro-access.ts +0 -141
  147. package/src/use-scroll-animation.ts +0 -219
  148. package/src/use-subscription.ts +0 -37
  149. package/src/use-toast.ts +0 -32
  150. package/src/utils/chart-helpers.ts +0 -357
  151. package/src/utils/cn.ts +0 -6
  152. package/src/utils/data-processing.ts +0 -151
  153. package/src/utils/license-validator.tsx +0 -183
@@ -1,706 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
5
- import { cva, type VariantProps } from "class-variance-authority"
6
- import { motion, AnimatePresence } from "framer-motion"
7
- import {
8
- Check,
9
- ChevronRight,
10
- Circle,
11
- Loader2,
12
- Search,
13
- Command,
14
- Sparkles,
15
- Zap,
16
- Star,
17
- Crown,
18
- Diamond,
19
- Gem,
20
- X
21
- } from "lucide-react"
22
-
23
- import { cn } from "../../lib/utils"
24
-
25
- /**
26
- * Premium Dropdown Menu Component Pro
27
- *
28
- * Gelişmiş, erişilebilir ve özelleştirilebilir dropdown menu component'i.
29
- * Zengin animasyonlar, arama özelliği, komut paleti entegrasyonu ve premium görünüm sunar.
30
- *
31
- * Pro Özellikler:
32
- * - Gelişmiş animasyon seçenekleri (slide, scale, fade, spring)
33
- * - Arama ve filtreleme özelliği
34
- * - Komut paleti entegrasyonu (⌘K style)
35
- * - Multi-level nested menu desteği
36
- * - Rich content support (avatars, badges, descriptions)
37
- * - Glass, gradient ve neon visual variants
38
- * - Keyboard shortcuts ile gelişmiş navigasyon
39
- * - Loading states ve async actions
40
- * - Custom icons ve badges
41
- * - Responsive mobile optimization
42
- * - Tooltip entegrasyonu
43
- * - Customizable animation timing
44
- * - Advanced keyboard navigation
45
- * - Context menu mode
46
- * - Command palette mode
47
- */
48
-
49
- const MoonUIDropdownMenuPro = DropdownMenuPrimitive.Root
50
- const MoonUIDropdownMenuTriggerPro = DropdownMenuPrimitive.Trigger
51
- const MoonUIDropdownMenuGroupPro = DropdownMenuPrimitive.Group
52
- const MoonUIDropdownMenuPortalPro = DropdownMenuPrimitive.Portal
53
- const MoonUIDropdownMenuSubPro = DropdownMenuPrimitive.Sub
54
- const MoonUIDropdownMenuRadioGroupPro = DropdownMenuPrimitive.RadioGroup
55
-
56
- const dropdownContentVariants = cva(
57
- "z-50 min-w-[8rem] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg",
58
- {
59
- variants: {
60
- variant: {
61
- default: "border-border bg-background",
62
- glass: "border-white/10 bg-white/5 backdrop-blur-xl dark:border-white/10 dark:bg-black/5",
63
- gradient: "border-0 bg-gradient-to-br from-background/95 via-primary/5 to-background/95 backdrop-blur-md",
64
- neon: "border-primary/50 shadow-[0_0_15px_rgba(59,130,246,0.3)] dark:shadow-[0_0_20px_rgba(59,130,246,0.5)]",
65
- command: "min-w-[300px] border-border bg-background p-0",
66
- premium: "border-yellow-500/20 bg-gradient-to-br from-yellow-50/5 via-background to-yellow-50/5 dark:from-yellow-900/5 dark:to-yellow-900/5",
67
- },
68
- animation: {
69
- none: "",
70
- slide: "",
71
- scale: "",
72
- fade: "",
73
- spring: "",
74
- slideAndFade: "",
75
- },
76
- size: {
77
- sm: "min-w-[6rem] text-xs",
78
- default: "min-w-[8rem] text-sm",
79
- lg: "min-w-[12rem] text-base",
80
- xl: "min-w-[16rem]",
81
- "2xl": "min-w-[20rem]",
82
- full: "min-w-[95vw] sm:min-w-[24rem]",
83
- }
84
- },
85
- defaultVariants: {
86
- variant: "default",
87
- animation: "slideAndFade",
88
- size: "default",
89
- },
90
- }
91
- )
92
-
93
- const dropdownItemVariants = cva(
94
- "relative flex cursor-pointer select-none items-center rounded-md px-2 py-1.5 text-sm outline-none transition-colors",
95
- {
96
- variants: {
97
- variant: {
98
- default: "focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-accent hover:text-accent-foreground",
99
- destructive: "focus:bg-red-100 focus:text-red-900 hover:bg-red-100 hover:text-red-900 dark:focus:bg-red-900/20 dark:focus:text-red-400 dark:hover:bg-red-900/20 dark:hover:text-red-400",
100
- success: "focus:bg-green-100 focus:text-green-900 hover:bg-green-100 hover:text-green-900 dark:focus:bg-green-900/20 dark:focus:text-green-400 dark:hover:bg-green-900/20 dark:hover:text-green-400",
101
- warning: "focus:bg-yellow-100 focus:text-yellow-900 hover:bg-yellow-100 hover:text-yellow-900 dark:focus:bg-yellow-900/20 dark:focus:text-yellow-400 dark:hover:bg-yellow-900/20 dark:hover:text-yellow-400",
102
- premium: "bg-gradient-to-r from-yellow-50/10 to-yellow-50/5 hover:from-yellow-50/20 hover:to-yellow-50/10 dark:from-yellow-900/10 dark:to-yellow-900/5",
103
- },
104
- size: {
105
- sm: "py-1 text-xs",
106
- default: "py-1.5",
107
- lg: "py-2 text-base",
108
- }
109
- },
110
- defaultVariants: {
111
- variant: "default",
112
- size: "default",
113
- },
114
- }
115
- )
116
-
117
- interface DropdownMenuContentProps
118
- extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>,
119
- VariantProps<typeof dropdownContentVariants> {
120
- enableSearch?: boolean;
121
- searchPlaceholder?: string;
122
- animationDuration?: number;
123
- enableSpringPhysics?: boolean;
124
- showPremiumBadge?: boolean;
125
- loading?: boolean;
126
- header?: React.ReactNode;
127
- footer?: React.ReactNode;
128
- }
129
-
130
- interface DropdownMenuItemProps
131
- extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item>,
132
- VariantProps<typeof dropdownItemVariants> {
133
- inset?: boolean;
134
- icon?: React.ReactNode;
135
- description?: string;
136
- shortcut?: string;
137
- badge?: React.ReactNode;
138
- showCheckmark?: boolean;
139
- loading?: boolean;
140
- }
141
-
142
- const MoonUIDropdownMenuSubTriggerPro = React.forwardRef<
143
- React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
144
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
145
- inset?: boolean;
146
- showChevron?: boolean;
147
- badge?: React.ReactNode;
148
- }
149
- >(({ className, inset, children, showChevron = true, badge, ...props }, ref) => (
150
- <DropdownMenuPrimitive.SubTrigger
151
- ref={ref}
152
- className={cn(
153
- "flex cursor-pointer select-none items-center rounded-md px-2 py-1.5 text-sm outline-none",
154
- "focus:bg-accent focus:text-accent-foreground",
155
- "data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
156
- "hover:bg-accent hover:text-accent-foreground",
157
- "transition-colors duration-150",
158
- inset && "pl-8",
159
- className
160
- )}
161
- {...props}
162
- >
163
- {children}
164
- <div className="ml-auto flex items-center gap-2">
165
- {badge}
166
- {showChevron && <ChevronRight className="h-4 w-4" />}
167
- </div>
168
- </DropdownMenuPrimitive.SubTrigger>
169
- ))
170
- MoonUIDropdownMenuSubTriggerPro.displayName =
171
- DropdownMenuPrimitive.SubTrigger.displayName
172
-
173
- const MoonUIDropdownMenuSubContentPro = React.forwardRef<
174
- React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
175
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent> &
176
- VariantProps<typeof dropdownContentVariants>
177
- >(({ className, variant, animation, size, ...props }, ref) => {
178
- const getAnimationVariants = () => {
179
- switch (animation) {
180
- case "slide":
181
- return {
182
- initial: { opacity: 0, x: -10 },
183
- animate: { opacity: 1, x: 0 },
184
- exit: { opacity: 0, x: -10 },
185
- };
186
- case "scale":
187
- return {
188
- initial: { opacity: 0, scale: 0.95 },
189
- animate: { opacity: 1, scale: 1 },
190
- exit: { opacity: 0, scale: 0.95 },
191
- };
192
- case "fade":
193
- return {
194
- initial: { opacity: 0 },
195
- animate: { opacity: 1 },
196
- exit: { opacity: 0 },
197
- };
198
- case "spring":
199
- return {
200
- initial: { opacity: 0, scale: 0.9, y: -10 },
201
- animate: {
202
- opacity: 1,
203
- scale: 1,
204
- y: 0,
205
- transition: { type: "spring", stiffness: 300, damping: 20 }
206
- },
207
- exit: { opacity: 0, scale: 0.9, y: -10 },
208
- };
209
- default:
210
- return {
211
- initial: { opacity: 0, y: -2, x: -2 },
212
- animate: { opacity: 1, y: 0, x: 0 },
213
- exit: { opacity: 0, y: -2, x: -2 },
214
- };
215
- }
216
- };
217
-
218
- // Animation removed for SubContent to fix type issues
219
- return (
220
- <DropdownMenuPrimitive.SubContent
221
- ref={ref}
222
- className={cn(dropdownContentVariants({ variant, size }), className)}
223
- {...props}
224
- />
225
- );
226
- });
227
- MoonUIDropdownMenuSubContentPro.displayName = DropdownMenuPrimitive.SubContent.displayName
228
-
229
- const MoonUIDropdownMenuContentPro = React.forwardRef<
230
- React.ElementRef<typeof DropdownMenuPrimitive.Content>,
231
- DropdownMenuContentProps
232
- >(
233
- (
234
- {
235
- className,
236
- variant,
237
- animation,
238
- size,
239
- sideOffset = 4,
240
- enableSearch = false,
241
- searchPlaceholder = "Search...",
242
- animationDuration = 150,
243
- enableSpringPhysics = false,
244
- showPremiumBadge = false,
245
- loading = false,
246
- header,
247
- footer,
248
- children,
249
- ...props
250
- },
251
- ref
252
- ) => {
253
- const [searchQuery, setSearchQuery] = React.useState("");
254
-
255
- const getAnimationVariants = () => {
256
- const duration = animationDuration / 1000;
257
- const springConfig = enableSpringPhysics
258
- ? { type: "spring", stiffness: 300, damping: 20 }
259
- : { duration };
260
-
261
- switch (animation) {
262
- case "slide":
263
- return {
264
- initial: { opacity: 0, y: -10 },
265
- animate: { opacity: 1, y: 0 },
266
- exit: { opacity: 0, y: -10 },
267
- transition: springConfig,
268
- };
269
- case "scale":
270
- return {
271
- initial: { opacity: 0, scale: 0.95 },
272
- animate: { opacity: 1, scale: 1 },
273
- exit: { opacity: 0, scale: 0.95 },
274
- transition: springConfig,
275
- };
276
- case "fade":
277
- return {
278
- initial: { opacity: 0 },
279
- animate: { opacity: 1 },
280
- exit: { opacity: 0 },
281
- transition: { duration },
282
- };
283
- case "spring":
284
- return {
285
- initial: { opacity: 0, scale: 0.9, y: -20 },
286
- animate: {
287
- opacity: 1,
288
- scale: 1,
289
- y: 0,
290
- transition: { type: "spring", stiffness: 400, damping: 25 }
291
- },
292
- exit: { opacity: 0, scale: 0.9, y: -20 },
293
- };
294
- default:
295
- return {
296
- initial: { opacity: 0, y: -2 },
297
- animate: { opacity: 1, y: 0 },
298
- exit: { opacity: 0, y: -2 },
299
- transition: { duration },
300
- };
301
- }
302
- };
303
-
304
- const animationVariants = getAnimationVariants();
305
-
306
- // Filter children based on search query
307
- const filteredChildren = React.useMemo(() => {
308
- if (!enableSearch || !searchQuery) return children;
309
-
310
- return React.Children.toArray(children).filter((child) => {
311
- if (!React.isValidElement(child)) return true;
312
-
313
- const childText = getTextFromElement(child);
314
- return childText.toLowerCase().includes(searchQuery.toLowerCase());
315
- });
316
- }, [children, searchQuery, enableSearch]);
317
-
318
- return (
319
- <DropdownMenuPrimitive.Portal>
320
- <DropdownMenuPrimitive.Content
321
- ref={ref}
322
- sideOffset={sideOffset}
323
- className={cn(
324
- dropdownContentVariants({ variant, size }),
325
- variant === "command" && "p-0",
326
- className
327
- )}
328
- {...props}
329
- >
330
- {/* Premium Badge */}
331
- {showPremiumBadge && (
332
- <div className="mb-1 flex items-center justify-center gap-1 border-b border-yellow-500/20 pb-1">
333
- <Crown className="h-3 w-3 text-yellow-500" />
334
- <span className="text-xs font-medium text-yellow-600 dark:text-yellow-400">
335
- Premium Menu
336
- </span>
337
- </div>
338
- )}
339
-
340
- {/* Custom Header */}
341
- {header && (
342
- <div className="mb-1 border-b pb-1">
343
- {header}
344
- </div>
345
- )}
346
-
347
- {/* Search Input */}
348
- {enableSearch && (
349
- <div className="mb-1 border-b pb-1">
350
- <div className="flex items-center gap-2 px-2 py-1.5">
351
- <Search className="h-4 w-4 text-muted-foreground" />
352
- <input
353
- type="text"
354
- placeholder={searchPlaceholder}
355
- value={searchQuery}
356
- onChange={(e) => setSearchQuery(e.target.value)}
357
- className={cn(
358
- "flex-1 bg-transparent text-sm outline-none",
359
- "placeholder:text-muted-foreground"
360
- )}
361
- onClick={(e) => e.stopPropagation()}
362
- />
363
- {searchQuery && (
364
- <button
365
- onClick={() => setSearchQuery("")}
366
- className="text-muted-foreground hover:text-foreground"
367
- >
368
- <X className="h-3 w-3" />
369
- </button>
370
- )}
371
- </div>
372
- </div>
373
- )}
374
-
375
- {/* Loading State */}
376
- {loading ? (
377
- <div className="flex items-center justify-center py-8">
378
- <Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
379
- </div>
380
- ) : (
381
- <div className={cn(variant === "command" && "p-1")}>
382
- {filteredChildren}
383
- </div>
384
- )}
385
-
386
- {/* Custom Footer */}
387
- {footer && (
388
- <div className="mt-1 border-t pt-1">
389
- {footer}
390
- </div>
391
- )}
392
- </DropdownMenuPrimitive.Content>
393
- </DropdownMenuPrimitive.Portal>
394
- );
395
- }
396
- )
397
- MoonUIDropdownMenuContentPro.displayName = DropdownMenuPrimitive.Content.displayName
398
-
399
- const MoonUIDropdownMenuItemPro = React.forwardRef<
400
- React.ElementRef<typeof DropdownMenuPrimitive.Item>,
401
- DropdownMenuItemProps
402
- >(
403
- (
404
- {
405
- className,
406
- variant,
407
- size,
408
- inset,
409
- icon,
410
- description,
411
- shortcut,
412
- badge,
413
- showCheckmark,
414
- loading,
415
- children,
416
- ...props
417
- },
418
- ref
419
- ) => (
420
- <DropdownMenuPrimitive.Item
421
- ref={ref}
422
- className={cn(
423
- dropdownItemVariants({ variant, size }),
424
- inset && "pl-8",
425
- className
426
- )}
427
- {...props}
428
- >
429
- {icon && (
430
- <span className="mr-2 flex h-4 w-4 items-center justify-center">
431
- {loading ? <Loader2 className="h-4 w-4 animate-spin" /> : icon}
432
- </span>
433
- )}
434
- <div className="flex flex-1 flex-col">
435
- <div className="flex items-center">
436
- {children}
437
- {badge && <span className="ml-2">{badge}</span>}
438
- </div>
439
- {description && (
440
- <span className="text-xs text-muted-foreground">{description}</span>
441
- )}
442
- </div>
443
- {shortcut && (
444
- <span className="ml-auto text-xs tracking-widest text-muted-foreground">
445
- {shortcut}
446
- </span>
447
- )}
448
- {showCheckmark && (
449
- <Check className="ml-2 h-4 w-4" />
450
- )}
451
- </DropdownMenuPrimitive.Item>
452
- )
453
- )
454
- MoonUIDropdownMenuItemPro.displayName = DropdownMenuPrimitive.Item.displayName
455
-
456
- const MoonUIDropdownMenuCheckboxItemPro = React.forwardRef<
457
- React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
458
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
459
- >(({ className, children, checked, ...props }, ref) => (
460
- <DropdownMenuPrimitive.CheckboxItem
461
- ref={ref}
462
- className={cn(
463
- "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",
464
- className
465
- )}
466
- checked={checked}
467
- {...props}
468
- >
469
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
470
- <DropdownMenuPrimitive.ItemIndicator>
471
- <Check className="h-4 w-4" />
472
- </DropdownMenuPrimitive.ItemIndicator>
473
- </span>
474
- {children}
475
- </DropdownMenuPrimitive.CheckboxItem>
476
- ))
477
- MoonUIDropdownMenuCheckboxItemPro.displayName =
478
- DropdownMenuPrimitive.CheckboxItem.displayName
479
-
480
- const MoonUIDropdownMenuRadioItemPro = React.forwardRef<
481
- React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
482
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
483
- >(({ className, children, ...props }, ref) => (
484
- <DropdownMenuPrimitive.RadioItem
485
- ref={ref}
486
- className={cn(
487
- "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",
488
- className
489
- )}
490
- {...props}
491
- >
492
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
493
- <DropdownMenuPrimitive.ItemIndicator>
494
- <Circle className="h-2 w-2 fill-current" />
495
- </DropdownMenuPrimitive.ItemIndicator>
496
- </span>
497
- {children}
498
- </DropdownMenuPrimitive.RadioItem>
499
- ))
500
- MoonUIDropdownMenuRadioItemPro.displayName = DropdownMenuPrimitive.RadioItem.displayName
501
-
502
- const MoonUIDropdownMenuLabelPro = React.forwardRef<
503
- React.ElementRef<typeof DropdownMenuPrimitive.Label>,
504
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
505
- inset?: boolean
506
- }
507
- >(({ className, inset, ...props }, ref) => (
508
- <DropdownMenuPrimitive.Label
509
- ref={ref}
510
- className={cn(
511
- "px-2 py-1.5 text-sm font-semibold",
512
- inset && "pl-8",
513
- className
514
- )}
515
- {...props}
516
- />
517
- ))
518
- MoonUIDropdownMenuLabelPro.displayName = DropdownMenuPrimitive.Label.displayName
519
-
520
- const MoonUIDropdownMenuSeparatorPro = React.forwardRef<
521
- React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
522
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
523
- >(({ className, ...props }, ref) => (
524
- <DropdownMenuPrimitive.Separator
525
- ref={ref}
526
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
527
- {...props}
528
- />
529
- ))
530
- MoonUIDropdownMenuSeparatorPro.displayName = DropdownMenuPrimitive.Separator.displayName
531
-
532
- const MoonUIDropdownMenuShortcutPro = ({
533
- className,
534
- ...props
535
- }: React.HTMLAttributes<HTMLSpanElement>) => {
536
- return (
537
- <span
538
- className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
539
- {...props}
540
- />
541
- )
542
- }
543
- MoonUIDropdownMenuShortcutPro.displayName = "MoonUIDropdownMenuShortcutPro"
544
-
545
- // Helper function to extract text from React elements
546
- function getTextFromElement(element: React.ReactElement<any>): string {
547
- const props = element.props as any;
548
- if (!props || !props.children) return "";
549
-
550
- if (typeof props.children === "string") {
551
- return props.children;
552
- }
553
- if (React.isValidElement(props.children)) {
554
- return getTextFromElement(props.children as React.ReactElement<any>);
555
- }
556
- if (Array.isArray(props.children)) {
557
- return props.children
558
- .map((child: any) => {
559
- if (typeof child === "string") return child;
560
- if (React.isValidElement(child)) return getTextFromElement(child as React.ReactElement<any>);
561
- return "";
562
- })
563
- .join("");
564
- }
565
- return "";
566
- }
567
-
568
- // Command Palette Mode Component
569
- interface CommandPaletteDropdownProps {
570
- items: Array<{
571
- category?: string;
572
- items: Array<{
573
- id: string;
574
- label: string;
575
- description?: string;
576
- icon?: React.ReactNode;
577
- shortcut?: string;
578
- action?: () => void;
579
- keywords?: string[];
580
- }>;
581
- }>;
582
- trigger: React.ReactNode;
583
- placeholder?: string;
584
- }
585
-
586
- const MoonUICommandPaletteDropdown: React.FC<CommandPaletteDropdownProps> = ({
587
- items,
588
- trigger,
589
- placeholder = "Type a command or search...",
590
- }) => {
591
- const [open, setOpen] = React.useState(false);
592
- const [search, setSearch] = React.useState("");
593
-
594
- const filteredItems = React.useMemo(() => {
595
- if (!search) return items;
596
-
597
- return items
598
- .map((category) => ({
599
- ...category,
600
- items: category.items.filter((item) => {
601
- const searchLower = search.toLowerCase();
602
- return (
603
- item.label.toLowerCase().includes(searchLower) ||
604
- item.description?.toLowerCase().includes(searchLower) ||
605
- item.keywords?.some((k) => k.toLowerCase().includes(searchLower))
606
- );
607
- }),
608
- }))
609
- .filter((category) => category.items.length > 0);
610
- }, [items, search]);
611
-
612
- return (
613
- <MoonUIDropdownMenuPro open={open} onOpenChange={setOpen}>
614
- <MoonUIDropdownMenuTriggerPro asChild>{trigger}</MoonUIDropdownMenuTriggerPro>
615
- <MoonUIDropdownMenuContentPro
616
- variant="command"
617
- size="2xl"
618
- animation="spring"
619
- enableSpringPhysics
620
- className="p-0"
621
- >
622
- <div className="flex items-center border-b px-3 pb-2 pt-3">
623
- <Command className="mr-2 h-4 w-4 shrink-0 opacity-50" />
624
- <input
625
- placeholder={placeholder}
626
- value={search}
627
- onChange={(e) => setSearch(e.target.value)}
628
- className="flex h-8 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"
629
- />
630
- </div>
631
- <div className="max-h-[300px] overflow-y-auto p-1">
632
- {filteredItems.map((category, i) => (
633
- <React.Fragment key={i}>
634
- {category.category && (
635
- <MoonUIDropdownMenuLabelPro className="px-2 py-1.5 text-xs text-muted-foreground">
636
- {category.category}
637
- </MoonUIDropdownMenuLabelPro>
638
- )}
639
- {category.items.map((item) => (
640
- <MoonUIDropdownMenuItemPro
641
- key={item.id}
642
- icon={item.icon}
643
- description={item.description}
644
- shortcut={item.shortcut}
645
- onClick={() => {
646
- item.action?.();
647
- setOpen(false);
648
- }}
649
- >
650
- {item.label}
651
- </MoonUIDropdownMenuItemPro>
652
- ))}
653
- {i < filteredItems.length - 1 && <MoonUIDropdownMenuSeparatorPro />}
654
- </React.Fragment>
655
- ))}
656
- {filteredItems.length === 0 && (
657
- <div className="py-6 text-center text-sm text-muted-foreground">
658
- No results found
659
- </div>
660
- )}
661
- </div>
662
- </MoonUIDropdownMenuContentPro>
663
- </MoonUIDropdownMenuPro>
664
- );
665
- };
666
-
667
- export {
668
- MoonUIDropdownMenuPro,
669
- MoonUIDropdownMenuTriggerPro,
670
- MoonUIDropdownMenuContentPro,
671
- MoonUIDropdownMenuItemPro,
672
- MoonUIDropdownMenuCheckboxItemPro,
673
- MoonUIDropdownMenuRadioItemPro,
674
- MoonUIDropdownMenuLabelPro,
675
- MoonUIDropdownMenuSeparatorPro,
676
- MoonUIDropdownMenuShortcutPro,
677
- MoonUIDropdownMenuGroupPro,
678
- MoonUIDropdownMenuPortalPro,
679
- MoonUIDropdownMenuSubPro,
680
- MoonUIDropdownMenuSubContentPro,
681
- MoonUIDropdownMenuSubTriggerPro,
682
- MoonUIDropdownMenuRadioGroupPro,
683
- MoonUICommandPaletteDropdown,
684
- type DropdownMenuContentProps,
685
- type DropdownMenuItemProps,
686
- type CommandPaletteDropdownProps,
687
- };
688
-
689
- // Clean exports (only dropdown-menu specific)
690
- export {
691
- MoonUIDropdownMenuPro as DropdownMenu,
692
- MoonUIDropdownMenuTriggerPro as DropdownMenuTrigger,
693
- MoonUIDropdownMenuContentPro as DropdownMenuContent,
694
- MoonUIDropdownMenuItemPro as DropdownMenuItem,
695
- MoonUIDropdownMenuCheckboxItemPro as DropdownMenuCheckboxItem,
696
- MoonUIDropdownMenuRadioItemPro as DropdownMenuRadioItem,
697
- MoonUIDropdownMenuLabelPro as DropdownMenuLabel,
698
- MoonUIDropdownMenuSeparatorPro as DropdownMenuSeparator,
699
- MoonUIDropdownMenuShortcutPro as DropdownMenuShortcut,
700
- MoonUIDropdownMenuGroupPro as DropdownMenuGroup,
701
- MoonUIDropdownMenuPortalPro as DropdownMenuPortal,
702
- MoonUIDropdownMenuSubPro as DropdownMenuSub,
703
- MoonUIDropdownMenuSubContentPro as DropdownMenuSubContent,
704
- MoonUIDropdownMenuSubTriggerPro as DropdownMenuSubTrigger,
705
- MoonUIDropdownMenuRadioGroupPro as DropdownMenuRadioGroup
706
- }