@moontra/moonui-pro 2.20.2 → 2.20.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -3
- package/plugin/index.d.ts +86 -0
- package/plugin/index.js +308 -0
- package/scripts/postinstall.js +176 -23
- package/src/components/advanced-chart/index.tsx +0 -1246
- package/src/components/advanced-forms/index.tsx +0 -585
- package/src/components/animated-button/index.tsx +0 -385
- package/src/components/calendar/event-dialog.tsx +0 -377
- package/src/components/calendar/index.tsx +0 -1220
- 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 -480
- 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 -225
- package/src/components/dashboard/widgets/activity-feed.tsx +0 -349
- package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
- package/src/components/dashboard/widgets/comparison-widget.tsx +0 -177
- package/src/components/dashboard/widgets/index.ts +0 -5
- package/src/components/dashboard/widgets/metric-card.tsx +0 -363
- package/src/components/dashboard/widgets/progress-widget.tsx +0 -113
- 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/index.tsx +0 -845
- package/src/components/draggable-list/index.tsx +0 -100
- package/src/components/error-boundary/index.tsx +0 -232
- 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 -335
- package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
- package/src/components/form-wizard/form-wizard-progress.tsx +0 -329
- 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 -77
- 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 -517
- 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 -515
- package/src/components/health-check/index.tsx +0 -439
- package/src/components/hover-card-3d/index.tsx +0 -529
- package/src/components/index.ts +0 -130
- 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 -1689
- 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 -31
- package/src/components/magnetic-button/index.tsx +0 -216
- package/src/components/memory-efficient-data/index.tsx +0 -1018
- package/src/components/moonui-quiz-form/index.tsx +0 -817
- package/src/components/navbar/index.tsx +0 -781
- package/src/components/optimized-image/index.tsx +0 -425
- package/src/components/performance-debugger/index.tsx +0 -613
- package/src/components/performance-monitor/index.tsx +0 -808
- package/src/components/phone-number-input/index.tsx +0 -343
- package/src/components/phone-number-input/phone-number-input-simple.tsx +0 -167
- 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.tsx +0 -2322
- package/src/components/rich-text-editor/slash-commands-extension.ts +0 -230
- 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 -884
- 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 -1183
- package/src/components/ui/accordion.tsx +0 -581
- 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 -155
- package/src/components/ui/badge.tsx +0 -230
- package/src/components/ui/breadcrumb.tsx +0 -216
- package/src/components/ui/button.tsx +0 -228
- package/src/components/ui/calendar.tsx +0 -387
- package/src/components/ui/card.tsx +0 -216
- package/src/components/ui/checkbox.tsx +0 -259
- package/src/components/ui/collapsible.tsx +0 -631
- package/src/components/ui/color-picker.tsx +0 -97
- package/src/components/ui/command.tsx +0 -948
- package/src/components/ui/dialog.tsx +0 -752
- package/src/components/ui/dropdown-menu.tsx +0 -706
- 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 -222
- package/src/components/ui/input.tsx +0 -224
- 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 -611
- package/src/components/ui/navigation-menu.tsx +0 -130
- package/src/components/ui/pagination.tsx +0 -125
- 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 -378
- 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 -331
- package/src/components/ui/tabs-pro.tsx +0 -542
- package/src/components/ui/tabs.tsx +0 -54
- 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 -22
- 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 -681
- package/src/styles/tailwind.css +0 -7
- package/src/styles/tokens.css +0 -455
- 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,336 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { motion } from "framer-motion";
|
|
5
|
-
import { Button } from "../ui/button";
|
|
6
|
-
import { Calendar } from "../ui/calendar";
|
|
7
|
-
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
|
|
8
|
-
import { cn } from "../../lib/utils";
|
|
9
|
-
import { CalendarIcon, ChevronDown } from "lucide-react";
|
|
10
|
-
import {
|
|
11
|
-
format,
|
|
12
|
-
startOfDay,
|
|
13
|
-
endOfDay,
|
|
14
|
-
subDays,
|
|
15
|
-
startOfWeek,
|
|
16
|
-
endOfWeek,
|
|
17
|
-
startOfMonth,
|
|
18
|
-
endOfMonth,
|
|
19
|
-
} from "date-fns";
|
|
20
|
-
import { TimeRange } from "./types";
|
|
21
|
-
|
|
22
|
-
interface TimeRangePickerProps {
|
|
23
|
-
value?: TimeRange;
|
|
24
|
-
onChange?: (range: TimeRange) => void;
|
|
25
|
-
className?: string;
|
|
26
|
-
showPresets?: boolean;
|
|
27
|
-
showComparison?: boolean;
|
|
28
|
-
glassmorphism?: boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const PRESET_RANGES = [
|
|
32
|
-
{
|
|
33
|
-
label: "Today",
|
|
34
|
-
value: "today",
|
|
35
|
-
getRange: () => ({
|
|
36
|
-
start: startOfDay(new Date()),
|
|
37
|
-
end: endOfDay(new Date()),
|
|
38
|
-
label: "Today",
|
|
39
|
-
preset: "today" as const,
|
|
40
|
-
}),
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: "Yesterday",
|
|
44
|
-
value: "yesterday",
|
|
45
|
-
getRange: () => ({
|
|
46
|
-
start: startOfDay(subDays(new Date(), 1)),
|
|
47
|
-
end: endOfDay(subDays(new Date(), 1)),
|
|
48
|
-
label: "Yesterday",
|
|
49
|
-
preset: "yesterday" as const,
|
|
50
|
-
}),
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
label: "Last 7 days",
|
|
54
|
-
value: "last7days",
|
|
55
|
-
getRange: () => ({
|
|
56
|
-
start: startOfDay(subDays(new Date(), 6)),
|
|
57
|
-
end: endOfDay(new Date()),
|
|
58
|
-
label: "Last 7 days",
|
|
59
|
-
preset: "last7days" as const,
|
|
60
|
-
}),
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
label: "Last 30 days",
|
|
64
|
-
value: "last30days",
|
|
65
|
-
getRange: () => ({
|
|
66
|
-
start: startOfDay(subDays(new Date(), 29)),
|
|
67
|
-
end: endOfDay(new Date()),
|
|
68
|
-
label: "Last 30 days",
|
|
69
|
-
preset: "last30days" as const,
|
|
70
|
-
}),
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
label: "This week",
|
|
74
|
-
value: "thisWeek",
|
|
75
|
-
getRange: () => ({
|
|
76
|
-
start: startOfWeek(new Date()),
|
|
77
|
-
end: endOfWeek(new Date()),
|
|
78
|
-
label: "This week",
|
|
79
|
-
preset: "custom" as const,
|
|
80
|
-
}),
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
label: "This month",
|
|
84
|
-
value: "thisMonth",
|
|
85
|
-
getRange: () => ({
|
|
86
|
-
start: startOfMonth(new Date()),
|
|
87
|
-
end: endOfMonth(new Date()),
|
|
88
|
-
label: "This month",
|
|
89
|
-
preset: "thisMonth" as const,
|
|
90
|
-
}),
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
label: "Last month",
|
|
94
|
-
value: "lastMonth",
|
|
95
|
-
getRange: () => {
|
|
96
|
-
const lastMonth = subDays(startOfMonth(new Date()), 1);
|
|
97
|
-
return {
|
|
98
|
-
start: startOfMonth(lastMonth),
|
|
99
|
-
end: endOfMonth(lastMonth),
|
|
100
|
-
label: "Last month",
|
|
101
|
-
preset: "lastMonth" as const,
|
|
102
|
-
};
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
];
|
|
106
|
-
|
|
107
|
-
export function TimeRangePicker({
|
|
108
|
-
value,
|
|
109
|
-
onChange,
|
|
110
|
-
className,
|
|
111
|
-
showPresets = true,
|
|
112
|
-
showComparison = false,
|
|
113
|
-
glassmorphism = false,
|
|
114
|
-
}: TimeRangePickerProps) {
|
|
115
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
116
|
-
const [customRange, setCustomRange] = React.useState<{
|
|
117
|
-
from?: Date;
|
|
118
|
-
to?: Date;
|
|
119
|
-
}>({
|
|
120
|
-
from: undefined,
|
|
121
|
-
to: undefined,
|
|
122
|
-
});
|
|
123
|
-
const [comparisonEnabled, setComparisonEnabled] = React.useState(false);
|
|
124
|
-
|
|
125
|
-
const currentRange = value || PRESET_RANGES[2].getRange(); // Default: Last 7 days
|
|
126
|
-
|
|
127
|
-
// Format tarih aralığı
|
|
128
|
-
const formatRange = (range: TimeRange) => {
|
|
129
|
-
if (range.preset && range.preset !== "custom") {
|
|
130
|
-
return range.label;
|
|
131
|
-
}
|
|
132
|
-
return `${format(range.start, "MMM d")} - ${format(range.end, "MMM d, yyyy")}`;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
// Preset seçimi
|
|
136
|
-
const handlePresetSelect = (preset: (typeof PRESET_RANGES)[0]) => {
|
|
137
|
-
const range = preset.getRange();
|
|
138
|
-
onChange?.(range);
|
|
139
|
-
setIsOpen(false);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
// Custom tarih seçimi
|
|
143
|
-
const handleCustomRangeSelect = () => {
|
|
144
|
-
if (customRange.from && customRange.to) {
|
|
145
|
-
onChange?.({
|
|
146
|
-
start: startOfDay(customRange.from),
|
|
147
|
-
end: endOfDay(customRange.to),
|
|
148
|
-
label: `${format(customRange.from, "MMM d")} - ${format(customRange.to, "MMM d, yyyy")}`,
|
|
149
|
-
preset: "custom",
|
|
150
|
-
});
|
|
151
|
-
setIsOpen(false);
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
return (
|
|
156
|
-
<Popover open={isOpen} onOpenChange={setIsOpen}>
|
|
157
|
-
<PopoverTrigger asChild>
|
|
158
|
-
<Button
|
|
159
|
-
variant="outline"
|
|
160
|
-
className={cn(
|
|
161
|
-
"justify-start text-left font-normal",
|
|
162
|
-
glassmorphism &&
|
|
163
|
-
"bg-background/60 backdrop-blur-sm border-white/10",
|
|
164
|
-
!value && "text-muted-foreground",
|
|
165
|
-
className
|
|
166
|
-
)}
|
|
167
|
-
>
|
|
168
|
-
<CalendarIcon className="mr-2 h-4 w-4" />
|
|
169
|
-
{formatRange(currentRange)}
|
|
170
|
-
<ChevronDown className="ml-auto h-4 w-4 opacity-50" />
|
|
171
|
-
</Button>
|
|
172
|
-
</PopoverTrigger>
|
|
173
|
-
<PopoverContent
|
|
174
|
-
className={cn(
|
|
175
|
-
"time-range-popover w-auto max-w-[95vw] sm:max-w-4xl p-0 overflow-hidden",
|
|
176
|
-
glassmorphism &&
|
|
177
|
-
"bg-background/95 backdrop-blur-md border-white/10"
|
|
178
|
-
)}
|
|
179
|
-
align="end"
|
|
180
|
-
side="bottom"
|
|
181
|
-
sideOffset={4}
|
|
182
|
-
collisionPadding={16}
|
|
183
|
-
>
|
|
184
|
-
<motion.div
|
|
185
|
-
initial={{ opacity: 0, y: -10 }}
|
|
186
|
-
animate={{ opacity: 1, y: 0 }}
|
|
187
|
-
transition={{ duration: 0.2 }}
|
|
188
|
-
className="min-w-0"
|
|
189
|
-
>
|
|
190
|
-
{/* Mobile: Stacked Layout */}
|
|
191
|
-
<div className="sm:hidden">
|
|
192
|
-
{/* Custom tarih seçici */}
|
|
193
|
-
<div className="p-3">
|
|
194
|
-
{/* Karşılaştırma */}
|
|
195
|
-
{showComparison && (
|
|
196
|
-
<div className="mt-3 pt-3 border-t">
|
|
197
|
-
<label className="flex items-center gap-2 cursor-pointer">
|
|
198
|
-
<input
|
|
199
|
-
type="checkbox"
|
|
200
|
-
checked={comparisonEnabled}
|
|
201
|
-
onChange={(e) =>
|
|
202
|
-
setComparisonEnabled(
|
|
203
|
-
e.target.checked
|
|
204
|
-
)
|
|
205
|
-
}
|
|
206
|
-
className="rounded w-3 h-3"
|
|
207
|
-
/>
|
|
208
|
-
<span className="text-xs">
|
|
209
|
-
Compare to previous
|
|
210
|
-
</span>
|
|
211
|
-
</label>
|
|
212
|
-
</div>
|
|
213
|
-
)}
|
|
214
|
-
</div>
|
|
215
|
-
</div>
|
|
216
|
-
|
|
217
|
-
{/* Desktop: Side by Side Layout */}
|
|
218
|
-
<div className="hidden sm:flex">
|
|
219
|
-
{/* Preset'ler */}
|
|
220
|
-
{showPresets && (
|
|
221
|
-
<div className="preset-column border-r p-3 min-w-[140px]">
|
|
222
|
-
<div className="grid grid-cols-1 gap-1">
|
|
223
|
-
{PRESET_RANGES.map((preset) => (
|
|
224
|
-
<motion.button
|
|
225
|
-
key={preset.value}
|
|
226
|
-
whileHover={{ x: 2 }}
|
|
227
|
-
whileTap={{ scale: 0.98 }}
|
|
228
|
-
onClick={() =>
|
|
229
|
-
handlePresetSelect(preset)
|
|
230
|
-
}
|
|
231
|
-
className={cn(
|
|
232
|
-
"w-full text-left px-2 py-1.5 text-sm rounded-md transition-colors whitespace-nowrap",
|
|
233
|
-
"hover:bg-muted",
|
|
234
|
-
currentRange.preset ===
|
|
235
|
-
preset.value &&
|
|
236
|
-
"bg-primary text-primary-foreground"
|
|
237
|
-
)}
|
|
238
|
-
>
|
|
239
|
-
{preset.label}
|
|
240
|
-
</motion.button>
|
|
241
|
-
))}
|
|
242
|
-
</div>
|
|
243
|
-
|
|
244
|
-
{/* Karşılaştırma */}
|
|
245
|
-
{showComparison && (
|
|
246
|
-
<div className="mt-4 pt-4 border-t">
|
|
247
|
-
<label className="flex items-center gap-2 px-2 cursor-pointer">
|
|
248
|
-
<input
|
|
249
|
-
type="checkbox"
|
|
250
|
-
checked={comparisonEnabled}
|
|
251
|
-
onChange={(e) =>
|
|
252
|
-
setComparisonEnabled(
|
|
253
|
-
e.target.checked
|
|
254
|
-
)
|
|
255
|
-
}
|
|
256
|
-
className="rounded w-4 h-4"
|
|
257
|
-
/>
|
|
258
|
-
<span className="text-sm">
|
|
259
|
-
Compare to previous period
|
|
260
|
-
</span>
|
|
261
|
-
</label>
|
|
262
|
-
</div>
|
|
263
|
-
)}
|
|
264
|
-
</div>
|
|
265
|
-
)}
|
|
266
|
-
|
|
267
|
-
{/* Custom tarih seçici */}
|
|
268
|
-
<div className="p-3 flex-1">
|
|
269
|
-
<div className="overflow-x-auto">
|
|
270
|
-
<Calendar
|
|
271
|
-
mode="range"
|
|
272
|
-
selected={{
|
|
273
|
-
from: customRange.from,
|
|
274
|
-
to: customRange.to,
|
|
275
|
-
}}
|
|
276
|
-
onSelect={(range: any) =>
|
|
277
|
-
setCustomRange(
|
|
278
|
-
range || {
|
|
279
|
-
from: undefined,
|
|
280
|
-
to: undefined,
|
|
281
|
-
}
|
|
282
|
-
)
|
|
283
|
-
}
|
|
284
|
-
numberOfMonths={2}
|
|
285
|
-
showOutsideDays={true}
|
|
286
|
-
className="rounded-md"
|
|
287
|
-
/>
|
|
288
|
-
</div>
|
|
289
|
-
|
|
290
|
-
<div className="flex items-center justify-between pt-3 px-2">
|
|
291
|
-
<div className="text-sm text-muted-foreground">
|
|
292
|
-
{customRange.from && customRange.to && (
|
|
293
|
-
<span>
|
|
294
|
-
{Math.ceil(
|
|
295
|
-
(customRange.to.getTime() -
|
|
296
|
-
customRange.from.getTime()) /
|
|
297
|
-
(1000 * 60 * 60 * 24)
|
|
298
|
-
)}{" "}
|
|
299
|
-
days selected
|
|
300
|
-
</span>
|
|
301
|
-
)}
|
|
302
|
-
</div>
|
|
303
|
-
<div className="flex gap-2">
|
|
304
|
-
<Button
|
|
305
|
-
variant="ghost"
|
|
306
|
-
size="sm"
|
|
307
|
-
onClick={() => {
|
|
308
|
-
setCustomRange({
|
|
309
|
-
from: undefined,
|
|
310
|
-
to: undefined,
|
|
311
|
-
});
|
|
312
|
-
setIsOpen(false);
|
|
313
|
-
}}
|
|
314
|
-
>
|
|
315
|
-
Cancel
|
|
316
|
-
</Button>
|
|
317
|
-
<Button
|
|
318
|
-
size="sm"
|
|
319
|
-
onClick={handleCustomRangeSelect}
|
|
320
|
-
disabled={
|
|
321
|
-
!customRange.from || !customRange.to
|
|
322
|
-
}
|
|
323
|
-
>
|
|
324
|
-
Apply
|
|
325
|
-
</Button>
|
|
326
|
-
</div>
|
|
327
|
-
</div>
|
|
328
|
-
</div>
|
|
329
|
-
</div>
|
|
330
|
-
</motion.div>
|
|
331
|
-
</PopoverContent>
|
|
332
|
-
</Popover>
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
export default TimeRangePicker;
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react'
|
|
2
|
-
|
|
3
|
-
// Widget tipleri
|
|
4
|
-
export type WidgetType =
|
|
5
|
-
| 'metric'
|
|
6
|
-
| 'chart'
|
|
7
|
-
| 'table'
|
|
8
|
-
| 'map'
|
|
9
|
-
| 'activity'
|
|
10
|
-
| 'calendar'
|
|
11
|
-
| 'progress'
|
|
12
|
-
| 'comparison'
|
|
13
|
-
|
|
14
|
-
// Widget boyutları
|
|
15
|
-
export interface WidgetSize {
|
|
16
|
-
w: number // Grid genişliği
|
|
17
|
-
h: number // Grid yüksekliği
|
|
18
|
-
minW?: number
|
|
19
|
-
maxW?: number
|
|
20
|
-
minH?: number
|
|
21
|
-
maxH?: number
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Widget pozisyonu
|
|
25
|
-
export interface WidgetPosition {
|
|
26
|
-
x: number
|
|
27
|
-
y: number
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Tema tipleri
|
|
31
|
-
export type DashboardTheme = 'analytics' | 'sales' | 'monitoring' | 'finance' | 'custom'
|
|
32
|
-
|
|
33
|
-
// Zaman aralığı
|
|
34
|
-
export interface TimeRange {
|
|
35
|
-
start: Date
|
|
36
|
-
end: Date
|
|
37
|
-
label: string
|
|
38
|
-
preset?: 'today' | 'yesterday' | 'last7days' | 'last30days' | 'thisMonth' | 'lastMonth' | 'custom'
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Metric widget
|
|
42
|
-
export interface MetricData {
|
|
43
|
-
id: string
|
|
44
|
-
title: string
|
|
45
|
-
value: string | number
|
|
46
|
-
change?: {
|
|
47
|
-
value: number
|
|
48
|
-
type: 'increase' | 'decrease' | 'neutral'
|
|
49
|
-
period: string
|
|
50
|
-
}
|
|
51
|
-
icon?: ReactNode
|
|
52
|
-
color?: 'primary' | 'success' | 'warning' | 'danger' | 'info'
|
|
53
|
-
sparkline?: number[]
|
|
54
|
-
forecast?: number
|
|
55
|
-
target?: number
|
|
56
|
-
unit?: string
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Chart widget
|
|
60
|
-
export interface ChartData {
|
|
61
|
-
type: 'line' | 'bar' | 'area' | 'pie' | 'donut' | 'radar'
|
|
62
|
-
data: any
|
|
63
|
-
options?: any
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Table widget
|
|
67
|
-
export interface TableData {
|
|
68
|
-
columns: Array<{
|
|
69
|
-
id: string
|
|
70
|
-
header: string
|
|
71
|
-
accessor: string
|
|
72
|
-
sortable?: boolean
|
|
73
|
-
filterable?: boolean
|
|
74
|
-
}>
|
|
75
|
-
data: any[]
|
|
76
|
-
pagination?: boolean
|
|
77
|
-
pageSize?: number
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Activity widget
|
|
81
|
-
export interface ActivityItem {
|
|
82
|
-
id: string
|
|
83
|
-
type: 'info' | 'success' | 'warning' | 'error'
|
|
84
|
-
title: string
|
|
85
|
-
description?: string
|
|
86
|
-
timestamp: Date
|
|
87
|
-
user?: {
|
|
88
|
-
name: string
|
|
89
|
-
avatar?: string
|
|
90
|
-
}
|
|
91
|
-
icon?: ReactNode
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Progress widget
|
|
95
|
-
export interface ProgressData {
|
|
96
|
-
id: string
|
|
97
|
-
title: string
|
|
98
|
-
current: number
|
|
99
|
-
target: number
|
|
100
|
-
unit?: string
|
|
101
|
-
color?: 'primary' | 'success' | 'warning' | 'danger'
|
|
102
|
-
deadline?: Date
|
|
103
|
-
description?: string
|
|
104
|
-
milestone?: number
|
|
105
|
-
trend?: number
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Comparison widget
|
|
109
|
-
export interface ComparisonData {
|
|
110
|
-
periods: Array<{
|
|
111
|
-
label: string
|
|
112
|
-
value: number
|
|
113
|
-
data?: any[]
|
|
114
|
-
}>
|
|
115
|
-
metric: string
|
|
116
|
-
unit?: string
|
|
117
|
-
showChart?: boolean
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Widget base interface
|
|
121
|
-
export interface Widget {
|
|
122
|
-
id: string
|
|
123
|
-
type: WidgetType
|
|
124
|
-
title: string
|
|
125
|
-
description?: string
|
|
126
|
-
size?: WidgetSize
|
|
127
|
-
position?: WidgetPosition
|
|
128
|
-
data?: any
|
|
129
|
-
config?: any
|
|
130
|
-
loading?: boolean
|
|
131
|
-
error?: string
|
|
132
|
-
refreshInterval?: number // ms
|
|
133
|
-
lastUpdated?: Date
|
|
134
|
-
permissions?: {
|
|
135
|
-
canEdit?: boolean
|
|
136
|
-
canDelete?: boolean
|
|
137
|
-
canResize?: boolean
|
|
138
|
-
canMove?: boolean
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Dashboard configuration
|
|
143
|
-
export interface DashboardConfig {
|
|
144
|
-
id: string
|
|
145
|
-
name: string
|
|
146
|
-
description?: string
|
|
147
|
-
theme: DashboardTheme
|
|
148
|
-
layout: {
|
|
149
|
-
rowHeight: number
|
|
150
|
-
margin: [number, number]
|
|
151
|
-
containerPadding: [number, number]
|
|
152
|
-
breakpoints: {
|
|
153
|
-
lg: number
|
|
154
|
-
md: number
|
|
155
|
-
sm: number
|
|
156
|
-
xs: number
|
|
157
|
-
xxs: number
|
|
158
|
-
}
|
|
159
|
-
cols: {
|
|
160
|
-
lg: number
|
|
161
|
-
md: number
|
|
162
|
-
sm: number
|
|
163
|
-
xs: number
|
|
164
|
-
xxs: number
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
widgets: Widget[]
|
|
168
|
-
filters?: {
|
|
169
|
-
timeRange?: TimeRange
|
|
170
|
-
dimensions?: Record<string, any>
|
|
171
|
-
}
|
|
172
|
-
createdAt: Date
|
|
173
|
-
updatedAt: Date
|
|
174
|
-
createdBy?: string
|
|
175
|
-
shared?: boolean
|
|
176
|
-
tags?: string[]
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Dashboard template
|
|
180
|
-
export interface DashboardTemplate {
|
|
181
|
-
id: string
|
|
182
|
-
name: string
|
|
183
|
-
description: string
|
|
184
|
-
thumbnail?: string
|
|
185
|
-
category: 'analytics' | 'sales' | 'operations' | 'finance' | 'marketing' | 'custom'
|
|
186
|
-
widgets: Omit<Widget, 'id'>[]
|
|
187
|
-
theme: DashboardTheme
|
|
188
|
-
popularity?: number
|
|
189
|
-
isPro?: boolean
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// WebSocket message
|
|
193
|
-
export interface DashboardUpdate {
|
|
194
|
-
type: 'widget-update' | 'notification' | 'alert' | 'refresh'
|
|
195
|
-
widgetId?: string
|
|
196
|
-
data?: any
|
|
197
|
-
timestamp: Date
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Export format
|
|
201
|
-
export type ExportFormat = 'json' | 'csv' | 'pdf' | 'png'
|
|
202
|
-
|
|
203
|
-
// Filter types
|
|
204
|
-
export interface DashboardFilter {
|
|
205
|
-
id: string
|
|
206
|
-
type: 'select' | 'multiselect' | 'daterange' | 'search' | 'toggle'
|
|
207
|
-
label: string
|
|
208
|
-
field: string
|
|
209
|
-
options?: Array<{ value: any; label: string }>
|
|
210
|
-
defaultValue?: any
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Notification
|
|
214
|
-
export interface DashboardNotification {
|
|
215
|
-
id: string
|
|
216
|
-
type: 'info' | 'success' | 'warning' | 'error'
|
|
217
|
-
title: string
|
|
218
|
-
message?: string
|
|
219
|
-
timestamp: Date
|
|
220
|
-
read?: boolean
|
|
221
|
-
action?: {
|
|
222
|
-
label: string
|
|
223
|
-
handler: () => void
|
|
224
|
-
}
|
|
225
|
-
}
|