@moontra/moonui-pro 2.20.1 → 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 (162) hide show
  1. package/dist/index.d.ts +691 -261
  2. package/dist/index.mjs +7418 -4934
  3. package/package.json +11 -5
  4. package/plugin/index.d.ts +86 -0
  5. package/plugin/index.js +308 -0
  6. package/scripts/postbuild.js +27 -0
  7. package/scripts/postinstall.js +176 -23
  8. package/src/__tests__/use-intersection-observer.test.tsx +0 -216
  9. package/src/__tests__/use-local-storage.test.tsx +0 -174
  10. package/src/__tests__/use-pro-access.test.tsx +0 -183
  11. package/src/components/advanced-chart/advanced-chart.test.tsx +0 -281
  12. package/src/components/advanced-chart/index.tsx +0 -1242
  13. package/src/components/advanced-forms/index.tsx +0 -426
  14. package/src/components/animated-button/index.tsx +0 -385
  15. package/src/components/calendar/event-dialog.tsx +0 -372
  16. package/src/components/calendar/index.tsx +0 -1073
  17. package/src/components/calendar-pro/index.tsx +0 -1697
  18. package/src/components/color-picker/index.tsx +0 -432
  19. package/src/components/credit-card-input/index.tsx +0 -406
  20. package/src/components/dashboard/dashboard-grid.tsx +0 -462
  21. package/src/components/dashboard/demo.tsx +0 -425
  22. package/src/components/dashboard/index.tsx +0 -1046
  23. package/src/components/dashboard/time-range-picker.tsx +0 -336
  24. package/src/components/dashboard/types.ts +0 -222
  25. package/src/components/dashboard/widgets/activity-feed.tsx +0 -344
  26. package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
  27. package/src/components/dashboard/widgets/metric-card.tsx +0 -343
  28. package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
  29. package/src/components/data-table/data-table-column-toggle.tsx +0 -169
  30. package/src/components/data-table/data-table-export.ts +0 -156
  31. package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
  32. package/src/components/data-table/data-table.test.tsx +0 -187
  33. package/src/components/data-table/index.tsx +0 -845
  34. package/src/components/draggable-list/index.tsx +0 -100
  35. package/src/components/enhanced/badge.tsx +0 -191
  36. package/src/components/enhanced/button.tsx +0 -362
  37. package/src/components/enhanced/card.tsx +0 -266
  38. package/src/components/enhanced/dialog.tsx +0 -246
  39. package/src/components/enhanced/index.ts +0 -4
  40. package/src/components/error-boundary/index.tsx +0 -109
  41. package/src/components/file-upload/file-upload.test.tsx +0 -243
  42. package/src/components/file-upload/index.tsx +0 -1660
  43. package/src/components/floating-action-button/index.tsx +0 -206
  44. package/src/components/form-wizard/form-wizard-context.tsx +0 -307
  45. package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
  46. package/src/components/form-wizard/form-wizard-progress.tsx +0 -298
  47. package/src/components/form-wizard/form-wizard-step.tsx +0 -111
  48. package/src/components/form-wizard/index.tsx +0 -102
  49. package/src/components/form-wizard/types.ts +0 -76
  50. package/src/components/gesture-drawer/index.tsx +0 -551
  51. package/src/components/github-stars/github-api.ts +0 -426
  52. package/src/components/github-stars/hooks.ts +0 -516
  53. package/src/components/github-stars/index.tsx +0 -375
  54. package/src/components/github-stars/types.ts +0 -148
  55. package/src/components/github-stars/variants.tsx +0 -513
  56. package/src/components/health-check/index.tsx +0 -439
  57. package/src/components/hover-card-3d/index.tsx +0 -530
  58. package/src/components/index.ts +0 -128
  59. package/src/components/internal/index.ts +0 -78
  60. package/src/components/kanban/add-card-modal.tsx +0 -502
  61. package/src/components/kanban/card-detail-modal.tsx +0 -761
  62. package/src/components/kanban/index.ts +0 -13
  63. package/src/components/kanban/kanban.tsx +0 -1684
  64. package/src/components/kanban/types.ts +0 -168
  65. package/src/components/lazy-component/index.tsx +0 -823
  66. package/src/components/license-error/index.tsx +0 -29
  67. package/src/components/magnetic-button/index.tsx +0 -167
  68. package/src/components/memory-efficient-data/index.tsx +0 -1016
  69. package/src/components/moonui-quiz-form/index.tsx +0 -817
  70. package/src/components/optimized-image/index.tsx +0 -425
  71. package/src/components/performance-debugger/index.tsx +0 -589
  72. package/src/components/performance-monitor/index.tsx +0 -794
  73. package/src/components/phone-number-input/index.tsx +0 -338
  74. package/src/components/pinch-zoom/index.tsx +0 -566
  75. package/src/components/quiz-form/index.tsx +0 -479
  76. package/src/components/rich-text-editor/index-old-backup.tsx +0 -437
  77. package/src/components/rich-text-editor/index.tsx +0 -2324
  78. package/src/components/rich-text-editor/slash-commands-extension.ts +0 -220
  79. package/src/components/rich-text-editor/slash-commands.css +0 -35
  80. package/src/components/rich-text-editor/table-styles.css +0 -65
  81. package/src/components/sidebar/index.tsx +0 -865
  82. package/src/components/spotlight-card/index.tsx +0 -191
  83. package/src/components/swipeable-card/index.tsx +0 -100
  84. package/src/components/timeline/index.tsx +0 -1148
  85. package/src/components/ui/accordion.tsx +0 -73
  86. package/src/components/ui/alert-dialog.tsx +0 -141
  87. package/src/components/ui/alert.tsx +0 -141
  88. package/src/components/ui/aspect-ratio.tsx +0 -245
  89. package/src/components/ui/avatar.tsx +0 -153
  90. package/src/components/ui/badge.tsx +0 -228
  91. package/src/components/ui/breadcrumb.tsx +0 -214
  92. package/src/components/ui/button.tsx +0 -222
  93. package/src/components/ui/calendar.tsx +0 -387
  94. package/src/components/ui/card.tsx +0 -214
  95. package/src/components/ui/checkbox.tsx +0 -259
  96. package/src/components/ui/collapsible.tsx +0 -135
  97. package/src/components/ui/color-picker.tsx +0 -97
  98. package/src/components/ui/command.tsx +0 -225
  99. package/src/components/ui/dialog.tsx +0 -334
  100. package/src/components/ui/dropdown-menu.tsx +0 -218
  101. package/src/components/ui/gesture-drawer.tsx +0 -11
  102. package/src/components/ui/hover-card.tsx +0 -29
  103. package/src/components/ui/index.ts +0 -190
  104. package/src/components/ui/input.tsx +0 -222
  105. package/src/components/ui/label.tsx +0 -29
  106. package/src/components/ui/lightbox.tsx +0 -606
  107. package/src/components/ui/magnetic-button.tsx +0 -129
  108. package/src/components/ui/media-gallery.tsx +0 -612
  109. package/src/components/ui/pagination.tsx +0 -123
  110. package/src/components/ui/popover.tsx +0 -185
  111. package/src/components/ui/progress.tsx +0 -30
  112. package/src/components/ui/radio-group.tsx +0 -257
  113. package/src/components/ui/scroll-area.tsx +0 -47
  114. package/src/components/ui/select.tsx +0 -374
  115. package/src/components/ui/separator.tsx +0 -145
  116. package/src/components/ui/sheet.tsx +0 -139
  117. package/src/components/ui/skeleton.tsx +0 -20
  118. package/src/components/ui/slider.tsx +0 -354
  119. package/src/components/ui/spotlight-card.tsx +0 -119
  120. package/src/components/ui/switch.tsx +0 -86
  121. package/src/components/ui/table.tsx +0 -329
  122. package/src/components/ui/tabs.tsx +0 -198
  123. package/src/components/ui/textarea.tsx +0 -28
  124. package/src/components/ui/toast.tsx +0 -317
  125. package/src/components/ui/toggle.tsx +0 -119
  126. package/src/components/ui/tooltip.tsx +0 -151
  127. package/src/components/virtual-list/index.tsx +0 -668
  128. package/src/hooks/use-chart.ts +0 -205
  129. package/src/hooks/use-data-table.ts +0 -182
  130. package/src/hooks/use-docs-pro-access.ts +0 -13
  131. package/src/hooks/use-license-check.ts +0 -65
  132. package/src/hooks/use-subscription.ts +0 -19
  133. package/src/hooks/use-toast.ts +0 -15
  134. package/src/index.ts +0 -14
  135. package/src/lib/ai-providers.ts +0 -377
  136. package/src/lib/component-metadata.ts +0 -18
  137. package/src/lib/micro-interactions.ts +0 -255
  138. package/src/lib/paddle.ts +0 -17
  139. package/src/lib/utils.ts +0 -6
  140. package/src/patterns/login-form/index.tsx +0 -276
  141. package/src/patterns/login-form/types.ts +0 -67
  142. package/src/setupTests.ts +0 -41
  143. package/src/styles/advanced-chart.css +0 -239
  144. package/src/styles/calendar.css +0 -35
  145. package/src/styles/design-system.css +0 -363
  146. package/src/styles/index.css +0 -85
  147. package/src/styles/tailwind.css +0 -7
  148. package/src/styles/tokens.css +0 -455
  149. package/src/types/moonui.d.ts +0 -22
  150. package/src/types/next-auth.d.ts +0 -21
  151. package/src/use-intersection-observer.tsx +0 -154
  152. package/src/use-local-storage.tsx +0 -71
  153. package/src/use-paddle.ts +0 -138
  154. package/src/use-performance-optimizer.ts +0 -389
  155. package/src/use-pro-access.ts +0 -141
  156. package/src/use-scroll-animation.ts +0 -219
  157. package/src/use-subscription.ts +0 -37
  158. package/src/use-toast.ts +0 -32
  159. package/src/utils/chart-helpers.ts +0 -357
  160. package/src/utils/cn.ts +0 -6
  161. package/src/utils/data-processing.ts +0 -151
  162. package/src/utils/license-validator.tsx +0 -183
