@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,141 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
5
-
6
- import { cn } from "../../lib/utils"
7
- import { buttonVariants } from "./button"
8
-
9
- const AlertDialog = AlertDialogPrimitive.Root
10
-
11
- const AlertDialogTrigger = AlertDialogPrimitive.Trigger
12
-
13
- const AlertDialogPortal = AlertDialogPrimitive.Portal
14
-
15
- const AlertDialogOverlay = React.forwardRef<
16
- React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
17
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
18
- >(({ className, ...props }, ref) => (
19
- <AlertDialogPrimitive.Overlay
20
- className={cn(
21
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
22
- className
23
- )}
24
- {...props}
25
- ref={ref}
26
- />
27
- ))
28
- AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
29
-
30
- const AlertDialogContent = React.forwardRef<
31
- React.ElementRef<typeof AlertDialogPrimitive.Content>,
32
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
33
- >(({ className, ...props }, ref) => (
34
- <AlertDialogPortal>
35
- <AlertDialogOverlay />
36
- <AlertDialogPrimitive.Content
37
- ref={ref}
38
- className={cn(
39
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg 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 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
40
- className
41
- )}
42
- {...props}
43
- />
44
- </AlertDialogPortal>
45
- ))
46
- AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
47
-
48
- const AlertDialogHeader = ({
49
- className,
50
- ...props
51
- }: React.HTMLAttributes<HTMLDivElement>) => (
52
- <div
53
- className={cn(
54
- "flex flex-col space-y-2 text-center sm:text-left",
55
- className
56
- )}
57
- {...props}
58
- />
59
- )
60
- AlertDialogHeader.displayName = "AlertDialogHeader"
61
-
62
- const AlertDialogFooter = ({
63
- className,
64
- ...props
65
- }: React.HTMLAttributes<HTMLDivElement>) => (
66
- <div
67
- className={cn(
68
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
69
- className
70
- )}
71
- {...props}
72
- />
73
- )
74
- AlertDialogFooter.displayName = "AlertDialogFooter"
75
-
76
- const AlertDialogTitle = React.forwardRef<
77
- React.ElementRef<typeof AlertDialogPrimitive.Title>,
78
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
79
- >(({ className, ...props }, ref) => (
80
- <AlertDialogPrimitive.Title
81
- ref={ref}
82
- className={cn("text-lg font-semibold", className)}
83
- {...props}
84
- />
85
- ))
86
- AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
87
-
88
- const AlertDialogDescription = React.forwardRef<
89
- React.ElementRef<typeof AlertDialogPrimitive.Description>,
90
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
91
- >(({ className, ...props }, ref) => (
92
- <AlertDialogPrimitive.Description
93
- ref={ref}
94
- className={cn("text-sm text-muted-foreground", className)}
95
- {...props}
96
- />
97
- ))
98
- AlertDialogDescription.displayName =
99
- AlertDialogPrimitive.Description.displayName
100
-
101
- const AlertDialogAction = React.forwardRef<
102
- React.ElementRef<typeof AlertDialogPrimitive.Action>,
103
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
104
- >(({ className, ...props }, ref) => (
105
- <AlertDialogPrimitive.Action
106
- ref={ref}
107
- className={cn(buttonVariants(), className)}
108
- {...props}
109
- />
110
- ))
111
- AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
112
-
113
- const AlertDialogCancel = React.forwardRef<
114
- React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
115
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
116
- >(({ className, ...props }, ref) => (
117
- <AlertDialogPrimitive.Cancel
118
- ref={ref}
119
- className={cn(
120
- buttonVariants({ variant: "outline" }),
121
- "mt-2 sm:mt-0",
122
- className
123
- )}
124
- {...props}
125
- />
126
- ))
127
- AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
128
-
129
- export {
130
- AlertDialog,
131
- AlertDialogPortal,
132
- AlertDialogOverlay,
133
- AlertDialogTrigger,
134
- AlertDialogContent,
135
- AlertDialogHeader,
136
- AlertDialogFooter,
137
- AlertDialogTitle,
138
- AlertDialogDescription,
139
- AlertDialogAction,
140
- AlertDialogCancel,
141
- }
@@ -1,141 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { cva, type VariantProps } from "class-variance-authority";
5
- import { AlertCircle, AlertTriangle, Info, Check, X } from "lucide-react";
6
-
7
- import { cn } from "../../lib/utils";
8
-
9
- /**
10
- * Alert Component
11
- *
12
- * Yüksek kaliteli, özelleştirilebilir ve erişilebilir alert bileşeni.
13
- * Bildirim, uyarı ve dikkat çekmek gereken içerikler için kullanılır.
14
- */
15
-
16
- const MoonUIalertVariantsPro = cva(
17
- "relative w-full flex items-center gap-3 p-4 border text-foreground [&>svg]:shrink-0",
18
- {
19
- variants: {
20
- variant: {
21
- default: "bg-background text-foreground border-border",
22
- primary: "bg-primary/10 text-primary border-primary/30",
23
- success: "bg-success/10 text-success border-success/30",
24
- warning: "bg-warning/10 text-warning border-warning/30",
25
- error: "bg-destructive/10 text-destructive border-destructive/30",
26
- info: "bg-blue-500/10 text-blue-500 border-blue-500/30",
27
- },
28
- size: {
29
- sm: "py-2 text-xs",
30
- default: "py-3 text-sm",
31
- lg: "py-4 text-base",
32
- },
33
- radius: {
34
- none: "rounded-none",
35
- sm: "rounded-sm",
36
- default: "rounded-md",
37
- lg: "rounded-lg",
38
- full: "rounded-full",
39
- },
40
- withClose: {
41
- true: "pr-10",
42
- },
43
- },
44
- defaultVariants: {
45
- variant: "default",
46
- size: "default",
47
- radius: "default",
48
- withClose: false,
49
- },
50
- }
51
- );
52
-
53
- export interface AlertProps
54
- extends React.HTMLAttributes<HTMLDivElement>,
55
- VariantProps<typeof MoonUIalertVariantsPro> {
56
- /** Alert ikonunu gizler */
57
- hideIcon?: boolean;
58
- /** Kapatma butonu ekler */
59
- closable?: boolean;
60
- /** Kapatma butonu tıklandığında çalışacak fonksiyon */
61
- onClose?: () => void;
62
- }
63
-
64
- const MoonUIAlertPro = React.forwardRef<HTMLDivElement, AlertProps>(
65
- ({ className, variant = "default", size, radius, hideIcon = false, closable = false, onClose, children, ...props }, ref) => {
66
- // Alert türüne göre ikon belirleme
67
- const MoonUIIconPro = React.useMemo(() => {
68
- switch (variant) {
69
- case "success":
70
- return Check;
71
- case "warning":
72
- return AlertTriangle;
73
- case "error":
74
- return AlertCircle;
75
- case "info":
76
- return Info;
77
- default:
78
- return Info;
79
- }
80
- }, [variant]);
81
-
82
- return (
83
- <div
84
- ref={ref}
85
- role="alert"
86
- className={cn(MoonUIalertVariantsPro({ variant, size, radius, withClose: closable }), className)}
87
- {...props}
88
- >
89
- {!hideIcon && <MoonUIIconPro className="h-5 w-5" />}
90
- <div className="flex-1">{children}</div>
91
- {closable && onClose && (
92
- <button
93
- onClick={onClose}
94
- className="absolute right-3 top-3 inline-flex h-6 w-6 items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100"
95
- aria-label="Kapat"
96
- >
97
- <X className="h-4 w-4" />
98
- </button>
99
- )}
100
- </div>
101
- );
102
- }
103
- );
104
- MoonUIAlertPro.displayName = "AlertPro";
105
-
106
- const MoonUIAlertTitlePro = React.forwardRef<
107
- HTMLParagraphElement,
108
- React.HTMLAttributes<HTMLHeadingElement>
109
- >(({ className, ...props }, ref) => (
110
- <h5
111
- ref={ref}
112
- className={cn("font-semibold leading-tight tracking-tight mb-1", className)}
113
- {...props}
114
- />
115
- ));
116
- MoonUIAlertTitlePro.displayName = "AlertTitlePro";
117
-
118
- const MoonUIAlertDescriptionPro = React.forwardRef<
119
- HTMLParagraphElement,
120
- React.HTMLAttributes<HTMLParagraphElement>
121
- >(({ className, ...props }, ref) => (
122
- <div
123
- ref={ref}
124
- className={cn("text-sm leading-5 text-muted-foreground", className)}
125
- {...props}
126
- />
127
- ));
128
- MoonUIAlertDescriptionPro.displayName = "AlertDescriptionPro";
129
-
130
-
131
- // Internal aliases for Pro component usage
132
- export const alertVariantsInternal = MoonUIalertVariantsPro
133
- export const AlertInternal = MoonUIAlertPro
134
- export const AlertTitleInternal = MoonUIAlertTitlePro
135
- export const AlertDescriptionInternal = MoonUIAlertDescriptionPro
136
-
137
- // Pro exports
138
- export { MoonUIalertVariantsPro, MoonUIAlertPro, MoonUIAlertTitlePro, MoonUIAlertDescriptionPro }
139
-
140
- // Clean exports (without MoonUI prefix for easier usage)
141
- export { MoonUIalertVariantsPro as alertVariants, MoonUIAlertPro as Alert, MoonUIAlertTitlePro as AlertTitle, MoonUIAlertDescriptionPro as AlertDescription };
@@ -1,245 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import { cva, type VariantProps } from "class-variance-authority"
5
-
6
- import { cn } from "../../lib/utils"
7
-
8
- /**
9
- * Premium Aspect Ratio Component
10
- *
11
- * Advanced component that maintains specific aspect ratios with preset support,
12
- * responsive behavior, animations, and enhanced styling options.
13
- * Perfect for images, videos, and media content in modern applications.
14
- */
15
-
16
- // Preset ratios
17
- const PRESET_RATIOS = {
18
- square: 1,
19
- video: 16 / 9,
20
- portrait: 3 / 4,
21
- landscape: 4 / 3,
22
- golden: 1.618,
23
- ultrawide: 21 / 9,
24
- cinema: 2.39,
25
- instagram: 4 / 5,
26
- story: 9 / 16,
27
- banner: 3 / 1,
28
- } as const
29
-
30
- type PresetRatio = keyof typeof PRESET_RATIOS
31
-
32
- // Responsive ratio configuration
33
- interface ResponsiveRatio {
34
- sm?: number | PresetRatio
35
- md?: number | PresetRatio
36
- lg?: number | PresetRatio
37
- xl?: number | PresetRatio
38
- "2xl"?: number | PresetRatio
39
- }
40
-
41
- const MoonUIaspectRatioVariantsPro = cva(
42
- "relative overflow-hidden",
43
- {
44
- variants: {
45
- variant: {
46
- default: "bg-muted/10",
47
- ghost: "bg-transparent",
48
- outline: "border border-border",
49
- card: "bg-card shadow-sm",
50
- glass: "bg-white/10 backdrop-blur-md border border-white/20",
51
- gradient: "bg-gradient-to-br from-primary/10 to-secondary/10",
52
- },
53
- radius: {
54
- none: "rounded-none",
55
- sm: "rounded-sm",
56
- md: "rounded-md",
57
- lg: "rounded-lg",
58
- xl: "rounded-xl",
59
- "2xl": "rounded-2xl",
60
- full: "rounded-full",
61
- },
62
- animate: {
63
- true: "transition-all duration-300 ease-in-out",
64
- false: "",
65
- },
66
- hover: {
67
- true: "hover:scale-105 hover:shadow-lg cursor-pointer",
68
- false: "",
69
- },
70
- loading: {
71
- true: "animate-pulse",
72
- false: "",
73
- },
74
- },
75
- defaultVariants: {
76
- variant: "default",
77
- radius: "md",
78
- animate: false,
79
- hover: false,
80
- loading: false,
81
- },
82
- }
83
- )
84
-
85
- interface AspectRatioProps
86
- extends React.HTMLAttributes<HTMLDivElement>,
87
- VariantProps<typeof MoonUIaspectRatioVariantsPro> {
88
- /**
89
- * Aspect ratio (width/height). For example 16/9, 4/3, 1/1 etc.
90
- * @default 16/9
91
- */
92
- ratio?: number
93
- /**
94
- * Preset aspect ratio for quick usage
95
- */
96
- preset?: PresetRatio
97
- /**
98
- * Responsive aspect ratios for different breakpoints
99
- */
100
- responsive?: ResponsiveRatio
101
- /**
102
- * Enable smooth aspect ratio changes
103
- */
104
- smoothTransition?: boolean
105
- /**
106
- * Add overlay content
107
- */
108
- overlay?: React.ReactNode
109
- /**
110
- * Overlay position
111
- */
112
- overlayPosition?: "center" | "top-left" | "top-right" | "bottom-left" | "bottom-right"
113
- /**
114
- * Show loading skeleton
115
- */
116
- skeleton?: boolean
117
- }
118
-
119
- const MoonUIAspectRatioPro = React.forwardRef<
120
- HTMLDivElement,
121
- AspectRatioProps
122
- >(({
123
- className,
124
- variant,
125
- radius,
126
- animate,
127
- hover,
128
- loading,
129
- ratio = 16 / 9,
130
- preset,
131
- responsive,
132
- smoothTransition = false,
133
- overlay,
134
- overlayPosition = "center",
135
- skeleton = false,
136
- style,
137
- children,
138
- ...props
139
- }, ref) => {
140
- const [currentRatio, setCurrentRatio] = React.useState(() => {
141
- if (preset) return PRESET_RATIOS[preset]
142
- return ratio
143
- })
144
-
145
- // Update ratio when props change
146
- React.useEffect(() => {
147
- const newRatio = preset ? PRESET_RATIOS[preset] : ratio
148
- if (smoothTransition) {
149
- setCurrentRatio(newRatio)
150
- } else {
151
- setCurrentRatio(newRatio)
152
- }
153
- }, [preset, ratio, smoothTransition])
154
-
155
- // Handle responsive ratios
156
- React.useEffect(() => {
157
- if (!responsive) return
158
-
159
- const handleResize = () => {
160
- const width = window.innerWidth
161
- let newRatio = currentRatio
162
-
163
- if (width >= 1536 && responsive["2xl"]) {
164
- newRatio = typeof responsive["2xl"] === "string"
165
- ? PRESET_RATIOS[responsive["2xl"]]
166
- : responsive["2xl"]
167
- } else if (width >= 1280 && responsive.xl) {
168
- newRatio = typeof responsive.xl === "string"
169
- ? PRESET_RATIOS[responsive.xl]
170
- : responsive.xl
171
- } else if (width >= 1024 && responsive.lg) {
172
- newRatio = typeof responsive.lg === "string"
173
- ? PRESET_RATIOS[responsive.lg]
174
- : responsive.lg
175
- } else if (width >= 768 && responsive.md) {
176
- newRatio = typeof responsive.md === "string"
177
- ? PRESET_RATIOS[responsive.md]
178
- : responsive.md
179
- } else if (width >= 640 && responsive.sm) {
180
- newRatio = typeof responsive.sm === "string"
181
- ? PRESET_RATIOS[responsive.sm]
182
- : responsive.sm
183
- }
184
-
185
- setCurrentRatio(newRatio)
186
- }
187
-
188
- handleResize()
189
- window.addEventListener("resize", handleResize)
190
- return () => window.removeEventListener("resize", handleResize)
191
- }, [responsive, currentRatio])
192
-
193
- const overlayPositionClasses = {
194
- center: "items-center justify-center",
195
- "top-left": "items-start justify-start p-4",
196
- "top-right": "items-start justify-end p-4",
197
- "bottom-left": "items-end justify-start p-4",
198
- "bottom-right": "items-end justify-end p-4",
199
- }
200
-
201
- return (
202
- <div
203
- ref={ref}
204
- className={cn(
205
- MoonUIaspectRatioVariantsPro({ variant, radius, animate: animate || smoothTransition, hover, loading: loading || skeleton }),
206
- className
207
- )}
208
- style={{
209
- position: "relative",
210
- paddingBottom: `${(1 / currentRatio) * 100}%`,
211
- ...style
212
- }}
213
- {...props}
214
- >
215
- <div className="absolute inset-0">
216
- {skeleton ? (
217
- <div className="w-full h-full bg-muted animate-pulse" />
218
- ) : (
219
- children
220
- )}
221
- {overlay && (
222
- <div className={cn(
223
- "absolute inset-0 flex",
224
- overlayPositionClasses[overlayPosition]
225
- )}>
226
- {overlay}
227
- </div>
228
- )}
229
- </div>
230
- </div>
231
- )
232
- })
233
- MoonUIAspectRatioPro.displayName = "AspectRatioPro"
234
-
235
-
236
- // Internal aliases for Pro component usage
237
- export const aspectRatioVariantsInternal = MoonUIaspectRatioVariantsPro
238
- export const AspectRatioInternal = MoonUIAspectRatioPro
239
-
240
- // Pro exports
241
- export { MoonUIaspectRatioVariantsPro, MoonUIAspectRatioPro }
242
-
243
- // Clean exports (without MoonUI prefix for easier usage)
244
- export { MoonUIaspectRatioVariantsPro as aspectRatioVariants, MoonUIAspectRatioPro as AspectRatio }
245
- export type { AspectRatioProps }
@@ -1,155 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react";
4
- import * as AvatarPrimitive from "@radix-ui/react-avatar";
5
- import { cva, type VariantProps } from "class-variance-authority";
6
-
7
- import { cn } from "../../lib/utils";
8
-
9
- const moonUIAvatarVariantsPro = cva(
10
- "relative flex shrink-0 overflow-hidden",
11
- {
12
- variants: {
13
- size: {
14
- default: "h-10 w-10",
15
- xs: "h-6 w-6",
16
- sm: "h-8 w-8",
17
- md: "h-10 w-10",
18
- lg: "h-12 w-12",
19
- xl: "h-16 w-16",
20
- "2xl": "h-20 w-20",
21
- },
22
- radius: {
23
- default: "rounded-full",
24
- sm: "rounded-md",
25
- lg: "rounded-xl",
26
- full: "rounded-full",
27
- none: "rounded-none",
28
- },
29
- variant: {
30
- default: "",
31
- ring: "ring-2 ring-gray-300 dark:ring-gray-600",
32
- ringOffset: "ring-2 ring-gray-300 dark:ring-gray-600 ring-offset-2 ring-offset-background dark:ring-offset-gray-950",
33
- border: "border-2 border-gray-200 dark:border-gray-800"
34
- }
35
- },
36
- defaultVariants: {
37
- size: "default",
38
- radius: "default",
39
- variant: "default"
40
- },
41
- }
42
- );
43
-
44
- export interface MoonUIAvatarProProps
45
- extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>,
46
- VariantProps<typeof moonUIAvatarVariantsPro> {}
47
-
48
- const MoonUIAvatarPro = React.forwardRef<
49
- React.ElementRef<typeof AvatarPrimitive.Root>,
50
- MoonUIAvatarProProps
51
- >(({ className, size, radius, variant, ...props }, ref) => (
52
- <AvatarPrimitive.Root
53
- ref={ref}
54
- className={cn(moonUIAvatarVariantsPro({ size, radius, variant }), className)}
55
- {...props}
56
- />
57
- ));
58
- MoonUIAvatarPro.displayName = AvatarPrimitive.Root.displayName;
59
-
60
- const MoonUIAvatarImagePro = React.forwardRef<
61
- React.ElementRef<typeof AvatarPrimitive.Image>,
62
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
63
- >(({ className, ...props }, ref) => (
64
- <AvatarPrimitive.Image
65
- ref={ref}
66
- className={cn("aspect-square h-full w-full", className)}
67
- {...props}
68
- />
69
- ));
70
- MoonUIAvatarImagePro.displayName = AvatarPrimitive.Image.displayName;
71
-
72
- const MoonUIAvatarFallbackPro = React.forwardRef<
73
- React.ElementRef<typeof AvatarPrimitive.Fallback>,
74
- React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
75
- >(({ className, ...props }, ref) => (
76
- <AvatarPrimitive.Fallback
77
- ref={ref}
78
- className={cn(
79
- "flex h-full w-full items-center justify-center bg-muted",
80
- className
81
- )}
82
- {...props}
83
- />
84
- ));
85
- MoonUIAvatarFallbackPro.displayName = AvatarPrimitive.Fallback.displayName;
86
-
87
- // Avatar Group Component for displaying multiple avatars
88
- interface MoonUIAvatarGroupProProps extends React.HTMLAttributes<HTMLDivElement> {
89
- max?: number;
90
- size?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
91
- children?: React.ReactNode;
92
- overlapOffset?: number;
93
- }
94
-
95
- const MoonUIAvatarGroupPro = React.forwardRef<HTMLDivElement, MoonUIAvatarGroupProProps>(
96
- ({ className, max = 3, size = "md", children, overlapOffset, ...props }, ref) => {
97
- const childrenArray = React.Children.toArray(children);
98
- const visibleChildren = max ? childrenArray.slice(0, max) : childrenArray;
99
- const remainingCount = max ? Math.max(0, childrenArray.length - max) : 0;
100
-
101
- // Calculate overlap offset based on size
102
- const defaultOffsets = {
103
- xs: -4,
104
- sm: -6,
105
- md: -8,
106
- lg: -10,
107
- xl: -12,
108
- "2xl": -16,
109
- };
110
- const finalOffset = overlapOffset ?? defaultOffsets[size as keyof typeof defaultOffsets] ?? -8;
111
-
112
- return (
113
- <div
114
- ref={ref}
115
- className={cn("flex items-center", className)}
116
- {...props}
117
- >
118
- <div className="flex">
119
- {visibleChildren.map((child, index) => (
120
- <div
121
- key={index}
122
- className="relative ring-2 ring-background rounded-full"
123
- style={{
124
- marginLeft: index === 0 ? 0 : `${finalOffset}px`,
125
- zIndex: visibleChildren.length - index
126
- }}
127
- >
128
- {React.isValidElement(child) && child.type === MoonUIAvatarPro
129
- ? React.cloneElement(child as React.ReactElement<any>, { size })
130
- : child}
131
- </div>
132
- ))}
133
- {remainingCount > 0 && (
134
- <div
135
- className="relative z-0 ring-2 ring-background rounded-full"
136
- style={{ marginLeft: `${finalOffset}px` }}
137
- >
138
- <MoonUIAvatarPro size={size} className="bg-muted">
139
- <MoonUIAvatarFallbackPro className="text-xs font-medium">
140
- +{remainingCount}
141
- </MoonUIAvatarFallbackPro>
142
- </MoonUIAvatarPro>
143
- </div>
144
- )}
145
- </div>
146
- </div>
147
- );
148
- }
149
- );
150
- MoonUIAvatarGroupPro.displayName = "MoonUIAvatarGroupPro";
151
-
152
- export { MoonUIAvatarPro, MoonUIAvatarImagePro, MoonUIAvatarFallbackPro, MoonUIAvatarGroupPro };
153
-
154
- // Backward compatibility exports
155
- export { MoonUIAvatarPro as Avatar, MoonUIAvatarImagePro as AvatarImage, MoonUIAvatarFallbackPro as AvatarFallback, MoonUIAvatarGroupPro as AvatarGroup };