@xsolla/xui-svg-themed 0.141.0 → 0.147.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/package.json +3 -3
  2. package/README.md +0 -230
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/xui-svg-themed",
3
- "version": "0.141.0",
3
+ "version": "0.147.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.141.0",
14
- "@xsolla/xui-primitives-core": "0.141.0"
13
+ "@xsolla/xui-core": "0.147.1",
14
+ "@xsolla/xui-primitives-core": "0.147.1"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "react": ">=16.8.0",
package/README.md DELETED
@@ -1,230 +0,0 @@
1
- # SVG Themed
2
-
3
- A React component that wraps SVG content and automatically resolves theme tokens (like `$colors_core_text_primary`) to actual theme values, enabling theme-aware custom SVG graphics.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @xsolla/xui-svg-themed
9
- # or
10
- yarn add @xsolla/xui-svg-themed
11
- ```
12
-
13
- ## Demo
14
-
15
- ### Basic Usage
16
-
17
- ```tsx
18
- import * as React from 'react';
19
- import { SvgThemed } from '@xsolla/xui-svg-themed';
20
-
21
- export default function BasicSvg() {
22
- return (
23
- <SvgThemed width={24} height={24} viewBox="0 0 24 24">
24
- <circle
25
- cx={12}
26
- cy={12}
27
- r={10}
28
- fill="$colors_core_text_primary"
29
- />
30
- </SvgThemed>
31
- );
32
- }
33
- ```
34
-
35
- ### With Theme Tokens
36
-
37
- ```tsx
38
- import * as React from 'react';
39
- import { SvgThemed } from '@xsolla/xui-svg-themed';
40
-
41
- export default function ThemedIcon() {
42
- return (
43
- <SvgThemed width={32} height={32} viewBox="0 0 32 32">
44
- <rect
45
- x={4}
46
- y={4}
47
- width={24}
48
- height={24}
49
- rx={4}
50
- fill="$colors_control_faint_bg"
51
- />
52
- <path
53
- d="M16 8L20 16H12L16 8Z"
54
- fill="$colors_core_text_brand"
55
- />
56
- </SvgThemed>
57
- );
58
- }
59
- ```
60
-
61
- ## Anatomy
62
-
63
- ```jsx
64
- import { SvgThemed } from '@xsolla/xui-svg-themed';
65
-
66
- <SvgThemed
67
- width={24}
68
- height={24}
69
- viewBox="0 0 24 24"
70
- // All standard SVG props
71
- >
72
- <path fill="$colors_core_text_primary" d="..." />
73
- <circle stroke="$colors_core_text_brand" />
74
- </SvgThemed>
75
- ```
76
-
77
- ## Examples
78
-
79
- ### Custom Status Icon
80
-
81
- ```tsx
82
- import * as React from 'react';
83
- import { SvgThemed } from '@xsolla/xui-svg-themed';
84
-
85
- export default function StatusIcon() {
86
- return (
87
- <SvgThemed width={24} height={24} viewBox="0 0 24 24">
88
- <circle
89
- cx={12}
90
- cy={12}
91
- r={10}
92
- fill="$colors_core_text_success"
93
- />
94
- <path
95
- d="M8 12L11 15L16 9"
96
- stroke="#fff"
97
- strokeWidth={2}
98
- fill="none"
99
- strokeLinecap="round"
100
- strokeLinejoin="round"
101
- />
102
- </SvgThemed>
103
- );
104
- }
105
- ```
106
-
107
- ### Illustration with Multiple Colors
108
-
109
- ```tsx
110
- import * as React from 'react';
111
- import { SvgThemed } from '@xsolla/xui-svg-themed';
112
-
113
- export default function Illustration() {
114
- return (
115
- <SvgThemed width={100} height={100} viewBox="0 0 100 100">
116
- {/* Background */}
117
- <rect
118
- width={100}
119
- height={100}
120
- rx={12}
121
- fill="$colors_control_faint_bg"
122
- />
123
- {/* Primary shape */}
124
- <circle
125
- cx={50}
126
- cy={40}
127
- r={20}
128
- fill="$colors_core_text_brand"
129
- />
130
- {/* Secondary shape */}
131
- <rect
132
- x={30}
133
- y={65}
134
- width={40}
135
- height={20}
136
- rx={4}
137
- fill="$colors_core_text_secondary"
138
- />
139
- </SvgThemed>
140
- );
141
- }
142
- ```
143
-
144
- ### Badge with Gradient
145
-
146
- ```tsx
147
- import * as React from 'react';
148
- import { SvgThemed } from '@xsolla/xui-svg-themed';
149
-
150
- export default function GradientBadge() {
151
- return (
152
- <SvgThemed width={48} height={48} viewBox="0 0 48 48">
153
- <defs>
154
- <linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
155
- <stop offset="0%" stopColor="$colors_core_text_brand" />
156
- <stop offset="100%" stopColor="$colors_core_text_success" />
157
- </linearGradient>
158
- </defs>
159
- <circle cx={24} cy={24} r={20} fill="url(#grad)" />
160
- <text
161
- x={24}
162
- y={24}
163
- textAnchor="middle"
164
- dominantBaseline="central"
165
- fill="#fff"
166
- fontSize={16}
167
- fontWeight="bold"
168
- >
169
- XP
170
- </text>
171
- </SvgThemed>
172
- );
173
- }
174
- ```
175
-
176
- ## API Reference
177
-
178
- ### SvgThemed
179
-
180
- **SvgThemedProps:**
181
-
182
- Extends all standard SVG element attributes plus:
183
-
184
- | Prop | Type | Default | Description |
185
- | :--- | :--- | :------ | :---------- |
186
- | children | `ReactNode` | - | SVG content with theme tokens. |
187
- | width | `number \| string` | - | SVG width. |
188
- | height | `number \| string` | - | SVG height. |
189
- | viewBox | `string` | - | SVG viewBox attribute. |
190
-
191
- ## Supported Theme Tokens
192
-
193
- Use these token strings prefixed with `$` for theme-aware colors:
194
-
195
- | Token | Theme Path |
196
- | :---- | :--------- |
197
- | `$colors_core_text_primary` | `content.primary` |
198
- | `$colors_core_text_secondary` | `content.secondary` |
199
- | `$colors_core_text_tertiary` | `content.tertiary` |
200
- | `$colors_core_text_brand` | `content.brand.primary` |
201
- | `$colors_core_text_success` | `content.success.primary` |
202
- | `$colors_core_text_warning` | `content.warning.primary` |
203
- | `$colors_core_text_alert` | `content.alert.primary` |
204
- | `$colors_core_text_neutral` | `content.neutral.primary` |
205
- | `$colors_control_faint_bg` | `control.mono.secondary.bg` |
206
-
207
- ## Themeable Properties
208
-
209
- The following SVG properties are automatically resolved:
210
-
211
- - `fill`
212
- - `stroke`
213
- - `stopColor`
214
- - `color`
215
-
216
- ## Use Cases
217
-
218
- - Custom icons not available in icon packages
219
- - Theme-aware illustrations
220
- - Dynamic SVG graphics that adapt to light/dark modes
221
- - Brand-specific visual elements
222
- - Decorative graphics with theme integration
223
-
224
- ## How It Works
225
-
226
- 1. SvgThemed wraps your SVG content
227
- 2. It recursively processes all child elements
228
- 3. Properties starting with `$` are matched against token map
229
- 4. Tokens are replaced with actual theme color values
230
- 5. Result is a fully themed SVG that updates with theme changes