@xsolla/xui-icons-payment 0.148.0 → 0.148.2

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.
Files changed (2) hide show
  1. package/README.md +243 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,243 @@
1
+ # Icons Payment
2
+
3
+ A cross-platform React payment icons package containing logos for major credit cards and payment providers. Renders as scalable SVGs.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @xsolla/xui-icons-payment
9
+ # or
10
+ yarn add @xsolla/xui-icons-payment
11
+ ```
12
+
13
+ ## Demo
14
+
15
+ ### Credit Card Icons
16
+
17
+ ```tsx
18
+ import * as React from 'react';
19
+ import { Visa, Mastercard, AmericanExpress, Discover } from '@xsolla/xui-icons-payment';
20
+
21
+ export default function CreditCardIcons() {
22
+ return (
23
+ <div style={{ display: 'flex', gap: 12 }}>
24
+ <Visa size={40} />
25
+ <Mastercard size={40} />
26
+ <AmericanExpress size={40} />
27
+ <Discover size={40} />
28
+ </div>
29
+ );
30
+ }
31
+ ```
32
+
33
+ ### Payment Providers
34
+
35
+ ```tsx
36
+ import * as React from 'react';
37
+ import { Paypal, Unionpay, Jcb, Maestro } from '@xsolla/xui-icons-payment';
38
+
39
+ export default function PaymentProviders() {
40
+ return (
41
+ <div style={{ display: 'flex', gap: 12 }}>
42
+ <Paypal size={40} />
43
+ <Unionpay size={40} />
44
+ <Jcb size={40} />
45
+ <Maestro size={40} />
46
+ </div>
47
+ );
48
+ }
49
+ ```
50
+
51
+ ### Icon Sizes
52
+
53
+ ```tsx
54
+ import * as React from 'react';
55
+ import { Visa } from '@xsolla/xui-icons-payment';
56
+
57
+ export default function PaymentSizes() {
58
+ return (
59
+ <div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
60
+ <Visa size={24} />
61
+ <Visa size={32} />
62
+ <Visa size={40} />
63
+ <Visa size={56} />
64
+ </div>
65
+ );
66
+ }
67
+ ```
68
+
69
+ ## Anatomy
70
+
71
+ ```jsx
72
+ import { Visa } from '@xsolla/xui-icons-payment';
73
+
74
+ <Visa
75
+ size={40} // Size in pixels
76
+ className="payment-icon" // CSS class
77
+ style={{ margin: 4 }} // Inline styles
78
+ aria-label="Visa" // Accessible label
79
+ />
80
+ ```
81
+
82
+ ## Examples
83
+
84
+ ### Accepted Payment Methods
85
+
86
+ ```tsx
87
+ import * as React from 'react';
88
+ import {
89
+ Visa,
90
+ Mastercard,
91
+ AmericanExpress,
92
+ Paypal,
93
+ Discover,
94
+ } from '@xsolla/xui-icons-payment';
95
+
96
+ export default function AcceptedPayments() {
97
+ return (
98
+ <div>
99
+ <p style={{ marginBottom: 8, fontSize: 14, color: '#666' }}>
100
+ We accept
101
+ </p>
102
+ <div style={{ display: 'flex', gap: 8 }}>
103
+ <Visa size={32} aria-label="Visa" />
104
+ <Mastercard size={32} aria-label="Mastercard" />
105
+ <AmericanExpress size={32} aria-label="American Express" />
106
+ <Discover size={32} aria-label="Discover" />
107
+ <Paypal size={32} aria-label="PayPal" />
108
+ </div>
109
+ </div>
110
+ );
111
+ }
112
+ ```
113
+
114
+ ### Payment Method Selector
115
+
116
+ ```tsx
117
+ import * as React from 'react';
118
+ import { Visa, Mastercard, AmericanExpress, Paypal } from '@xsolla/xui-icons-payment';
119
+
120
+ export default function PaymentSelector() {
121
+ const [selected, setSelected] = React.useState('visa');
122
+
123
+ const methods = [
124
+ { id: 'visa', name: 'Visa', Icon: Visa },
125
+ { id: 'mastercard', name: 'Mastercard', Icon: Mastercard },
126
+ { id: 'amex', name: 'American Express', Icon: AmericanExpress },
127
+ { id: 'paypal', name: 'PayPal', Icon: Paypal },
128
+ ];
129
+
130
+ return (
131
+ <div style={{ display: 'flex', gap: 8 }}>
132
+ {methods.map(({ id, name, Icon }) => (
133
+ <button
134
+ key={id}
135
+ onClick={() => setSelected(id)}
136
+ style={{
137
+ padding: '12px 16px',
138
+ border: selected === id ? '2px solid #007bff' : '1px solid #ddd',
139
+ borderRadius: 8,
140
+ background: 'white',
141
+ cursor: 'pointer',
142
+ }}
143
+ aria-pressed={selected === id}
144
+ >
145
+ <Icon size={40} aria-label={name} />
146
+ </button>
147
+ ))}
148
+ </div>
149
+ );
150
+ }
151
+ ```
152
+
153
+ ### Card Input Display
154
+
155
+ ```tsx
156
+ import * as React from 'react';
157
+ import { Visa, Mastercard, AmericanExpress } from '@xsolla/xui-icons-payment';
158
+ import { Input } from '@xsolla/xui-input';
159
+
160
+ export default function CardInputDisplay() {
161
+ const [cardNumber, setCardNumber] = React.useState('');
162
+
163
+ const getCardIcon = () => {
164
+ if (cardNumber.startsWith('4')) return <Visa size={24} />;
165
+ if (cardNumber.startsWith('5')) return <Mastercard size={24} />;
166
+ if (cardNumber.startsWith('3')) return <AmericanExpress size={24} />;
167
+ return null;
168
+ };
169
+
170
+ return (
171
+ <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
172
+ <Input
173
+ value={cardNumber}
174
+ onChange={(e) => setCardNumber(e.target.value)}
175
+ placeholder="Card number"
176
+ style={{ flex: 1 }}
177
+ />
178
+ {getCardIcon()}
179
+ </div>
180
+ );
181
+ }
182
+ ```
183
+
184
+ ## API Reference
185
+
186
+ ### Payment Icon Components
187
+
188
+ Each payment icon component accepts the same props:
189
+
190
+ **PaymentIconProps:**
191
+
192
+ | Prop | Type | Default | Description |
193
+ | :--- | :--- | :------ | :---------- |
194
+ | size | `number` | `24` | Size in pixels. |
195
+ | className | `string` | - | CSS class name. |
196
+ | style | `CSSProperties` | - | Inline styles. |
197
+ | data-testid | `string` | - | Test ID (web). |
198
+ | testID | `string` | - | Test ID (React Native). |
199
+ | aria-label | `string` | - | Accessible label. |
200
+ | aria-hidden | `boolean` | `true` if no aria-label | Hide from screen readers. |
201
+
202
+ ## Available Icons
203
+
204
+ | Component | Payment Method |
205
+ | :-------- | :------------- |
206
+ | `AmericanExpress` | American Express |
207
+ | `Aura` | Aura |
208
+ | `CartesBancaires` | Cartes Bancaires |
209
+ | `Cirrus` | Cirrus |
210
+ | `Dankort` | Dankort |
211
+ | `Dinersclub` | Diners Club |
212
+ | `Discover` | Discover |
213
+ | `Elo` | Elo |
214
+ | `Hipercard` | Hipercard |
215
+ | `Jcb` | JCB |
216
+ | `Maestro` | Maestro |
217
+ | `Mastercard` | Mastercard |
218
+ | `Mir` | Mir |
219
+ | `Naranja` | Naranja |
220
+ | `Paypal` | PayPal |
221
+ | `Sodexo` | Sodexo |
222
+ | `Uatp` | UATP |
223
+ | `Unionpay` | UnionPay |
224
+ | `Visa` | Visa |
225
+
226
+ ## Tree Shaking
227
+
228
+ Import individual icons for optimal bundle size:
229
+
230
+ ```tsx
231
+ // Good - only imports needed icons
232
+ import { Visa, Mastercard } from '@xsolla/xui-icons-payment';
233
+
234
+ // Avoid - imports all icons
235
+ import * as PaymentIcons from '@xsolla/xui-icons-payment';
236
+ ```
237
+
238
+ ## Accessibility
239
+
240
+ - Icons are hidden from screen readers by default
241
+ - Use `aria-label` when the icon conveys meaningful information
242
+ - For decorative payment badges, keep the default hidden behavior
243
+ - When used in buttons/links, the parent element should have the accessible label
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/xui-icons-payment",
3
- "version": "0.148.0",
3
+ "version": "0.148.2",
4
4
  "main": "./web/index.js",
5
5
  "types": "./web/index.d.ts",
6
6
  "exports": {