@xsolla/xui-quest-card 0.118.0 → 0.119.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/README.md +137 -98
- package/native/index.d.mts +22 -7
- package/native/index.d.ts +22 -7
- package/native/index.js +586 -130
- package/native/index.js.flow +30 -9
- package/native/index.js.map +1 -1
- package/native/index.mjs +587 -131
- package/native/index.mjs.map +1 -1
- package/package.json +3 -3
- package/web/index.d.mts +22 -7
- package/web/index.d.ts +22 -7
- package/web/index.js +586 -130
- package/web/index.js.flow +30 -9
- package/web/index.js.map +1 -1
- package/web/index.mjs +587 -131
- package/web/index.mjs.map +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# QuestCard
|
|
2
2
|
|
|
3
|
-
A cross-platform React card component for displaying quest or mission items with progress tracking,
|
|
3
|
+
A cross-platform React card component for displaying quest or mission items with progress tracking, state-driven visuals, and reward tags. Perfect for gamification systems, daily challenges, and achievement displays.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -23,135 +23,142 @@ export default function BasicQuestCard() {
|
|
|
23
23
|
return (
|
|
24
24
|
<QuestCard
|
|
25
25
|
title="Play any game"
|
|
26
|
-
|
|
26
|
+
description="With Play Time Rewards On"
|
|
27
|
+
caption="0/12 hours"
|
|
28
|
+
questState="default"
|
|
27
29
|
icon={<Flag />}
|
|
28
30
|
/>
|
|
29
31
|
);
|
|
30
32
|
}
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
### QuestCard
|
|
35
|
+
### QuestCard States
|
|
34
36
|
|
|
35
37
|
```tsx
|
|
36
38
|
import * as React from 'react';
|
|
37
39
|
import { QuestCard } from '@xsolla/xui-quest-card';
|
|
38
40
|
import { Tag } from '@xsolla/xui-tag';
|
|
39
|
-
import { AlertCircle } from '@xsolla/xui-icons';
|
|
40
41
|
import { Flag, CheckCr, Clock } from '@xsolla/xui-icons-base';
|
|
41
42
|
import { XsollaPoint } from '@xsolla/xui-icons-currency';
|
|
42
43
|
|
|
43
|
-
export default function
|
|
44
|
-
|
|
45
|
-
<
|
|
46
|
-
title="Play any game (with Play Time Rewards On)"
|
|
47
|
-
subtitle="0/12 hours"
|
|
48
|
-
icon={<Flag />}
|
|
49
|
-
status="alert"
|
|
50
|
-
statusIcon={<AlertCircle />}
|
|
51
|
-
trailing={
|
|
52
|
-
<Tag size="sm" tone="secondary" icon={<XsollaPoint />}>
|
|
53
|
-
5x
|
|
54
|
-
</Tag>
|
|
55
|
-
}
|
|
56
|
-
/>
|
|
44
|
+
export default function QuestCardStates() {
|
|
45
|
+
const reward = (
|
|
46
|
+
<Tag size="sm" tone="secondary" icon={<XsollaPoint />}>+50</Tag>
|
|
57
47
|
);
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### QuestCard Status Variants
|
|
62
|
-
|
|
63
|
-
```tsx
|
|
64
|
-
import * as React from 'react';
|
|
65
|
-
import { QuestCard } from '@xsolla/xui-quest-card';
|
|
66
|
-
import { Tag } from '@xsolla/xui-tag';
|
|
67
|
-
import { AlertCircle } from '@xsolla/xui-icons';
|
|
68
|
-
import { Flag, CheckCr, Clock } from '@xsolla/xui-icons-base';
|
|
69
|
-
import { XsollaPoint, XsollaTicket } from '@xsolla/xui-icons-currency';
|
|
70
48
|
|
|
71
|
-
export default function QuestCardStatuses() {
|
|
72
49
|
return (
|
|
73
50
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
|
74
|
-
{/*
|
|
51
|
+
{/* Default — active quest */}
|
|
75
52
|
<QuestCard
|
|
76
|
-
title="
|
|
77
|
-
|
|
53
|
+
title="Play any game"
|
|
54
|
+
description="With Play Time Rewards On"
|
|
55
|
+
caption="0/12 hours"
|
|
56
|
+
questState="default"
|
|
78
57
|
icon={<Flag />}
|
|
79
|
-
|
|
80
|
-
statusIcon={<AlertCircle />}
|
|
81
|
-
trailing={<Tag size="sm" tone="alert">Urgent</Tag>}
|
|
58
|
+
trailing={reward}
|
|
82
59
|
/>
|
|
83
60
|
|
|
84
|
-
{/*
|
|
61
|
+
{/* Expiring — urgent quest with badge */}
|
|
85
62
|
<QuestCard
|
|
86
|
-
title="
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
trailing={
|
|
63
|
+
title="Reach level 10"
|
|
64
|
+
description="Level up to unlock rewards"
|
|
65
|
+
caption="7/10"
|
|
66
|
+
questState="expiring"
|
|
67
|
+
icon={<Flag />}
|
|
68
|
+
trailing={reward}
|
|
92
69
|
/>
|
|
93
70
|
|
|
94
|
-
{/*
|
|
71
|
+
{/* Completed — dimmed at 48% opacity */}
|
|
95
72
|
<QuestCard
|
|
96
|
-
title="
|
|
97
|
-
|
|
73
|
+
title="Complete daily login"
|
|
74
|
+
description="Login every day"
|
|
75
|
+
caption="Completed"
|
|
76
|
+
questState="completed"
|
|
98
77
|
icon={<CheckCr />}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
78
|
+
trailing={reward}
|
|
79
|
+
/>
|
|
80
|
+
|
|
81
|
+
{/* Expired — dimmed at 48% opacity */}
|
|
82
|
+
<QuestCard
|
|
83
|
+
title="Invite 3 friends"
|
|
84
|
+
description="Share your referral link"
|
|
85
|
+
caption="Expired"
|
|
86
|
+
questState="expired"
|
|
87
|
+
icon={<Clock />}
|
|
88
|
+
trailing={reward}
|
|
102
89
|
/>
|
|
103
90
|
</div>
|
|
104
91
|
);
|
|
105
92
|
}
|
|
106
93
|
```
|
|
107
94
|
|
|
95
|
+
### Without Description or Caption
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import * as React from 'react';
|
|
99
|
+
import { QuestCard } from '@xsolla/xui-quest-card';
|
|
100
|
+
import { Flag } from '@xsolla/xui-icons-base';
|
|
101
|
+
|
|
102
|
+
export default function MinimalQuestCard() {
|
|
103
|
+
return (
|
|
104
|
+
<QuestCard
|
|
105
|
+
title="Simple quest"
|
|
106
|
+
questState="default"
|
|
107
|
+
icon={<Flag />}
|
|
108
|
+
/>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
108
113
|
### Quest List
|
|
109
114
|
|
|
110
115
|
```tsx
|
|
111
116
|
import * as React from 'react';
|
|
112
117
|
import { QuestCard } from '@xsolla/xui-quest-card';
|
|
113
118
|
import { Tag } from '@xsolla/xui-tag';
|
|
114
|
-
import {
|
|
115
|
-
import {
|
|
116
|
-
import { XsollaPoint, XsollaTicket } from '@xsolla/xui-icons-currency';
|
|
119
|
+
import { Flag, CheckCr, Clock } from '@xsolla/xui-icons-base';
|
|
120
|
+
import { XsollaPoint } from '@xsolla/xui-icons-currency';
|
|
117
121
|
|
|
118
122
|
export default function QuestList() {
|
|
123
|
+
const reward = (
|
|
124
|
+
<Tag size="sm" tone="secondary" icon={<XsollaPoint />}>+50</Tag>
|
|
125
|
+
);
|
|
126
|
+
|
|
119
127
|
return (
|
|
120
128
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
|
121
129
|
<QuestCard
|
|
122
130
|
title="Play any game"
|
|
123
|
-
|
|
131
|
+
description="With Play Time Rewards On"
|
|
132
|
+
caption="0/12 hours"
|
|
133
|
+
questState="default"
|
|
124
134
|
icon={<Flag />}
|
|
125
|
-
|
|
126
|
-
statusIcon={<AlertCircle />}
|
|
127
|
-
trailing={<Tag size="sm" tone="secondary" icon={<XsollaPoint />}>5x</Tag>}
|
|
135
|
+
trailing={reward}
|
|
128
136
|
onPress={() => console.log('Quest 1 clicked')}
|
|
129
137
|
/>
|
|
130
138
|
<QuestCard
|
|
131
139
|
title="Complete daily login"
|
|
132
|
-
|
|
140
|
+
description="Login every day"
|
|
141
|
+
caption="Completed"
|
|
142
|
+
questState="completed"
|
|
133
143
|
icon={<CheckCr />}
|
|
134
|
-
|
|
135
|
-
statusIcon={<CheckCr />}
|
|
136
|
-
trailing={<Tag size="sm" tone="success">Done</Tag>}
|
|
144
|
+
trailing={reward}
|
|
137
145
|
/>
|
|
138
146
|
<QuestCard
|
|
139
147
|
title="Invite 3 friends"
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
148
|
+
description="Share your referral link"
|
|
149
|
+
caption="Expired"
|
|
150
|
+
questState="expired"
|
|
151
|
+
icon={<Clock />}
|
|
152
|
+
trailing={reward}
|
|
144
153
|
/>
|
|
145
154
|
<QuestCard
|
|
146
155
|
title="Reach level 10"
|
|
147
|
-
|
|
156
|
+
description="Level up to unlock rewards"
|
|
157
|
+
caption="7/10"
|
|
158
|
+
questState="expiring"
|
|
148
159
|
icon={<Flag />}
|
|
149
|
-
trailing={
|
|
150
|
-
|
|
151
|
-
<Tag size="sm" tone="brand" icon={<XsollaPoint />}>100</Tag>
|
|
152
|
-
<Tag size="sm" tone="secondary">2x</Tag>
|
|
153
|
-
</div>
|
|
154
|
-
}
|
|
160
|
+
trailing={reward}
|
|
161
|
+
onPress={() => console.log('Quest 4 clicked')}
|
|
155
162
|
/>
|
|
156
163
|
</div>
|
|
157
164
|
);
|
|
@@ -166,13 +173,13 @@ Import the component and use it directly:
|
|
|
166
173
|
import { QuestCard } from '@xsolla/xui-quest-card';
|
|
167
174
|
|
|
168
175
|
<QuestCard
|
|
169
|
-
title="Quest Title"
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
trailing={<Tag />}
|
|
175
|
-
onPress={() => {}}
|
|
176
|
+
title="Quest Title" // Required: Quest name
|
|
177
|
+
description="Description" // Optional: Secondary text
|
|
178
|
+
caption="0/100" // Optional: Progress or status text
|
|
179
|
+
questState="default" // Optional: Visual state
|
|
180
|
+
icon={<Flag />} // Optional: Quest icon
|
|
181
|
+
trailing={<Tag />} // Optional: Reward/action content
|
|
182
|
+
onPress={() => {}} // Optional: Card press handler
|
|
176
183
|
/>
|
|
177
184
|
```
|
|
178
185
|
|
|
@@ -187,43 +194,75 @@ A card component for displaying quest or mission items.
|
|
|
187
194
|
| Prop | Type | Default | Description |
|
|
188
195
|
| :--- | :--- | :------ | :---------- |
|
|
189
196
|
| title | `string` | required | Quest title text. |
|
|
190
|
-
|
|
|
197
|
+
| description | `string` | - | Secondary description text below the title. |
|
|
198
|
+
| caption | `string` | - | Bottom caption text (e.g. "0/100", "Completed", "Expired"). |
|
|
199
|
+
| questState | `"default" \| "completed" \| "expired" \| "expiring"` | `"default"` | Visual quest state controlling opacity, border, and badge. |
|
|
191
200
|
| icon | `ReactNode` | - | Icon to display in the icon container. |
|
|
192
|
-
| status | `"default" \| "alert" \| "warning" \| "success"` | - | Status indicator type. |
|
|
193
|
-
| statusIcon | `ReactNode` | - | Custom status icon (overrides default status indicator). |
|
|
194
201
|
| trailing | `ReactNode` | - | Reward tag or custom trailing content. |
|
|
195
202
|
| onPress | `() => void` | - | Card press handler. |
|
|
196
203
|
| className | `string` | - | Custom className for the container. |
|
|
197
204
|
| testID | `string` | - | Test ID for testing. |
|
|
198
205
|
|
|
199
|
-
**
|
|
206
|
+
**Quest States:**
|
|
207
|
+
|
|
208
|
+
| State | Description |
|
|
209
|
+
| :---- | :---------- |
|
|
210
|
+
| default | Active quest with border, full opacity |
|
|
211
|
+
| completed | Completed quest, 48% opacity, no border |
|
|
212
|
+
| expired | Expired quest, 48% opacity, no border |
|
|
213
|
+
| expiring | Urgent quest with border, full opacity, and a red lightning badge on the icon |
|
|
200
214
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
|
204
|
-
|
|
|
205
|
-
|
|
|
206
|
-
|
|
|
215
|
+
**Recommended icons per state:**
|
|
216
|
+
|
|
217
|
+
| State | Icon |
|
|
218
|
+
| :---- | :--- |
|
|
219
|
+
| default | `<Flag />` from `@xsolla/xui-icons-base` |
|
|
220
|
+
| completed | `<CheckCr />` from `@xsolla/xui-icons-base` |
|
|
221
|
+
| expired | `<Clock />` from `@xsolla/xui-icons-base` |
|
|
222
|
+
| expiring | `<Flag />` from `@xsolla/xui-icons-base` |
|
|
223
|
+
|
|
224
|
+
### Deprecated Props
|
|
225
|
+
|
|
226
|
+
These props still work but will emit console warnings in development:
|
|
227
|
+
|
|
228
|
+
| Prop | Replacement | Mapping |
|
|
229
|
+
| :--- | :---------- | :------ |
|
|
230
|
+
| subtitle | `description` | Direct alias |
|
|
231
|
+
| status | `questState` | "success" -> "completed", "warning"/"alert" -> "expiring", "default" -> "default" |
|
|
232
|
+
| statusIcon | `questState` | No longer rendered; visual state driven by `questState` |
|
|
207
233
|
|
|
208
234
|
## Theming
|
|
209
235
|
|
|
210
236
|
QuestCard uses the design system theme for colors:
|
|
211
237
|
|
|
212
238
|
```typescript
|
|
213
|
-
//
|
|
214
|
-
theme.colors.
|
|
215
|
-
theme.colors.content.primary
|
|
216
|
-
theme.colors.content.tertiary
|
|
217
|
-
theme.colors.content.alert
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
239
|
+
theme.colors.overlay.mono // Card background
|
|
240
|
+
theme.colors.border.secondary // Card border (default/expiring only)
|
|
241
|
+
theme.colors.content.primary // Title text
|
|
242
|
+
theme.colors.content.tertiary // Description and caption text
|
|
243
|
+
theme.colors.content.alert.secondary // Expiring badge color
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Migration from v1
|
|
247
|
+
|
|
248
|
+
```diff
|
|
249
|
+
<QuestCard
|
|
250
|
+
title="Play any game"
|
|
251
|
+
- subtitle="0/12 hours"
|
|
252
|
+
+ description="With Play Time Rewards On"
|
|
253
|
+
+ caption="0/12 hours"
|
|
254
|
+
icon={<Flag />}
|
|
255
|
+
- status="warning"
|
|
256
|
+
- statusIcon={<AlertCircle />}
|
|
257
|
+
+ questState="expiring"
|
|
258
|
+
trailing={<Tag>+50</Tag>}
|
|
259
|
+
/>
|
|
221
260
|
```
|
|
222
261
|
|
|
223
262
|
## Accessibility
|
|
224
263
|
|
|
225
264
|
- Uses semantic HTML structure
|
|
226
265
|
- Interactive cards support keyboard navigation
|
|
227
|
-
-
|
|
266
|
+
- Quest state visuals provide clear feedback (opacity, border, badge)
|
|
228
267
|
- Supports custom `onPress` for full card interaction
|
|
229
268
|
- Includes `testID` prop for testing
|
package/native/index.d.mts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
/** @deprecated Use `QuestCardState` instead. */
|
|
3
4
|
type QuestCardStatus = "default" | "alert" | "warning" | "success";
|
|
5
|
+
type QuestCardState = "default" | "completed" | "expired" | "expiring";
|
|
4
6
|
interface QuestCardProps {
|
|
5
7
|
/** Quest title text */
|
|
6
8
|
title: string;
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
+
/** Secondary description text displayed below the title */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** Bottom caption text (e.g. "0/100", "Completed", "Expired") */
|
|
12
|
+
caption?: string;
|
|
13
|
+
/** Visual quest state controlling opacity, border, and badge */
|
|
14
|
+
questState?: QuestCardState;
|
|
9
15
|
/** Icon to display in the icon container */
|
|
10
16
|
icon?: React.ReactNode;
|
|
11
|
-
/** Status indicator - shows an icon next to the title */
|
|
12
|
-
status?: QuestCardStatus;
|
|
13
|
-
/** Custom status icon (overrides default status icons) */
|
|
14
|
-
statusIcon?: React.ReactNode;
|
|
15
17
|
/** Reward tag or custom trailing content */
|
|
16
18
|
trailing?: React.ReactNode;
|
|
17
19
|
/** Card press handler */
|
|
@@ -20,8 +22,21 @@ interface QuestCardProps {
|
|
|
20
22
|
className?: string;
|
|
21
23
|
/** Test ID for testing */
|
|
22
24
|
testID?: string;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Use `description` instead. Maps directly to `description`.
|
|
27
|
+
*/
|
|
28
|
+
subtitle?: string;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Use `questState` instead.
|
|
31
|
+
* "success" maps to "completed", "warning"/"alert" map to "expiring", "default" maps to "default".
|
|
32
|
+
*/
|
|
33
|
+
status?: QuestCardStatus;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated No longer used in the redesigned component. Use `questState` to control visual state.
|
|
36
|
+
*/
|
|
37
|
+
statusIcon?: React.ReactNode;
|
|
23
38
|
}
|
|
24
39
|
|
|
25
40
|
declare const QuestCard: React.FC<QuestCardProps>;
|
|
26
41
|
|
|
27
|
-
export { QuestCard, type QuestCardProps, type QuestCardStatus };
|
|
42
|
+
export { QuestCard, type QuestCardProps, type QuestCardState, type QuestCardStatus };
|
package/native/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
/** @deprecated Use `QuestCardState` instead. */
|
|
3
4
|
type QuestCardStatus = "default" | "alert" | "warning" | "success";
|
|
5
|
+
type QuestCardState = "default" | "completed" | "expired" | "expiring";
|
|
4
6
|
interface QuestCardProps {
|
|
5
7
|
/** Quest title text */
|
|
6
8
|
title: string;
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
+
/** Secondary description text displayed below the title */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** Bottom caption text (e.g. "0/100", "Completed", "Expired") */
|
|
12
|
+
caption?: string;
|
|
13
|
+
/** Visual quest state controlling opacity, border, and badge */
|
|
14
|
+
questState?: QuestCardState;
|
|
9
15
|
/** Icon to display in the icon container */
|
|
10
16
|
icon?: React.ReactNode;
|
|
11
|
-
/** Status indicator - shows an icon next to the title */
|
|
12
|
-
status?: QuestCardStatus;
|
|
13
|
-
/** Custom status icon (overrides default status icons) */
|
|
14
|
-
statusIcon?: React.ReactNode;
|
|
15
17
|
/** Reward tag or custom trailing content */
|
|
16
18
|
trailing?: React.ReactNode;
|
|
17
19
|
/** Card press handler */
|
|
@@ -20,8 +22,21 @@ interface QuestCardProps {
|
|
|
20
22
|
className?: string;
|
|
21
23
|
/** Test ID for testing */
|
|
22
24
|
testID?: string;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Use `description` instead. Maps directly to `description`.
|
|
27
|
+
*/
|
|
28
|
+
subtitle?: string;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Use `questState` instead.
|
|
31
|
+
* "success" maps to "completed", "warning"/"alert" map to "expiring", "default" maps to "default".
|
|
32
|
+
*/
|
|
33
|
+
status?: QuestCardStatus;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated No longer used in the redesigned component. Use `questState` to control visual state.
|
|
36
|
+
*/
|
|
37
|
+
statusIcon?: React.ReactNode;
|
|
23
38
|
}
|
|
24
39
|
|
|
25
40
|
declare const QuestCard: React.FC<QuestCardProps>;
|
|
26
41
|
|
|
27
|
-
export { QuestCard, type QuestCardProps, type QuestCardStatus };
|
|
42
|
+
export { QuestCard, type QuestCardProps, type QuestCardState, type QuestCardStatus };
|