@moontra/moonui-pro 2.19.0 → 2.20.0
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.ts +3251 -0
- package/dist/index.mjs +2410 -1545
- package/package.json +137 -136
- package/src/__tests__/use-local-storage.test.tsx +2 -2
- package/src/components/advanced-chart/index.tsx +6 -6
- package/src/components/calendar/event-dialog.tsx +1 -1
- package/src/components/calendar/index.tsx +1 -1
- package/src/components/calendar-pro/index.tsx +2 -4
- package/src/components/dashboard/demo.tsx +2 -2
- package/src/components/dashboard/widgets/activity-feed.tsx +1 -1
- package/src/components/dashboard/widgets/metric-card.tsx +1 -1
- package/src/components/enhanced/button.tsx +13 -13
- package/src/components/file-upload/file-upload.test.tsx +20 -19
- package/src/components/form-wizard/form-wizard-progress.tsx +7 -7
- package/src/components/gesture-drawer/index.tsx +551 -0
- package/src/components/github-stars/hooks.ts +1 -1
- package/src/components/github-stars/index.tsx +1 -1
- package/src/components/github-stars/types.ts +1 -0
- package/src/components/health-check/index.tsx +2 -2
- package/src/components/hover-card-3d/index.tsx +437 -74
- package/src/components/index.ts +10 -1
- package/src/components/lazy-component/index.tsx +4 -2
- package/src/components/license-error/index.tsx +29 -0
- package/src/components/memory-efficient-data/index.tsx +1 -1
- package/src/components/pinch-zoom/index.tsx +438 -42
- package/src/components/rich-text-editor/index.tsx +12 -12
- package/src/components/timeline/index.tsx +2 -2
- package/src/components/ui/aspect-ratio.tsx +186 -22
- package/src/components/ui/button.tsx +47 -50
- package/src/components/ui/card.tsx +98 -30
- package/src/components/ui/gesture-drawer.tsx +11 -0
- package/src/components/ui/index.ts +17 -5
- package/src/components/ui/lightbox.tsx +606 -0
- package/src/components/ui/media-gallery.tsx +612 -0
- package/src/components/ui/select.tsx +134 -35
- package/src/components/ui/toggle.tsx +78 -15
- package/src/components/virtual-list/index.tsx +7 -7
- package/src/index.ts +4 -4
- package/src/lib/component-metadata.ts +18 -0
- package/src/lib/paddle.ts +17 -0
- package/src/patterns/login-form/index.tsx +1 -1
- package/src/patterns/login-form/types.ts +6 -6
- package/src/styles/index.css +14 -4
- package/src/types/next-auth.d.ts +21 -0
- package/src/use-local-storage.tsx +3 -3
- package/src/use-scroll-animation.ts +3 -5
- package/src/components/ui/hover-card-3d.tsx +0 -472
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { render, screen, fireEvent, waitFor } from '@testing-library/react'
|
|
2
2
|
import '@testing-library/jest-dom'
|
|
3
|
-
import
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import MoonUIFileUploadPro from './index'
|
|
4
5
|
|
|
5
6
|
// Mock FileReader
|
|
6
7
|
const mockFileReader = {
|
|
@@ -19,13 +20,13 @@ const createMockFile = (name: string, size: number, type: string) => {
|
|
|
19
20
|
return file
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
describe('
|
|
23
|
+
describe('MoonUIFileUploadPro', () => {
|
|
23
24
|
beforeEach(() => {
|
|
24
25
|
jest.clearAllMocks()
|
|
25
26
|
})
|
|
26
27
|
|
|
27
28
|
it('renders without crashing', () => {
|
|
28
|
-
render(<
|
|
29
|
+
render(<MoonUIFileUploadPro />)
|
|
29
30
|
|
|
30
31
|
expect(screen.getByText('File Upload')).toBeInTheDocument()
|
|
31
32
|
expect(screen.getByText('Drag and drop files here, or click to select')).toBeInTheDocument()
|
|
@@ -33,7 +34,7 @@ describe('FileUpload', () => {
|
|
|
33
34
|
|
|
34
35
|
it('renders with custom title and description', () => {
|
|
35
36
|
render(
|
|
36
|
-
<
|
|
37
|
+
<MoonUIFileUploadPro
|
|
37
38
|
accept="image/*"
|
|
38
39
|
maxSize={5}
|
|
39
40
|
multiple
|
|
@@ -46,7 +47,7 @@ describe('FileUpload', () => {
|
|
|
46
47
|
|
|
47
48
|
it('handles file selection', async () => {
|
|
48
49
|
const mockOnUpload = jest.fn()
|
|
49
|
-
render(<
|
|
50
|
+
render(<MoonUIFileUploadPro onUpload={mockOnUpload} />)
|
|
50
51
|
|
|
51
52
|
const file = createMockFile('test.jpg', 1024, 'image/jpeg')
|
|
52
53
|
const input = screen.getByRole('button', { hidden: true }) // Hidden file input
|
|
@@ -60,7 +61,7 @@ describe('FileUpload', () => {
|
|
|
60
61
|
|
|
61
62
|
it('validates file size', () => {
|
|
62
63
|
const mockOnUpload = jest.fn()
|
|
63
|
-
render(<
|
|
64
|
+
render(<MoonUIFileUploadPro onUpload={mockOnUpload} maxSize={1} />)
|
|
64
65
|
|
|
65
66
|
const file = createMockFile('large-file.jpg', 2 * 1024 * 1024, 'image/jpeg') // 2MB
|
|
66
67
|
const input = screen.getByRole('button', { hidden: true })
|
|
@@ -77,9 +78,9 @@ describe('FileUpload', () => {
|
|
|
77
78
|
it('validates file type', () => {
|
|
78
79
|
const mockOnUpload = jest.fn()
|
|
79
80
|
render(
|
|
80
|
-
<
|
|
81
|
+
<MoonUIFileUploadPro
|
|
81
82
|
onUpload={mockOnUpload}
|
|
82
|
-
|
|
83
|
+
allowedMimeTypes={['image/jpeg', 'image/png']}
|
|
83
84
|
/>
|
|
84
85
|
)
|
|
85
86
|
|
|
@@ -96,7 +97,7 @@ describe('FileUpload', () => {
|
|
|
96
97
|
|
|
97
98
|
it('handles multiple files', async () => {
|
|
98
99
|
const mockOnUpload = jest.fn()
|
|
99
|
-
render(<
|
|
100
|
+
render(<MoonUIFileUploadPro onUpload={mockOnUpload} multiple />)
|
|
100
101
|
|
|
101
102
|
const files = [
|
|
102
103
|
createMockFile('file1.jpg', 1024, 'image/jpeg'),
|
|
@@ -113,7 +114,7 @@ describe('FileUpload', () => {
|
|
|
113
114
|
|
|
114
115
|
it('respects maxFiles limit', () => {
|
|
115
116
|
const mockOnUpload = jest.fn()
|
|
116
|
-
render(<
|
|
117
|
+
render(<MoonUIFileUploadPro onUpload={mockOnUpload} maxFiles={2} />)
|
|
117
118
|
|
|
118
119
|
const files = [
|
|
119
120
|
createMockFile('file1.jpg', 1024, 'image/jpeg'),
|
|
@@ -132,7 +133,7 @@ describe('FileUpload', () => {
|
|
|
132
133
|
|
|
133
134
|
it('handles drag and drop', () => {
|
|
134
135
|
const mockOnUpload = jest.fn()
|
|
135
|
-
render(<
|
|
136
|
+
render(<MoonUIFileUploadPro onUpload={mockOnUpload} />)
|
|
136
137
|
|
|
137
138
|
const dropZone = screen.getByText('Drag and drop files here, or click to select').closest('div')
|
|
138
139
|
const file = createMockFile('test.jpg', 1024, 'image/jpeg')
|
|
@@ -152,7 +153,7 @@ describe('FileUpload', () => {
|
|
|
152
153
|
|
|
153
154
|
it('handles file removal', async () => {
|
|
154
155
|
const mockOnRemove = jest.fn()
|
|
155
|
-
render(<
|
|
156
|
+
render(<MoonUIFileUploadPro onRemove={mockOnRemove} />)
|
|
156
157
|
|
|
157
158
|
const file = createMockFile('test.jpg', 1024, 'image/jpeg')
|
|
158
159
|
const input = screen.getByRole('button', { hidden: true })
|
|
@@ -171,7 +172,7 @@ describe('FileUpload', () => {
|
|
|
171
172
|
|
|
172
173
|
it('shows progress during upload', async () => {
|
|
173
174
|
const mockOnUpload = jest.fn().mockResolvedValue(undefined)
|
|
174
|
-
render(<
|
|
175
|
+
render(<MoonUIFileUploadPro onUpload={mockOnUpload} />)
|
|
175
176
|
|
|
176
177
|
const file = createMockFile('test.jpg', 1024, 'image/jpeg')
|
|
177
178
|
const input = screen.getByRole('button', { hidden: true })
|
|
@@ -185,7 +186,7 @@ describe('FileUpload', () => {
|
|
|
185
186
|
|
|
186
187
|
it('handles upload success', async () => {
|
|
187
188
|
const mockOnUpload = jest.fn().mockResolvedValue(undefined)
|
|
188
|
-
render(<
|
|
189
|
+
render(<MoonUIFileUploadPro onUpload={mockOnUpload} />)
|
|
189
190
|
|
|
190
191
|
const file = createMockFile('test.jpg', 1024, 'image/jpeg')
|
|
191
192
|
const input = screen.getByRole('button', { hidden: true })
|
|
@@ -199,7 +200,7 @@ describe('FileUpload', () => {
|
|
|
199
200
|
|
|
200
201
|
it('handles upload error', async () => {
|
|
201
202
|
const mockOnUpload = jest.fn().mockRejectedValue(new Error('Upload failed'))
|
|
202
|
-
render(<
|
|
203
|
+
render(<MoonUIFileUploadPro onUpload={mockOnUpload} />)
|
|
203
204
|
|
|
204
205
|
const file = createMockFile('test.jpg', 1024, 'image/jpeg')
|
|
205
206
|
const input = screen.getByRole('button', { hidden: true })
|
|
@@ -213,28 +214,28 @@ describe('FileUpload', () => {
|
|
|
213
214
|
})
|
|
214
215
|
|
|
215
216
|
it('is disabled when disabled prop is true', () => {
|
|
216
|
-
render(<
|
|
217
|
+
render(<MoonUIFileUploadPro disabled />)
|
|
217
218
|
|
|
218
219
|
const dropZone = screen.getByText('Drag and drop files here, or click to select').closest('div')
|
|
219
220
|
expect(dropZone).toHaveClass('cursor-not-allowed')
|
|
220
221
|
})
|
|
221
222
|
|
|
222
223
|
it('applies custom className', () => {
|
|
223
|
-
render(<
|
|
224
|
+
render(<MoonUIFileUploadPro className="custom-upload" />)
|
|
224
225
|
|
|
225
226
|
const container = screen.getByText('File Upload').closest('div')
|
|
226
227
|
expect(container).toHaveClass('custom-upload')
|
|
227
228
|
})
|
|
228
229
|
|
|
229
230
|
it('formats file sizes correctly', () => {
|
|
230
|
-
render(<
|
|
231
|
+
render(<MoonUIFileUploadPro />)
|
|
231
232
|
|
|
232
233
|
// This would be tested through the file display after upload
|
|
233
234
|
// The formatFileSize function should be tested separately
|
|
234
235
|
})
|
|
235
236
|
|
|
236
237
|
it('displays correct file icons', () => {
|
|
237
|
-
render(<
|
|
238
|
+
render(<MoonUIFileUploadPro />)
|
|
238
239
|
|
|
239
240
|
// This would be tested through the file display after upload
|
|
240
241
|
// The getFileIcon function should be tested separately
|
|
@@ -85,7 +85,7 @@ export const FormWizardProgress: React.FC<FormWizardProgressProps> = ({
|
|
|
85
85
|
marginLeft: '24px'
|
|
86
86
|
}}
|
|
87
87
|
>
|
|
88
|
-
<div className="h-full bg-
|
|
88
|
+
<div className="h-full bg-border" />
|
|
89
89
|
{index < currentStep && (
|
|
90
90
|
<motion.div
|
|
91
91
|
className="absolute inset-0 bg-primary"
|
|
@@ -108,8 +108,8 @@ export const FormWizardProgress: React.FC<FormWizardProgressProps> = ({
|
|
|
108
108
|
"w-12 h-12 border-2",
|
|
109
109
|
isActive && "border-primary bg-primary text-primary-foreground shadow-lg shadow-primary/20",
|
|
110
110
|
isCompleted && !isActive && "border-primary bg-primary text-primary-foreground",
|
|
111
|
-
!isActive && !isCompleted && isAccessible && "border-
|
|
112
|
-
!isAccessible && "border-
|
|
111
|
+
!isActive && !isCompleted && isAccessible && "border-border bg-background text-muted-foreground hover:border-accent",
|
|
112
|
+
!isAccessible && "border-border/50 bg-muted text-muted-foreground/50 cursor-not-allowed",
|
|
113
113
|
hasError && "border-destructive bg-destructive text-destructive-foreground"
|
|
114
114
|
)}
|
|
115
115
|
>
|
|
@@ -146,7 +146,7 @@ export const FormWizardProgress: React.FC<FormWizardProgressProps> = ({
|
|
|
146
146
|
{/* Vertical Progress Line */}
|
|
147
147
|
{steps.length > 1 && (
|
|
148
148
|
<>
|
|
149
|
-
<div className="absolute left-6 top-8 bottom-8 w-[2px] bg-
|
|
149
|
+
<div className="absolute left-6 top-8 bottom-8 w-[2px] bg-border" />
|
|
150
150
|
<motion.div
|
|
151
151
|
className="absolute left-6 top-8 w-[2px] bg-primary"
|
|
152
152
|
initial={{ height: 0 }}
|
|
@@ -179,8 +179,8 @@ export const FormWizardProgress: React.FC<FormWizardProgressProps> = ({
|
|
|
179
179
|
"w-12 h-12",
|
|
180
180
|
isActive && "border-primary bg-primary text-primary-foreground shadow-lg",
|
|
181
181
|
isCompleted && !isActive && "border-primary bg-primary text-primary-foreground",
|
|
182
|
-
!isActive && !isCompleted && isAccessible && "border-
|
|
183
|
-
!isAccessible && "border-
|
|
182
|
+
!isActive && !isCompleted && isAccessible && "border-border bg-background text-muted-foreground hover:border-accent",
|
|
183
|
+
!isAccessible && "border-border/50 bg-muted text-muted-foreground/50 cursor-not-allowed",
|
|
184
184
|
hasError && "border-destructive bg-destructive text-destructive-foreground"
|
|
185
185
|
)}
|
|
186
186
|
>
|
|
@@ -268,7 +268,7 @@ export const FormWizardProgress: React.FC<FormWizardProgressProps> = ({
|
|
|
268
268
|
fill="none"
|
|
269
269
|
stroke="currentColor"
|
|
270
270
|
strokeWidth="8"
|
|
271
|
-
className="text-
|
|
271
|
+
className="text-border"
|
|
272
272
|
/>
|
|
273
273
|
<motion.circle
|
|
274
274
|
cx="72"
|