@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,406 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import React, { useState, useRef, useEffect } from "react"
|
|
4
|
-
import { cn } from "../../lib/utils"
|
|
5
|
-
import { Input } from "../ui/input"
|
|
6
|
-
import { Label } from "../ui/label"
|
|
7
|
-
import { CreditCard, Lock } from "lucide-react"
|
|
8
|
-
import { motion, AnimatePresence } from "framer-motion"
|
|
9
|
-
|
|
10
|
-
export interface CreditCardInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value'> {
|
|
11
|
-
value?: {
|
|
12
|
-
number: string
|
|
13
|
-
expiry: string
|
|
14
|
-
cvc: string
|
|
15
|
-
name?: string
|
|
16
|
-
}
|
|
17
|
-
onChange?: (value: {
|
|
18
|
-
number: string
|
|
19
|
-
expiry: string
|
|
20
|
-
cvc: string
|
|
21
|
-
name?: string
|
|
22
|
-
}) => void
|
|
23
|
-
showCardPreview?: boolean
|
|
24
|
-
showCardType?: boolean
|
|
25
|
-
showSecurityBadge?: boolean
|
|
26
|
-
autoFormat?: boolean
|
|
27
|
-
validateOnChange?: boolean
|
|
28
|
-
labels?: {
|
|
29
|
-
number?: string
|
|
30
|
-
expiry?: string
|
|
31
|
-
cvc?: string
|
|
32
|
-
name?: string
|
|
33
|
-
}
|
|
34
|
-
placeholders?: {
|
|
35
|
-
number?: string
|
|
36
|
-
expiry?: string
|
|
37
|
-
cvc?: string
|
|
38
|
-
name?: string
|
|
39
|
-
}
|
|
40
|
-
errors?: {
|
|
41
|
-
number?: string
|
|
42
|
-
expiry?: string
|
|
43
|
-
cvc?: string
|
|
44
|
-
name?: string
|
|
45
|
-
}
|
|
46
|
-
className?: string
|
|
47
|
-
inputClassName?: string
|
|
48
|
-
labelClassName?: string
|
|
49
|
-
errorClassName?: string
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Kart tipi tespiti için regex patternleri
|
|
53
|
-
const cardPatterns = {
|
|
54
|
-
visa: /^4/,
|
|
55
|
-
mastercard: /^5[1-5]/,
|
|
56
|
-
amex: /^3[47]/,
|
|
57
|
-
discover: /^6(?:011|5)/,
|
|
58
|
-
diners: /^3(?:0[0-5]|[68])/,
|
|
59
|
-
jcb: /^35/,
|
|
60
|
-
unionpay: /^62/
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Kart numarası formatlama fonksiyonu
|
|
64
|
-
function formatCardNumber(value: string, cardType?: string): string {
|
|
65
|
-
const v = value.replace(/\s+/g, '').replace(/[^0-9]/gi, '')
|
|
66
|
-
const matches = cardType === 'amex'
|
|
67
|
-
? v.match(/\d{1,4}/g)
|
|
68
|
-
: v.match(/\d{1,4}/g)
|
|
69
|
-
return matches ? matches.join(' ') : v
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Expiry formatlama fonksiyonu
|
|
73
|
-
function formatExpiry(value: string): string {
|
|
74
|
-
const v = value.replace(/\s+/g, '').replace(/[^0-9]/gi, '')
|
|
75
|
-
if (v.length >= 2) {
|
|
76
|
-
return v.slice(0, 2) + (v.length > 2 ? '/' + v.slice(2, 4) : '')
|
|
77
|
-
}
|
|
78
|
-
return v
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Kart tipi tespiti
|
|
82
|
-
function detectCardType(number: string): string | null {
|
|
83
|
-
const cleanNumber = number.replace(/\s+/g, '')
|
|
84
|
-
for (const [type, pattern] of Object.entries(cardPatterns)) {
|
|
85
|
-
if (pattern.test(cleanNumber)) {
|
|
86
|
-
return type
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return null
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Luhn algoritması ile kart numarası doğrulama
|
|
93
|
-
function validateCardNumber(number: string): boolean {
|
|
94
|
-
const cleanNumber = number.replace(/\s+/g, '')
|
|
95
|
-
if (!/^\d+$/.test(cleanNumber)) return false
|
|
96
|
-
|
|
97
|
-
let sum = 0
|
|
98
|
-
let isEven = false
|
|
99
|
-
|
|
100
|
-
for (let i = cleanNumber.length - 1; i >= 0; i--) {
|
|
101
|
-
let digit = parseInt(cleanNumber.charAt(i), 10)
|
|
102
|
-
|
|
103
|
-
if (isEven) {
|
|
104
|
-
digit *= 2
|
|
105
|
-
if (digit > 9) {
|
|
106
|
-
digit -= 9
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
sum += digit
|
|
111
|
-
isEven = !isEven
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return sum % 10 === 0
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Expiry doğrulama
|
|
118
|
-
function validateExpiry(expiry: string): boolean {
|
|
119
|
-
const parts = expiry.split('/')
|
|
120
|
-
if (parts.length !== 2) return false
|
|
121
|
-
|
|
122
|
-
const month = parseInt(parts[0], 10)
|
|
123
|
-
const year = parseInt('20' + parts[1], 10)
|
|
124
|
-
|
|
125
|
-
if (month < 1 || month > 12) return false
|
|
126
|
-
|
|
127
|
-
const now = new Date()
|
|
128
|
-
const expiryDate = new Date(year, month - 1)
|
|
129
|
-
|
|
130
|
-
return expiryDate > now
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export const MoonUICreditCardInputPro = React.forwardRef<HTMLDivElement, CreditCardInputProps>(({
|
|
134
|
-
value = { number: '', expiry: '', cvc: '', name: '' },
|
|
135
|
-
onChange,
|
|
136
|
-
showCardPreview = true,
|
|
137
|
-
showCardType = true,
|
|
138
|
-
showSecurityBadge = true,
|
|
139
|
-
autoFormat = true,
|
|
140
|
-
validateOnChange = false,
|
|
141
|
-
labels = {},
|
|
142
|
-
placeholders = {},
|
|
143
|
-
errors = {},
|
|
144
|
-
className,
|
|
145
|
-
inputClassName,
|
|
146
|
-
labelClassName,
|
|
147
|
-
errorClassName,
|
|
148
|
-
disabled,
|
|
149
|
-
required,
|
|
150
|
-
...props
|
|
151
|
-
}, ref) => {
|
|
152
|
-
const [cardType, setCardType] = useState<string | null>(null)
|
|
153
|
-
const [focused, setFocused] = useState<string | null>(null)
|
|
154
|
-
const [localErrors, setLocalErrors] = useState<typeof errors>({})
|
|
155
|
-
|
|
156
|
-
const numberRef = useRef<HTMLInputElement>(null)
|
|
157
|
-
const expiryRef = useRef<HTMLInputElement>(null)
|
|
158
|
-
const cvcRef = useRef<HTMLInputElement>(null)
|
|
159
|
-
const nameRef = useRef<HTMLInputElement>(null)
|
|
160
|
-
|
|
161
|
-
// Kart tipini tespit et
|
|
162
|
-
useEffect(() => {
|
|
163
|
-
const detectedType = detectCardType(value.number)
|
|
164
|
-
setCardType(detectedType)
|
|
165
|
-
}, [value.number])
|
|
166
|
-
|
|
167
|
-
// Doğrulama
|
|
168
|
-
useEffect(() => {
|
|
169
|
-
if (!validateOnChange) return
|
|
170
|
-
|
|
171
|
-
const newErrors: typeof errors = {}
|
|
172
|
-
|
|
173
|
-
if (value.number && !validateCardNumber(value.number)) {
|
|
174
|
-
newErrors.number = 'Invalid card number'
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (value.expiry && !validateExpiry(value.expiry)) {
|
|
178
|
-
newErrors.expiry = 'Invalid expiry date'
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (value.cvc && (value.cvc.length < 3 || value.cvc.length > 4)) {
|
|
182
|
-
newErrors.cvc = 'Invalid CVC'
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
setLocalErrors(newErrors)
|
|
186
|
-
}, [value, validateOnChange])
|
|
187
|
-
|
|
188
|
-
const handleChange = (field: keyof typeof value, newValue: string) => {
|
|
189
|
-
let formattedValue = newValue
|
|
190
|
-
|
|
191
|
-
if (autoFormat) {
|
|
192
|
-
if (field === 'number') {
|
|
193
|
-
formattedValue = formatCardNumber(newValue, cardType || undefined)
|
|
194
|
-
// Maksimum uzunluk kontrolü
|
|
195
|
-
const maxLength = cardType === 'amex' ? 18 : 19 // Boşluklarla birlikte
|
|
196
|
-
if (formattedValue.length > maxLength) return
|
|
197
|
-
} else if (field === 'expiry') {
|
|
198
|
-
formattedValue = formatExpiry(newValue)
|
|
199
|
-
if (formattedValue.length > 5) return
|
|
200
|
-
} else if (field === 'cvc') {
|
|
201
|
-
formattedValue = newValue.replace(/\D/g, '')
|
|
202
|
-
const maxLength = cardType === 'amex' ? 4 : 3
|
|
203
|
-
if (formattedValue.length > maxLength) return
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
onChange?.({
|
|
208
|
-
...value,
|
|
209
|
-
[field]: formattedValue
|
|
210
|
-
})
|
|
211
|
-
|
|
212
|
-
// Otomatik geçiş
|
|
213
|
-
if (autoFormat) {
|
|
214
|
-
if (field === 'number' && formattedValue.length === (cardType === 'amex' ? 18 : 19)) {
|
|
215
|
-
expiryRef.current?.focus()
|
|
216
|
-
} else if (field === 'expiry' && formattedValue.length === 5) {
|
|
217
|
-
cvcRef.current?.focus()
|
|
218
|
-
} else if (field === 'cvc' && formattedValue.length === (cardType === 'amex' ? 4 : 3)) {
|
|
219
|
-
nameRef.current?.focus()
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
const displayErrors = { ...localErrors, ...errors }
|
|
225
|
-
|
|
226
|
-
return (
|
|
227
|
-
<div ref={ref} className={cn("space-y-4", className)} {...props}>
|
|
228
|
-
{showCardPreview && (
|
|
229
|
-
<motion.div
|
|
230
|
-
className="relative w-full max-w-md mx-auto h-48 rounded-xl bg-gradient-to-r from-blue-600 to-purple-600 dark:from-blue-700 dark:to-purple-700 p-6 text-white shadow-xl overflow-hidden"
|
|
231
|
-
initial={{ opacity: 0, y: -20 }}
|
|
232
|
-
animate={{ opacity: 1, y: 0 }}
|
|
233
|
-
transition={{ duration: 0.3 }}
|
|
234
|
-
>
|
|
235
|
-
<div className="flex justify-between items-start mb-8">
|
|
236
|
-
<div className="text-lg font-semibold">
|
|
237
|
-
{cardType ? cardType.toUpperCase() : 'CARD'}
|
|
238
|
-
</div>
|
|
239
|
-
<CreditCard className="w-8 h-8 text-white/80" />
|
|
240
|
-
</div>
|
|
241
|
-
|
|
242
|
-
<div className="space-y-4">
|
|
243
|
-
<div className="text-xl font-mono tracking-wider">
|
|
244
|
-
{value.number || '•••• •••• •••• ••••'}
|
|
245
|
-
</div>
|
|
246
|
-
|
|
247
|
-
<div className="flex justify-between">
|
|
248
|
-
<div>
|
|
249
|
-
<div className="text-xs text-white/70">NAME</div>
|
|
250
|
-
<div className="text-sm uppercase">
|
|
251
|
-
{value.name || 'YOUR NAME'}
|
|
252
|
-
</div>
|
|
253
|
-
</div>
|
|
254
|
-
|
|
255
|
-
<div>
|
|
256
|
-
<div className="text-xs text-white/70">EXPIRES</div>
|
|
257
|
-
<div className="text-sm">
|
|
258
|
-
{value.expiry || 'MM/YY'}
|
|
259
|
-
</div>
|
|
260
|
-
</div>
|
|
261
|
-
</div>
|
|
262
|
-
</div>
|
|
263
|
-
</motion.div>
|
|
264
|
-
)}
|
|
265
|
-
|
|
266
|
-
<div className="space-y-4">
|
|
267
|
-
{/* Kart Numarası */}
|
|
268
|
-
<div className="space-y-1">
|
|
269
|
-
<Label htmlFor="card-number" className={labelClassName}>
|
|
270
|
-
{labels.number || 'Card Number'}
|
|
271
|
-
{required && <span className="text-destructive ml-1">*</span>}
|
|
272
|
-
</Label>
|
|
273
|
-
<div className="relative">
|
|
274
|
-
<Input
|
|
275
|
-
ref={numberRef}
|
|
276
|
-
id="card-number"
|
|
277
|
-
type="text"
|
|
278
|
-
inputMode="numeric"
|
|
279
|
-
value={value.number}
|
|
280
|
-
onChange={(e) => handleChange('number', e.target.value)}
|
|
281
|
-
onFocus={() => setFocused('number')}
|
|
282
|
-
onBlur={() => setFocused(null)}
|
|
283
|
-
placeholder={placeholders.number || '1234 5678 9012 3456'}
|
|
284
|
-
className={cn(
|
|
285
|
-
"pr-20",
|
|
286
|
-
displayErrors.number && "border-destructive",
|
|
287
|
-
inputClassName
|
|
288
|
-
)}
|
|
289
|
-
disabled={disabled}
|
|
290
|
-
/>
|
|
291
|
-
{showCardType && cardType && (
|
|
292
|
-
<div className="absolute right-3 top-1/2 -translate-y-1/2 text-sm font-medium text-muted-foreground">
|
|
293
|
-
{cardType.toUpperCase()}
|
|
294
|
-
</div>
|
|
295
|
-
)}
|
|
296
|
-
</div>
|
|
297
|
-
{displayErrors.number && (
|
|
298
|
-
<p className={cn("text-sm text-destructive", errorClassName)}>
|
|
299
|
-
{displayErrors.number}
|
|
300
|
-
</p>
|
|
301
|
-
)}
|
|
302
|
-
</div>
|
|
303
|
-
|
|
304
|
-
{/* Expiry ve CVC */}
|
|
305
|
-
<div className="grid grid-cols-2 gap-4">
|
|
306
|
-
<div className="space-y-1">
|
|
307
|
-
<Label htmlFor="card-expiry" className={labelClassName}>
|
|
308
|
-
{labels.expiry || 'Expiry Date'}
|
|
309
|
-
{required && <span className="text-destructive ml-1">*</span>}
|
|
310
|
-
</Label>
|
|
311
|
-
<Input
|
|
312
|
-
ref={expiryRef}
|
|
313
|
-
id="card-expiry"
|
|
314
|
-
type="text"
|
|
315
|
-
inputMode="numeric"
|
|
316
|
-
value={value.expiry}
|
|
317
|
-
onChange={(e) => handleChange('expiry', e.target.value)}
|
|
318
|
-
onFocus={() => setFocused('expiry')}
|
|
319
|
-
onBlur={() => setFocused(null)}
|
|
320
|
-
placeholder={placeholders.expiry || 'MM/YY'}
|
|
321
|
-
className={cn(
|
|
322
|
-
displayErrors.expiry && "border-destructive",
|
|
323
|
-
inputClassName
|
|
324
|
-
)}
|
|
325
|
-
disabled={disabled}
|
|
326
|
-
/>
|
|
327
|
-
{displayErrors.expiry && (
|
|
328
|
-
<p className={cn("text-sm text-destructive", errorClassName)}>
|
|
329
|
-
{displayErrors.expiry}
|
|
330
|
-
</p>
|
|
331
|
-
)}
|
|
332
|
-
</div>
|
|
333
|
-
|
|
334
|
-
<div className="space-y-1">
|
|
335
|
-
<Label htmlFor="card-cvc" className={labelClassName}>
|
|
336
|
-
{labels.cvc || 'CVC'}
|
|
337
|
-
{required && <span className="text-destructive ml-1">*</span>}
|
|
338
|
-
</Label>
|
|
339
|
-
<div className="relative">
|
|
340
|
-
<Input
|
|
341
|
-
ref={cvcRef}
|
|
342
|
-
id="card-cvc"
|
|
343
|
-
type="text"
|
|
344
|
-
inputMode="numeric"
|
|
345
|
-
value={value.cvc}
|
|
346
|
-
onChange={(e) => handleChange('cvc', e.target.value)}
|
|
347
|
-
onFocus={() => setFocused('cvc')}
|
|
348
|
-
onBlur={() => setFocused(null)}
|
|
349
|
-
placeholder={placeholders.cvc || cardType === 'amex' ? '1234' : '123'}
|
|
350
|
-
className={cn(
|
|
351
|
-
displayErrors.cvc && "border-destructive",
|
|
352
|
-
inputClassName
|
|
353
|
-
)}
|
|
354
|
-
disabled={disabled}
|
|
355
|
-
/>
|
|
356
|
-
{showSecurityBadge && (
|
|
357
|
-
<Lock className="absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" />
|
|
358
|
-
)}
|
|
359
|
-
</div>
|
|
360
|
-
{displayErrors.cvc && (
|
|
361
|
-
<p className={cn("text-sm text-destructive", errorClassName)}>
|
|
362
|
-
{displayErrors.cvc}
|
|
363
|
-
</p>
|
|
364
|
-
)}
|
|
365
|
-
</div>
|
|
366
|
-
</div>
|
|
367
|
-
|
|
368
|
-
{/* Kart Sahibi Adı */}
|
|
369
|
-
<div className="space-y-1">
|
|
370
|
-
<Label htmlFor="card-name" className={labelClassName}>
|
|
371
|
-
{labels.name || 'Cardholder Name'}
|
|
372
|
-
</Label>
|
|
373
|
-
<Input
|
|
374
|
-
ref={nameRef}
|
|
375
|
-
id="card-name"
|
|
376
|
-
type="text"
|
|
377
|
-
value={value.name}
|
|
378
|
-
onChange={(e) => handleChange('name', e.target.value)}
|
|
379
|
-
onFocus={() => setFocused('name')}
|
|
380
|
-
onBlur={() => setFocused(null)}
|
|
381
|
-
placeholder={placeholders.name || 'John Doe'}
|
|
382
|
-
className={cn(
|
|
383
|
-
displayErrors.name && "border-destructive",
|
|
384
|
-
inputClassName
|
|
385
|
-
)}
|
|
386
|
-
disabled={disabled}
|
|
387
|
-
/>
|
|
388
|
-
{displayErrors.name && (
|
|
389
|
-
<p className={cn("text-sm text-destructive", errorClassName)}>
|
|
390
|
-
{displayErrors.name}
|
|
391
|
-
</p>
|
|
392
|
-
)}
|
|
393
|
-
</div>
|
|
394
|
-
</div>
|
|
395
|
-
|
|
396
|
-
{showSecurityBadge && (
|
|
397
|
-
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
|
398
|
-
<Lock className="w-4 h-4" />
|
|
399
|
-
<span>Your payment information is secure and encrypted</span>
|
|
400
|
-
</div>
|
|
401
|
-
)}
|
|
402
|
-
</div>
|
|
403
|
-
)
|
|
404
|
-
})
|
|
405
|
-
|
|
406
|
-
MoonUICreditCardInputPro.displayName = "MoonUICreditCardInputPro"
|