@@ -1,123 +0,0 @@
1
- import * as React from "react"
2
- import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react"
3
- import { cn } from "../../lib/utils"
4
- import { moonUIButtonProVariants } from "./button"
5
- import type { ButtonProps } from "./button"
6
-
7
- const MoonUIPaginationPro = ({ className, ...props }: React.ComponentProps<"nav">) => (
8
- <nav
9
- role="navigation"
10
- aria-label="pagination"
11
- className={cn("mx-auto flex w-full justify-center", className)}
12
- {...props}
13
- />
14
- )
15
- MoonUIPaginationPro.displayName = "PaginationPro"
16
-
17
- const MoonUIPaginationContentPro = React.forwardRef<
18
- HTMLUListElement,
19
- React.ComponentProps<"ul">
20
- >(({ className, ...props }, ref) => (
21
- <ul
22
- ref={ref}
23
- className={cn("flex flex-row items-center gap-1", className)}
24
- {...props}
25
- />
26
- ))
27
- MoonUIPaginationContentPro.displayName = "PaginationContentPro"
28
-
29
- const MoonUIPaginationItemPro = React.forwardRef<
30
- HTMLLIElement,
31
- React.ComponentProps<"li">
32
- >(({ className, ...props }, ref) => (
33
- <li ref={ref} className={cn("", className)} {...props} />
34
- ))
35
- MoonUIPaginationItemPro.displayName = "PaginationItemPro"
36
-
37
- type PaginationLinkProps = {
38
- isActive?: boolean
39
- } & Pick<ButtonProps, "size"> &
40
- React.ComponentProps<"a">
41
-
42
- const MoonUIPaginationLinkPro = ({
43
- className,
44
- isActive,
45
- size = "icon",
46
- ...props
47
- }: PaginationLinkProps) => (
48
- <a
49
- aria-current={isActive ? "page" : undefined}
50
- className={cn(
51
- moonUIButtonProVariants({
52
- variant: isActive ? "outline" : "ghost",
53
- size,
54
- }),
55
- className
56
- )}
57
- {...props}
58
- />
59
- )
60
- MoonUIPaginationLinkPro.displayName = "PaginationLinkPro"
61
-
62
- const MoonUIPaginationPreviousPro = ({
63
- className,
64
- ...props
65
- }: React.ComponentProps<typeof MoonUIPaginationLinkPro>) => (
66
- <MoonUIPaginationLinkPro
67
- aria-label="Go to previous page"
68
- size="md"
69
- className={cn("gap-1 pl-2.5", className)}
70
- {...props}
71
- >
72
- <ChevronLeft className="h-4 w-4" />
73
- <span>Previous</span>
74
- </MoonUIPaginationLinkPro>
75
- )
76
- MoonUIPaginationPreviousPro.displayName = "PaginationPreviousPro"
77
-
78
- const MoonUIPaginationNextPro = ({
79
- className,
80
- ...props
81
- }: React.ComponentProps<typeof MoonUIPaginationLinkPro>) => (
82
- <MoonUIPaginationLinkPro
83
- aria-label="Go to next page"
84
- size="md"
85
- className={cn("gap-1 pr-2.5", className)}
86
- {...props}
87
- >
88
- <span>Next</span>
89
- <ChevronRight className="h-4 w-4" />
90
- </MoonUIPaginationLinkPro>
91
- )
92
- MoonUIPaginationNextPro.displayName = "PaginationNextPro"
93
-
94
- const MoonUIPaginationEllipsisPro = ({
95
- className,
96
- ...props
97
- }: React.ComponentProps<"span">) => (
98
- <span
99
- aria-hidden
100
- className={cn("flex h-9 w-9 items-center justify-center", className)}
101
- {...props}
102
- >
103
- <MoreHorizontal className="h-4 w-4" />
104
- <span className="sr-only">More pages</span>
105
- </span>
106
- )
107
- MoonUIPaginationEllipsisPro.displayName = "PaginationEllipsisPro"
108
-
109
-
110
- // Internal aliases for Pro component usage
111
- export const PaginationInternal = MoonUIPaginationPro
112
- export const PaginationContentInternal = MoonUIPaginationContentPro
113
- export const PaginationItemInternal = MoonUIPaginationItemPro
114
- export const PaginationLinkInternal = MoonUIPaginationLinkPro
115
- export const PaginationPreviousInternal = MoonUIPaginationPreviousPro
116
- export const PaginationNextInternal = MoonUIPaginationNextPro
117
- export const PaginationEllipsisInternal = MoonUIPaginationEllipsisPro
118
-
119
- // Pro exports
120
- export { MoonUIPaginationPro, MoonUIPaginationContentPro, MoonUIPaginationItemPro, MoonUIPaginationLinkPro, MoonUIPaginationPreviousPro, MoonUIPaginationNextPro, MoonUIPaginationEllipsisPro }
121
-
122
- // Clean exports (without MoonUI prefix for easier usage)
123
- export { MoonUIPaginationPro as Pagination, MoonUIPaginationContentPro as PaginationContent, MoonUIPaginationItemPro as PaginationItem, MoonUIPaginationLinkPro as PaginationLink, MoonUIPaginationPreviousPro as PaginationPrevious, MoonUIPaginationNextPro as PaginationNext, MoonUIPaginationEllipsisPro as PaginationEllipsis }
@@ -1,185 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as PopoverPrimitive from "@radix-ui/react-popover";
5
- import { cva, type VariantProps } from "class-variance-authority";
6
-
7
- import { cn } from "../../lib/utils";
8
-
9
- /**
10
- * Popover Bileşeni
11
- *
12
- * Tıklanabilir bir öğeden açılan, tema sistemiyle tam entegre bir içerik bileşeni.
13
- * Filtreler, ayarlar ve diğer içerikler için kullanışlı ve erişilebilir bir arayüz sağlar.
14
- */
15
-
16
- const popoverContentVariants = cva(
17
- "z-50 w-72 rounded-md border border-border bg-background p-4 shadow-md outline-none 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",
18
- {
19
- variants: {
20
- variant: {
21
- default: "",
22
- destructive: "border-destructive bg-destructive/5",
23
- outline: "border-border bg-transparent",
24
- subtle: "border-transparent bg-muted/50",
25
- },
26
- size: {
27
- sm: "w-48 p-3",
28
- default: "w-72 p-4",
29
- lg: "w-96 p-5",
30
- },
31
- side: {
32
- top: "data-[side=top]:slide-in-from-bottom-2",
33
- right: "data-[side=right]:slide-in-from-left-2",
34
- bottom: "data-[side=bottom]:slide-in-from-top-2",
35
- left: "data-[side=left]:slide-in-from-right-2",
36
- },
37
- position: {
38
- pointerEventsNone: "pointer-events-none",
39
- default: "",
40
- },
41
- radius: {
42
- none: "rounded-none",
43
- sm: "rounded-sm",
44
- default: "rounded-md",
45
- lg: "rounded-lg",
46
- full: "rounded-full",
47
- },
48
- shadow: {
49
- none: "shadow-none",
50
- sm: "shadow-sm",
51
- default: "shadow-md",
52
- md: "shadow-md",
53
- lg: "shadow-lg",
54
- xl: "shadow-xl",
55
- },
56
- },
57
- defaultVariants: {
58
- variant: "default",
59
- size: "default",
60
- radius: "default",
61
- shadow: "default",
62
- },
63
- }
64
- );
65
-
66
- const MoonUIPopoverPro = PopoverPrimitive.Root;
67
- const MoonUIPopoverTriggerPro = PopoverPrimitive.Trigger;
68
- const MoonUIPopoverAnchorPro = PopoverPrimitive.Anchor;
69
-
70
- export interface MoonUIPopoverContentProProps
71
- extends Omit<React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>, 'side'>,
72
- VariantProps<typeof popoverContentVariants> {
73
- /**
74
- * Popover'ın arka plan bulanıklığı etkin mi
75
- */
76
- backdrop?: boolean;
77
- /**
78
- * Popover'a tıklandığında kapanıp kapanmayacağı
79
- */
80
- closeOnInteractOutside?: boolean;
81
- /**
82
- * Popover açıkken arka planın karartılması
83
- */
84
- overlayBackdrop?: boolean;
85
- }
86
-
87
- const MoonUIPopoverContentPro = React.forwardRef<
88
- React.ElementRef<typeof PopoverPrimitive.Content>,
89
- MoonUIPopoverContentProProps
90
- >(({
91
- className,
92
- variant,
93
- size,
94
- side,
95
- position,
96
- radius,
97
- shadow,
98
- backdrop = false,
99
- closeOnInteractOutside = true,
100
- overlayBackdrop = false,
101
- sideOffset = 4,
102
- ...props
103
- }, ref) => (
104
- <>
105
- {overlayBackdrop && (
106
- <div className="fixed inset-0 z-40 bg-overlay opacity-30" />
107
- )}
108
- <PopoverPrimitive.Content
109
- ref={ref}
110
- sideOffset={sideOffset}
111
- collisionPadding={8}
112
- onInteractOutside={(e) => {
113
- if (!closeOnInteractOutside) {
114
- e.preventDefault();
115
- }
116
- }}
117
- className={cn(
118
- popoverContentVariants({
119
- variant,
120
- size,
121
- side,
122
- position,
123
- radius,
124
- shadow
125
- }),
126
- backdrop && "backdrop-blur-md bg-opacity-80",
127
- className
128
- )}
129
- {...props}
130
- />
131
- </>
132
- ));
133
- MoonUIPopoverContentPro.displayName = PopoverPrimitive.Content.displayName;
134
-
135
- /**
136
- * PopoverClose bileşeni
137
- */
138
- const MoonUIPopoverClosePro = PopoverPrimitive.Close;
139
-
140
- /**
141
- * Popover için bölüm ayırıcı
142
- */
143
- const MoonUIPopoverSeparatorPro = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
144
- <div
145
- className={cn("my-2 h-px bg-border", className)}
146
- {...props}
147
- />
148
- );
149
- MoonUIPopoverSeparatorPro.displayName = "PopoverSeparator";
150
-
151
- /**
152
- * Popover başlık bileşeni
153
- */
154
- const MoonUIPopoverHeaderPro = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
155
- <div
156
- className={cn("-mx-4 -mt-4 mb-3 px-4 pt-4 pb-3 border-b border-border", className)}
157
- {...props}
158
- />
159
- );
160
- MoonUIPopoverHeaderPro.displayName = "PopoverHeader";
161
-
162
- /**
163
- * Popover footer bileşeni
164
- */
165
- const MoonUIPopoverFooterPro = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
166
- <div
167
- className={cn("-mx-4 -mb-4 mt-3 px-4 pt-3 pb-4 border-t border-border", className)}
168
- {...props}
169
- />
170
- );
171
- MoonUIPopoverFooterPro.displayName = "PopoverFooter";
172
-
173
- export { MoonUIPopoverPro,
174
- MoonUIPopoverTriggerPro,
175
- MoonUIPopoverContentPro,
176
- MoonUIPopoverAnchorPro,
177
- MoonUIPopoverClosePro,
178
- MoonUIPopoverSeparatorPro,
179
- MoonUIPopoverHeaderPro,
180
- MoonUIPopoverFooterPro,
181
- popoverContentVariants,
182
- };
183
-
184
- // Backward compatibility exports
185
- export { MoonUIPopoverPro as Popover, MoonUIPopoverSeparatorPro as PopoverSeparator, MoonUIPopoverTriggerPro as PopoverTrigger, MoonUIPopoverContentPro as PopoverContent, MoonUIPopoverAnchorPro as PopoverAnchor, MoonUIPopoverClosePro as PopoverClose, MoonUIPopoverHeaderPro as PopoverHeader, MoonUIPopoverFooterPro as PopoverFooter };
@@ -1,30 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as ProgressPrimitive from "@radix-ui/react-progress"
5
- import { cn } from "../../lib/utils"
6
-
7
- const MoonUIProgressPro = React.forwardRef<
8
- React.ElementRef<typeof ProgressPrimitive.Root>,
9
- React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
10
- >(({ className, value, ...props }, ref) => (
11
- <ProgressPrimitive.Root
12
- ref={ref}
13
- className={cn(
14
- "relative h-4 w-full overflow-hidden rounded-full bg-secondary",
15
- className
16
- )}
17
- {...props}
18
- >
19
- <ProgressPrimitive.Indicator
20
- className="h-full w-full flex-1 bg-primary transition-all"
21
- style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
22
- />
23
- </ProgressPrimitive.Root>
24
- ))
25
- MoonUIProgressPro.displayName = ProgressPrimitive.Root.displayName
26
-
27
- export { MoonUIProgressPro };
28
-
29
- // Backward compatibility exports
30
- export { MoonUIProgressPro as Progress }
@@ -1,257 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { Circle } from "lucide-react";
5
- import { cva, type VariantProps } from "class-variance-authority";
6
-
7
- import { cn } from "../../lib/utils";
8
-
9
- /**
10
- * Radio Group Component
11
- *
12
- * Accessible, customizable, and fully integrated with the theme system radio button group.
13
- * Allows users to select a single option from a group of choices.
14
- */
15
-
16
- const MoonUIradioGroupItemVariantsPro = cva(
17
- "aspect-square border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
18
- {
19
- variants: {
20
- variant: {
21
- default: "border-border bg-background text-primary",
22
- outline: "border-border bg-transparent text-primary",
23
- filled: "border-primary bg-primary/10 text-primary",
24
- },
25
- size: {
26
- sm: "h-3.5 w-3.5",
27
- default: "h-4 w-4",
28
- md: "h-5 w-5",
29
- lg: "h-6 w-6",
30
- },
31
- },
32
- defaultVariants: {
33
- variant: "default",
34
- size: "default",
35
- },
36
- }
37
- );
38
-
39
- export interface RadioGroupProps extends React.HTMLAttributes<HTMLDivElement> {
40
- /**
41
- * Radio group value
42
- */
43
- value?: string;
44
- /**
45
- * Function to call when radio group value changes
46
- */
47
- onValueChange?: (value: string) => void;
48
- /**
49
- * Radio group disabled state
50
- */
51
- disabled?: boolean;
52
- /**
53
- * Radio group name
54
- */
55
- name?: string;
56
- }
57
-
58
- const MoonUIRadioGroupContextPro = React.createContext<{
59
- value?: string;
60
- onValueChange?: (value: string) => void;
61
- disabled?: boolean;
62
- name?: string;
63
- }>({});
64
-
65
- const MoonUIRadioGroupPro = React.forwardRef<HTMLDivElement, RadioGroupProps>(
66
- ({ className, value, onValueChange, disabled, name, ...props }, ref) => {
67
- return (
68
- <MoonUIRadioGroupContextPro.Provider value={{ value, onValueChange, disabled, name }}>
69
- <div
70
- ref={ref}
71
- role="radiogroup"
72
- className={cn("grid gap-2", className)}
73
- {...props}
74
- />
75
- </MoonUIRadioGroupContextPro.Provider>
76
- );
77
- }
78
- );
79
- MoonUIRadioGroupPro.displayName = "RadioGroupPro";
80
-
81
- export interface RadioGroupItemProps
82
- extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>,
83
- VariantProps<typeof MoonUIradioGroupItemVariantsPro> {
84
- /**
85
- * Custom indicator component
86
- */
87
- indicator?: React.ReactNode;
88
- /**
89
- * HTML id for radio button
90
- */
91
- id?: string;
92
- /**
93
- * Radio button value
94
- */
95
- value: string;
96
- /**
97
- * Radio button disabled state
98
- */
99
- disabled?: boolean;
100
- }
101
-
102
- const MoonUIRadioGroupItemPro = React.forwardRef<
103
- HTMLInputElement,
104
- RadioGroupItemProps
105
- >(({ className, variant, size, indicator, id, value, disabled, ...props }, ref) => {
106
- // Get context values from radio group
107
- const radioGroup = React.useContext(MoonUIRadioGroupContextPro);
108
- const generatedId = React.useId();
109
- const radioId = id || generatedId;
110
- const isChecked = radioGroup.value === value;
111
-
112
- // Call onValueChange function when RadioGroupItem changes
113
- const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
114
- if (radioGroup.onValueChange) {
115
- radioGroup.onValueChange(e.target.value);
116
- }
117
-
118
- if (props.onChange) {
119
- props.onChange(e);
120
- }
121
- };
122
-
123
- return (
124
- <div className="relative flex items-center">
125
- <input
126
- type="radio"
127
- id={radioId}
128
- ref={ref}
129
- value={value}
130
- checked={isChecked}
131
- disabled={disabled || radioGroup.disabled}
132
- name={radioGroup.name}
133
- onChange={handleChange}
134
- className="sr-only"
135
- {...props}
136
- />
137
- <label
138
- htmlFor={radioId}
139
- className={cn(
140
- MoonUIradioGroupItemVariantsPro({ variant, size }),
141
- "rounded-full",
142
- "focus-visible:ring-primary/50",
143
- "relative inline-flex shrink-0 cursor-pointer items-center justify-center overflow-hidden",
144
- disabled && "cursor-not-allowed opacity-50",
145
- className
146
- )}
147
- >
148
- <span className={cn(
149
- "absolute inset-0 pointer-events-none",
150
- isChecked && "flex items-center justify-center"
151
- )}>
152
- {isChecked && (indicator || <Circle className="h-[60%] w-[60%] fill-current text-current" />)}
153
- </span>
154
- </label>
155
- </div>
156
- );
157
- });
158
- MoonUIRadioGroupItemPro.displayName = "RadioGroupItemPro";
159
-
160
- // Radio Label Component
161
- interface RadioLabelProps extends React.HTMLAttributes<HTMLLabelElement> {
162
- /**
163
- * HTML id for radio button
164
- */
165
- htmlFor?: string;
166
- /**
167
- * Label content
168
- */
169
- children: React.ReactNode;
170
- /**
171
- * Disabled state style
172
- */
173
- disabled?: boolean;
174
- }
175
-
176
- const MoonUIRadioLabelPro = React.forwardRef<HTMLLabelElement, RadioLabelProps>(
177
- ({ className, htmlFor, children, disabled = false, ...props }, ref) => {
178
- return (
179
- <label
180
- ref={ref}
181
- htmlFor={htmlFor}
182
- className={cn(
183
- "text-sm font-medium leading-none ml-2 text-foreground",
184
- disabled && "cursor-not-allowed opacity-70",
185
- className
186
- )}
187
- {...props}
188
- >
189
- {children}
190
- </label>
191
- );
192
- }
193
- );
194
- MoonUIRadioLabelPro.displayName = "RadioLabelPro";
195
-
196
- // Radio Item and Label combination
197
- interface RadioItemWithLabelProps extends RadioGroupItemProps {
198
- /**
199
- * Label content
200
- */
201
- label: React.ReactNode;
202
- /**
203
- * HTML classes for label
204
- */
205
- labelClassName?: string;
206
- /**
207
- * HTML id for radio button
208
- */
209
- id?: string;
210
- /**
211
- * Disabled state
212
- */
213
- disabled?: boolean;
214
- }
215
-
216
- const MoonUIRadioItemWithLabelPro = React.forwardRef<
217
- HTMLInputElement,
218
- RadioItemWithLabelProps
219
- >(({
220
- id,
221
- label,
222
- labelClassName,
223
- ...radioProps
224
- }, ref) => {
225
- const generatedId = React.useId();
226
- const radioId = id || generatedId;
227
-
228
- return (
229
- <div className="flex items-center">
230
- <MoonUIRadioGroupItemPro ref={ref} id={radioId} {...radioProps} />
231
- <MoonUIRadioLabelPro
232
- htmlFor={radioId}
233
- disabled={radioProps.disabled}
234
- className={labelClassName}
235
- >
236
- {label}
237
- </MoonUIRadioLabelPro>
238
- </div>
239
- );
240
- });
241
- MoonUIRadioItemWithLabelPro.displayName = "RadioItemWithLabelPro";
242
-
243
-
244
- // Internal aliases for Pro component usage
245
- export const radioGroupItemVariantsInternal = MoonUIradioGroupItemVariantsPro
246
- export const RadioGroupContextInternal = MoonUIRadioGroupContextPro
247
- export const RadioGroupInternal = MoonUIRadioGroupPro
248
- export const RadioGroupItemInternal = MoonUIRadioGroupItemPro
249
- export const radioGroupInternal = MoonUIRadioGroupPro
250
- export const RadioLabelInternal = MoonUIRadioLabelPro
251
- export const RadioItemWithLabelInternal = MoonUIRadioItemWithLabelPro
252
-
253
- // Pro exports
254
- export { MoonUIradioGroupItemVariantsPro, MoonUIRadioGroupContextPro, MoonUIRadioGroupPro, MoonUIRadioGroupItemPro, MoonUIRadioLabelPro, MoonUIRadioItemWithLabelPro }
255
-
256
- // Clean exports (without MoonUI prefix for easier usage)
257
- export { MoonUIradioGroupItemVariantsPro as radioGroupItemVariants, MoonUIRadioGroupContextPro as RadioGroupContext, MoonUIRadioGroupPro as RadioGroup, MoonUIRadioGroupItemPro as RadioGroupItem, MoonUIRadioLabelPro as RadioLabel, MoonUIRadioItemWithLabelPro as RadioItemWithLabel };
@@ -1,47 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
5
- import { cn } from "../../lib/utils"
6
-
7
- const ScrollArea = React.forwardRef<
8
- React.ElementRef<typeof ScrollAreaPrimitive.Root>,
9
- React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
10
- >(({ className, children, ...props }, ref) => (
11
- <ScrollAreaPrimitive.Root
12
- ref={ref}
13
- className={cn("relative overflow-hidden", className)}
14
- {...props}
15
- >
16
- <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
17
- {children}
18
- </ScrollAreaPrimitive.Viewport>
19
- <ScrollBar />
20
- <ScrollAreaPrimitive.Corner />
21
- </ScrollAreaPrimitive.Root>
22
- ))
23
- ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
24
-
25
- const ScrollBar = React.forwardRef<
26
- React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
27
- React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
28
- >(({ className, orientation = "vertical", ...props }, ref) => (
29
- <ScrollAreaPrimitive.ScrollAreaScrollbar
30
- ref={ref}
31
- orientation={orientation}
32
- className={cn(
33
- "flex touch-none select-none transition-colors",
34
- orientation === "vertical" &&
35
- "h-full w-2.5 border-l border-l-transparent p-[1px]",
36
- orientation === "horizontal" &&
37
- "h-2.5 flex-col border-t border-t-transparent p-[1px]",
38
- className
39
- )}
40
- {...props}
41
- >
42
- <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
43
- </ScrollAreaPrimitive.ScrollAreaScrollbar>
44
- ))
45
- ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
46
-
47
- export { ScrollArea, ScrollBar }