xiod-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +73 -0
- package/README.md +167 -0
- package/dist/components/accordion.d.ts +9 -0
- package/dist/components/accordion.js +46 -0
- package/dist/components/agent-steps.d.ts +47 -0
- package/dist/components/agent-steps.js +223 -0
- package/dist/components/alert-dialog.d.ts +21 -0
- package/dist/components/alert-dialog.js +74 -0
- package/dist/components/alert.d.ts +12 -0
- package/dist/components/alert.js +45 -0
- package/dist/components/aspect-ratio.d.ts +9 -0
- package/dist/components/aspect-ratio.js +22 -0
- package/dist/components/autocomplete.d.ts +35 -0
- package/dist/components/autocomplete.js +160 -0
- package/dist/components/avatar.d.ts +17 -0
- package/dist/components/avatar.js +65 -0
- package/dist/components/badge.d.ts +15 -0
- package/dist/components/badge.js +46 -0
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.js +75 -0
- package/dist/components/button-group.d.ts +14 -0
- package/dist/components/button-group.js +45 -0
- package/dist/components/button-split.d.ts +19 -0
- package/dist/components/button-split.js +73 -0
- package/dist/components/button.d.ts +15 -0
- package/dist/components/button.js +54 -0
- package/dist/components/calendar.d.ts +63 -0
- package/dist/components/calendar.js +425 -0
- package/dist/components/card.d.ts +17 -0
- package/dist/components/card.js +139 -0
- package/dist/components/carousel.d.ts +59 -0
- package/dist/components/carousel.js +503 -0
- package/dist/components/checkbox.d.ts +16 -0
- package/dist/components/checkbox.js +86 -0
- package/dist/components/circular-progress.d.ts +28 -0
- package/dist/components/circular-progress.js +127 -0
- package/dist/components/collapsible.d.ts +8 -0
- package/dist/components/collapsible.js +27 -0
- package/dist/components/color-picker.d.ts +159 -0
- package/dist/components/color-picker.js +1589 -0
- package/dist/components/combobox.d.ts +46 -0
- package/dist/components/combobox.js +237 -0
- package/dist/components/command.d.ts +22 -0
- package/dist/components/command.js +129 -0
- package/dist/components/context-menu.d.ts +38 -0
- package/dist/components/context-menu.js +164 -0
- package/dist/components/copy-to-clipboard.d.ts +32 -0
- package/dist/components/copy-to-clipboard.js +83 -0
- package/dist/components/corner-badge.d.ts +22 -0
- package/dist/components/corner-badge.js +84 -0
- package/dist/components/dashboard-grid.d.ts +83 -0
- package/dist/components/dashboard-grid.js +486 -0
- package/dist/components/date-picker.d.ts +29 -0
- package/dist/components/date-picker.js +261 -0
- package/dist/components/dialog.d.ts +26 -0
- package/dist/components/dialog.js +97 -0
- package/dist/components/dot-matrix.d.ts +32 -0
- package/dist/components/dot-matrix.js +707 -0
- package/dist/components/draggable.d.ts +42 -0
- package/dist/components/draggable.js +346 -0
- package/dist/components/drawer.d.ts +66 -0
- package/dist/components/drawer.js +304 -0
- package/dist/components/empty.d.ts +14 -0
- package/dist/components/empty.js +75 -0
- package/dist/components/field.d.ts +12 -0
- package/dist/components/field.js +44 -0
- package/dist/components/fieldset.d.ts +7 -0
- package/dist/components/fieldset.js +21 -0
- package/dist/components/file-upload.d.ts +61 -0
- package/dist/components/file-upload.js +482 -0
- package/dist/components/form.d.ts +6 -0
- package/dist/components/form.js +14 -0
- package/dist/components/frame.d.ts +10 -0
- package/dist/components/frame.js +47 -0
- package/dist/components/gauge.d.ts +27 -0
- package/dist/components/gauge.js +74 -0
- package/dist/components/grid.d.ts +26 -0
- package/dist/components/grid.js +204 -0
- package/dist/components/group.d.ts +19 -0
- package/dist/components/group.js +45 -0
- package/dist/components/input-group.d.ts +15 -0
- package/dist/components/input-group.js +61 -0
- package/dist/components/input-otp.d.ts +24 -0
- package/dist/components/input-otp.js +50 -0
- package/dist/components/input-payment.d.ts +131 -0
- package/dist/components/input-payment.js +1140 -0
- package/dist/components/input-phone.d.ts +70 -0
- package/dist/components/input-phone.js +657 -0
- package/dist/components/input-sensitive.d.ts +12 -0
- package/dist/components/input-sensitive.js +169 -0
- package/dist/components/input.d.ts +13 -0
- package/dist/components/input.js +26 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +19 -0
- package/dist/components/kinetic-click.d.ts +48 -0
- package/dist/components/kinetic-click.js +1184 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +18 -0
- package/dist/components/list-box.d.ts +20 -0
- package/dist/components/list-box.js +148 -0
- package/dist/components/loader.d.ts +13 -0
- package/dist/components/loader.js +430 -0
- package/dist/components/marker.d.ts +15 -0
- package/dist/components/marker.js +59 -0
- package/dist/components/menu.d.ts +42 -0
- package/dist/components/menu.js +186 -0
- package/dist/components/menubar.d.ts +40 -0
- package/dist/components/menubar.js +107 -0
- package/dist/components/message.d.ts +33 -0
- package/dist/components/message.js +112 -0
- package/dist/components/meter.d.ts +10 -0
- package/dist/components/meter.js +42 -0
- package/dist/components/morphic-toast.d.ts +61 -0
- package/dist/components/morphic-toast.js +916 -0
- package/dist/components/navigation-menu.d.ts +26 -0
- package/dist/components/navigation-menu.js +116 -0
- package/dist/components/number-field.d.ts +15 -0
- package/dist/components/number-field.js +86 -0
- package/dist/components/option-picker.d.ts +18 -0
- package/dist/components/option-picker.js +89 -0
- package/dist/components/orb.d.ts +38 -0
- package/dist/components/orb.js +1413 -0
- package/dist/components/pagination.d.ts +25 -0
- package/dist/components/pagination.js +147 -0
- package/dist/components/popover.d.ts +22 -0
- package/dist/components/popover.js +79 -0
- package/dist/components/preview-card.d.ts +16 -0
- package/dist/components/preview-card.js +60 -0
- package/dist/components/progress.d.ts +21 -0
- package/dist/components/progress.js +139 -0
- package/dist/components/radio.d.ts +16 -0
- package/dist/components/radio.js +68 -0
- package/dist/components/resizable.d.ts +58 -0
- package/dist/components/resizable.js +964 -0
- package/dist/components/ruler-picker.d.ts +27 -0
- package/dist/components/ruler-picker.js +253 -0
- package/dist/components/scroll-area.d.ts +13 -0
- package/dist/components/scroll-area.js +34 -0
- package/dist/components/scroll-bar.d.ts +13 -0
- package/dist/components/scroll-bar.js +47 -0
- package/dist/components/select.d.ts +29 -0
- package/dist/components/select.js +140 -0
- package/dist/components/separator.d.ts +6 -0
- package/dist/components/separator.js +15 -0
- package/dist/components/sidebar.d.ts +65 -0
- package/dist/components/sidebar.js +408 -0
- package/dist/components/skeleton.d.ts +5 -0
- package/dist/components/skeleton.js +12 -0
- package/dist/components/slider.d.ts +12 -0
- package/dist/components/slider.js +96 -0
- package/dist/components/sortable.d.ts +44 -0
- package/dist/components/sortable.js +327 -0
- package/dist/components/switch.d.ts +15 -0
- package/dist/components/switch.js +63 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +65 -0
- package/dist/components/tabs.d.ts +12 -0
- package/dist/components/tabs.js +39 -0
- package/dist/components/text.d.ts +14 -0
- package/dist/components/text.js +69 -0
- package/dist/components/textarea.d.ts +9 -0
- package/dist/components/textarea.js +20 -0
- package/dist/components/theme-provider.d.ts +52 -0
- package/dist/components/theme-provider.js +148 -0
- package/dist/components/timeline.d.ts +34 -0
- package/dist/components/timeline.js +147 -0
- package/dist/components/toast.d.ts +17 -0
- package/dist/components/toast.js +161 -0
- package/dist/components/toggle-group.d.ts +14 -0
- package/dist/components/toggle-group.js +53 -0
- package/dist/components/toggle.d.ts +11 -0
- package/dist/components/toggle.js +36 -0
- package/dist/components/toolbar.d.ts +11 -0
- package/dist/components/toolbar.js +49 -0
- package/dist/components/tooltip.d.ts +17 -0
- package/dist/components/tooltip.js +56 -0
- package/dist/components/waveform.d.ts +61 -0
- package/dist/components/waveform.js +500 -0
- package/dist/components/wheel-picker.d.ts +44 -0
- package/dist/components/wheel-picker.js +771 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +9 -0
- package/dist/hooks/use-copy-to-clipboard.js +36 -0
- package/dist/hooks/use-media-query.d.ts +21 -0
- package/dist/hooks/use-media-query.js +58 -0
- package/dist/styles.css +202 -0
- package/dist/themes/afterglow.css +89 -0
- package/dist/themes/afterglow.scoped.css +90 -0
- package/dist/themes/blacklight.css +89 -0
- package/dist/themes/blacklight.scoped.css +90 -0
- package/dist/themes/cathode.css +89 -0
- package/dist/themes/cathode.scoped.css +90 -0
- package/dist/themes/cel.css +89 -0
- package/dist/themes/cel.scoped.css +90 -0
- package/dist/themes/cinder.css +89 -0
- package/dist/themes/cinder.scoped.css +90 -0
- package/dist/themes/clay.css +89 -0
- package/dist/themes/clay.scoped.css +90 -0
- package/dist/themes/cobalt.css +89 -0
- package/dist/themes/cobalt.scoped.css +90 -0
- package/dist/themes/crimson.css +89 -0
- package/dist/themes/crimson.scoped.css +90 -0
- package/dist/themes/ion.css +89 -0
- package/dist/themes/ion.scoped.css +90 -0
- package/dist/themes/iris.css +89 -0
- package/dist/themes/iris.scoped.css +90 -0
- package/dist/themes/lagoon.css +89 -0
- package/dist/themes/lagoon.scoped.css +90 -0
- package/dist/themes/mochi.css +89 -0
- package/dist/themes/mochi.scoped.css +90 -0
- package/dist/themes/riso.css +89 -0
- package/dist/themes/riso.scoped.css +90 -0
- package/dist/themes/roast.css +89 -0
- package/dist/themes/roast.scoped.css +90 -0
- package/dist/themes/sage.css +89 -0
- package/dist/themes/sage.scoped.css +90 -0
- package/dist/themes/sepia.css +89 -0
- package/dist/themes/sepia.scoped.css +90 -0
- package/dist/themes/sorbet.css +89 -0
- package/dist/themes/sorbet.scoped.css +90 -0
- package/dist/themes/taffy.css +89 -0
- package/dist/themes/taffy.scoped.css +90 -0
- package/dist/themes/toxin.css +89 -0
- package/dist/themes/toxin.scoped.css +90 -0
- package/package.json +140 -0
|
@@ -0,0 +1,1140 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Tabs, TabsList, TabsTab } from "./tabs.js";
|
|
3
|
+
import { cn } from "cn";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import * as React$1 from "react";
|
|
6
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
7
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
8
|
+
import { Input } from "@base-ui/react/input";
|
|
9
|
+
import { CreditCard } from "xiod-icons/icons/CreditCard";
|
|
10
|
+
import { Zap } from "xiod-icons/icons/Zap";
|
|
11
|
+
//#region src/components/input-payment.tsx
|
|
12
|
+
const CARD_TYPES = [
|
|
13
|
+
{
|
|
14
|
+
displayName: "Visa",
|
|
15
|
+
type: "visa",
|
|
16
|
+
startPattern: /^4/,
|
|
17
|
+
gaps: [
|
|
18
|
+
4,
|
|
19
|
+
8,
|
|
20
|
+
12
|
|
21
|
+
],
|
|
22
|
+
lengths: [
|
|
23
|
+
16,
|
|
24
|
+
18,
|
|
25
|
+
19
|
|
26
|
+
],
|
|
27
|
+
code: {
|
|
28
|
+
name: "CVV",
|
|
29
|
+
length: 3
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
displayName: "Mastercard",
|
|
34
|
+
type: "mastercard",
|
|
35
|
+
startPattern: /^(5[1-5]|677189)|^(222[1-9]|2[3-6]\d{2}|27[0-1]\d|2720)/,
|
|
36
|
+
gaps: [
|
|
37
|
+
4,
|
|
38
|
+
8,
|
|
39
|
+
12
|
|
40
|
+
],
|
|
41
|
+
lengths: [16],
|
|
42
|
+
code: {
|
|
43
|
+
name: "CVC",
|
|
44
|
+
length: 3
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
displayName: "American Express",
|
|
49
|
+
type: "amex",
|
|
50
|
+
startPattern: /^3[47]/,
|
|
51
|
+
gaps: [4, 10],
|
|
52
|
+
lengths: [15],
|
|
53
|
+
code: {
|
|
54
|
+
name: "CID",
|
|
55
|
+
length: 4
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
displayName: "RuPay",
|
|
60
|
+
type: "rupay",
|
|
61
|
+
startPattern: /^(508[5-9]|6069[89]|607[0-9]|608[0-3]|652[1-5]|652[89]|653[0-1]|6950|353|356)/,
|
|
62
|
+
gaps: [
|
|
63
|
+
4,
|
|
64
|
+
8,
|
|
65
|
+
12
|
|
66
|
+
],
|
|
67
|
+
lengths: [16],
|
|
68
|
+
code: {
|
|
69
|
+
name: "CVV",
|
|
70
|
+
length: 3
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
displayName: "UnionPay",
|
|
75
|
+
type: "unionpay",
|
|
76
|
+
startPattern: /^62/,
|
|
77
|
+
gaps: [
|
|
78
|
+
4,
|
|
79
|
+
8,
|
|
80
|
+
12
|
|
81
|
+
],
|
|
82
|
+
lengths: [
|
|
83
|
+
14,
|
|
84
|
+
15,
|
|
85
|
+
16,
|
|
86
|
+
17,
|
|
87
|
+
18,
|
|
88
|
+
19
|
|
89
|
+
],
|
|
90
|
+
code: {
|
|
91
|
+
name: "CVN",
|
|
92
|
+
length: 3
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
displayName: "Discover",
|
|
97
|
+
type: "discover",
|
|
98
|
+
startPattern: /^(6011|65|64[4-9]|622)/,
|
|
99
|
+
gaps: [
|
|
100
|
+
4,
|
|
101
|
+
8,
|
|
102
|
+
12
|
|
103
|
+
],
|
|
104
|
+
lengths: [16, 19],
|
|
105
|
+
code: {
|
|
106
|
+
name: "CID",
|
|
107
|
+
length: 3
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
displayName: "Diners Club",
|
|
112
|
+
type: "dinersclub",
|
|
113
|
+
startPattern: /^(36|38|30[0-5])/,
|
|
114
|
+
gaps: [4, 10],
|
|
115
|
+
lengths: [
|
|
116
|
+
14,
|
|
117
|
+
16,
|
|
118
|
+
19
|
|
119
|
+
],
|
|
120
|
+
code: {
|
|
121
|
+
name: "CVV",
|
|
122
|
+
length: 3
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
displayName: "JCB",
|
|
127
|
+
type: "jcb",
|
|
128
|
+
startPattern: /^35/,
|
|
129
|
+
gaps: [
|
|
130
|
+
4,
|
|
131
|
+
8,
|
|
132
|
+
12
|
|
133
|
+
],
|
|
134
|
+
lengths: [
|
|
135
|
+
16,
|
|
136
|
+
17,
|
|
137
|
+
18,
|
|
138
|
+
19
|
|
139
|
+
],
|
|
140
|
+
code: {
|
|
141
|
+
name: "CVV",
|
|
142
|
+
length: 3
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
displayName: "Mir",
|
|
147
|
+
type: "mir",
|
|
148
|
+
startPattern: /^220[0-4]/,
|
|
149
|
+
gaps: [
|
|
150
|
+
4,
|
|
151
|
+
8,
|
|
152
|
+
12
|
|
153
|
+
],
|
|
154
|
+
lengths: [16],
|
|
155
|
+
code: {
|
|
156
|
+
name: "CVC",
|
|
157
|
+
length: 3
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
];
|
|
161
|
+
const DEFAULT_CARD_TYPE = {
|
|
162
|
+
displayName: "Unknown",
|
|
163
|
+
type: "unknown",
|
|
164
|
+
startPattern: /^/,
|
|
165
|
+
gaps: [
|
|
166
|
+
4,
|
|
167
|
+
8,
|
|
168
|
+
12
|
|
169
|
+
],
|
|
170
|
+
lengths: [16],
|
|
171
|
+
code: {
|
|
172
|
+
name: "CVC",
|
|
173
|
+
length: 3
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
function getCardTypeByValue(cardNumber) {
|
|
177
|
+
const clean = cardNumber.replace(/\D/g, "");
|
|
178
|
+
if (!clean) return DEFAULT_CARD_TYPE;
|
|
179
|
+
return CARD_TYPES.find((cardType) => cardType.startPattern.test(clean)) || DEFAULT_CARD_TYPE;
|
|
180
|
+
}
|
|
181
|
+
function detectBrand(cardNumber) {
|
|
182
|
+
return getCardTypeByValue(cardNumber).type;
|
|
183
|
+
}
|
|
184
|
+
const UPI_HANDLE_MAP = {
|
|
185
|
+
okaxis: "gpay",
|
|
186
|
+
okicici: "gpay",
|
|
187
|
+
oksbi: "gpay",
|
|
188
|
+
okhdfcbank: "gpay",
|
|
189
|
+
ybl: "phonepe",
|
|
190
|
+
ibl: "phonepe",
|
|
191
|
+
axl: "phonepe",
|
|
192
|
+
paytm: "paytm",
|
|
193
|
+
ptaxis: "paytm",
|
|
194
|
+
ptyes: "paytm",
|
|
195
|
+
ptsbi: "paytm",
|
|
196
|
+
pthdfc: "paytm",
|
|
197
|
+
apl: "amazonpay",
|
|
198
|
+
yapl: "amazonpay",
|
|
199
|
+
rapl: "amazonpay",
|
|
200
|
+
upi: "bhim",
|
|
201
|
+
cred: "cred",
|
|
202
|
+
axisb: "cred",
|
|
203
|
+
yescred: "cred",
|
|
204
|
+
yescurie: "cred",
|
|
205
|
+
waicici: "whatsapp"
|
|
206
|
+
};
|
|
207
|
+
function validateUpiId(vpa) {
|
|
208
|
+
const clean = vpa.trim();
|
|
209
|
+
if (!clean) return false;
|
|
210
|
+
return /^[a-zA-Z0-9._-]{2,256}@[a-zA-Z]{2,64}$/.test(clean);
|
|
211
|
+
}
|
|
212
|
+
function detectUpiProvider(vpa) {
|
|
213
|
+
const clean = vpa.trim().toLowerCase();
|
|
214
|
+
if (!clean.includes("@")) return "generic";
|
|
215
|
+
const handle = clean.split("@")[1];
|
|
216
|
+
if (!handle) return "generic";
|
|
217
|
+
return UPI_HANDLE_MAP[handle] || "generic";
|
|
218
|
+
}
|
|
219
|
+
function getUpiError(vpa) {
|
|
220
|
+
const clean = vpa.trim();
|
|
221
|
+
if (!clean) return "UPI ID is required";
|
|
222
|
+
if (!clean.includes("@")) return "UPI ID must contain '@' (e.g. user@bank)";
|
|
223
|
+
if (!validateUpiId(clean)) return "Invalid UPI ID format";
|
|
224
|
+
}
|
|
225
|
+
function validateLuhn(cardNumber) {
|
|
226
|
+
const clean = cardNumber.replace(/\D/g, "");
|
|
227
|
+
if (!clean || clean.length < 12) return false;
|
|
228
|
+
let sum = 0;
|
|
229
|
+
let shouldDouble = false;
|
|
230
|
+
for (let i = clean.length - 1; i >= 0; i--) {
|
|
231
|
+
let digit = parseInt(clean.charAt(i), 10);
|
|
232
|
+
if (shouldDouble) {
|
|
233
|
+
digit *= 2;
|
|
234
|
+
if (digit > 9) digit -= 9;
|
|
235
|
+
}
|
|
236
|
+
sum += digit;
|
|
237
|
+
shouldDouble = !shouldDouble;
|
|
238
|
+
}
|
|
239
|
+
return sum % 10 === 0;
|
|
240
|
+
}
|
|
241
|
+
function formatCardNumber(cardNumber, cardTypeConfig) {
|
|
242
|
+
const clean = cardNumber.replace(/\D/g, "");
|
|
243
|
+
if (!clean) return "";
|
|
244
|
+
const cardType = cardTypeConfig || getCardTypeByValue(clean);
|
|
245
|
+
const maxLen = cardType.lengths[cardType.lengths.length - 1] || 19;
|
|
246
|
+
const trimmed = clean.slice(0, maxLen);
|
|
247
|
+
const gaps = cardType.gaps || [
|
|
248
|
+
4,
|
|
249
|
+
8,
|
|
250
|
+
12
|
|
251
|
+
];
|
|
252
|
+
let formatted = "";
|
|
253
|
+
for (let i = 0; i < trimmed.length; i++) {
|
|
254
|
+
if (gaps.includes(i) && i > 0) formatted += " ";
|
|
255
|
+
formatted += trimmed[i];
|
|
256
|
+
}
|
|
257
|
+
return formatted;
|
|
258
|
+
}
|
|
259
|
+
function formatExpiry(value) {
|
|
260
|
+
const clean = value.replace(/\D/g, "");
|
|
261
|
+
if (!clean) return "";
|
|
262
|
+
if (clean.length === 1) {
|
|
263
|
+
if (clean[0] !== "0" && clean[0] !== "1") return `0${clean[0]}/`;
|
|
264
|
+
return clean;
|
|
265
|
+
}
|
|
266
|
+
const month = clean.slice(0, 2);
|
|
267
|
+
const year = clean.slice(2, 4);
|
|
268
|
+
let formattedMonth = month;
|
|
269
|
+
const monthNum = parseInt(month, 10);
|
|
270
|
+
if (monthNum > 12) formattedMonth = "12";
|
|
271
|
+
else if (monthNum === 0 && clean.length >= 2) formattedMonth = "01";
|
|
272
|
+
if (clean.length > 2) return `${formattedMonth}/${year}`;
|
|
273
|
+
if (clean.length === 2) return `${formattedMonth}/`;
|
|
274
|
+
return formattedMonth;
|
|
275
|
+
}
|
|
276
|
+
function getCardNumberError(cardNumber) {
|
|
277
|
+
const clean = cardNumber.replace(/\D/g, "");
|
|
278
|
+
if (!clean) return "Card number is required";
|
|
279
|
+
if (!getCardTypeByValue(clean).lengths.includes(clean.length)) return "Card number length is invalid";
|
|
280
|
+
if (!validateLuhn(clean)) return "Card number checksum is invalid";
|
|
281
|
+
}
|
|
282
|
+
function getExpiryDateError(expiryDate) {
|
|
283
|
+
const clean = expiryDate.replace(/\D/g, "");
|
|
284
|
+
if (!clean) return "Expiry date is required";
|
|
285
|
+
if (clean.length < 4) return "Expiry date must be MM/YY";
|
|
286
|
+
const month = parseInt(clean.slice(0, 2), 10);
|
|
287
|
+
const year = parseInt(`20${clean.slice(2, 4)}`, 10);
|
|
288
|
+
const now = /* @__PURE__ */ new Date();
|
|
289
|
+
const currentYear = now.getFullYear();
|
|
290
|
+
const currentMonth = now.getMonth() + 1;
|
|
291
|
+
if (month < 1 || month > 12) return "Expiry month must be 01–12";
|
|
292
|
+
if (year < currentYear) return "Expiry year is in the past";
|
|
293
|
+
if (year === currentYear && month < currentMonth) return "Expiry date is in the past";
|
|
294
|
+
}
|
|
295
|
+
function getCvcError(cvc, cardTypeConfig) {
|
|
296
|
+
const clean = cvc.replace(/\D/g, "");
|
|
297
|
+
if (!clean) return "CVC is required";
|
|
298
|
+
const expectedLength = cardTypeConfig?.code.length || 3;
|
|
299
|
+
if (clean.length !== expectedLength) return `CVC must be ${expectedLength} digits`;
|
|
300
|
+
}
|
|
301
|
+
function getZipError(zip) {
|
|
302
|
+
const clean = zip.trim();
|
|
303
|
+
if (!clean) return "ZIP code is required";
|
|
304
|
+
if (clean.length < 3 || clean.length > 10) return "ZIP code is invalid";
|
|
305
|
+
}
|
|
306
|
+
const InputPaymentContext = React$1.createContext(null);
|
|
307
|
+
function useInputPaymentContext() {
|
|
308
|
+
const context = React$1.useContext(InputPaymentContext);
|
|
309
|
+
if (!context) throw new Error("InputPayment subcomponents must be rendered within an <InputPayment> provider component.");
|
|
310
|
+
return context;
|
|
311
|
+
}
|
|
312
|
+
const usePaymentInputContext = useInputPaymentContext;
|
|
313
|
+
const useInputPayment = useInputPaymentContext;
|
|
314
|
+
const usePaymentInput = useInputPaymentContext;
|
|
315
|
+
function InputPayment({ paymentMethod: paymentMethodProp, defaultPaymentMethod = "card", onPaymentMethodChange, cardNumber: cardNumberProp, defaultCardNumber = "", onCardNumberChange, cardExpiry: cardExpiryProp, defaultCardExpiry = "", onCardExpiryChange, cardCvc: cardCvcProp, defaultCardCvc = "", onCardCvcChange, cardZip: cardZipProp, defaultCardZip = "", onCardZipChange, upiId: upiIdProp, defaultUpiId = "", onUpiIdChange, disabled = false, readOnly = false, autoFocusNext = true, onValidationChange, children, ...props }) {
|
|
316
|
+
const [internalPaymentMethod, setInternalPaymentMethod] = React$1.useState(defaultPaymentMethod);
|
|
317
|
+
const [internalCardNumber, setInternalCardNumber] = React$1.useState(defaultCardNumber);
|
|
318
|
+
const [internalCardExpiry, setInternalCardExpiry] = React$1.useState(defaultCardExpiry);
|
|
319
|
+
const [internalCardCvc, setInternalCardCvc] = React$1.useState(defaultCardCvc);
|
|
320
|
+
const [internalCardZip, setInternalCardZip] = React$1.useState(defaultCardZip);
|
|
321
|
+
const [internalUpiId, setInternalUpiId] = React$1.useState(defaultUpiId);
|
|
322
|
+
const [isInGroup, setIsInGroup] = React$1.useState(false);
|
|
323
|
+
const cardNumberRef = React$1.useRef(null);
|
|
324
|
+
const expiryRef = React$1.useRef(null);
|
|
325
|
+
const cvcRef = React$1.useRef(null);
|
|
326
|
+
const zipRef = React$1.useRef(null);
|
|
327
|
+
const upiRef = React$1.useRef(null);
|
|
328
|
+
const paymentMethod = paymentMethodProp ?? internalPaymentMethod;
|
|
329
|
+
const cardNumber = cardNumberProp ?? internalCardNumber;
|
|
330
|
+
const cardExpiry = cardExpiryProp ?? internalCardExpiry;
|
|
331
|
+
const cardCvc = cardCvcProp ?? internalCardCvc;
|
|
332
|
+
const cardZip = cardZipProp ?? internalCardZip;
|
|
333
|
+
const upiId = upiIdProp ?? internalUpiId;
|
|
334
|
+
const cardType = React$1.useMemo(() => getCardTypeByValue(cardNumber), [cardNumber]);
|
|
335
|
+
const brand = cardType.type;
|
|
336
|
+
const upiProvider = React$1.useMemo(() => detectUpiProvider(upiId), [upiId]);
|
|
337
|
+
const isLuhnValid = React$1.useMemo(() => validateLuhn(cardNumber), [cardNumber]);
|
|
338
|
+
const setPaymentMethod = React$1.useCallback((method) => {
|
|
339
|
+
if (paymentMethodProp === void 0) setInternalPaymentMethod(method);
|
|
340
|
+
onPaymentMethodChange?.(method);
|
|
341
|
+
}, [paymentMethodProp, onPaymentMethodChange]);
|
|
342
|
+
const errors = React$1.useMemo(() => {
|
|
343
|
+
const errs = {};
|
|
344
|
+
if (paymentMethod === "card") {
|
|
345
|
+
if (cardNumber) errs.cardNumber = getCardNumberError(cardNumber);
|
|
346
|
+
if (cardExpiry) errs.expiryDate = getExpiryDateError(cardExpiry);
|
|
347
|
+
if (cardCvc) errs.cvc = getCvcError(cardCvc, cardType);
|
|
348
|
+
if (cardZip) errs.zip = getZipError(cardZip);
|
|
349
|
+
} else if (paymentMethod === "upi") {
|
|
350
|
+
if (upiId) errs.upi = getUpiError(upiId);
|
|
351
|
+
}
|
|
352
|
+
return errs;
|
|
353
|
+
}, [
|
|
354
|
+
paymentMethod,
|
|
355
|
+
cardNumber,
|
|
356
|
+
cardExpiry,
|
|
357
|
+
cardCvc,
|
|
358
|
+
cardZip,
|
|
359
|
+
upiId,
|
|
360
|
+
cardType
|
|
361
|
+
]);
|
|
362
|
+
const isValid = React$1.useMemo(() => {
|
|
363
|
+
if (paymentMethod === "card") return Boolean(cardNumber) && Boolean(cardExpiry) && Boolean(cardCvc) && !errors.cardNumber && !errors.expiryDate && !errors.cvc && !errors.zip;
|
|
364
|
+
if (paymentMethod === "upi") return Boolean(upiId) && validateUpiId(upiId);
|
|
365
|
+
return false;
|
|
366
|
+
}, [
|
|
367
|
+
paymentMethod,
|
|
368
|
+
cardNumber,
|
|
369
|
+
cardExpiry,
|
|
370
|
+
cardCvc,
|
|
371
|
+
upiId,
|
|
372
|
+
errors
|
|
373
|
+
]);
|
|
374
|
+
React$1.useEffect(() => {
|
|
375
|
+
onValidationChange?.(isValid, errors);
|
|
376
|
+
}, [
|
|
377
|
+
isValid,
|
|
378
|
+
errors,
|
|
379
|
+
onValidationChange
|
|
380
|
+
]);
|
|
381
|
+
const setCardNumber = React$1.useCallback((val) => {
|
|
382
|
+
const clean = val.replace(/\D/g, "");
|
|
383
|
+
const detected = getCardTypeByValue(clean);
|
|
384
|
+
const formatted = formatCardNumber(clean, detected);
|
|
385
|
+
if (cardNumberProp === void 0) setInternalCardNumber(formatted);
|
|
386
|
+
onCardNumberChange?.(formatted);
|
|
387
|
+
if (autoFocusNext && detected.lengths.includes(clean.length) && validateLuhn(clean)) expiryRef.current?.focus();
|
|
388
|
+
}, [
|
|
389
|
+
cardNumberProp,
|
|
390
|
+
onCardNumberChange,
|
|
391
|
+
autoFocusNext
|
|
392
|
+
]);
|
|
393
|
+
const setCardExpiry = React$1.useCallback((val) => {
|
|
394
|
+
const formatted = formatExpiry(val);
|
|
395
|
+
if (cardExpiryProp === void 0) setInternalCardExpiry(formatted);
|
|
396
|
+
onCardExpiryChange?.(formatted);
|
|
397
|
+
const clean = formatted.replace(/\D/g, "");
|
|
398
|
+
if (autoFocusNext && clean.length === 4 && !getExpiryDateError(formatted)) cvcRef.current?.focus();
|
|
399
|
+
}, [
|
|
400
|
+
cardExpiryProp,
|
|
401
|
+
onCardExpiryChange,
|
|
402
|
+
autoFocusNext
|
|
403
|
+
]);
|
|
404
|
+
const setCardCvc = React$1.useCallback((val) => {
|
|
405
|
+
const clean = val.replace(/\D/g, "");
|
|
406
|
+
const limit = cardType.code.length;
|
|
407
|
+
const truncated = clean.slice(0, limit);
|
|
408
|
+
if (cardCvcProp === void 0) setInternalCardCvc(truncated);
|
|
409
|
+
onCardCvcChange?.(truncated);
|
|
410
|
+
if (autoFocusNext && truncated.length === limit && zipRef.current) zipRef.current.focus();
|
|
411
|
+
}, [
|
|
412
|
+
cardCvcProp,
|
|
413
|
+
onCardCvcChange,
|
|
414
|
+
cardType,
|
|
415
|
+
autoFocusNext
|
|
416
|
+
]);
|
|
417
|
+
const setCardZip = React$1.useCallback((val) => {
|
|
418
|
+
if (cardZipProp === void 0) setInternalCardZip(val);
|
|
419
|
+
onCardZipChange?.(val);
|
|
420
|
+
}, [cardZipProp, onCardZipChange]);
|
|
421
|
+
const setUpiId = React$1.useCallback((val) => {
|
|
422
|
+
if (upiIdProp === void 0) setInternalUpiId(val);
|
|
423
|
+
onUpiIdChange?.(val);
|
|
424
|
+
}, [upiIdProp, onUpiIdChange]);
|
|
425
|
+
const contextValue = React$1.useMemo(() => ({
|
|
426
|
+
paymentMethod,
|
|
427
|
+
setPaymentMethod,
|
|
428
|
+
cardNumber,
|
|
429
|
+
cardExpiry,
|
|
430
|
+
cardCvc,
|
|
431
|
+
cardZip,
|
|
432
|
+
upiId,
|
|
433
|
+
brand,
|
|
434
|
+
cardType,
|
|
435
|
+
upiProvider,
|
|
436
|
+
disabled,
|
|
437
|
+
readOnly,
|
|
438
|
+
isInGroup,
|
|
439
|
+
autoFocusNext,
|
|
440
|
+
isLuhnValid,
|
|
441
|
+
errors,
|
|
442
|
+
isValid,
|
|
443
|
+
cardNumberRef,
|
|
444
|
+
expiryRef,
|
|
445
|
+
cvcRef,
|
|
446
|
+
zipRef,
|
|
447
|
+
upiRef,
|
|
448
|
+
setCardNumber,
|
|
449
|
+
setCardExpiry,
|
|
450
|
+
setCardCvc,
|
|
451
|
+
setCardZip,
|
|
452
|
+
setUpiId
|
|
453
|
+
}), [
|
|
454
|
+
paymentMethod,
|
|
455
|
+
setPaymentMethod,
|
|
456
|
+
cardNumber,
|
|
457
|
+
cardExpiry,
|
|
458
|
+
cardCvc,
|
|
459
|
+
cardZip,
|
|
460
|
+
upiId,
|
|
461
|
+
brand,
|
|
462
|
+
cardType,
|
|
463
|
+
upiProvider,
|
|
464
|
+
disabled,
|
|
465
|
+
readOnly,
|
|
466
|
+
isInGroup,
|
|
467
|
+
autoFocusNext,
|
|
468
|
+
isLuhnValid,
|
|
469
|
+
errors,
|
|
470
|
+
isValid,
|
|
471
|
+
setCardNumber,
|
|
472
|
+
setCardExpiry,
|
|
473
|
+
setCardCvc,
|
|
474
|
+
setCardZip,
|
|
475
|
+
setUpiId
|
|
476
|
+
]);
|
|
477
|
+
const providerRef = React$1.useRef(null);
|
|
478
|
+
React$1.useEffect(() => {
|
|
479
|
+
if (providerRef.current?.querySelector("[data-slot=\"input-payment-group\"],[data-slot=\"input-payment-upi-group\"]")) setIsInGroup(true);
|
|
480
|
+
}, []);
|
|
481
|
+
return /* @__PURE__ */ jsx(InputPaymentContext.Provider, {
|
|
482
|
+
value: contextValue,
|
|
483
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
484
|
+
ref: providerRef,
|
|
485
|
+
className: "contents",
|
|
486
|
+
...props,
|
|
487
|
+
children
|
|
488
|
+
})
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
function InputPaymentMethodSelector({ className, ...props }) {
|
|
492
|
+
const { disabled, paymentMethod, readOnly, setPaymentMethod } = useInputPaymentContext();
|
|
493
|
+
return /* @__PURE__ */ jsx(Tabs, {
|
|
494
|
+
value: paymentMethod,
|
|
495
|
+
onValueChange: (val) => setPaymentMethod(val),
|
|
496
|
+
className: cn("w-full", className),
|
|
497
|
+
"data-slot": "input-payment-method-selector",
|
|
498
|
+
...props,
|
|
499
|
+
children: /* @__PURE__ */ jsxs(TabsList, {
|
|
500
|
+
"aria-label": "Payment method",
|
|
501
|
+
className: "grid w-full grid-cols-2",
|
|
502
|
+
children: [/* @__PURE__ */ jsxs(TabsTab, {
|
|
503
|
+
disabled: disabled || readOnly,
|
|
504
|
+
value: "card",
|
|
505
|
+
className: "pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11",
|
|
506
|
+
children: [/* @__PURE__ */ jsx(CreditCard, { className: "size-4 shrink-0" }), /* @__PURE__ */ jsx("span", { children: "Card" })]
|
|
507
|
+
}), /* @__PURE__ */ jsxs(TabsTab, {
|
|
508
|
+
disabled: disabled || readOnly,
|
|
509
|
+
value: "upi",
|
|
510
|
+
className: "pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11",
|
|
511
|
+
children: [/* @__PURE__ */ jsx(Zap, { className: "size-4 shrink-0 text-amber-500 fill-amber-500/20" }), /* @__PURE__ */ jsx("span", { children: "UPI" })]
|
|
512
|
+
})]
|
|
513
|
+
})
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
function InputPaymentGroup({ className, render, ...props }) {
|
|
517
|
+
const { errors } = useInputPaymentContext();
|
|
518
|
+
const hasError = Boolean(errors.cardNumber || errors.expiryDate || errors.cvc || errors.zip);
|
|
519
|
+
const defaultProps = {
|
|
520
|
+
className: cn("group/container relative inline-flex h-10 sm:h-9 w-full items-center gap-2 rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-within:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-within:has-aria-invalid:border-destructive/64 has-focus-within:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-within:border-ring has-disabled:opacity-64 has-[:disabled,:focus-within,[aria-invalid]]:shadow-none has-focus-within:ring-[3px] px-[calc(--spacing(3)-1px)] sm:text-sm dark:bg-input/32 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:not-has-focus-within:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
|
|
521
|
+
"aria-invalid": hasError ? true : void 0,
|
|
522
|
+
"data-slot": "input-payment-group"
|
|
523
|
+
};
|
|
524
|
+
return useRender({
|
|
525
|
+
defaultTagName: "div",
|
|
526
|
+
props: mergeProps(defaultProps, props),
|
|
527
|
+
render
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
function InputPaymentUpiGroup({ className, render, ...props }) {
|
|
531
|
+
const { errors } = useInputPaymentContext();
|
|
532
|
+
const hasError = Boolean(errors.upi);
|
|
533
|
+
const defaultProps = {
|
|
534
|
+
className: cn("group/container relative inline-flex h-10 sm:h-9 w-full items-center gap-2 rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-has-focus-within:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-within:has-aria-invalid:border-destructive/64 has-focus-within:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-within:border-ring has-disabled:opacity-64 has-[:disabled,:focus-within,[aria-invalid]]:shadow-none has-focus-within:ring-[3px] px-[calc(--spacing(3)-1px)] sm:text-sm dark:bg-input/32 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:not-has-focus-within:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
|
|
535
|
+
"aria-invalid": hasError ? true : void 0,
|
|
536
|
+
"data-slot": "input-payment-upi-group"
|
|
537
|
+
};
|
|
538
|
+
return useRender({
|
|
539
|
+
defaultTagName: "div",
|
|
540
|
+
props: mergeProps(defaultProps, props),
|
|
541
|
+
render
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
function InputPaymentCardNumber({ className, size = "default", onChange, ref, ...props }) {
|
|
545
|
+
const { cardNumber, setCardNumber, disabled, readOnly, isInGroup, cardNumberRef, errors } = useInputPaymentContext();
|
|
546
|
+
const handleRef = (node) => {
|
|
547
|
+
cardNumberRef.current = node;
|
|
548
|
+
if (typeof ref === "function") ref(node);
|
|
549
|
+
else if (ref) ref.current = node;
|
|
550
|
+
};
|
|
551
|
+
const handleChange = (e) => {
|
|
552
|
+
setCardNumber(e.target.value);
|
|
553
|
+
onChange?.(e);
|
|
554
|
+
};
|
|
555
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
556
|
+
"data-size": typeof size === "string" ? size : void 0,
|
|
557
|
+
ref: handleRef,
|
|
558
|
+
type: "tel",
|
|
559
|
+
inputMode: "numeric",
|
|
560
|
+
size: typeof size === "number" ? size : void 0,
|
|
561
|
+
autoComplete: "cc-number",
|
|
562
|
+
value: cardNumber,
|
|
563
|
+
onChange: handleChange,
|
|
564
|
+
disabled,
|
|
565
|
+
readOnly,
|
|
566
|
+
placeholder: "Card number",
|
|
567
|
+
"aria-label": "Card number",
|
|
568
|
+
"aria-invalid": errors.cardNumber ? true : void 0,
|
|
569
|
+
className: cn("w-full bg-transparent font-mono outline-none caret-foreground placeholder:text-muted-foreground/60 text-foreground", isInGroup ? "border-0 p-0 shadow-none ring-0 focus-visible:ring-0" : "h-10 sm:h-9 rounded-lg border border-input px-3 text-sm shadow-xs/5 ring-ring/24 focus-visible:border-ring focus-visible:ring-[3px]", className),
|
|
570
|
+
...props
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
function InputPaymentExpiry({ className, size = "default", onChange, onKeyDown, ref, ...props }) {
|
|
574
|
+
const { cardExpiry, setCardExpiry, disabled, readOnly, isInGroup, expiryRef, cardNumberRef, autoFocusNext, errors } = useInputPaymentContext();
|
|
575
|
+
const handleRef = (node) => {
|
|
576
|
+
expiryRef.current = node;
|
|
577
|
+
if (typeof ref === "function") ref(node);
|
|
578
|
+
else if (ref) ref.current = node;
|
|
579
|
+
};
|
|
580
|
+
const handleChange = (e) => {
|
|
581
|
+
setCardExpiry(e.target.value);
|
|
582
|
+
onChange?.(e);
|
|
583
|
+
};
|
|
584
|
+
const handleKeyDown = (e) => {
|
|
585
|
+
onKeyDown?.(e);
|
|
586
|
+
if (e.key === "Backspace" && !cardExpiry && autoFocusNext) cardNumberRef.current?.focus();
|
|
587
|
+
};
|
|
588
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
589
|
+
"data-size": typeof size === "string" ? size : void 0,
|
|
590
|
+
ref: handleRef,
|
|
591
|
+
type: "tel",
|
|
592
|
+
inputMode: "numeric",
|
|
593
|
+
size: typeof size === "number" ? size : void 0,
|
|
594
|
+
autoComplete: "cc-exp",
|
|
595
|
+
value: cardExpiry,
|
|
596
|
+
onChange: handleChange,
|
|
597
|
+
onKeyDown: handleKeyDown,
|
|
598
|
+
disabled,
|
|
599
|
+
readOnly,
|
|
600
|
+
placeholder: "MM/YY",
|
|
601
|
+
"aria-label": "Expiration date",
|
|
602
|
+
"aria-invalid": errors.expiryDate ? true : void 0,
|
|
603
|
+
className: cn("w-16 bg-transparent text-center font-mono outline-none caret-foreground placeholder:text-muted-foreground/60 text-foreground", isInGroup ? "border-0 p-0 shadow-none ring-0 focus-visible:ring-0" : "h-10 sm:h-9 rounded-lg border border-input px-2 text-sm shadow-xs/5 ring-ring/24 focus-visible:border-ring focus-visible:ring-[3px]", className),
|
|
604
|
+
...props
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
function InputPaymentCVC({ className, size = "default", onChange, onKeyDown, ref, ...props }) {
|
|
608
|
+
const { cardCvc, setCardCvc, disabled, readOnly, isInGroup, cvcRef, expiryRef, cardType, autoFocusNext, errors } = useInputPaymentContext();
|
|
609
|
+
const handleRef = (node) => {
|
|
610
|
+
cvcRef.current = node;
|
|
611
|
+
if (typeof ref === "function") ref(node);
|
|
612
|
+
else if (ref) ref.current = node;
|
|
613
|
+
};
|
|
614
|
+
const handleChange = (e) => {
|
|
615
|
+
setCardCvc(e.target.value);
|
|
616
|
+
onChange?.(e);
|
|
617
|
+
};
|
|
618
|
+
const handleKeyDown = (e) => {
|
|
619
|
+
onKeyDown?.(e);
|
|
620
|
+
if (e.key === "Backspace" && !cardCvc && autoFocusNext) expiryRef.current?.focus();
|
|
621
|
+
};
|
|
622
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
623
|
+
"data-size": typeof size === "string" ? size : void 0,
|
|
624
|
+
ref: handleRef,
|
|
625
|
+
type: "tel",
|
|
626
|
+
inputMode: "numeric",
|
|
627
|
+
size: typeof size === "number" ? size : void 0,
|
|
628
|
+
autoComplete: "cc-csc",
|
|
629
|
+
value: cardCvc,
|
|
630
|
+
onChange: handleChange,
|
|
631
|
+
onKeyDown: handleKeyDown,
|
|
632
|
+
disabled,
|
|
633
|
+
readOnly,
|
|
634
|
+
placeholder: cardType.code.name,
|
|
635
|
+
"aria-label": cardType.code.name,
|
|
636
|
+
maxLength: cardType.code.length,
|
|
637
|
+
"aria-invalid": errors.cvc ? true : void 0,
|
|
638
|
+
className: cn("w-14 bg-transparent text-center font-mono outline-none caret-foreground placeholder:text-muted-foreground/60 text-foreground", isInGroup ? "border-0 p-0 shadow-none ring-0 focus-visible:ring-0" : "h-10 sm:h-9 rounded-lg border border-input px-2 text-sm shadow-xs/5 ring-ring/24 focus-visible:border-ring focus-visible:ring-[3px]", className),
|
|
639
|
+
...props
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
function InputPaymentZip({ className, size = "default", onChange, onKeyDown, ref, ...props }) {
|
|
643
|
+
const { cardZip, setCardZip, disabled, readOnly, isInGroup, zipRef, cvcRef, autoFocusNext, errors } = useInputPaymentContext();
|
|
644
|
+
const handleRef = (node) => {
|
|
645
|
+
zipRef.current = node;
|
|
646
|
+
if (typeof ref === "function") ref(node);
|
|
647
|
+
else if (ref) ref.current = node;
|
|
648
|
+
};
|
|
649
|
+
const handleChange = (e) => {
|
|
650
|
+
setCardZip(e.target.value);
|
|
651
|
+
onChange?.(e);
|
|
652
|
+
};
|
|
653
|
+
const handleKeyDown = (e) => {
|
|
654
|
+
onKeyDown?.(e);
|
|
655
|
+
if (e.key === "Backspace" && !cardZip && autoFocusNext) cvcRef.current?.focus();
|
|
656
|
+
};
|
|
657
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
658
|
+
"data-size": typeof size === "string" ? size : void 0,
|
|
659
|
+
ref: handleRef,
|
|
660
|
+
type: "text",
|
|
661
|
+
size: typeof size === "number" ? size : void 0,
|
|
662
|
+
autoComplete: "postal-code",
|
|
663
|
+
value: cardZip,
|
|
664
|
+
onChange: handleChange,
|
|
665
|
+
onKeyDown: handleKeyDown,
|
|
666
|
+
disabled,
|
|
667
|
+
readOnly,
|
|
668
|
+
placeholder: "ZIP",
|
|
669
|
+
"aria-label": "Postal code",
|
|
670
|
+
maxLength: 10,
|
|
671
|
+
"aria-invalid": errors.zip ? true : void 0,
|
|
672
|
+
className: cn("w-16 bg-transparent text-center font-mono outline-none caret-foreground placeholder:text-muted-foreground/60 text-foreground", isInGroup ? "border-0 p-0 shadow-none ring-0 focus-visible:ring-0" : "h-10 sm:h-9 rounded-lg border border-input px-2 text-sm shadow-xs/5 ring-ring/24 focus-visible:border-ring focus-visible:ring-[3px]", className),
|
|
673
|
+
...props
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
function InputPaymentUpiId({ className, size = "default", onChange, ref, ...props }) {
|
|
677
|
+
const { upiId, setUpiId, disabled, readOnly, isInGroup, upiRef, errors } = useInputPaymentContext();
|
|
678
|
+
const handleRef = (node) => {
|
|
679
|
+
upiRef.current = node;
|
|
680
|
+
if (typeof ref === "function") ref(node);
|
|
681
|
+
else if (ref) ref.current = node;
|
|
682
|
+
};
|
|
683
|
+
const handleChange = (e) => {
|
|
684
|
+
setUpiId(e.target.value);
|
|
685
|
+
onChange?.(e);
|
|
686
|
+
};
|
|
687
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
688
|
+
"data-size": typeof size === "string" ? size : void 0,
|
|
689
|
+
ref: handleRef,
|
|
690
|
+
type: "text",
|
|
691
|
+
inputMode: "email",
|
|
692
|
+
size: typeof size === "number" ? size : void 0,
|
|
693
|
+
autoComplete: "off",
|
|
694
|
+
autoCapitalize: "off",
|
|
695
|
+
value: upiId,
|
|
696
|
+
onChange: handleChange,
|
|
697
|
+
disabled,
|
|
698
|
+
readOnly,
|
|
699
|
+
placeholder: "username@bank (e.g. john@okaxis)",
|
|
700
|
+
"aria-label": "UPI ID",
|
|
701
|
+
"aria-invalid": errors.upi ? true : void 0,
|
|
702
|
+
className: cn("w-full bg-transparent font-mono outline-none caret-foreground placeholder:text-muted-foreground/60 text-foreground", isInGroup ? "border-0 p-0 shadow-none ring-0 focus-visible:ring-0" : "h-10 sm:h-9 rounded-lg border border-input px-3 text-sm shadow-xs/5 ring-ring/24 focus-visible:border-ring focus-visible:ring-[3px]", className),
|
|
703
|
+
...props
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
function InputPaymentBrandIcon({ className, render, ...props }) {
|
|
707
|
+
const { brand } = useInputPaymentContext();
|
|
708
|
+
const defaultProps = {
|
|
709
|
+
className: cn("flex items-center justify-center shrink-0 w-8 select-none", className),
|
|
710
|
+
"data-slot": "input-payment-brand-icon"
|
|
711
|
+
};
|
|
712
|
+
const getBrandSvg = () => {
|
|
713
|
+
switch (brand) {
|
|
714
|
+
case "visa": return /* @__PURE__ */ jsxs("svg", {
|
|
715
|
+
viewBox: "0 0 24 24",
|
|
716
|
+
className: "w-6 h-4",
|
|
717
|
+
children: [
|
|
718
|
+
/* @__PURE__ */ jsx("title", { children: "Visa" }),
|
|
719
|
+
/* @__PURE__ */ jsx("path", {
|
|
720
|
+
d: "M9.6 15.6h1.7l1.1-6.4H10.7l-1.1 6.4zm4.2-6.4c-.6-.3-1.1-.4-1.1-.8 0-.3.3-.5.9-.5.6 0 1 .2 1.3.3l.2-1.5c-.4-.1-1-.3-1.8-.3-1.9 0-3.3 1-3.3 2.5 0 1.1 1 1.7 1.7 2 .7.4 1 .6 1 .9 0 .5-.6.7-1.1.7-.8 0-1.3-.2-1.8-.4l-.2 1.5c.5.2 1.3.4 2.1.4 2 0 3.3-1 3.3-2.5 0-1.6-2.6-1.7-2.6-2.3zm7.1 3.2c.1-.3.6-1.7.6-1.7s.1-.3.2-.7l-.1-.1s-.5 2.5-.5 2.5h-1.3l-1.5-6.4h1.8l1.1 3 1.1-3h1.7l-2.6 6.4h-1.4zm-15-3.2L4.2 15.6H2.5L.9 9.2h1.8l.9 4 .9-4h1.4z",
|
|
721
|
+
fill: "#1434CB"
|
|
722
|
+
}),
|
|
723
|
+
/* @__PURE__ */ jsx("path", {
|
|
724
|
+
d: "M4.8 9.2L3.1 15.6H1.4L3 9.2h1.8z",
|
|
725
|
+
fill: "#F7B600"
|
|
726
|
+
})
|
|
727
|
+
]
|
|
728
|
+
});
|
|
729
|
+
case "mastercard": return /* @__PURE__ */ jsxs("svg", {
|
|
730
|
+
viewBox: "0 0 24 24",
|
|
731
|
+
className: "w-6 h-4",
|
|
732
|
+
children: [
|
|
733
|
+
/* @__PURE__ */ jsx("title", { children: "Mastercard" }),
|
|
734
|
+
/* @__PURE__ */ jsx("circle", {
|
|
735
|
+
cx: "8.5",
|
|
736
|
+
cy: "12",
|
|
737
|
+
r: "5.5",
|
|
738
|
+
fill: "#EB001B"
|
|
739
|
+
}),
|
|
740
|
+
/* @__PURE__ */ jsx("circle", {
|
|
741
|
+
cx: "15.5",
|
|
742
|
+
cy: "12",
|
|
743
|
+
r: "5.5",
|
|
744
|
+
fill: "#F79E1B",
|
|
745
|
+
fillOpacity: "0.85"
|
|
746
|
+
}),
|
|
747
|
+
/* @__PURE__ */ jsx("path", {
|
|
748
|
+
d: "M12 7.7a5.5 5.5 0 00-1.5 4.3 5.5 5.5 0 001.5 4.3 5.5 5.5 0 001.5-4.3 5.5 5.5 0 00-1.5-4.3z",
|
|
749
|
+
fill: "#FF5F00"
|
|
750
|
+
})
|
|
751
|
+
]
|
|
752
|
+
});
|
|
753
|
+
case "amex": return /* @__PURE__ */ jsxs("svg", {
|
|
754
|
+
viewBox: "0 0 24 24",
|
|
755
|
+
className: "w-6 h-4",
|
|
756
|
+
children: [
|
|
757
|
+
/* @__PURE__ */ jsx("title", { children: "American Express" }),
|
|
758
|
+
/* @__PURE__ */ jsx("rect", {
|
|
759
|
+
width: "24",
|
|
760
|
+
height: "16",
|
|
761
|
+
y: "4",
|
|
762
|
+
rx: "2",
|
|
763
|
+
fill: "#006FCF"
|
|
764
|
+
}),
|
|
765
|
+
/* @__PURE__ */ jsx("path", {
|
|
766
|
+
d: "M4 14.5l.8-2.1h1.4l.8 2.1h1.2l-2-4.9h-1.4l-2 4.9h1.2zm1.5-3.3l.5 1.3h-1l.5-1.3zm3.7 3.3h1.1v-3.7l1.5 3.7h.8l1.5-3.7v3.7h1.1v-4.9h-1.6l-1.4 3.4-1.4-3.4h-1.6v4.9zm8-4.9v4.9h3.6v-1h-2.5v-1h2.2v-1h-2.2v-.9h2.4v-1h-3.5zm-5.4 0l-1.2 2.4-1.2-2.4h-1.4l1.9 3.5-1.9 3.5h1.4l1.2-2.4 1.2 2.4h1.4l-1.9-3.5 1.9-3.5h-1.4z",
|
|
767
|
+
fill: "#FFFFFF"
|
|
768
|
+
})
|
|
769
|
+
]
|
|
770
|
+
});
|
|
771
|
+
case "rupay": return /* @__PURE__ */ jsxs("svg", {
|
|
772
|
+
viewBox: "0 0 24 24",
|
|
773
|
+
className: "w-6 h-4",
|
|
774
|
+
children: [
|
|
775
|
+
/* @__PURE__ */ jsx("title", { children: "RuPay" }),
|
|
776
|
+
/* @__PURE__ */ jsx("rect", {
|
|
777
|
+
width: "24",
|
|
778
|
+
height: "16",
|
|
779
|
+
y: "4",
|
|
780
|
+
rx: "2",
|
|
781
|
+
fill: "#0F172A"
|
|
782
|
+
}),
|
|
783
|
+
/* @__PURE__ */ jsx("path", {
|
|
784
|
+
d: "M4.5 8.5h5.2c1.6 0 2.7.3 3.3.8.5.5.7 1.4.3 2.6-.2.7-.5 1.3-.9 1.8-.4.5-1 1-1.6 1.1.6.1.9.4 1.1.8.2.4.1 1-.1 1.8l-.4 1.6h-1.8l.4-1.6c.2-.6.2-1 0-1.3-.1-.3-.5-.4-1-.4H7.8l-1.1-4h1.6c.6 0 1-.1 1.2-.3.2-.2.3-.5.2-.9-.1-.4-.4-.7-1-.7H7l-1.1-4z",
|
|
785
|
+
fill: "#1B3281"
|
|
786
|
+
}),
|
|
787
|
+
/* @__PURE__ */ jsx("path", {
|
|
788
|
+
d: "M16.5 16.5l3.2-6.4h-6.8l3.2 6.4z",
|
|
789
|
+
fill: "#008C44"
|
|
790
|
+
}),
|
|
791
|
+
/* @__PURE__ */ jsx("path", {
|
|
792
|
+
d: "M15.1 16.5l3.2-6.4h-6.8l3.2 6.4z",
|
|
793
|
+
fill: "#F47920"
|
|
794
|
+
})
|
|
795
|
+
]
|
|
796
|
+
});
|
|
797
|
+
case "discover": return /* @__PURE__ */ jsxs("svg", {
|
|
798
|
+
viewBox: "0 0 24 24",
|
|
799
|
+
className: "w-6 h-4",
|
|
800
|
+
children: [
|
|
801
|
+
/* @__PURE__ */ jsx("title", { children: "Discover" }),
|
|
802
|
+
/* @__PURE__ */ jsx("rect", {
|
|
803
|
+
width: "24",
|
|
804
|
+
height: "16",
|
|
805
|
+
y: "4",
|
|
806
|
+
rx: "2",
|
|
807
|
+
fill: "#1E293B"
|
|
808
|
+
}),
|
|
809
|
+
/* @__PURE__ */ jsx("circle", {
|
|
810
|
+
cx: "14.5",
|
|
811
|
+
cy: "12",
|
|
812
|
+
r: "3.2",
|
|
813
|
+
fill: "#F9A01B"
|
|
814
|
+
}),
|
|
815
|
+
/* @__PURE__ */ jsx("path", {
|
|
816
|
+
d: "M3.5 10.5h1.8c.8 0 1.4.4 1.4 1.2 0 .8-.6 1.3-1.4 1.3H3.5v-2.5zm.9.7v1.1h.8c.4 0 .7-.2.7-.6 0-.3-.3-.5-.7-.5h-.8zM7.5 10.5h.9v3h-.9v-3zM9.2 12.8c.3.2.6.3.9.3.5 0 .8-.2.8-.5 0-.3-.2-.4-.7-.6-.6-.2-1.1-.4-1.1-1 0-.6.5-1 1.2-1 .4 0 .8.1 1.1.3l-.3.6c-.2-.1-.5-.2-.8-.2-.4 0-.6.2-.6.4 0 .3.2.4.7.6.6.2 1.1.4 1.1 1 0 .7-.6 1.1-1.3 1.1-.5 0-.9-.1-1.2-.4l.3-.6z",
|
|
817
|
+
fill: "#FFFFFF"
|
|
818
|
+
})
|
|
819
|
+
]
|
|
820
|
+
});
|
|
821
|
+
case "dinersclub": return /* @__PURE__ */ jsxs("svg", {
|
|
822
|
+
viewBox: "0 0 24 24",
|
|
823
|
+
className: "w-6 h-4",
|
|
824
|
+
children: [
|
|
825
|
+
/* @__PURE__ */ jsx("title", { children: "Diners Club" }),
|
|
826
|
+
/* @__PURE__ */ jsx("rect", {
|
|
827
|
+
width: "24",
|
|
828
|
+
height: "16",
|
|
829
|
+
y: "4",
|
|
830
|
+
rx: "2",
|
|
831
|
+
fill: "#FFFFFF",
|
|
832
|
+
stroke: "#CBD5E1",
|
|
833
|
+
strokeWidth: "0.5"
|
|
834
|
+
}),
|
|
835
|
+
/* @__PURE__ */ jsx("circle", {
|
|
836
|
+
cx: "12",
|
|
837
|
+
cy: "12",
|
|
838
|
+
r: "5",
|
|
839
|
+
fill: "#004A97"
|
|
840
|
+
}),
|
|
841
|
+
/* @__PURE__ */ jsx("path", {
|
|
842
|
+
d: "M12 7.5a4.5 4.5 0 00-4.5 4.5c0 2.5 2 4.5 4.5 4.5V7.5z",
|
|
843
|
+
fill: "#FFFFFF"
|
|
844
|
+
})
|
|
845
|
+
]
|
|
846
|
+
});
|
|
847
|
+
case "jcb": return /* @__PURE__ */ jsxs("svg", {
|
|
848
|
+
viewBox: "0 0 24 24",
|
|
849
|
+
className: "w-6 h-4",
|
|
850
|
+
children: [
|
|
851
|
+
/* @__PURE__ */ jsx("title", { children: "JCB" }),
|
|
852
|
+
/* @__PURE__ */ jsx("rect", {
|
|
853
|
+
width: "6",
|
|
854
|
+
height: "14",
|
|
855
|
+
x: "3",
|
|
856
|
+
y: "5",
|
|
857
|
+
rx: "1.5",
|
|
858
|
+
fill: "#004098"
|
|
859
|
+
}),
|
|
860
|
+
/* @__PURE__ */ jsx("rect", {
|
|
861
|
+
width: "6",
|
|
862
|
+
height: "14",
|
|
863
|
+
x: "9",
|
|
864
|
+
y: "5",
|
|
865
|
+
rx: "1.5",
|
|
866
|
+
fill: "#E60012"
|
|
867
|
+
}),
|
|
868
|
+
/* @__PURE__ */ jsx("rect", {
|
|
869
|
+
width: "6",
|
|
870
|
+
height: "14",
|
|
871
|
+
x: "15",
|
|
872
|
+
y: "5",
|
|
873
|
+
rx: "1.5",
|
|
874
|
+
fill: "#008D36"
|
|
875
|
+
}),
|
|
876
|
+
/* @__PURE__ */ jsx("path", {
|
|
877
|
+
d: "M5.5 15.5v-3.5c0-.6.4-1 1-1h.5",
|
|
878
|
+
stroke: "#FFFFFF",
|
|
879
|
+
strokeWidth: "1.2",
|
|
880
|
+
fill: "none"
|
|
881
|
+
}),
|
|
882
|
+
/* @__PURE__ */ jsx("path", {
|
|
883
|
+
d: "M13.5 11h-2c-.6 0-1 .4-1 1v1.5c0 .6.4 1 1 1h2",
|
|
884
|
+
stroke: "#FFFFFF",
|
|
885
|
+
strokeWidth: "1.2",
|
|
886
|
+
fill: "none"
|
|
887
|
+
}),
|
|
888
|
+
/* @__PURE__ */ jsx("path", {
|
|
889
|
+
d: "M16.5 11h2c.6 0 1 .3 1 .8s-.3.8-.7.9c.4.1.7.4.7.9s-.4.9-1 .9h-2v-3.5z",
|
|
890
|
+
stroke: "#FFFFFF",
|
|
891
|
+
strokeWidth: "1.2",
|
|
892
|
+
fill: "none"
|
|
893
|
+
})
|
|
894
|
+
]
|
|
895
|
+
});
|
|
896
|
+
case "unionpay": return /* @__PURE__ */ jsxs("svg", {
|
|
897
|
+
viewBox: "0 0 24 24",
|
|
898
|
+
className: "w-6 h-4",
|
|
899
|
+
children: [
|
|
900
|
+
/* @__PURE__ */ jsx("title", { children: "UnionPay" }),
|
|
901
|
+
/* @__PURE__ */ jsx("rect", {
|
|
902
|
+
width: "24",
|
|
903
|
+
height: "16",
|
|
904
|
+
y: "4",
|
|
905
|
+
rx: "2",
|
|
906
|
+
fill: "#FFFFFF",
|
|
907
|
+
stroke: "#CBD5E1",
|
|
908
|
+
strokeWidth: "0.5"
|
|
909
|
+
}),
|
|
910
|
+
/* @__PURE__ */ jsx("path", {
|
|
911
|
+
d: "M4 17.5l2.2-11h4.2l-2.2 11H4z",
|
|
912
|
+
fill: "#DD0228"
|
|
913
|
+
}),
|
|
914
|
+
/* @__PURE__ */ jsx("path", {
|
|
915
|
+
d: "M8.2 17.5l2.2-11h4.2l-2.2 11H8.2z",
|
|
916
|
+
fill: "#024381"
|
|
917
|
+
}),
|
|
918
|
+
/* @__PURE__ */ jsx("path", {
|
|
919
|
+
d: "M12.4 17.5l2.2-11h5.4c.6 0 1 .4.9 1l-1.8 9c-.1.6-.6 1-1.2 1h-5.5z",
|
|
920
|
+
fill: "#01798A"
|
|
921
|
+
})
|
|
922
|
+
]
|
|
923
|
+
});
|
|
924
|
+
case "mir": return /* @__PURE__ */ jsxs("svg", {
|
|
925
|
+
viewBox: "0 0 24 24",
|
|
926
|
+
className: "w-6 h-4",
|
|
927
|
+
children: [
|
|
928
|
+
/* @__PURE__ */ jsx("title", { children: "Mir" }),
|
|
929
|
+
/* @__PURE__ */ jsx("rect", {
|
|
930
|
+
width: "24",
|
|
931
|
+
height: "16",
|
|
932
|
+
y: "4",
|
|
933
|
+
rx: "2",
|
|
934
|
+
fill: "#008B47"
|
|
935
|
+
}),
|
|
936
|
+
/* @__PURE__ */ jsx("path", {
|
|
937
|
+
d: "M14 8h6v8h-6z",
|
|
938
|
+
fill: "#006CB5"
|
|
939
|
+
}),
|
|
940
|
+
/* @__PURE__ */ jsx("path", {
|
|
941
|
+
d: "M5.5 14.5l.8-4.2h1.4l.8 2.6.8-2.6h1.4l-.8 4.2H8.6l-.8-2.6-.8 2.6H5.5zm8-4.2h2.2c.8 0 1.4.3 1.4.9 0 .5-.3.8-.7 1l.9 2.3h-1.4l-.8-2.1h-.9v2.1h-1.3v-4.2zm1.3 1.1v.9h.8c.2 0 .4-.1.4-.4 0-.3-.2-.5-.4-.5h-.8z",
|
|
942
|
+
fill: "#FFFFFF"
|
|
943
|
+
})
|
|
944
|
+
]
|
|
945
|
+
});
|
|
946
|
+
default: return /* @__PURE__ */ jsx(CreditCard, { className: "size-4 text-muted-foreground/80" });
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
const defaultContent = getBrandSvg();
|
|
950
|
+
const mergedProps = mergeProps(defaultProps, props);
|
|
951
|
+
if (mergedProps.children === void 0) mergedProps.children = defaultContent;
|
|
952
|
+
return useRender({
|
|
953
|
+
defaultTagName: "div",
|
|
954
|
+
props: mergedProps,
|
|
955
|
+
render
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
function InputPaymentUpiProviderIcon({ className, render, ...props }) {
|
|
959
|
+
const { upiProvider } = useInputPaymentContext();
|
|
960
|
+
const defaultProps = {
|
|
961
|
+
className: cn("flex items-center justify-center shrink-0 w-8 select-none", className),
|
|
962
|
+
"data-slot": "input-payment-upi-provider-icon"
|
|
963
|
+
};
|
|
964
|
+
const getProviderSvg = () => {
|
|
965
|
+
switch (upiProvider) {
|
|
966
|
+
case "gpay": return /* @__PURE__ */ jsxs("svg", {
|
|
967
|
+
viewBox: "0 0 24 24",
|
|
968
|
+
className: "w-6 h-4",
|
|
969
|
+
children: [
|
|
970
|
+
/* @__PURE__ */ jsx("title", { children: "Google Pay" }),
|
|
971
|
+
/* @__PURE__ */ jsx("rect", {
|
|
972
|
+
width: "24",
|
|
973
|
+
height: "16",
|
|
974
|
+
y: "4",
|
|
975
|
+
rx: "2",
|
|
976
|
+
fill: "#1E293B"
|
|
977
|
+
}),
|
|
978
|
+
/* @__PURE__ */ jsx("path", {
|
|
979
|
+
d: "M7.8 11.6v.9h2.3c-.1.6-.7 1.7-2.3 1.7-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5c.8 0 1.3.3 1.6.6l.7-.7C9.6 8.6 8.8 8.2 7.8 8.2c-2.1 0-3.8 1.7-3.8 3.8s1.7 3.8 3.8 3.8c2.2 0 3.6-1.5 3.6-3.7 0-.3 0-.5-.1-.7H7.8z",
|
|
980
|
+
fill: "#4285F4"
|
|
981
|
+
}),
|
|
982
|
+
/* @__PURE__ */ jsx("path", {
|
|
983
|
+
d: "M13.5 10.2h1.5v4.5h-1.5v-.5c-.3.4-.8.6-1.4.6-1.3 0-2.2-1-2.2-2.3s.9-2.3 2.2-2.3c.6 0 1.1.2 1.4.6v-.6zm-1.1 3.5c.7 0 1.2-.5 1.2-1.2s-.5-1.2-1.2-1.2-1.2.5-1.2 1.2.5 1.2 1.2 1.2z",
|
|
984
|
+
fill: "#34A853"
|
|
985
|
+
}),
|
|
986
|
+
/* @__PURE__ */ jsx("path", {
|
|
987
|
+
d: "M16 10.2l1.6 4h.1l1.5-4h1.6l-2.4 5.5h-1.5l.9-2.1-2.2-3.4H16z",
|
|
988
|
+
fill: "#EA4335"
|
|
989
|
+
})
|
|
990
|
+
]
|
|
991
|
+
});
|
|
992
|
+
case "phonepe": return /* @__PURE__ */ jsxs("svg", {
|
|
993
|
+
viewBox: "0 0 24 24",
|
|
994
|
+
className: "w-6 h-4",
|
|
995
|
+
children: [
|
|
996
|
+
/* @__PURE__ */ jsx("title", { children: "PhonePe" }),
|
|
997
|
+
/* @__PURE__ */ jsx("rect", {
|
|
998
|
+
width: "24",
|
|
999
|
+
height: "16",
|
|
1000
|
+
y: "4",
|
|
1001
|
+
rx: "2",
|
|
1002
|
+
fill: "#5F259F"
|
|
1003
|
+
}),
|
|
1004
|
+
/* @__PURE__ */ jsx("path", {
|
|
1005
|
+
d: "M8.5 7.5h4c1.4 0 2.5 1.1 2.5 2.5s-1.1 2.5-2.5 2.5h-2.5v3.5h-1.5v-8.5zm1.5 3.5h2.5c.6 0 1-.4 1-1s-.4-1-1-1h-2.5v2z",
|
|
1006
|
+
fill: "#FFFFFF"
|
|
1007
|
+
}),
|
|
1008
|
+
/* @__PURE__ */ jsx("path", {
|
|
1009
|
+
d: "M12.5 11.5l3.5 5h-1.8l-3.2-4.5h1.5z",
|
|
1010
|
+
fill: "#FFFFFF"
|
|
1011
|
+
})
|
|
1012
|
+
]
|
|
1013
|
+
});
|
|
1014
|
+
case "paytm": return /* @__PURE__ */ jsxs("svg", {
|
|
1015
|
+
viewBox: "0 0 24 24",
|
|
1016
|
+
className: "w-6 h-4",
|
|
1017
|
+
children: [
|
|
1018
|
+
/* @__PURE__ */ jsx("title", { children: "Paytm" }),
|
|
1019
|
+
/* @__PURE__ */ jsx("rect", {
|
|
1020
|
+
width: "24",
|
|
1021
|
+
height: "16",
|
|
1022
|
+
y: "4",
|
|
1023
|
+
rx: "2",
|
|
1024
|
+
fill: "#002E6E"
|
|
1025
|
+
}),
|
|
1026
|
+
/* @__PURE__ */ jsx("path", {
|
|
1027
|
+
d: "M4.5 8.5h3.2c.8 0 1.3.5 1.3 1.2s-.5 1.2-1.3 1.2H6.2v2.6H4.5v-5zm1.7 1.3h1.4c.2 0 .4-.1.4-.3s-.2-.3-.4-.3H6.2v.6zM10.2 8.5h1.7v5h-1.7v-5zM13.2 8.5h1.7l1.2 3.2 1.2-3.2h1.7v5h-1.5v-3.5l-1.1 3.5h-.7l-1.1-3.5v3.5h-1.7v-5z",
|
|
1028
|
+
fill: "#00BAF2"
|
|
1029
|
+
})
|
|
1030
|
+
]
|
|
1031
|
+
});
|
|
1032
|
+
case "amazonpay": return /* @__PURE__ */ jsxs("svg", {
|
|
1033
|
+
viewBox: "0 0 24 24",
|
|
1034
|
+
className: "w-6 h-4",
|
|
1035
|
+
children: [
|
|
1036
|
+
/* @__PURE__ */ jsx("title", { children: "Amazon Pay" }),
|
|
1037
|
+
/* @__PURE__ */ jsx("rect", {
|
|
1038
|
+
width: "24",
|
|
1039
|
+
height: "16",
|
|
1040
|
+
y: "4",
|
|
1041
|
+
rx: "2",
|
|
1042
|
+
fill: "#141920"
|
|
1043
|
+
}),
|
|
1044
|
+
/* @__PURE__ */ jsx("path", {
|
|
1045
|
+
d: "M4.5 10.5h1.1v2.5H4.5v-2.5zm2.2.8c0-.6.4-.9 1-.9.6 0 1 .3 1 .9v1.7H7.6v-.4c-.2.3-.5.5-.9.5-.6 0-1-.4-1-.9 0-.6.4-.9 1-.9h1v-.1c0-.3-.2-.4-.5-.4-.3 0-.5.1-.6.3l-.9-.2zm1.9.9v-.4h-.9c-.3 0-.5.1-.5.4 0 .2.2.4.5.4.4 0 .9-.2.9-.4zM10.2 10.5h1v.4c.2-.3.6-.5 1-.5.5 0 .9.2 1.1.7.3-.5.7-.7 1.2-.7.7 0 1.2.4 1.2 1.2v1.9h-1v-1.7c0-.4-.2-.6-.6-.6s-.7.3-.7.7v1.6h-1v-1.7c0-.4-.2-.6-.6-.6s-.6.3-.6.7v1.6h-1v-2.5z",
|
|
1046
|
+
fill: "#FFFFFF"
|
|
1047
|
+
}),
|
|
1048
|
+
/* @__PURE__ */ jsx("path", {
|
|
1049
|
+
d: "M4.5 14.5c3.2 1.2 7.8 1.2 11 0l.4.5c-3.5 1.4-8.3 1.4-11.8 0l.4-.5z",
|
|
1050
|
+
fill: "#FF9900"
|
|
1051
|
+
})
|
|
1052
|
+
]
|
|
1053
|
+
});
|
|
1054
|
+
case "bhim": return /* @__PURE__ */ jsxs("svg", {
|
|
1055
|
+
viewBox: "0 0 24 24",
|
|
1056
|
+
className: "w-6 h-4",
|
|
1057
|
+
children: [
|
|
1058
|
+
/* @__PURE__ */ jsx("title", { children: "BHIM UPI" }),
|
|
1059
|
+
/* @__PURE__ */ jsx("rect", {
|
|
1060
|
+
width: "24",
|
|
1061
|
+
height: "16",
|
|
1062
|
+
y: "4",
|
|
1063
|
+
rx: "2",
|
|
1064
|
+
fill: "#0F172A"
|
|
1065
|
+
}),
|
|
1066
|
+
/* @__PURE__ */ jsx("path", {
|
|
1067
|
+
d: "M5.5 7.5h5.5c1.4 0 2.2.6 2.2 1.6 0 .7-.4 1.2-1 1.4.8.2 1.3.8 1.3 1.6 0 1.2-.9 1.9-2.5 1.9H5.5v-6.5zm2 2v1.2h3c.4 0 .7-.2.7-.6s-.3-.6-.7-.6h-3zm0 2.2v1.3h3.2c.5 0 .8-.2.8-.6 0-.5-.3-.7-.8-.7h-3.2z",
|
|
1068
|
+
fill: "#FFFFFF"
|
|
1069
|
+
}),
|
|
1070
|
+
/* @__PURE__ */ jsx("path", {
|
|
1071
|
+
d: "M14.5 15.5l3.5-7h2l-3.5 7h-2z",
|
|
1072
|
+
fill: "#FF6600"
|
|
1073
|
+
}),
|
|
1074
|
+
/* @__PURE__ */ jsx("path", {
|
|
1075
|
+
d: "M17.5 15.5l3.5-7h2l-3.5 7h-2z",
|
|
1076
|
+
fill: "#009933"
|
|
1077
|
+
})
|
|
1078
|
+
]
|
|
1079
|
+
});
|
|
1080
|
+
case "cred": return /* @__PURE__ */ jsxs("svg", {
|
|
1081
|
+
viewBox: "0 0 24 24",
|
|
1082
|
+
className: "w-6 h-4",
|
|
1083
|
+
children: [
|
|
1084
|
+
/* @__PURE__ */ jsx("title", { children: "CRED" }),
|
|
1085
|
+
/* @__PURE__ */ jsx("rect", {
|
|
1086
|
+
width: "24",
|
|
1087
|
+
height: "16",
|
|
1088
|
+
y: "4",
|
|
1089
|
+
rx: "2",
|
|
1090
|
+
fill: "#000000"
|
|
1091
|
+
}),
|
|
1092
|
+
/* @__PURE__ */ jsx("path", {
|
|
1093
|
+
d: "M6 7.5h12v9H6v-9zm2 2v5h8v-5H8zm2 1.5h4v2h-4v-2z",
|
|
1094
|
+
fill: "#FFFFFF"
|
|
1095
|
+
})
|
|
1096
|
+
]
|
|
1097
|
+
});
|
|
1098
|
+
case "whatsapp": return /* @__PURE__ */ jsxs("svg", {
|
|
1099
|
+
viewBox: "0 0 24 24",
|
|
1100
|
+
className: "w-6 h-4",
|
|
1101
|
+
children: [
|
|
1102
|
+
/* @__PURE__ */ jsx("title", { children: "WhatsApp Pay" }),
|
|
1103
|
+
/* @__PURE__ */ jsx("rect", {
|
|
1104
|
+
width: "24",
|
|
1105
|
+
height: "16",
|
|
1106
|
+
y: "4",
|
|
1107
|
+
rx: "2",
|
|
1108
|
+
fill: "#25D366"
|
|
1109
|
+
}),
|
|
1110
|
+
/* @__PURE__ */ jsx("path", {
|
|
1111
|
+
d: "M12 7c-2.8 0-5 2.2-5 5 0 .9.2 1.8.7 2.5L7 17l2.6-.7c.7.4 1.5.7 2.4.7 2.8 0 5-2.2 5-5s-2.2-5-5-5zm0 8.2c-.8 0-1.5-.2-2.1-.6l-.2-.1-1.5.4.4-1.5-.1-.2c-.4-.6-.6-1.3-.6-2.1 0-2.3 1.9-4.2 4.2-4.2s4.2 1.9 4.2 4.2-1.9 4.1-4.3 4.1z",
|
|
1112
|
+
fill: "#FFFFFF"
|
|
1113
|
+
})
|
|
1114
|
+
]
|
|
1115
|
+
});
|
|
1116
|
+
default: return /* @__PURE__ */ jsx(Zap, { className: "size-4 text-amber-500" });
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
const defaultContent = getProviderSvg();
|
|
1120
|
+
const mergedProps = mergeProps(defaultProps, props);
|
|
1121
|
+
if (mergedProps.children === void 0) mergedProps.children = defaultContent;
|
|
1122
|
+
return useRender({
|
|
1123
|
+
defaultTagName: "div",
|
|
1124
|
+
props: mergedProps,
|
|
1125
|
+
render
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
const PaymentInput = InputPayment;
|
|
1129
|
+
const PaymentInputGroup = InputPaymentGroup;
|
|
1130
|
+
const PaymentInputCardNumber = InputPaymentCardNumber;
|
|
1131
|
+
const PaymentInputExpiry = InputPaymentExpiry;
|
|
1132
|
+
const PaymentInputCVC = InputPaymentCVC;
|
|
1133
|
+
const PaymentInputZip = InputPaymentZip;
|
|
1134
|
+
const PaymentInputBrandIcon = InputPaymentBrandIcon;
|
|
1135
|
+
const PaymentInputUpiGroup = InputPaymentUpiGroup;
|
|
1136
|
+
const PaymentInputUpiId = InputPaymentUpiId;
|
|
1137
|
+
const PaymentInputUpiProviderIcon = InputPaymentUpiProviderIcon;
|
|
1138
|
+
const PaymentInputMethodSelector = InputPaymentMethodSelector;
|
|
1139
|
+
//#endregion
|
|
1140
|
+
export { CARD_TYPES, DEFAULT_CARD_TYPE, InputPayment, InputPaymentBrandIcon, InputPaymentCVC, InputPaymentCardNumber, InputPaymentExpiry, InputPaymentGroup, InputPaymentMethodSelector, InputPaymentUpiGroup, InputPaymentUpiId, InputPaymentUpiProviderIcon, InputPaymentZip, PaymentInput, PaymentInputBrandIcon, PaymentInputCVC, PaymentInputCardNumber, PaymentInputExpiry, PaymentInputGroup, PaymentInputMethodSelector, PaymentInputUpiGroup, PaymentInputUpiId, PaymentInputUpiProviderIcon, PaymentInputZip, detectBrand, detectUpiProvider, formatCardNumber, formatExpiry, getCardNumberError, getCardTypeByValue, getCvcError, getExpiryDateError, getUpiError, getZipError, useInputPayment, usePaymentInput, usePaymentInputContext, validateLuhn, validateUpiId };
|