@xsolla/xui-rich-icon 0.148.0 → 0.148.1

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 +277 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,277 @@
1
+ # Rich Icon
2
+
3
+ A cross-platform React component for displaying icons, images, or text content in a styled container with customizable shapes and sizes.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @xsolla/xui-rich-icon
9
+ # or
10
+ yarn add @xsolla/xui-rich-icon
11
+ ```
12
+
13
+ ## Demo
14
+
15
+ ### With Icon
16
+
17
+ ```tsx
18
+ import * as React from 'react';
19
+ import { RichIcon } from '@xsolla/xui-rich-icon';
20
+ import { Star } from '@xsolla/xui-icons-base';
21
+
22
+ export default function WithIcon() {
23
+ return (
24
+ <RichIcon size="md" variant="rounded">
25
+ <RichIcon.Icon>
26
+ <Star size={20} />
27
+ </RichIcon.Icon>
28
+ </RichIcon>
29
+ );
30
+ }
31
+ ```
32
+
33
+ ### With Image
34
+
35
+ ```tsx
36
+ import * as React from 'react';
37
+ import { RichIcon } from '@xsolla/xui-rich-icon';
38
+
39
+ export default function WithImage() {
40
+ return (
41
+ <RichIcon size="lg" variant="circle">
42
+ <RichIcon.Icon src="https://example.com/avatar.jpg" />
43
+ </RichIcon>
44
+ );
45
+ }
46
+ ```
47
+
48
+ ### With Text
49
+
50
+ ```tsx
51
+ import * as React from 'react';
52
+ import { RichIcon } from '@xsolla/xui-rich-icon';
53
+
54
+ export default function WithText() {
55
+ return (
56
+ <RichIcon size="md" variant="rounded">
57
+ <RichIcon.Icon>
58
+ <RichIcon.Text>AB</RichIcon.Text>
59
+ </RichIcon.Icon>
60
+ </RichIcon>
61
+ );
62
+ }
63
+ ```
64
+
65
+ ## Anatomy
66
+
67
+ ```jsx
68
+ import { RichIcon } from '@xsolla/xui-rich-icon';
69
+
70
+ <RichIcon
71
+ size="md" // s, m, l, xl
72
+ variant="rounded" // rounded, circle, square
73
+ >
74
+ <RichIcon.Icon
75
+ src={imageUrl} // Image source URL
76
+ component={<Icon />} // Custom component
77
+ >
78
+ {children} // Or render children
79
+ </RichIcon.Icon>
80
+ </RichIcon>
81
+ ```
82
+
83
+ ## Examples
84
+
85
+ ### Different Variants
86
+
87
+ ```tsx
88
+ import * as React from 'react';
89
+ import { RichIcon } from '@xsolla/xui-rich-icon';
90
+ import { User } from '@xsolla/xui-icons-base';
91
+
92
+ export default function Variants() {
93
+ return (
94
+ <div style={{ display: 'flex', gap: 16 }}>
95
+ <RichIcon size="lg" variant="square">
96
+ <RichIcon.Icon><User size={24} /></RichIcon.Icon>
97
+ </RichIcon>
98
+ <RichIcon size="lg" variant="rounded">
99
+ <RichIcon.Icon><User size={24} /></RichIcon.Icon>
100
+ </RichIcon>
101
+ <RichIcon size="lg" variant="circle">
102
+ <RichIcon.Icon><User size={24} /></RichIcon.Icon>
103
+ </RichIcon>
104
+ </div>
105
+ );
106
+ }
107
+ ```
108
+
109
+ ### Different Sizes
110
+
111
+ ```tsx
112
+ import * as React from 'react';
113
+ import { RichIcon } from '@xsolla/xui-rich-icon';
114
+ import { Heart } from '@xsolla/xui-icons-base';
115
+
116
+ export default function Sizes() {
117
+ return (
118
+ <div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
119
+ <RichIcon size="sm" variant="rounded">
120
+ <RichIcon.Icon><Heart size={14} /></RichIcon.Icon>
121
+ </RichIcon>
122
+ <RichIcon size="md" variant="rounded">
123
+ <RichIcon.Icon><Heart size={18} /></RichIcon.Icon>
124
+ </RichIcon>
125
+ <RichIcon size="lg" variant="rounded">
126
+ <RichIcon.Icon><Heart size={24} /></RichIcon.Icon>
127
+ </RichIcon>
128
+ <RichIcon size="xl" variant="rounded">
129
+ <RichIcon.Icon><Heart size={32} /></RichIcon.Icon>
130
+ </RichIcon>
131
+ </div>
132
+ );
133
+ }
134
+ ```
135
+
136
+ ### User Initials
137
+
138
+ ```tsx
139
+ import * as React from 'react';
140
+ import { RichIcon } from '@xsolla/xui-rich-icon';
141
+
142
+ export default function UserInitials() {
143
+ const users = [
144
+ { name: 'John Doe', initials: 'JD' },
145
+ { name: 'Alice Smith', initials: 'AS' },
146
+ { name: 'Bob Wilson', initials: 'BW' },
147
+ ];
148
+
149
+ return (
150
+ <div style={{ display: 'flex', gap: 8 }}>
151
+ {users.map(({ name, initials }) => (
152
+ <RichIcon key={name} size="md" variant="circle" aria-label={name}>
153
+ <RichIcon.Icon>
154
+ <RichIcon.Text>{initials}</RichIcon.Text>
155
+ </RichIcon.Icon>
156
+ </RichIcon>
157
+ ))}
158
+ </div>
159
+ );
160
+ }
161
+ ```
162
+
163
+ ### Feature Icons
164
+
165
+ ```tsx
166
+ import * as React from 'react';
167
+ import { RichIcon } from '@xsolla/xui-rich-icon';
168
+ import { Shield, Zap, Globe } from '@xsolla/xui-icons-base';
169
+
170
+ export default function FeatureIcons() {
171
+ const features = [
172
+ { icon: <Shield size={24} />, title: 'Secure' },
173
+ { icon: <Zap size={24} />, title: 'Fast' },
174
+ { icon: <Globe size={24} />, title: 'Global' },
175
+ ];
176
+
177
+ return (
178
+ <div style={{ display: 'flex', gap: 32 }}>
179
+ {features.map(({ icon, title }) => (
180
+ <div key={title} style={{ textAlign: 'center' }}>
181
+ <RichIcon size="xl" variant="rounded">
182
+ <RichIcon.Icon>{icon}</RichIcon.Icon>
183
+ </RichIcon>
184
+ <p style={{ marginTop: 8 }}>{title}</p>
185
+ </div>
186
+ ))}
187
+ </div>
188
+ );
189
+ }
190
+ ```
191
+
192
+ ### Game Platform Icons
193
+
194
+ ```tsx
195
+ import * as React from 'react';
196
+ import { RichIcon } from '@xsolla/xui-rich-icon';
197
+ import { Steam, Playstation, Xbox } from '@xsolla/xui-icons-brand';
198
+
199
+ export default function PlatformIcons() {
200
+ return (
201
+ <div style={{ display: 'flex', gap: 12 }}>
202
+ <RichIcon size="lg" variant="rounded">
203
+ <RichIcon.Icon component={<Steam size={24} />} />
204
+ </RichIcon>
205
+ <RichIcon size="lg" variant="rounded">
206
+ <RichIcon.Icon component={<Playstation size={24} />} />
207
+ </RichIcon>
208
+ <RichIcon size="lg" variant="rounded">
209
+ <RichIcon.Icon component={<Xbox size={24} />} />
210
+ </RichIcon>
211
+ </div>
212
+ );
213
+ }
214
+ ```
215
+
216
+ ## API Reference
217
+
218
+ ### RichIcon
219
+
220
+ **RichIconProps:**
221
+
222
+ | Prop | Type | Default | Description |
223
+ | :--- | :--- | :------ | :---------- |
224
+ | children | `ReactNode` | - | RichIcon.Icon child component. |
225
+ | variant | `"rounded" \| "circle" \| "square"` | `"rounded"` | Container shape. |
226
+ | size | `"sm" \| "md" \| "lg" \| "xl"` | `"md"` | Container size. |
227
+
228
+ ### RichIcon.Icon
229
+
230
+ **RichIconIconProps:**
231
+
232
+ | Prop | Type | Default | Description |
233
+ | :--- | :--- | :------ | :---------- |
234
+ | src | `string` | - | Image URL (displays as background). |
235
+ | component | `ReactNode` | - | Custom icon component. |
236
+ | children | `ReactNode` | - | Child content (icon or text). |
237
+ | color | `string` | - | Icon color override. |
238
+
239
+ ### RichIcon.Text
240
+
241
+ **RichIconTextProps:**
242
+
243
+ | Prop | Type | Default | Description |
244
+ | :--- | :--- | :------ | :---------- |
245
+ | children | `string` | - | Text content (typically initials). |
246
+
247
+ ## Size Specifications
248
+
249
+ | Size | Dimensions | Font Size |
250
+ | :--- | :--------- | :-------- |
251
+ | `sm` | 24x24 | 10px |
252
+ | `md` | 32x32 | 12px |
253
+ | `lg` | 40x40 | 14px |
254
+ | `xl` | 64x64 | 18px |
255
+
256
+ ## Variant Shapes
257
+
258
+ | Variant | Border Radius |
259
+ | :------ | :------------ |
260
+ | `square` | 0px |
261
+ | `rounded` | 8px |
262
+ | `circle` | 1000px |
263
+
264
+ ## Use Cases
265
+
266
+ - **User avatars**: Display profile pictures or initials
267
+ - **Feature icons**: Highlight features with styled icons
268
+ - **Category icons**: Visual indicators for categories
269
+ - **Platform badges**: Display platform or service icons
270
+ - **Status indicators**: Combined with status icons
271
+
272
+ ## Accessibility
273
+
274
+ - Use `aria-label` on the RichIcon when conveying meaning
275
+ - For decorative icons, content is hidden from screen readers
276
+ - Text content (initials) is accessible to screen readers
277
+ - Ensure sufficient color contrast for text content
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/xui-rich-icon",
3
- "version": "0.148.0",
3
+ "version": "0.148.1",
4
4
  "main": "./web/index.js",
5
5
  "module": "./web/index.mjs",
6
6
  "types": "./web/index.d.ts",
@@ -10,8 +10,8 @@
10
10
  "build:native": "PLATFORM=native tsup"
11
11
  },
12
12
  "dependencies": {
13
- "@xsolla/xui-core": "0.148.0",
14
- "@xsolla/xui-primitives-core": "0.148.0"
13
+ "@xsolla/xui-core": "0.148.1",
14
+ "@xsolla/xui-primitives-core": "0.148.1"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "react": ">=16.8.0",