@moontra/moonui-pro 2.20.2 → 2.20.4
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 +191 -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
package/src/hooks/use-chart.ts
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { ChartDataPoint, ChartSeries } from '../components/advanced-chart'
|
|
5
|
-
|
|
6
|
-
interface UseChartOptions {
|
|
7
|
-
data: ChartDataPoint[]
|
|
8
|
-
series: ChartSeries[]
|
|
9
|
-
realtime?: boolean
|
|
10
|
-
refreshInterval?: number
|
|
11
|
-
maxDataPoints?: number
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface UseChartReturn {
|
|
15
|
-
data: ChartDataPoint[]
|
|
16
|
-
series: ChartSeries[]
|
|
17
|
-
isLoading: boolean
|
|
18
|
-
error: string | null
|
|
19
|
-
addDataPoint: (point: ChartDataPoint) => void
|
|
20
|
-
updateSeries: (seriesUpdate: Partial<ChartSeries>[]) => void
|
|
21
|
-
toggleSeries: (dataKey: string) => void
|
|
22
|
-
resetData: () => void
|
|
23
|
-
exportData: (format: 'csv' | 'json') => void
|
|
24
|
-
getStats: () => {
|
|
25
|
-
total: number
|
|
26
|
-
average: number
|
|
27
|
-
min: number
|
|
28
|
-
max: number
|
|
29
|
-
trend: 'up' | 'down' | 'neutral'
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function useChart({
|
|
34
|
-
data: initialData,
|
|
35
|
-
series: initialSeries,
|
|
36
|
-
realtime = false,
|
|
37
|
-
refreshInterval = 5000,
|
|
38
|
-
maxDataPoints = 100,
|
|
39
|
-
}: UseChartOptions): UseChartReturn {
|
|
40
|
-
const [data, setData] = React.useState<ChartDataPoint[]>(initialData)
|
|
41
|
-
const [series, setSeries] = React.useState<ChartSeries[]>(initialSeries)
|
|
42
|
-
const [isLoading, setIsLoading] = React.useState(false)
|
|
43
|
-
const [error, setError] = React.useState<string | null>(null)
|
|
44
|
-
|
|
45
|
-
// Realtime data updates
|
|
46
|
-
React.useEffect(() => {
|
|
47
|
-
if (!realtime) return
|
|
48
|
-
|
|
49
|
-
const interval = setInterval(() => {
|
|
50
|
-
// This would typically fetch new data from an API
|
|
51
|
-
// For demo purposes, we'll simulate data updates
|
|
52
|
-
setData(prevData => {
|
|
53
|
-
const newData = [...prevData]
|
|
54
|
-
|
|
55
|
-
// Keep only the last maxDataPoints
|
|
56
|
-
if (newData.length >= maxDataPoints) {
|
|
57
|
-
newData.shift()
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Add simulated new data point
|
|
61
|
-
const lastPoint = newData[newData.length - 1]
|
|
62
|
-
if (lastPoint) {
|
|
63
|
-
const newPoint: ChartDataPoint = { ...lastPoint }
|
|
64
|
-
|
|
65
|
-
// Simulate data changes for each series
|
|
66
|
-
series.forEach(s => {
|
|
67
|
-
if (typeof lastPoint[s.dataKey] === 'number') {
|
|
68
|
-
const currentValue = lastPoint[s.dataKey] as number
|
|
69
|
-
const change = (Math.random() - 0.5) * currentValue * 0.1
|
|
70
|
-
newPoint[s.dataKey] = Math.max(0, currentValue + change)
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
// Update timestamp if exists
|
|
75
|
-
if ('timestamp' in newPoint) {
|
|
76
|
-
newPoint.timestamp = Date.now()
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
newData.push(newPoint)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return newData
|
|
83
|
-
})
|
|
84
|
-
}, refreshInterval)
|
|
85
|
-
|
|
86
|
-
return () => clearInterval(interval)
|
|
87
|
-
}, [realtime, refreshInterval, maxDataPoints, series])
|
|
88
|
-
|
|
89
|
-
const addDataPoint = React.useCallback((point: ChartDataPoint) => {
|
|
90
|
-
setData(prevData => {
|
|
91
|
-
const newData = [...prevData, point]
|
|
92
|
-
|
|
93
|
-
// Keep only the last maxDataPoints
|
|
94
|
-
if (newData.length > maxDataPoints) {
|
|
95
|
-
return newData.slice(-maxDataPoints)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return newData
|
|
99
|
-
})
|
|
100
|
-
}, [maxDataPoints])
|
|
101
|
-
|
|
102
|
-
const updateSeries = React.useCallback((seriesUpdate: Partial<ChartSeries>[]) => {
|
|
103
|
-
setSeries(prevSeries => {
|
|
104
|
-
return prevSeries.map(s => {
|
|
105
|
-
const update = seriesUpdate.find(u => u.dataKey === s.dataKey)
|
|
106
|
-
return update ? { ...s, ...update } : s
|
|
107
|
-
})
|
|
108
|
-
})
|
|
109
|
-
}, [])
|
|
110
|
-
|
|
111
|
-
const toggleSeries = React.useCallback((dataKey: string) => {
|
|
112
|
-
setSeries(prevSeries => {
|
|
113
|
-
return prevSeries.map(s =>
|
|
114
|
-
s.dataKey === dataKey ? { ...s, hide: !s.hide } : s
|
|
115
|
-
)
|
|
116
|
-
})
|
|
117
|
-
}, [])
|
|
118
|
-
|
|
119
|
-
const resetData = React.useCallback(() => {
|
|
120
|
-
setData(initialData)
|
|
121
|
-
setSeries(initialSeries)
|
|
122
|
-
setError(null)
|
|
123
|
-
}, [initialData, initialSeries])
|
|
124
|
-
|
|
125
|
-
const exportData = React.useCallback((format: 'csv' | 'json') => {
|
|
126
|
-
try {
|
|
127
|
-
if (format === 'csv') {
|
|
128
|
-
const headers = Object.keys(data[0] || {})
|
|
129
|
-
const csvContent = [
|
|
130
|
-
headers.join(','),
|
|
131
|
-
...data.map(row =>
|
|
132
|
-
headers.map(header => {
|
|
133
|
-
const value = row[header]
|
|
134
|
-
if (typeof value === 'string' && (value.includes(',') || value.includes('"'))) {
|
|
135
|
-
return `"${value.replace(/"/g, '""')}"`
|
|
136
|
-
}
|
|
137
|
-
return value
|
|
138
|
-
}).join(',')
|
|
139
|
-
)
|
|
140
|
-
].join('\n')
|
|
141
|
-
|
|
142
|
-
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' })
|
|
143
|
-
const link = document.createElement('a')
|
|
144
|
-
link.href = URL.createObjectURL(blob)
|
|
145
|
-
link.download = 'chart-data.csv'
|
|
146
|
-
link.click()
|
|
147
|
-
} else if (format === 'json') {
|
|
148
|
-
const jsonContent = JSON.stringify({ data, series }, null, 2)
|
|
149
|
-
const blob = new Blob([jsonContent], { type: 'application/json;charset=utf-8;' })
|
|
150
|
-
const link = document.createElement('a')
|
|
151
|
-
link.href = URL.createObjectURL(blob)
|
|
152
|
-
link.download = 'chart-data.json'
|
|
153
|
-
link.click()
|
|
154
|
-
}
|
|
155
|
-
} catch (err) {
|
|
156
|
-
setError('Failed to export data')
|
|
157
|
-
}
|
|
158
|
-
}, [data, series])
|
|
159
|
-
|
|
160
|
-
const getStats = React.useCallback(() => {
|
|
161
|
-
if (!data.length || !series.length) {
|
|
162
|
-
return { total: 0, average: 0, min: 0, max: 0, trend: 'neutral' as const }
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const firstSeries = series[0]
|
|
166
|
-
const values = data
|
|
167
|
-
.map(d => Number(d[firstSeries.dataKey]))
|
|
168
|
-
.filter(v => !isNaN(v))
|
|
169
|
-
|
|
170
|
-
if (!values.length) {
|
|
171
|
-
return { total: 0, average: 0, min: 0, max: 0, trend: 'neutral' as const }
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const total = values.reduce((sum, val) => sum + val, 0)
|
|
175
|
-
const average = total / values.length
|
|
176
|
-
const min = Math.min(...values)
|
|
177
|
-
const max = Math.max(...values)
|
|
178
|
-
|
|
179
|
-
// Calculate trend
|
|
180
|
-
let trend: 'up' | 'down' | 'neutral' = 'neutral'
|
|
181
|
-
if (values.length >= 2) {
|
|
182
|
-
const first = values[0]
|
|
183
|
-
const last = values[values.length - 1]
|
|
184
|
-
const change = ((last - first) / first) * 100
|
|
185
|
-
|
|
186
|
-
if (change > 5) trend = 'up'
|
|
187
|
-
else if (change < -5) trend = 'down'
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return { total, average, min, max, trend }
|
|
191
|
-
}, [data, series])
|
|
192
|
-
|
|
193
|
-
return {
|
|
194
|
-
data,
|
|
195
|
-
series,
|
|
196
|
-
isLoading,
|
|
197
|
-
error,
|
|
198
|
-
addDataPoint,
|
|
199
|
-
updateSeries,
|
|
200
|
-
toggleSeries,
|
|
201
|
-
resetData,
|
|
202
|
-
exportData,
|
|
203
|
-
getStats,
|
|
204
|
-
}
|
|
205
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { ColumnDef } from '@tanstack/react-table'
|
|
5
|
-
|
|
6
|
-
export interface UseDataTableOptions<TData> {
|
|
7
|
-
data: TData[]
|
|
8
|
-
columns: ColumnDef<TData, any>[]
|
|
9
|
-
searchable?: boolean
|
|
10
|
-
filterable?: boolean
|
|
11
|
-
sortable?: boolean
|
|
12
|
-
pagination?: boolean
|
|
13
|
-
pageSize?: number
|
|
14
|
-
enableRowSelection?: boolean
|
|
15
|
-
enableMultiRowSelection?: boolean
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface UseDataTableReturn<TData> {
|
|
19
|
-
// Table state
|
|
20
|
-
filteredData: TData[]
|
|
21
|
-
selectedRows: TData[]
|
|
22
|
-
searchQuery: string
|
|
23
|
-
currentPage: number
|
|
24
|
-
totalPages: number
|
|
25
|
-
|
|
26
|
-
// Actions
|
|
27
|
-
setSearchQuery: (query: string) => void
|
|
28
|
-
setCurrentPage: (page: number) => void
|
|
29
|
-
selectRow: (row: TData) => void
|
|
30
|
-
selectAllRows: () => void
|
|
31
|
-
clearSelection: () => void
|
|
32
|
-
exportData: (format?: 'csv' | 'json') => void
|
|
33
|
-
|
|
34
|
-
// Utilities
|
|
35
|
-
getRowCount: () => number
|
|
36
|
-
getSelectedCount: () => number
|
|
37
|
-
isRowSelected: (row: TData) => boolean
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function useDataTable<TData extends Record<string, any>>(
|
|
41
|
-
options: UseDataTableOptions<TData>
|
|
42
|
-
): UseDataTableReturn<TData> {
|
|
43
|
-
const {
|
|
44
|
-
data,
|
|
45
|
-
searchable = true,
|
|
46
|
-
pageSize = 10,
|
|
47
|
-
enableRowSelection = false,
|
|
48
|
-
enableMultiRowSelection = true,
|
|
49
|
-
} = options
|
|
50
|
-
|
|
51
|
-
const [searchQuery, setSearchQuery] = React.useState('')
|
|
52
|
-
const [currentPage, setCurrentPage] = React.useState(1)
|
|
53
|
-
const [selectedRows, setSelectedRows] = React.useState<TData[]>([])
|
|
54
|
-
|
|
55
|
-
// Filter data based on search query
|
|
56
|
-
const filteredData = React.useMemo(() => {
|
|
57
|
-
if (!searchable || !searchQuery.trim()) {
|
|
58
|
-
return data
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return data.filter((row) => {
|
|
62
|
-
return Object.values(row).some((value) => {
|
|
63
|
-
if (value == null) return false
|
|
64
|
-
return String(value).toLowerCase().includes(searchQuery.toLowerCase())
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
}, [data, searchQuery, searchable])
|
|
68
|
-
|
|
69
|
-
// Calculate pagination
|
|
70
|
-
const totalPages = Math.ceil(filteredData.length / pageSize)
|
|
71
|
-
const paginatedData = React.useMemo(() => {
|
|
72
|
-
const startIndex = (currentPage - 1) * pageSize
|
|
73
|
-
const endIndex = startIndex + pageSize
|
|
74
|
-
return filteredData.slice(startIndex, endIndex)
|
|
75
|
-
}, [filteredData, currentPage, pageSize])
|
|
76
|
-
|
|
77
|
-
// Row selection handlers
|
|
78
|
-
const selectRow = React.useCallback((row: TData) => {
|
|
79
|
-
if (!enableRowSelection) return
|
|
80
|
-
|
|
81
|
-
setSelectedRows((prev) => {
|
|
82
|
-
if (!enableMultiRowSelection) {
|
|
83
|
-
return [row]
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const isSelected = prev.some((selectedRow) =>
|
|
87
|
-
JSON.stringify(selectedRow) === JSON.stringify(row)
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
if (isSelected) {
|
|
91
|
-
return prev.filter((selectedRow) =>
|
|
92
|
-
JSON.stringify(selectedRow) !== JSON.stringify(row)
|
|
93
|
-
)
|
|
94
|
-
} else {
|
|
95
|
-
return [...prev, row]
|
|
96
|
-
}
|
|
97
|
-
})
|
|
98
|
-
}, [enableRowSelection, enableMultiRowSelection])
|
|
99
|
-
|
|
100
|
-
const selectAllRows = React.useCallback(() => {
|
|
101
|
-
if (!enableRowSelection) return
|
|
102
|
-
|
|
103
|
-
setSelectedRows((prev) => {
|
|
104
|
-
if (prev.length === filteredData.length) {
|
|
105
|
-
return []
|
|
106
|
-
} else {
|
|
107
|
-
return [...filteredData]
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
}, [enableRowSelection, filteredData])
|
|
111
|
-
|
|
112
|
-
const clearSelection = React.useCallback(() => {
|
|
113
|
-
setSelectedRows([])
|
|
114
|
-
}, [])
|
|
115
|
-
|
|
116
|
-
const isRowSelected = React.useCallback((row: TData) => {
|
|
117
|
-
return selectedRows.some((selectedRow) =>
|
|
118
|
-
JSON.stringify(selectedRow) === JSON.stringify(row)
|
|
119
|
-
)
|
|
120
|
-
}, [selectedRows])
|
|
121
|
-
|
|
122
|
-
// Export functionality
|
|
123
|
-
const exportData = React.useCallback((format: 'csv' | 'json' = 'csv') => {
|
|
124
|
-
const dataToExport = selectedRows.length > 0 ? selectedRows : filteredData
|
|
125
|
-
|
|
126
|
-
if (format === 'csv') {
|
|
127
|
-
const headers = Object.keys(dataToExport[0] || {})
|
|
128
|
-
const csvContent = [
|
|
129
|
-
headers.join(','),
|
|
130
|
-
...dataToExport.map(row =>
|
|
131
|
-
headers.map(header => {
|
|
132
|
-
const value = row[header]
|
|
133
|
-
// Escape commas and quotes in CSV
|
|
134
|
-
if (typeof value === 'string' && (value.includes(',') || value.includes('"'))) {
|
|
135
|
-
return `"${value.replace(/"/g, '""')}"`
|
|
136
|
-
}
|
|
137
|
-
return value
|
|
138
|
-
}).join(',')
|
|
139
|
-
)
|
|
140
|
-
].join('\n')
|
|
141
|
-
|
|
142
|
-
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' })
|
|
143
|
-
const link = document.createElement('a')
|
|
144
|
-
link.href = URL.createObjectURL(blob)
|
|
145
|
-
link.download = 'data.csv'
|
|
146
|
-
link.click()
|
|
147
|
-
} else if (format === 'json') {
|
|
148
|
-
const jsonContent = JSON.stringify(dataToExport, null, 2)
|
|
149
|
-
const blob = new Blob([jsonContent], { type: 'application/json;charset=utf-8;' })
|
|
150
|
-
const link = document.createElement('a')
|
|
151
|
-
link.href = URL.createObjectURL(blob)
|
|
152
|
-
link.download = 'data.json'
|
|
153
|
-
link.click()
|
|
154
|
-
}
|
|
155
|
-
}, [selectedRows, filteredData])
|
|
156
|
-
|
|
157
|
-
// Utility functions
|
|
158
|
-
const getRowCount = React.useCallback(() => filteredData.length, [filteredData])
|
|
159
|
-
const getSelectedCount = React.useCallback(() => selectedRows.length, [selectedRows])
|
|
160
|
-
|
|
161
|
-
// Reset page when search changes
|
|
162
|
-
React.useEffect(() => {
|
|
163
|
-
setCurrentPage(1)
|
|
164
|
-
}, [searchQuery])
|
|
165
|
-
|
|
166
|
-
return {
|
|
167
|
-
filteredData: paginatedData,
|
|
168
|
-
selectedRows,
|
|
169
|
-
searchQuery,
|
|
170
|
-
currentPage,
|
|
171
|
-
totalPages,
|
|
172
|
-
setSearchQuery,
|
|
173
|
-
setCurrentPage,
|
|
174
|
-
selectRow,
|
|
175
|
-
selectAllRows,
|
|
176
|
-
clearSelection,
|
|
177
|
-
exportData,
|
|
178
|
-
getRowCount,
|
|
179
|
-
getSelectedCount,
|
|
180
|
-
isRowSelected,
|
|
181
|
-
}
|
|
182
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Mock docs pro access hook for standalone moonui-pro package
|
|
2
|
-
// Bu hook, moonui-pro'nun bağımsız çalışması için basit bir mock'tur
|
|
3
|
-
|
|
4
|
-
export function useDocsProAccess() {
|
|
5
|
-
// Production ortamında her zaman pro erişim verilir
|
|
6
|
-
// Gerçek uygulamada bu hook uygulamanın kendi auth sistemiyle değiştirilmelidir
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
hasProAccess: true,
|
|
10
|
-
isLoading: false,
|
|
11
|
-
isDocsMode: false, // Standalone package'da docs mode yok
|
|
12
|
-
};
|
|
13
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react'
|
|
2
|
-
|
|
3
|
-
interface LicenseCheckResult {
|
|
4
|
-
isValid: boolean
|
|
5
|
-
isLoading: boolean
|
|
6
|
-
error?: string
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// License kontrolü için hook
|
|
10
|
-
export function useLicenseCheck(): LicenseCheckResult {
|
|
11
|
-
const [isValid, setIsValid] = useState(false)
|
|
12
|
-
const [isLoading, setIsLoading] = useState(true)
|
|
13
|
-
const [error, setError] = useState<string>()
|
|
14
|
-
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
async function checkLicense() {
|
|
17
|
-
try {
|
|
18
|
-
// Önce localStorage'dan kontrol et
|
|
19
|
-
const cachedLicense = localStorage.getItem('moonui_pro_license')
|
|
20
|
-
if (cachedLicense) {
|
|
21
|
-
const parsed = JSON.parse(cachedLicense)
|
|
22
|
-
if (parsed.expiresAt && new Date(parsed.expiresAt) > new Date()) {
|
|
23
|
-
setIsValid(true)
|
|
24
|
-
setIsLoading(false)
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// API'den kontrol et
|
|
30
|
-
const response = await fetch('/api/license/verify', {
|
|
31
|
-
method: 'POST',
|
|
32
|
-
headers: { 'Content-Type': 'application/json' },
|
|
33
|
-
body: JSON.stringify({
|
|
34
|
-
key: process.env.NEXT_PUBLIC_MOONUI_LICENSE_KEY || localStorage.getItem('moonui_license_key')
|
|
35
|
-
})
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
if (response.ok) {
|
|
39
|
-
const data = await response.json()
|
|
40
|
-
if (data.valid) {
|
|
41
|
-
// Cache'e kaydet
|
|
42
|
-
localStorage.setItem('moonui_pro_license', JSON.stringify({
|
|
43
|
-
valid: true,
|
|
44
|
-
expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000) // 24 saat
|
|
45
|
-
}))
|
|
46
|
-
setIsValid(true)
|
|
47
|
-
} else {
|
|
48
|
-
setError('Invalid license key')
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
setError('License verification failed')
|
|
52
|
-
}
|
|
53
|
-
} catch (err) {
|
|
54
|
-
console.error('License check error:', err)
|
|
55
|
-
setError('License verification error')
|
|
56
|
-
} finally {
|
|
57
|
-
setIsLoading(false)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
checkLicense()
|
|
62
|
-
}, [])
|
|
63
|
-
|
|
64
|
-
return { isValid, isLoading, error }
|
|
65
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Mock subscription hook for standalone moonui-pro package
|
|
2
|
-
// Bu hook, moonui-pro'nun bağımsız çalışması için basit bir mock'tur
|
|
3
|
-
|
|
4
|
-
export function useSubscription() {
|
|
5
|
-
// Production ortamında her zaman pro erişim verilir
|
|
6
|
-
// Gerçek uygulamada bu hook uygulamanın kendi auth sistemiyle değiştirilmelidir
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
isLoading: false,
|
|
10
|
-
isAuthenticated: true,
|
|
11
|
-
isAdmin: false,
|
|
12
|
-
hasProAccess: true, // Pro package kullanıcıları varsayılan olarak pro erişime sahip
|
|
13
|
-
subscriptionPlan: "pro" as const,
|
|
14
|
-
subscription: {
|
|
15
|
-
status: "active" as const,
|
|
16
|
-
plan: "pro" as const,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
}
|
package/src/hooks/use-toast.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
interface ToastOptions {
|
|
2
|
-
title: string
|
|
3
|
-
description?: string
|
|
4
|
-
variant?: 'default' | 'destructive'
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function useToast() {
|
|
8
|
-
const toast = (options: ToastOptions) => {
|
|
9
|
-
// Simple console implementation for now
|
|
10
|
-
// In production, this would integrate with a proper toast system
|
|
11
|
-
console.log(`[Toast] ${options.title}${options.description ? ': ' + options.description : ''}`)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return { toast }
|
|
15
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Pro Components Export - Source of Truth: packages/moonui-pro
|
|
2
|
-
// Development environment imports from local packages
|
|
3
|
-
|
|
4
|
-
// Import CSS for auto-loading
|
|
5
|
-
import "./styles/index.css";
|
|
6
|
-
|
|
7
|
-
// Utilities
|
|
8
|
-
export { cn } from "./lib/utils";
|
|
9
|
-
|
|
10
|
-
// AI Providers
|
|
11
|
-
export {
|
|
12
|
-
createAIProvider,
|
|
13
|
-
type AIProvider,
|
|
14
|
-
type AIProviderConfig,
|
|
15
|
-
type AIResponse,
|
|
16
|
-
OpenAIProvider,
|
|
17
|
-
ClaudeProvider,
|
|
18
|
-
GeminiProvider
|
|
19
|
-
} from "./lib/ai-providers";
|
|
20
|
-
|
|
21
|
-
// Pro Components (Commercial License) - from packages/moonui-pro
|
|
22
|
-
export * from "./components";
|