@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.
- package/dist/index.d.ts +691 -261
- package/dist/index.mjs +7418 -4934
- package/package.json +11 -5
- package/plugin/index.d.ts +86 -0
- package/plugin/index.js +308 -0
- package/scripts/postbuild.js +27 -0
- package/scripts/postinstall.js +176 -23
- package/src/__tests__/use-intersection-observer.test.tsx +0 -216
- package/src/__tests__/use-local-storage.test.tsx +0 -174
- package/src/__tests__/use-pro-access.test.tsx +0 -183
- package/src/components/advanced-chart/advanced-chart.test.tsx +0 -281
- package/src/components/advanced-chart/index.tsx +0 -1242
- package/src/components/advanced-forms/index.tsx +0 -426
- package/src/components/animated-button/index.tsx +0 -385
- package/src/components/calendar/event-dialog.tsx +0 -372
- package/src/components/calendar/index.tsx +0 -1073
- package/src/components/calendar-pro/index.tsx +0 -1697
- package/src/components/color-picker/index.tsx +0 -432
- package/src/components/credit-card-input/index.tsx +0 -406
- package/src/components/dashboard/dashboard-grid.tsx +0 -462
- package/src/components/dashboard/demo.tsx +0 -425
- package/src/components/dashboard/index.tsx +0 -1046
- package/src/components/dashboard/time-range-picker.tsx +0 -336
- package/src/components/dashboard/types.ts +0 -222
- package/src/components/dashboard/widgets/activity-feed.tsx +0 -344
- package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
- package/src/components/dashboard/widgets/metric-card.tsx +0 -343
- package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
- package/src/components/data-table/data-table-column-toggle.tsx +0 -169
- package/src/components/data-table/data-table-export.ts +0 -156
- package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
- package/src/components/data-table/data-table.test.tsx +0 -187
- package/src/components/data-table/index.tsx +0 -845
- package/src/components/draggable-list/index.tsx +0 -100
- package/src/components/enhanced/badge.tsx +0 -191
- package/src/components/enhanced/button.tsx +0 -362
- package/src/components/enhanced/card.tsx +0 -266
- package/src/components/enhanced/dialog.tsx +0 -246
- package/src/components/enhanced/index.ts +0 -4
- package/src/components/error-boundary/index.tsx +0 -109
- package/src/components/file-upload/file-upload.test.tsx +0 -243
- package/src/components/file-upload/index.tsx +0 -1660
- package/src/components/floating-action-button/index.tsx +0 -206
- package/src/components/form-wizard/form-wizard-context.tsx +0 -307
- package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
- package/src/components/form-wizard/form-wizard-progress.tsx +0 -298
- package/src/components/form-wizard/form-wizard-step.tsx +0 -111
- package/src/components/form-wizard/index.tsx +0 -102
- package/src/components/form-wizard/types.ts +0 -76
- package/src/components/gesture-drawer/index.tsx +0 -551
- package/src/components/github-stars/github-api.ts +0 -426
- package/src/components/github-stars/hooks.ts +0 -516
- package/src/components/github-stars/index.tsx +0 -375
- package/src/components/github-stars/types.ts +0 -148
- package/src/components/github-stars/variants.tsx +0 -513
- package/src/components/health-check/index.tsx +0 -439
- package/src/components/hover-card-3d/index.tsx +0 -530
- package/src/components/index.ts +0 -128
- package/src/components/internal/index.ts +0 -78
- package/src/components/kanban/add-card-modal.tsx +0 -502
- package/src/components/kanban/card-detail-modal.tsx +0 -761
- package/src/components/kanban/index.ts +0 -13
- package/src/components/kanban/kanban.tsx +0 -1684
- package/src/components/kanban/types.ts +0 -168
- package/src/components/lazy-component/index.tsx +0 -823
- package/src/components/license-error/index.tsx +0 -29
- package/src/components/magnetic-button/index.tsx +0 -167
- package/src/components/memory-efficient-data/index.tsx +0 -1016
- package/src/components/moonui-quiz-form/index.tsx +0 -817
- package/src/components/optimized-image/index.tsx +0 -425
- package/src/components/performance-debugger/index.tsx +0 -589
- package/src/components/performance-monitor/index.tsx +0 -794
- package/src/components/phone-number-input/index.tsx +0 -338
- package/src/components/pinch-zoom/index.tsx +0 -566
- package/src/components/quiz-form/index.tsx +0 -479
- package/src/components/rich-text-editor/index-old-backup.tsx +0 -437
- package/src/components/rich-text-editor/index.tsx +0 -2324
- package/src/components/rich-text-editor/slash-commands-extension.ts +0 -220
- package/src/components/rich-text-editor/slash-commands.css +0 -35
- package/src/components/rich-text-editor/table-styles.css +0 -65
- package/src/components/sidebar/index.tsx +0 -865
- package/src/components/spotlight-card/index.tsx +0 -191
- package/src/components/swipeable-card/index.tsx +0 -100
- package/src/components/timeline/index.tsx +0 -1148
- package/src/components/ui/accordion.tsx +0 -73
- package/src/components/ui/alert-dialog.tsx +0 -141
- package/src/components/ui/alert.tsx +0 -141
- package/src/components/ui/aspect-ratio.tsx +0 -245
- package/src/components/ui/avatar.tsx +0 -153
- package/src/components/ui/badge.tsx +0 -228
- package/src/components/ui/breadcrumb.tsx +0 -214
- package/src/components/ui/button.tsx +0 -222
- package/src/components/ui/calendar.tsx +0 -387
- package/src/components/ui/card.tsx +0 -214
- package/src/components/ui/checkbox.tsx +0 -259
- package/src/components/ui/collapsible.tsx +0 -135
- package/src/components/ui/color-picker.tsx +0 -97
- package/src/components/ui/command.tsx +0 -225
- package/src/components/ui/dialog.tsx +0 -334
- package/src/components/ui/dropdown-menu.tsx +0 -218
- package/src/components/ui/gesture-drawer.tsx +0 -11
- package/src/components/ui/hover-card.tsx +0 -29
- package/src/components/ui/index.ts +0 -190
- package/src/components/ui/input.tsx +0 -222
- package/src/components/ui/label.tsx +0 -29
- package/src/components/ui/lightbox.tsx +0 -606
- package/src/components/ui/magnetic-button.tsx +0 -129
- package/src/components/ui/media-gallery.tsx +0 -612
- package/src/components/ui/pagination.tsx +0 -123
- package/src/components/ui/popover.tsx +0 -185
- package/src/components/ui/progress.tsx +0 -30
- package/src/components/ui/radio-group.tsx +0 -257
- package/src/components/ui/scroll-area.tsx +0 -47
- package/src/components/ui/select.tsx +0 -374
- package/src/components/ui/separator.tsx +0 -145
- package/src/components/ui/sheet.tsx +0 -139
- package/src/components/ui/skeleton.tsx +0 -20
- package/src/components/ui/slider.tsx +0 -354
- package/src/components/ui/spotlight-card.tsx +0 -119
- package/src/components/ui/switch.tsx +0 -86
- package/src/components/ui/table.tsx +0 -329
- package/src/components/ui/tabs.tsx +0 -198
- package/src/components/ui/textarea.tsx +0 -28
- package/src/components/ui/toast.tsx +0 -317
- package/src/components/ui/toggle.tsx +0 -119
- package/src/components/ui/tooltip.tsx +0 -151
- package/src/components/virtual-list/index.tsx +0 -668
- package/src/hooks/use-chart.ts +0 -205
- package/src/hooks/use-data-table.ts +0 -182
- package/src/hooks/use-docs-pro-access.ts +0 -13
- package/src/hooks/use-license-check.ts +0 -65
- package/src/hooks/use-subscription.ts +0 -19
- package/src/hooks/use-toast.ts +0 -15
- package/src/index.ts +0 -14
- package/src/lib/ai-providers.ts +0 -377
- package/src/lib/component-metadata.ts +0 -18
- package/src/lib/micro-interactions.ts +0 -255
- package/src/lib/paddle.ts +0 -17
- package/src/lib/utils.ts +0 -6
- package/src/patterns/login-form/index.tsx +0 -276
- package/src/patterns/login-form/types.ts +0 -67
- package/src/setupTests.ts +0 -41
- package/src/styles/advanced-chart.css +0 -239
- package/src/styles/calendar.css +0 -35
- package/src/styles/design-system.css +0 -363
- package/src/styles/index.css +0 -85
- package/src/styles/tailwind.css +0 -7
- package/src/styles/tokens.css +0 -455
- package/src/types/moonui.d.ts +0 -22
- package/src/types/next-auth.d.ts +0 -21
- package/src/use-intersection-observer.tsx +0 -154
- package/src/use-local-storage.tsx +0 -71
- package/src/use-paddle.ts +0 -138
- package/src/use-performance-optimizer.ts +0 -389
- package/src/use-pro-access.ts +0 -141
- package/src/use-scroll-animation.ts +0 -219
- package/src/use-subscription.ts +0 -37
- package/src/use-toast.ts +0 -32
- package/src/utils/chart-helpers.ts +0 -357
- package/src/utils/cn.ts +0 -6
- package/src/utils/data-processing.ts +0 -151
- package/src/utils/license-validator.tsx +0 -183
|
@@ -1,462 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { motion, AnimatePresence } from 'framer-motion'
|
|
5
|
-
import { cn } from '../../lib/utils'
|
|
6
|
-
import { Widget } from './types'
|
|
7
|
-
import { MetricCard } from './widgets/metric-card'
|
|
8
|
-
import { ChartWidget } from './widgets/chart-widget'
|
|
9
|
-
import { ActivityFeed } from './widgets/activity-feed'
|
|
10
|
-
import { Responsive, WidthProvider, Layout, Layouts } from 'react-grid-layout'
|
|
11
|
-
const ResponsiveGridLayout = WidthProvider(Responsive)
|
|
12
|
-
import 'react-grid-layout/css/styles.css'
|
|
13
|
-
import 'react-resizable/css/styles.css'
|
|
14
|
-
import {
|
|
15
|
-
Grip,
|
|
16
|
-
X,
|
|
17
|
-
Maximize2,
|
|
18
|
-
Minimize2,
|
|
19
|
-
Lock,
|
|
20
|
-
Unlock,
|
|
21
|
-
Settings
|
|
22
|
-
} from 'lucide-react'
|
|
23
|
-
import { Button } from '../ui/button'
|
|
24
|
-
|
|
25
|
-
interface DashboardGridProps {
|
|
26
|
-
widgets: Widget[]
|
|
27
|
-
onLayoutChange?: (layout: Layout[]) => void
|
|
28
|
-
onWidgetRemove?: (widgetId: string) => void
|
|
29
|
-
onWidgetAction?: (widgetId: string, action: string, data?: any) => void
|
|
30
|
-
editMode?: boolean
|
|
31
|
-
className?: string
|
|
32
|
-
glassmorphism?: boolean
|
|
33
|
-
breakpoints?: { lg: number; md: number; sm: number; xs: number; xxs: number }
|
|
34
|
-
cols?: { lg: number; md: number; sm: number; xs: number; xxs: number }
|
|
35
|
-
rowHeight?: number
|
|
36
|
-
margin?: [number, number]
|
|
37
|
-
containerPadding?: [number, number]
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function DashboardGrid({
|
|
41
|
-
widgets,
|
|
42
|
-
onLayoutChange,
|
|
43
|
-
onWidgetRemove,
|
|
44
|
-
onWidgetAction,
|
|
45
|
-
editMode = false,
|
|
46
|
-
className,
|
|
47
|
-
glassmorphism = false,
|
|
48
|
-
breakpoints = { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 },
|
|
49
|
-
cols = { lg: 12, md: 8, sm: 4, xs: 2, xxs: 1 },
|
|
50
|
-
rowHeight = 80,
|
|
51
|
-
margin = [16, 24],
|
|
52
|
-
containerPadding = [0, 0]
|
|
53
|
-
}: DashboardGridProps) {
|
|
54
|
-
const [layouts, setLayouts] = React.useState<Layouts>({})
|
|
55
|
-
const [currentBreakpoint, setCurrentBreakpoint] = React.useState('lg')
|
|
56
|
-
const [lockedWidgets, setLockedWidgets] = React.useState<Set<string>>(new Set())
|
|
57
|
-
const [fullscreenWidget, setFullscreenWidget] = React.useState<string | null>(null)
|
|
58
|
-
const [containerWidth, setContainerWidth] = React.useState(1200)
|
|
59
|
-
const containerRef = React.useRef<HTMLDivElement>(null)
|
|
60
|
-
const [compactType, setCompactType] = React.useState<'vertical' | 'horizontal' | null>('vertical')
|
|
61
|
-
|
|
62
|
-
// Container genişliğini ölç ve breakpoint'i güncelle
|
|
63
|
-
React.useEffect(() => {
|
|
64
|
-
const updateWidth = () => {
|
|
65
|
-
if (containerRef.current) {
|
|
66
|
-
const width = containerRef.current.offsetWidth
|
|
67
|
-
setContainerWidth(width)
|
|
68
|
-
|
|
69
|
-
// Breakpoint'i manuel olarak belirle
|
|
70
|
-
if (width < 480) {
|
|
71
|
-
setCurrentBreakpoint('xxs')
|
|
72
|
-
} else if (width < 768) {
|
|
73
|
-
setCurrentBreakpoint('xs')
|
|
74
|
-
} else if (width < 996) {
|
|
75
|
-
setCurrentBreakpoint('sm')
|
|
76
|
-
} else if (width < 1200) {
|
|
77
|
-
setCurrentBreakpoint('md')
|
|
78
|
-
} else {
|
|
79
|
-
setCurrentBreakpoint('lg')
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
updateWidth()
|
|
85
|
-
window.addEventListener('resize', updateWidth)
|
|
86
|
-
return () => window.removeEventListener('resize', updateWidth)
|
|
87
|
-
}, [])
|
|
88
|
-
|
|
89
|
-
// Responsive layout oluştur
|
|
90
|
-
const generateResponsiveLayouts = (): Layouts => {
|
|
91
|
-
const baseLayout = widgets.map((widget, index) => ({
|
|
92
|
-
i: widget.id,
|
|
93
|
-
x: widget.position?.x ?? (index * 3) % 12,
|
|
94
|
-
y: widget.position?.y ?? Math.floor((index * 3) / 12) * 3,
|
|
95
|
-
w: widget.size?.w ?? 3,
|
|
96
|
-
h: widget.size?.h ?? 3,
|
|
97
|
-
minW: widget.size?.minW || 2,
|
|
98
|
-
maxW: widget.size?.maxW || 12,
|
|
99
|
-
minH: widget.size?.minH || 2,
|
|
100
|
-
maxH: widget.size?.maxH || 8,
|
|
101
|
-
isDraggable: editMode && !lockedWidgets.has(widget.id) && widget.permissions?.canMove !== false,
|
|
102
|
-
isResizable: editMode && !lockedWidgets.has(widget.id) && widget.permissions?.canResize !== false,
|
|
103
|
-
}))
|
|
104
|
-
|
|
105
|
-
// Farklı breakpoint'ler için layout'ları ayarla
|
|
106
|
-
const sortedLayout = [...baseLayout].sort((a, b) => {
|
|
107
|
-
if (a.y === b.y) return a.x - b.x;
|
|
108
|
-
return a.y - b.y;
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
return {
|
|
112
|
-
lg: baseLayout,
|
|
113
|
-
md: sortedLayout.map((item, index) => {
|
|
114
|
-
const cols = 8;
|
|
115
|
-
const maxW = Math.min(item.w, 4);
|
|
116
|
-
const row = Math.floor(index / 2);
|
|
117
|
-
const col = (index % 2) * 4;
|
|
118
|
-
return {
|
|
119
|
-
...item,
|
|
120
|
-
w: maxW,
|
|
121
|
-
x: col,
|
|
122
|
-
y: row * 3,
|
|
123
|
-
h: Math.min(item.h, 3)
|
|
124
|
-
};
|
|
125
|
-
}),
|
|
126
|
-
sm: sortedLayout.map((item, index) => {
|
|
127
|
-
const maxW = Math.min(item.w, 4);
|
|
128
|
-
return {
|
|
129
|
-
...item,
|
|
130
|
-
w: maxW,
|
|
131
|
-
x: 0,
|
|
132
|
-
y: index * 3,
|
|
133
|
-
h: Math.min(item.h, 3)
|
|
134
|
-
};
|
|
135
|
-
}),
|
|
136
|
-
xs: sortedLayout.map((item, index) => ({
|
|
137
|
-
...item,
|
|
138
|
-
w: 2, // Full width on mobile
|
|
139
|
-
x: 0,
|
|
140
|
-
y: index * 2,
|
|
141
|
-
h: Math.min(item.h, 2)
|
|
142
|
-
})),
|
|
143
|
-
xxs: sortedLayout.map((item, index) => ({
|
|
144
|
-
...item,
|
|
145
|
-
w: 1, // Full width on extra small
|
|
146
|
-
x: 0,
|
|
147
|
-
y: index * 2,
|
|
148
|
-
h: Math.min(item.h, 2)
|
|
149
|
-
}))
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// Layout oluştur (geriye uyumluluk için)
|
|
154
|
-
const generateLayout = (): Layout[] => {
|
|
155
|
-
const responsiveLayouts = generateResponsiveLayouts()
|
|
156
|
-
return responsiveLayouts[currentBreakpoint as keyof Layouts] || responsiveLayouts.lg
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Widget kilit durumunu değiştir
|
|
160
|
-
const toggleWidgetLock = (widgetId: string) => {
|
|
161
|
-
setLockedWidgets(prev => {
|
|
162
|
-
const newSet = new Set(prev)
|
|
163
|
-
if (newSet.has(widgetId)) {
|
|
164
|
-
newSet.delete(widgetId)
|
|
165
|
-
} else {
|
|
166
|
-
newSet.add(widgetId)
|
|
167
|
-
}
|
|
168
|
-
return newSet
|
|
169
|
-
})
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Widget'ı tam ekran yap
|
|
173
|
-
const toggleFullscreen = (widgetId: string) => {
|
|
174
|
-
if (fullscreenWidget === widgetId) {
|
|
175
|
-
setFullscreenWidget(null)
|
|
176
|
-
} else {
|
|
177
|
-
setFullscreenWidget(widgetId)
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// Widget render
|
|
182
|
-
const renderWidget = (widget: Widget) => {
|
|
183
|
-
const isLocked = lockedWidgets.has(widget.id)
|
|
184
|
-
const isFullscreen = fullscreenWidget === widget.id
|
|
185
|
-
|
|
186
|
-
const widgetContent = () => {
|
|
187
|
-
switch (widget.type) {
|
|
188
|
-
case 'metric':
|
|
189
|
-
return (
|
|
190
|
-
<MetricCard
|
|
191
|
-
data={widget.data}
|
|
192
|
-
onAction={(action) => onWidgetAction?.(widget.id, action)}
|
|
193
|
-
glassmorphism={glassmorphism}
|
|
194
|
-
/>
|
|
195
|
-
)
|
|
196
|
-
|
|
197
|
-
case 'chart':
|
|
198
|
-
return (
|
|
199
|
-
<ChartWidget
|
|
200
|
-
id={widget.id}
|
|
201
|
-
title={widget.title}
|
|
202
|
-
description={widget.description}
|
|
203
|
-
data={widget.data}
|
|
204
|
-
loading={widget.loading}
|
|
205
|
-
glassmorphism={glassmorphism}
|
|
206
|
-
onAction={(action, data) => onWidgetAction?.(widget.id, action, data)}
|
|
207
|
-
/>
|
|
208
|
-
)
|
|
209
|
-
|
|
210
|
-
case 'activity':
|
|
211
|
-
return (
|
|
212
|
-
<ActivityFeed
|
|
213
|
-
items={widget.data?.items || []}
|
|
214
|
-
title={widget.title}
|
|
215
|
-
loading={widget.loading}
|
|
216
|
-
glassmorphism={glassmorphism}
|
|
217
|
-
realtime={widget.data?.realtime}
|
|
218
|
-
onAction={(action, data) => onWidgetAction?.(widget.id, action, data)}
|
|
219
|
-
/>
|
|
220
|
-
)
|
|
221
|
-
|
|
222
|
-
case 'table':
|
|
223
|
-
case 'map':
|
|
224
|
-
case 'calendar':
|
|
225
|
-
case 'progress':
|
|
226
|
-
case 'comparison':
|
|
227
|
-
// Bu widget tipleri için geçici olarak basit bir görünüm
|
|
228
|
-
return (
|
|
229
|
-
<div className={cn(
|
|
230
|
-
"h-full p-4 rounded-lg border",
|
|
231
|
-
glassmorphism ? "bg-background/60 backdrop-blur-md border-white/10" : "bg-card"
|
|
232
|
-
)}>
|
|
233
|
-
<h3 className="font-semibold mb-2">{widget.title}</h3>
|
|
234
|
-
{widget.description && (
|
|
235
|
-
<p className="text-sm text-muted-foreground mb-4">{widget.description}</p>
|
|
236
|
-
)}
|
|
237
|
-
<div className="flex items-center justify-center h-32 text-muted-foreground">
|
|
238
|
-
<span className="text-sm">{widget.type} widget content</span>
|
|
239
|
-
</div>
|
|
240
|
-
</div>
|
|
241
|
-
)
|
|
242
|
-
|
|
243
|
-
default:
|
|
244
|
-
return (
|
|
245
|
-
<div className="flex items-center justify-center h-full text-muted-foreground">
|
|
246
|
-
Widget type not supported: {widget.type}
|
|
247
|
-
</div>
|
|
248
|
-
)
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
return (
|
|
253
|
-
<motion.div
|
|
254
|
-
key={widget.id}
|
|
255
|
-
className={cn(
|
|
256
|
-
"relative group h-full",
|
|
257
|
-
isFullscreen && "!fixed !inset-4 !z-50 !h-auto !w-auto"
|
|
258
|
-
)}
|
|
259
|
-
layout={!isFullscreen}
|
|
260
|
-
transition={{ duration: 0.2 }}
|
|
261
|
-
>
|
|
262
|
-
{/* Widget içeriği */}
|
|
263
|
-
<div className="h-full">
|
|
264
|
-
{widgetContent()}
|
|
265
|
-
</div>
|
|
266
|
-
|
|
267
|
-
{/* Edit mode kontrolleri */}
|
|
268
|
-
{editMode && !isFullscreen && (
|
|
269
|
-
<motion.div
|
|
270
|
-
initial={{ opacity: 0 }}
|
|
271
|
-
animate={{ opacity: 1 }}
|
|
272
|
-
className="absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-100 transition-opacity"
|
|
273
|
-
>
|
|
274
|
-
<div className={cn(
|
|
275
|
-
"flex items-center gap-1 p-1 rounded-lg",
|
|
276
|
-
glassmorphism ? "bg-background/80 backdrop-blur-sm" : "bg-background/95",
|
|
277
|
-
"border shadow-sm"
|
|
278
|
-
)}>
|
|
279
|
-
{/* Drag handle */}
|
|
280
|
-
{!isLocked && (
|
|
281
|
-
<div className="drag-handle cursor-move p-1 hover:bg-muted rounded">
|
|
282
|
-
<Grip className="h-4 w-4" />
|
|
283
|
-
</div>
|
|
284
|
-
)}
|
|
285
|
-
|
|
286
|
-
{/* Lock/Unlock */}
|
|
287
|
-
<Button
|
|
288
|
-
variant="ghost"
|
|
289
|
-
size="sm"
|
|
290
|
-
className="h-6 w-6 p-0"
|
|
291
|
-
onClick={() => toggleWidgetLock(widget.id)}
|
|
292
|
-
>
|
|
293
|
-
{isLocked ? (
|
|
294
|
-
<Lock className="h-3 w-3" />
|
|
295
|
-
) : (
|
|
296
|
-
<Unlock className="h-3 w-3" />
|
|
297
|
-
)}
|
|
298
|
-
</Button>
|
|
299
|
-
|
|
300
|
-
{/* Fullscreen */}
|
|
301
|
-
<Button
|
|
302
|
-
variant="ghost"
|
|
303
|
-
size="sm"
|
|
304
|
-
className="h-6 w-6 p-0"
|
|
305
|
-
onClick={() => toggleFullscreen(widget.id)}
|
|
306
|
-
>
|
|
307
|
-
<Maximize2 className="h-3 w-3" />
|
|
308
|
-
</Button>
|
|
309
|
-
|
|
310
|
-
{/* Settings */}
|
|
311
|
-
<Button
|
|
312
|
-
variant="ghost"
|
|
313
|
-
size="sm"
|
|
314
|
-
className="h-6 w-6 p-0"
|
|
315
|
-
onClick={() => onWidgetAction?.(widget.id, 'settings')}
|
|
316
|
-
>
|
|
317
|
-
<Settings className="h-3 w-3" />
|
|
318
|
-
</Button>
|
|
319
|
-
|
|
320
|
-
{/* Remove */}
|
|
321
|
-
{widget.permissions?.canDelete !== false && (
|
|
322
|
-
<Button
|
|
323
|
-
variant="ghost"
|
|
324
|
-
size="sm"
|
|
325
|
-
className="h-6 w-6 p-0 text-destructive hover:text-destructive"
|
|
326
|
-
onClick={() => onWidgetRemove?.(widget.id)}
|
|
327
|
-
>
|
|
328
|
-
<X className="h-3 w-3" />
|
|
329
|
-
</Button>
|
|
330
|
-
)}
|
|
331
|
-
</div>
|
|
332
|
-
</motion.div>
|
|
333
|
-
)}
|
|
334
|
-
|
|
335
|
-
{/* Fullscreen kontrolleri */}
|
|
336
|
-
{isFullscreen && (
|
|
337
|
-
<motion.div
|
|
338
|
-
initial={{ opacity: 0, y: -10 }}
|
|
339
|
-
animate={{ opacity: 1, y: 0 }}
|
|
340
|
-
className="absolute top-4 right-4 z-10"
|
|
341
|
-
>
|
|
342
|
-
<Button
|
|
343
|
-
variant="outline"
|
|
344
|
-
size="sm"
|
|
345
|
-
onClick={() => toggleFullscreen(widget.id)}
|
|
346
|
-
>
|
|
347
|
-
<Minimize2 className="h-4 w-4 mr-2" />
|
|
348
|
-
Exit Fullscreen
|
|
349
|
-
</Button>
|
|
350
|
-
</motion.div>
|
|
351
|
-
)}
|
|
352
|
-
</motion.div>
|
|
353
|
-
)
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
// Mobile kontrolü
|
|
357
|
-
const isMobile = currentBreakpoint === 'xs' || currentBreakpoint === 'xxs' || currentBreakpoint === 'sm';
|
|
358
|
-
|
|
359
|
-
return (
|
|
360
|
-
<div ref={containerRef} className={cn("w-full relative", className)}>
|
|
361
|
-
<AnimatePresence>
|
|
362
|
-
{fullscreenWidget ? (
|
|
363
|
-
// Fullscreen widget
|
|
364
|
-
<motion.div
|
|
365
|
-
initial={{ opacity: 0 }}
|
|
366
|
-
animate={{ opacity: 1 }}
|
|
367
|
-
exit={{ opacity: 0 }}
|
|
368
|
-
className="fixed inset-0 z-40 bg-background"
|
|
369
|
-
>
|
|
370
|
-
{widgets
|
|
371
|
-
.filter(w => w.id === fullscreenWidget)
|
|
372
|
-
.map(renderWidget)}
|
|
373
|
-
</motion.div>
|
|
374
|
-
) : isMobile ? (
|
|
375
|
-
// Mobile layout - Grid Layout yerine normal flex kullan
|
|
376
|
-
<div className="space-y-6">
|
|
377
|
-
{widgets.map(widget => (
|
|
378
|
-
<motion.div
|
|
379
|
-
key={widget.id}
|
|
380
|
-
initial={{ opacity: 0, y: 20 }}
|
|
381
|
-
animate={{ opacity: 1, y: 0 }}
|
|
382
|
-
transition={{ duration: 0.3 }}
|
|
383
|
-
className="w-full"
|
|
384
|
-
>
|
|
385
|
-
{renderWidget(widget)}
|
|
386
|
-
</motion.div>
|
|
387
|
-
))}
|
|
388
|
-
</div>
|
|
389
|
-
) : (
|
|
390
|
-
// Desktop Grid layout
|
|
391
|
-
<ResponsiveGridLayout
|
|
392
|
-
className="layout"
|
|
393
|
-
layouts={layouts.lg ? layouts : generateResponsiveLayouts()}
|
|
394
|
-
breakpoints={breakpoints}
|
|
395
|
-
cols={cols}
|
|
396
|
-
rowHeight={currentBreakpoint === 'xs' || currentBreakpoint === 'xxs' ? 60 : currentBreakpoint === 'sm' ? 70 : rowHeight}
|
|
397
|
-
margin={currentBreakpoint === 'xs' || currentBreakpoint === 'xxs' ? [12, 20] : margin}
|
|
398
|
-
containerPadding={currentBreakpoint === 'xs' || currentBreakpoint === 'xxs' ? [8, 8] : containerPadding}
|
|
399
|
-
onLayoutChange={(layout, allLayouts) => {
|
|
400
|
-
setLayouts(allLayouts)
|
|
401
|
-
onLayoutChange?.(layout)
|
|
402
|
-
}}
|
|
403
|
-
onBreakpointChange={(breakpoint) => {
|
|
404
|
-
setCurrentBreakpoint(breakpoint)
|
|
405
|
-
// Dar alanlarda compact type'ı değiştir
|
|
406
|
-
if (breakpoint === 'xs' || breakpoint === 'xxs' || breakpoint === 'sm') {
|
|
407
|
-
setCompactType('vertical')
|
|
408
|
-
} else {
|
|
409
|
-
setCompactType('vertical')
|
|
410
|
-
}
|
|
411
|
-
}}
|
|
412
|
-
draggableHandle=".drag-handle"
|
|
413
|
-
isDraggable={editMode}
|
|
414
|
-
isResizable={editMode}
|
|
415
|
-
compactType={compactType}
|
|
416
|
-
preventCollision={false}
|
|
417
|
-
useCSSTransforms={true}
|
|
418
|
-
transformScale={1}
|
|
419
|
-
isDroppable={true}
|
|
420
|
-
autoSize={true}
|
|
421
|
-
verticalCompact={true}
|
|
422
|
-
>
|
|
423
|
-
{widgets.map(widget => (
|
|
424
|
-
<div key={widget.id}>
|
|
425
|
-
{renderWidget(widget)}
|
|
426
|
-
</div>
|
|
427
|
-
))}
|
|
428
|
-
</ResponsiveGridLayout>
|
|
429
|
-
)}
|
|
430
|
-
</AnimatePresence>
|
|
431
|
-
|
|
432
|
-
{/* Grid çizgileri (edit mode) */}
|
|
433
|
-
{editMode && !fullscreenWidget && (
|
|
434
|
-
<motion.div
|
|
435
|
-
initial={{ opacity: 0 }}
|
|
436
|
-
animate={{ opacity: 0.1 }}
|
|
437
|
-
className="absolute inset-0 pointer-events-none"
|
|
438
|
-
style={{
|
|
439
|
-
backgroundImage: `
|
|
440
|
-
repeating-linear-gradient(
|
|
441
|
-
0deg,
|
|
442
|
-
var(--border) 0px,
|
|
443
|
-
transparent 1px,
|
|
444
|
-
transparent ${rowHeight + margin[1]}px,
|
|
445
|
-
var(--border) ${rowHeight + margin[1]}px
|
|
446
|
-
),
|
|
447
|
-
repeating-linear-gradient(
|
|
448
|
-
90deg,
|
|
449
|
-
var(--border) 0px,
|
|
450
|
-
transparent 1px,
|
|
451
|
-
transparent ${100 / cols[currentBreakpoint as keyof typeof cols]}%,
|
|
452
|
-
var(--border) ${100 / cols[currentBreakpoint as keyof typeof cols]}%
|
|
453
|
-
)
|
|
454
|
-
`
|
|
455
|
-
}}
|
|
456
|
-
/>
|
|
457
|
-
)}
|
|
458
|
-
</div>
|
|
459
|
-
)
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
export default DashboardGrid
|