@moontra/moonui 2.1.9 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1656 -0
- package/dist/index.d.ts +1656 -0
- package/dist/index.js +1847 -469
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1679 -471
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/components/ui/accordion.tsx +1 -1
- package/src/components/ui/alert.tsx +123 -93
- package/src/components/ui/aspect-ratio.tsx +1 -1
- package/src/components/ui/avatar.tsx +8 -6
- package/src/components/ui/badge.tsx +20 -18
- package/src/components/ui/breadcrumb.tsx +12 -10
- package/src/components/ui/button.stories.tsx +4 -2
- package/src/components/ui/button.tsx +71 -68
- package/src/components/ui/calendar.tsx +2 -2
- package/src/components/ui/card-input.tsx +231 -0
- package/src/components/ui/card.stories.tsx +2 -0
- package/src/components/ui/card.tsx +9 -7
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/collapsible.tsx +3 -3
- package/src/components/ui/color-picker.tsx +2 -2
- package/src/components/ui/command.tsx +4 -4
- package/src/components/ui/data-table.stories.tsx +4 -2
- package/src/components/ui/data-table.tsx +8 -8
- package/src/components/ui/date-picker.stories.tsx +2 -0
- package/src/components/ui/date-picker.tsx +25 -15
- package/src/components/ui/dialog.tsx +2 -2
- package/src/components/ui/draggable-list.tsx +3 -1
- package/src/components/ui/dropdown-menu.tsx +2 -2
- package/src/components/ui/file-upload.tsx +2 -2
- package/src/components/ui/github-stars.tsx +1 -1
- package/src/components/ui/index.ts +357 -45
- package/src/components/ui/input.stories.tsx +2 -0
- package/src/components/ui/input.tsx +3 -1
- package/src/components/ui/locked-component.tsx +222 -0
- package/src/components/ui/moon-logo.tsx +1 -1
- package/src/components/ui/pagination.tsx +10 -8
- package/src/components/ui/phone-input.tsx +172 -0
- package/src/components/ui/popover-pro.tsx +424 -0
- package/src/components/ui/popover.tsx +3 -3
- package/src/components/ui/progress.tsx +1 -1
- package/src/components/ui/radio-group.tsx +1 -1
- package/src/components/ui/rich-text-editor/index.tsx +2 -1
- package/src/components/ui/scroll-area.tsx +48 -0
- package/src/components/ui/select.tsx +7 -3
- package/src/components/ui/separator.tsx +2 -2
- package/src/components/ui/skeleton.tsx +19 -7
- package/src/components/ui/slider.tsx +1 -1
- package/src/components/ui/swipeable-card.tsx +2 -0
- package/src/components/ui/switch.tsx +1 -1
- package/src/components/ui/table.tsx +7 -5
- package/src/components/ui/tabs.tsx +6 -1
- package/src/components/ui/tags-input.tsx +130 -0
- package/src/components/ui/textarea.tsx +3 -1
- package/src/components/ui/toast.tsx +5 -3
- package/src/components/ui/toggle.tsx +2 -3
- package/src/components/ui/tooltip.tsx +2 -5
- package/src/index.tsx +4 -46
- package/src/lib/micro-interactions.ts +2 -1
- package/src/lib/performance-profiler.ts +79 -0
- package/src/styles/index.css +315 -2
- package/src/use-performance-optimizer.ts +26 -26
- package/src/use-scroll-animation.ts +5 -7
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover"
|
|
5
|
+
import { motion, AnimatePresence, useSpring, useTransform } from "framer-motion"
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
8
|
+
|
|
9
|
+
const PopoverPro = PopoverPrimitive.Root
|
|
10
|
+
const PopoverTriggerPro = PopoverPrimitive.Trigger
|
|
11
|
+
const PopoverAnchorPro = PopoverPrimitive.Anchor
|
|
12
|
+
const PopoverPortalPro = PopoverPrimitive.Portal
|
|
13
|
+
|
|
14
|
+
// Animation variants
|
|
15
|
+
const popoverAnimations = {
|
|
16
|
+
// Basic animations
|
|
17
|
+
fade: {
|
|
18
|
+
initial: { opacity: 0 },
|
|
19
|
+
animate: { opacity: 1 },
|
|
20
|
+
exit: { opacity: 0 }
|
|
21
|
+
},
|
|
22
|
+
scale: {
|
|
23
|
+
initial: { opacity: 0, scale: 0.95 },
|
|
24
|
+
animate: { opacity: 1, scale: 1 },
|
|
25
|
+
exit: { opacity: 0, scale: 0.95 }
|
|
26
|
+
},
|
|
27
|
+
slide: {
|
|
28
|
+
initial: { opacity: 0, y: -10 },
|
|
29
|
+
animate: { opacity: 1, y: 0 },
|
|
30
|
+
exit: { opacity: 0, y: -10 }
|
|
31
|
+
},
|
|
32
|
+
// Advanced animations
|
|
33
|
+
spring: {
|
|
34
|
+
initial: { opacity: 0, scale: 0.8, y: -20 },
|
|
35
|
+
animate: {
|
|
36
|
+
opacity: 1,
|
|
37
|
+
scale: 1,
|
|
38
|
+
y: 0,
|
|
39
|
+
transition: {
|
|
40
|
+
type: "spring",
|
|
41
|
+
stiffness: 300,
|
|
42
|
+
damping: 20
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
exit: { opacity: 0, scale: 0.8, y: -20 }
|
|
46
|
+
},
|
|
47
|
+
elastic: {
|
|
48
|
+
initial: { opacity: 0, scale: 0.5, rotate: -10 },
|
|
49
|
+
animate: {
|
|
50
|
+
opacity: 1,
|
|
51
|
+
scale: 1,
|
|
52
|
+
rotate: 0,
|
|
53
|
+
transition: {
|
|
54
|
+
type: "spring",
|
|
55
|
+
stiffness: 400,
|
|
56
|
+
damping: 15
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
exit: { opacity: 0, scale: 0.5, rotate: 10 }
|
|
60
|
+
},
|
|
61
|
+
bounce: {
|
|
62
|
+
initial: { opacity: 0, y: -30 },
|
|
63
|
+
animate: {
|
|
64
|
+
opacity: 1,
|
|
65
|
+
y: 0,
|
|
66
|
+
transition: {
|
|
67
|
+
type: "spring",
|
|
68
|
+
stiffness: 500,
|
|
69
|
+
damping: 15,
|
|
70
|
+
mass: 1
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
exit: { opacity: 0, y: -30 }
|
|
74
|
+
},
|
|
75
|
+
flip: {
|
|
76
|
+
initial: { opacity: 0, rotateX: -90 },
|
|
77
|
+
animate: {
|
|
78
|
+
opacity: 1,
|
|
79
|
+
rotateX: 0,
|
|
80
|
+
transition: {
|
|
81
|
+
type: "spring",
|
|
82
|
+
stiffness: 300,
|
|
83
|
+
damping: 20
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
exit: { opacity: 0, rotateX: 90 }
|
|
87
|
+
},
|
|
88
|
+
slideFromBottom: {
|
|
89
|
+
initial: { opacity: 0, y: 20 },
|
|
90
|
+
animate: {
|
|
91
|
+
opacity: 1,
|
|
92
|
+
y: 0,
|
|
93
|
+
transition: {
|
|
94
|
+
type: "spring",
|
|
95
|
+
stiffness: 300,
|
|
96
|
+
damping: 25
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
exit: { opacity: 0, y: 20 }
|
|
100
|
+
},
|
|
101
|
+
zoom: {
|
|
102
|
+
initial: { opacity: 0, scale: 0 },
|
|
103
|
+
animate: {
|
|
104
|
+
opacity: 1,
|
|
105
|
+
scale: 1,
|
|
106
|
+
transition: {
|
|
107
|
+
type: "spring",
|
|
108
|
+
stiffness: 300,
|
|
109
|
+
damping: 20
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
exit: { opacity: 0, scale: 0 }
|
|
113
|
+
},
|
|
114
|
+
morph: {
|
|
115
|
+
initial: {
|
|
116
|
+
opacity: 0,
|
|
117
|
+
scale: 0.8,
|
|
118
|
+
borderRadius: "50%"
|
|
119
|
+
},
|
|
120
|
+
animate: {
|
|
121
|
+
opacity: 1,
|
|
122
|
+
scale: 1,
|
|
123
|
+
borderRadius: "12px",
|
|
124
|
+
transition: {
|
|
125
|
+
type: "spring",
|
|
126
|
+
stiffness: 300,
|
|
127
|
+
damping: 25
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
exit: {
|
|
131
|
+
opacity: 0,
|
|
132
|
+
scale: 0.8,
|
|
133
|
+
borderRadius: "50%"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const popoverContentVariants = cva(
|
|
139
|
+
"z-50 w-72 rounded-md p-4 shadow-md outline-none",
|
|
140
|
+
{
|
|
141
|
+
variants: {
|
|
142
|
+
variant: {
|
|
143
|
+
default: "border bg-popover text-popover-foreground",
|
|
144
|
+
glass: [
|
|
145
|
+
"border border-white/20 bg-white/80 backdrop-blur-xl",
|
|
146
|
+
"dark:border-gray-800/50 dark:bg-gray-900/80",
|
|
147
|
+
"shadow-xl"
|
|
148
|
+
],
|
|
149
|
+
gradient: [
|
|
150
|
+
"bg-gradient-to-br from-white to-gray-50",
|
|
151
|
+
"dark:from-gray-900 dark:to-gray-950",
|
|
152
|
+
"border border-gray-200 dark:border-gray-800",
|
|
153
|
+
"shadow-xl"
|
|
154
|
+
],
|
|
155
|
+
solid: [
|
|
156
|
+
"bg-white dark:bg-gray-900",
|
|
157
|
+
"border-2 border-gray-200 dark:border-gray-700",
|
|
158
|
+
"shadow-2xl"
|
|
159
|
+
],
|
|
160
|
+
floating: [
|
|
161
|
+
"bg-white dark:bg-gray-900",
|
|
162
|
+
"shadow-2xl shadow-black/20 dark:shadow-black/40",
|
|
163
|
+
"border border-gray-100 dark:border-gray-800"
|
|
164
|
+
],
|
|
165
|
+
neumorphic: [
|
|
166
|
+
"bg-gray-100 dark:bg-gray-900",
|
|
167
|
+
"shadow-[20px_20px_60px_#bebebe,-20px_-20px_60px_#ffffff]",
|
|
168
|
+
"dark:shadow-[20px_20px_60px_#1a1a1a,-20px_-20px_60px_#2a2a2a]",
|
|
169
|
+
"border-0"
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
size: {
|
|
173
|
+
sm: "w-56 p-3",
|
|
174
|
+
default: "w-72 p-4",
|
|
175
|
+
lg: "w-96 p-6",
|
|
176
|
+
xl: "w-[32rem] p-8",
|
|
177
|
+
auto: "w-auto p-4"
|
|
178
|
+
},
|
|
179
|
+
overlayBlur: {
|
|
180
|
+
none: "",
|
|
181
|
+
sm: "backdrop-blur-sm",
|
|
182
|
+
md: "backdrop-blur-md",
|
|
183
|
+
lg: "backdrop-blur-lg",
|
|
184
|
+
xl: "backdrop-blur-xl"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
defaultVariants: {
|
|
188
|
+
variant: "default",
|
|
189
|
+
size: "default",
|
|
190
|
+
overlayBlur: "none"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
export interface PopoverContentProProps
|
|
196
|
+
extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>,
|
|
197
|
+
VariantProps<typeof popoverContentVariants> {
|
|
198
|
+
animation?: keyof typeof popoverAnimations
|
|
199
|
+
enableSpringPhysics?: boolean
|
|
200
|
+
showArrow?: boolean
|
|
201
|
+
arrowSize?: number
|
|
202
|
+
customBackdrop?: boolean
|
|
203
|
+
dragToDismiss?: boolean
|
|
204
|
+
pinnable?: boolean
|
|
205
|
+
resizable?: boolean
|
|
206
|
+
focusTrap?: boolean
|
|
207
|
+
closeOnEscape?: boolean
|
|
208
|
+
closeOnClickOutside?: boolean
|
|
209
|
+
staggerChildren?: boolean
|
|
210
|
+
glowEffect?: boolean
|
|
211
|
+
magneticEdges?: boolean
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const PopoverContentPro = React.forwardRef<
|
|
215
|
+
React.ElementRef<typeof PopoverPrimitive.Content>,
|
|
216
|
+
PopoverContentProProps
|
|
217
|
+
>(
|
|
218
|
+
(
|
|
219
|
+
{
|
|
220
|
+
className,
|
|
221
|
+
align = "center",
|
|
222
|
+
sideOffset = 4,
|
|
223
|
+
variant,
|
|
224
|
+
size,
|
|
225
|
+
overlayBlur,
|
|
226
|
+
animation = "spring",
|
|
227
|
+
enableSpringPhysics = false,
|
|
228
|
+
showArrow = false,
|
|
229
|
+
arrowSize = 8,
|
|
230
|
+
customBackdrop = false,
|
|
231
|
+
dragToDismiss = false,
|
|
232
|
+
pinnable = false,
|
|
233
|
+
resizable = false,
|
|
234
|
+
focusTrap = false,
|
|
235
|
+
closeOnEscape = true,
|
|
236
|
+
closeOnClickOutside = true,
|
|
237
|
+
staggerChildren = false,
|
|
238
|
+
glowEffect = false,
|
|
239
|
+
magneticEdges = false,
|
|
240
|
+
children,
|
|
241
|
+
...props
|
|
242
|
+
},
|
|
243
|
+
ref
|
|
244
|
+
) => {
|
|
245
|
+
const [isPinned, setIsPinned] = React.useState(false)
|
|
246
|
+
const [isDragging, setIsDragging] = React.useState(false)
|
|
247
|
+
const animationVariant = popoverAnimations[animation] || popoverAnimations.spring
|
|
248
|
+
|
|
249
|
+
// Spring physics for magnetic edges
|
|
250
|
+
const x = useSpring(0, { stiffness: 300, damping: 30 })
|
|
251
|
+
const y = useSpring(0, { stiffness: 300, damping: 30 })
|
|
252
|
+
|
|
253
|
+
const contentElement = (
|
|
254
|
+
<PopoverPrimitive.Content
|
|
255
|
+
ref={ref}
|
|
256
|
+
align={align}
|
|
257
|
+
sideOffset={sideOffset}
|
|
258
|
+
onEscapeKeyDown={(e) => {
|
|
259
|
+
if (!closeOnEscape || isPinned) {
|
|
260
|
+
e.preventDefault()
|
|
261
|
+
}
|
|
262
|
+
}}
|
|
263
|
+
onPointerDownOutside={(e) => {
|
|
264
|
+
if (!closeOnClickOutside || isPinned) {
|
|
265
|
+
e.preventDefault()
|
|
266
|
+
}
|
|
267
|
+
}}
|
|
268
|
+
className={cn(
|
|
269
|
+
popoverContentVariants({ variant, size, overlayBlur }),
|
|
270
|
+
glowEffect && "shadow-[0_0_30px_rgba(59,130,246,0.3)]",
|
|
271
|
+
resizable && "resize overflow-auto",
|
|
272
|
+
isDragging && "cursor-grabbing",
|
|
273
|
+
className
|
|
274
|
+
)}
|
|
275
|
+
{...props}
|
|
276
|
+
>
|
|
277
|
+
{pinnable && (
|
|
278
|
+
<button
|
|
279
|
+
onClick={() => setIsPinned(!isPinned)}
|
|
280
|
+
className="absolute top-2 right-2 p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800"
|
|
281
|
+
aria-label={isPinned ? "Unpin popover" : "Pin popover"}
|
|
282
|
+
>
|
|
283
|
+
<svg
|
|
284
|
+
width="16"
|
|
285
|
+
height="16"
|
|
286
|
+
viewBox="0 0 24 24"
|
|
287
|
+
fill="none"
|
|
288
|
+
stroke="currentColor"
|
|
289
|
+
strokeWidth="2"
|
|
290
|
+
className={cn(
|
|
291
|
+
"transition-transform",
|
|
292
|
+
isPinned && "rotate-45"
|
|
293
|
+
)}
|
|
294
|
+
>
|
|
295
|
+
<path d="M12 17v5M9 10V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v6M9 10l-2 2v3h10v-3l-2-2" />
|
|
296
|
+
</svg>
|
|
297
|
+
</button>
|
|
298
|
+
)}
|
|
299
|
+
|
|
300
|
+
{showArrow && (
|
|
301
|
+
<PopoverPrimitive.Arrow
|
|
302
|
+
width={arrowSize * 2}
|
|
303
|
+
height={arrowSize}
|
|
304
|
+
className={cn(
|
|
305
|
+
"fill-current",
|
|
306
|
+
variant === "glass" && "text-white/80 dark:text-gray-900/80",
|
|
307
|
+
variant === "gradient" && "text-white dark:text-gray-900",
|
|
308
|
+
variant === "default" && "text-popover"
|
|
309
|
+
)}
|
|
310
|
+
/>
|
|
311
|
+
)}
|
|
312
|
+
|
|
313
|
+
<div
|
|
314
|
+
className={cn(
|
|
315
|
+
staggerChildren && "space-y-2",
|
|
316
|
+
dragToDismiss && "select-none"
|
|
317
|
+
)}
|
|
318
|
+
>
|
|
319
|
+
{children}
|
|
320
|
+
</div>
|
|
321
|
+
</PopoverPrimitive.Content>
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
if (enableSpringPhysics || magneticEdges) {
|
|
325
|
+
return (
|
|
326
|
+
<AnimatePresence mode="wait">
|
|
327
|
+
<motion.div
|
|
328
|
+
{...(animationVariant as any)}
|
|
329
|
+
style={magneticEdges ? { x, y } : undefined}
|
|
330
|
+
drag={dragToDismiss}
|
|
331
|
+
dragElastic={0.2}
|
|
332
|
+
dragConstraints={{ left: -50, right: 50, top: -50, bottom: 50 }}
|
|
333
|
+
onDragStart={() => setIsDragging(true)}
|
|
334
|
+
onDragEnd={() => setIsDragging(false)}
|
|
335
|
+
>
|
|
336
|
+
{contentElement}
|
|
337
|
+
</motion.div>
|
|
338
|
+
</AnimatePresence>
|
|
339
|
+
)
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return contentElement
|
|
343
|
+
}
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
PopoverContentPro.displayName = PopoverPrimitive.Content.displayName
|
|
347
|
+
|
|
348
|
+
// Additional Pro components
|
|
349
|
+
const PopoverHeaderPro = React.forwardRef<
|
|
350
|
+
HTMLDivElement,
|
|
351
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
352
|
+
>(({ className, ...props }, ref) => (
|
|
353
|
+
<div
|
|
354
|
+
ref={ref}
|
|
355
|
+
className={cn("mb-4 space-y-1", className)}
|
|
356
|
+
{...props}
|
|
357
|
+
/>
|
|
358
|
+
))
|
|
359
|
+
PopoverHeaderPro.displayName = "PopoverHeaderPro"
|
|
360
|
+
|
|
361
|
+
const PopoverTitlePro = React.forwardRef<
|
|
362
|
+
HTMLHeadingElement,
|
|
363
|
+
React.HTMLAttributes<HTMLHeadingElement>
|
|
364
|
+
>(({ className, ...props }, ref) => (
|
|
365
|
+
<h3
|
|
366
|
+
ref={ref}
|
|
367
|
+
className={cn("font-semibold text-lg leading-none tracking-tight", className)}
|
|
368
|
+
{...props}
|
|
369
|
+
/>
|
|
370
|
+
))
|
|
371
|
+
PopoverTitlePro.displayName = "PopoverTitlePro"
|
|
372
|
+
|
|
373
|
+
const PopoverDescriptionPro = React.forwardRef<
|
|
374
|
+
HTMLParagraphElement,
|
|
375
|
+
React.HTMLAttributes<HTMLParagraphElement>
|
|
376
|
+
>(({ className, ...props }, ref) => (
|
|
377
|
+
<p
|
|
378
|
+
ref={ref}
|
|
379
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
380
|
+
{...props}
|
|
381
|
+
/>
|
|
382
|
+
))
|
|
383
|
+
PopoverDescriptionPro.displayName = "PopoverDescriptionPro"
|
|
384
|
+
|
|
385
|
+
const PopoverFooterPro = React.forwardRef<
|
|
386
|
+
HTMLDivElement,
|
|
387
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
388
|
+
>(({ className, ...props }, ref) => (
|
|
389
|
+
<div
|
|
390
|
+
ref={ref}
|
|
391
|
+
className={cn(
|
|
392
|
+
"mt-4 flex items-center justify-end space-x-2 pt-4 border-t",
|
|
393
|
+
className
|
|
394
|
+
)}
|
|
395
|
+
{...props}
|
|
396
|
+
/>
|
|
397
|
+
))
|
|
398
|
+
PopoverFooterPro.displayName = "PopoverFooterPro"
|
|
399
|
+
|
|
400
|
+
const PopoverSeparatorPro = React.forwardRef<
|
|
401
|
+
HTMLHRElement,
|
|
402
|
+
React.HTMLAttributes<HTMLHRElement>
|
|
403
|
+
>(({ className, ...props }, ref) => (
|
|
404
|
+
<hr
|
|
405
|
+
ref={ref}
|
|
406
|
+
className={cn("my-4 border-t", className)}
|
|
407
|
+
{...props}
|
|
408
|
+
/>
|
|
409
|
+
))
|
|
410
|
+
PopoverSeparatorPro.displayName = "PopoverSeparatorPro"
|
|
411
|
+
|
|
412
|
+
export {
|
|
413
|
+
PopoverPro,
|
|
414
|
+
PopoverTriggerPro,
|
|
415
|
+
PopoverContentPro,
|
|
416
|
+
PopoverAnchorPro,
|
|
417
|
+
PopoverPortalPro,
|
|
418
|
+
PopoverHeaderPro,
|
|
419
|
+
PopoverTitlePro,
|
|
420
|
+
PopoverDescriptionPro,
|
|
421
|
+
PopoverFooterPro,
|
|
422
|
+
PopoverSeparatorPro,
|
|
423
|
+
popoverContentVariants
|
|
424
|
+
}
|
|
@@ -142,7 +142,7 @@ const PopoverClose = PopoverPrimitive.Close;
|
|
|
142
142
|
*/
|
|
143
143
|
const PopoverSeparator = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
144
144
|
<div
|
|
145
|
-
className={cn("my-2 h-px bg-border", className)}
|
|
145
|
+
className={cn("moonui-theme", "my-2 h-px bg-border", className)}
|
|
146
146
|
{...props}
|
|
147
147
|
/>
|
|
148
148
|
);
|
|
@@ -153,7 +153,7 @@ PopoverSeparator.displayName = "PopoverSeparator";
|
|
|
153
153
|
*/
|
|
154
154
|
const PopoverHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
155
155
|
<div
|
|
156
|
-
className={cn("-mx-4 -mt-4 mb-3 px-4 pt-4 pb-3 border-b border-border", className)}
|
|
156
|
+
className={cn("moonui-theme", "-mx-4 -mt-4 mb-3 px-4 pt-4 pb-3 border-b border-border", className)}
|
|
157
157
|
{...props}
|
|
158
158
|
/>
|
|
159
159
|
);
|
|
@@ -164,7 +164,7 @@ PopoverHeader.displayName = "PopoverHeader";
|
|
|
164
164
|
*/
|
|
165
165
|
const PopoverFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
166
166
|
<div
|
|
167
|
-
className={cn("-mx-4 -mb-4 mt-3 px-4 pt-3 pb-4 border-t border-border", className)}
|
|
167
|
+
className={cn("moonui-theme", "-mx-4 -mb-4 mt-3 px-4 pt-3 pb-4 border-t border-border", className)}
|
|
168
168
|
{...props}
|
|
169
169
|
/>
|
|
170
170
|
);
|
|
@@ -155,7 +155,7 @@ const Progress = React.forwardRef<
|
|
|
155
155
|
)}
|
|
156
156
|
<div
|
|
157
157
|
ref={ref}
|
|
158
|
-
className={cn(progressVariants({ variant, size, radius, animation }), className)}
|
|
158
|
+
className={cn("moonui-theme", progressVariants({ variant, size, radius, animation }), className)}
|
|
159
159
|
role="progressbar"
|
|
160
160
|
aria-valuemin={0}
|
|
161
161
|
aria-valuemax={max}
|
|
@@ -69,7 +69,7 @@ const RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>(
|
|
|
69
69
|
<div
|
|
70
70
|
ref={ref}
|
|
71
71
|
role="radiogroup"
|
|
72
|
-
className={cn("grid gap-2", className)}
|
|
72
|
+
className={cn("moonui-theme", "grid gap-2", className)}
|
|
73
73
|
{...props}
|
|
74
74
|
/>
|
|
75
75
|
</RadioGroupContext.Provider>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
|
|
8
|
+
const ScrollArea = React.forwardRef<
|
|
9
|
+
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
|
10
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
|
|
11
|
+
>(({ className, children, ...props }, ref) => (
|
|
12
|
+
<ScrollAreaPrimitive.Root
|
|
13
|
+
ref={ref}
|
|
14
|
+
className={cn("relative overflow-hidden", className)}
|
|
15
|
+
{...props}
|
|
16
|
+
>
|
|
17
|
+
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
|
|
18
|
+
{children}
|
|
19
|
+
</ScrollAreaPrimitive.Viewport>
|
|
20
|
+
<ScrollBar />
|
|
21
|
+
<ScrollAreaPrimitive.Corner />
|
|
22
|
+
</ScrollAreaPrimitive.Root>
|
|
23
|
+
))
|
|
24
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
|
|
25
|
+
|
|
26
|
+
const ScrollBar = React.forwardRef<
|
|
27
|
+
React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
|
|
28
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
29
|
+
>(({ className, orientation = "vertical", ...props }, ref) => (
|
|
30
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
31
|
+
ref={ref}
|
|
32
|
+
orientation={orientation}
|
|
33
|
+
className={cn(
|
|
34
|
+
"flex touch-none select-none transition-colors",
|
|
35
|
+
orientation === "vertical" &&
|
|
36
|
+
"h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
37
|
+
orientation === "horizontal" &&
|
|
38
|
+
"h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
|
|
44
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
45
|
+
))
|
|
46
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
|
|
47
|
+
|
|
48
|
+
export { ScrollArea, ScrollBar }
|
|
@@ -143,10 +143,14 @@ SelectScrollDownButton.displayName =
|
|
|
143
143
|
const SelectContent = React.forwardRef<
|
|
144
144
|
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
145
145
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
146
|
-
>(({ className, children, position = "
|
|
146
|
+
>(({ className, children, position = "popper", side = "bottom", sideOffset = 4, align = "start", ...props }, ref) => (
|
|
147
147
|
<SelectPrimitive.Portal>
|
|
148
148
|
<SelectPrimitive.Content
|
|
149
149
|
ref={ref}
|
|
150
|
+
side={side}
|
|
151
|
+
sideOffset={sideOffset}
|
|
152
|
+
align={align}
|
|
153
|
+
avoidCollisions={false}
|
|
150
154
|
className={cn(
|
|
151
155
|
["relative z-50 max-h-96 min-w-[8rem] overflow-hidden",
|
|
152
156
|
"rounded-md border border-gray-200 dark:border-gray-700",
|
|
@@ -185,7 +189,7 @@ const SelectLabel = React.forwardRef<
|
|
|
185
189
|
>(({ className, ...props }, ref) => (
|
|
186
190
|
<SelectPrimitive.Label
|
|
187
191
|
ref={ref}
|
|
188
|
-
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
|
|
192
|
+
className={cn("moonui-theme", "py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
|
|
189
193
|
{...props}
|
|
190
194
|
/>
|
|
191
195
|
))
|
|
@@ -253,7 +257,7 @@ const SelectSeparator = React.forwardRef<
|
|
|
253
257
|
>(({ className, ...props }, ref) => (
|
|
254
258
|
<SelectPrimitive.Separator
|
|
255
259
|
ref={ref}
|
|
256
|
-
className={cn("-mx-1 my-1 h-px bg-muted dark:bg-gray-700", className)}
|
|
260
|
+
className={cn("moonui-theme", "-mx-1 my-1 h-px bg-muted dark:bg-gray-700", className)}
|
|
257
261
|
{...props}
|
|
258
262
|
/>
|
|
259
263
|
))
|
|
@@ -105,7 +105,7 @@ const separatorVariants = cva(
|
|
|
105
105
|
)
|
|
106
106
|
|
|
107
107
|
export interface SeparatorProps
|
|
108
|
-
extends React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>,
|
|
108
|
+
extends Omit<React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>, keyof VariantProps<typeof separatorVariants>>,
|
|
109
109
|
VariantProps<typeof separatorVariants> {}
|
|
110
110
|
|
|
111
111
|
const Separator = React.forwardRef<
|
|
@@ -126,7 +126,7 @@ const Separator = React.forwardRef<
|
|
|
126
126
|
<SeparatorPrimitive.Root
|
|
127
127
|
ref={ref}
|
|
128
128
|
decorative={decorative}
|
|
129
|
-
orientation={orientation}
|
|
129
|
+
orientation={orientation || undefined}
|
|
130
130
|
className={cn(
|
|
131
131
|
separatorVariants({ orientation, variant, size }),
|
|
132
132
|
className
|
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
5
|
import { cn } from "../../lib/utils";
|
|
6
6
|
import { motion } from "framer-motion";
|
|
7
|
-
import { skeletonAnimation } from "
|
|
7
|
+
import { skeletonAnimation } from "../../lib/micro-interactions";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Skeleton Component
|
|
@@ -93,6 +93,17 @@ export const Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(
|
|
|
93
93
|
style,
|
|
94
94
|
...props
|
|
95
95
|
}, ref) => {
|
|
96
|
+
// Filter out HTML event handlers that conflict with Framer Motion
|
|
97
|
+
const {
|
|
98
|
+
onDrag,
|
|
99
|
+
onDragEnd,
|
|
100
|
+
onDragStart,
|
|
101
|
+
onAnimationStart,
|
|
102
|
+
onAnimationEnd,
|
|
103
|
+
onAnimationIteration,
|
|
104
|
+
...filteredProps
|
|
105
|
+
} = props;
|
|
106
|
+
|
|
96
107
|
// Show content when loaded
|
|
97
108
|
if (isLoaded && children) {
|
|
98
109
|
if (useMotion) {
|
|
@@ -102,13 +113,13 @@ export const Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(
|
|
|
102
113
|
initial={{ opacity: 0 }}
|
|
103
114
|
animate={{ opacity: 1 }}
|
|
104
115
|
transition={{ duration: fadeInDuration / 1000 }}
|
|
105
|
-
className={className}
|
|
116
|
+
className={cn("moonui-theme", className)}
|
|
106
117
|
style={{
|
|
107
118
|
height,
|
|
108
119
|
width,
|
|
109
120
|
...style,
|
|
110
121
|
}}
|
|
111
|
-
{...
|
|
122
|
+
{...filteredProps}
|
|
112
123
|
>
|
|
113
124
|
{children}
|
|
114
125
|
</motion.div>
|
|
@@ -118,7 +129,7 @@ export const Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(
|
|
|
118
129
|
return (
|
|
119
130
|
<div
|
|
120
131
|
ref={ref}
|
|
121
|
-
className={cn("animate-fade-in", className)}
|
|
132
|
+
className={cn("moonui-theme", "animate-fade-in", className)}
|
|
122
133
|
style={{
|
|
123
134
|
animationDuration: `${fadeInDuration}ms`,
|
|
124
135
|
height,
|
|
@@ -138,6 +149,7 @@ export const Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(
|
|
|
138
149
|
<SkeletonElement
|
|
139
150
|
ref={ref}
|
|
140
151
|
className={cn(
|
|
152
|
+
"moonui-theme",
|
|
141
153
|
skeletonVariants({ variant, size, shape, animation }),
|
|
142
154
|
"relative isolate",
|
|
143
155
|
className
|
|
@@ -148,7 +160,7 @@ export const Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(
|
|
|
148
160
|
...style,
|
|
149
161
|
}}
|
|
150
162
|
{...(useMotion ? skeletonAnimation : {})}
|
|
151
|
-
{...
|
|
163
|
+
{...filteredProps}
|
|
152
164
|
/>
|
|
153
165
|
);
|
|
154
166
|
}
|
|
@@ -198,7 +210,7 @@ export const SkeletonText = React.forwardRef<HTMLDivElement, SkeletonTextProps>(
|
|
|
198
210
|
return (
|
|
199
211
|
<div
|
|
200
212
|
ref={ref}
|
|
201
|
-
className={cn("flex flex-col", className)}
|
|
213
|
+
className={cn("moonui-theme", "flex flex-col", className)}
|
|
202
214
|
style={{ gap: spacing }}
|
|
203
215
|
{...props}
|
|
204
216
|
>
|
|
@@ -254,7 +266,7 @@ export const SkeletonAvatar = React.forwardRef<HTMLDivElement, SkeletonAvatarPro
|
|
|
254
266
|
variant={variant}
|
|
255
267
|
animation={animation}
|
|
256
268
|
shape="circle"
|
|
257
|
-
className={cn("shrink-0", className)}
|
|
269
|
+
className={cn("moonui-theme", "shrink-0", className)}
|
|
258
270
|
style={{
|
|
259
271
|
height: size,
|
|
260
272
|
width: size,
|
|
@@ -296,7 +296,7 @@ const Slider = React.forwardRef<
|
|
|
296
296
|
)}
|
|
297
297
|
|
|
298
298
|
<div
|
|
299
|
-
className={cn(sliderVariants({ size }), className)}
|
|
299
|
+
className={cn("moonui-theme", sliderVariants({ size }), className)}
|
|
300
300
|
data-disabled={disabled ? true : undefined}
|
|
301
301
|
>
|
|
302
302
|
{/* Track */}
|
|
@@ -27,7 +27,7 @@ const Switch = React.forwardRef<
|
|
|
27
27
|
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
28
28
|
SwitchProps
|
|
29
29
|
>(({ className, size = "md", variant = "primary", loading, leftIcon, rightIcon, description, ...props }, ref) => (
|
|
30
|
-
<div className="inline-flex items-center gap-2">
|
|
30
|
+
<div className="moonui-theme inline-flex items-center gap-2">
|
|
31
31
|
{leftIcon && <span className="text-muted-foreground">{leftIcon}</span>}
|
|
32
32
|
<SwitchPrimitives.Root
|
|
33
33
|
className={cn(
|