@xsolla/xui-stepper 0.141.1 → 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 +246 -0
  2. package/package.json +5 -4
package/README.md ADDED
@@ -0,0 +1,246 @@
1
+ # Stepper
2
+
3
+ > **Deprecated.** For B2B surfaces, use [`@xsolla/xui-b2b-stepper`](./b2b-stepper.md) which implements the current Figma design. This package remains available for existing consumers of `@xsolla/xui-display` and will be removed in a future release.
4
+
5
+ A cross-platform React stepper component that displays progress through a sequence of steps, supporting horizontal and vertical layouts with multiple step states.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @xsolla/xui-stepper
11
+ # or
12
+ yarn add @xsolla/xui-stepper
13
+ ```
14
+
15
+ ## Demo
16
+
17
+ ### Basic Stepper
18
+
19
+ ```tsx
20
+ import * as React from 'react';
21
+ import { Stepper } from '@xsolla/xui-stepper';
22
+
23
+ export default function BasicStepper() {
24
+ const steps = [
25
+ { title: 'Account', state: 'complete' as const },
26
+ { title: 'Payment', state: 'current' as const },
27
+ { title: 'Review', state: 'incomplete' as const },
28
+ ];
29
+
30
+ return <Stepper steps={steps} />;
31
+ }
32
+ ```
33
+
34
+ ### Vertical Stepper
35
+
36
+ ```tsx
37
+ import * as React from 'react';
38
+ import { Stepper } from '@xsolla/xui-stepper';
39
+
40
+ export default function VerticalStepper() {
41
+ const steps = [
42
+ { title: 'Step 1', description: 'Account details', state: 'complete' as const },
43
+ { title: 'Step 2', description: 'Payment method', state: 'current' as const },
44
+ { title: 'Step 3', description: 'Order review', state: 'incomplete' as const },
45
+ ];
46
+
47
+ return <Stepper steps={steps} direction="vertical" />;
48
+ }
49
+ ```
50
+
51
+ ### With States
52
+
53
+ ```tsx
54
+ import * as React from 'react';
55
+ import { Stepper } from '@xsolla/xui-stepper';
56
+
57
+ export default function StepStates() {
58
+ const steps = [
59
+ { title: 'Complete', state: 'complete' as const },
60
+ { title: 'Warning', state: 'warning' as const },
61
+ { title: 'Alert', state: 'alert' as const },
62
+ { title: 'Loading', state: 'loading' as const },
63
+ { title: 'Current', state: 'current' as const },
64
+ { title: 'Incomplete', state: 'incomplete' as const },
65
+ ];
66
+
67
+ return <Stepper steps={steps} />;
68
+ }
69
+ ```
70
+
71
+ ## Anatomy
72
+
73
+ ```jsx
74
+ import { Stepper } from '@xsolla/xui-stepper';
75
+
76
+ <Stepper
77
+ steps={steps} // Array of step objects
78
+ direction="horizontal" // horizontal or vertical
79
+ size="md" // s or m
80
+ variantUI="current" // current or simple
81
+ palette="brand" // brand or brandSecondary
82
+ tail={false} // Show connecting line (simple variant)
83
+ onClick={handleClick} // Step click handler
84
+ aria-label="Checkout" // Accessible label
85
+ />
86
+ ```
87
+
88
+ ## Examples
89
+
90
+ ### Checkout Flow
91
+
92
+ ```tsx
93
+ import * as React from 'react';
94
+ import { Stepper } from '@xsolla/xui-stepper';
95
+
96
+ export default function CheckoutFlow() {
97
+ const [currentStep, setCurrentStep] = React.useState(1);
98
+
99
+ const steps = [
100
+ { title: 'Cart', state: currentStep > 0 ? 'complete' as const : 'incomplete' as const },
101
+ { title: 'Shipping', state: currentStep === 1 ? 'current' as const : currentStep > 1 ? 'complete' as const : 'incomplete' as const },
102
+ { title: 'Payment', state: currentStep === 2 ? 'current' as const : currentStep > 2 ? 'complete' as const : 'incomplete' as const },
103
+ { title: 'Confirm', state: currentStep === 3 ? 'current' as const : 'incomplete' as const },
104
+ ];
105
+
106
+ return (
107
+ <div>
108
+ <Stepper
109
+ steps={steps}
110
+ onClick={({ number }) => setCurrentStep(number)}
111
+ />
112
+ <div style={{ marginTop: 24 }}>
113
+ <button onClick={() => setCurrentStep(Math.max(0, currentStep - 1))}>Back</button>
114
+ <button onClick={() => setCurrentStep(Math.min(3, currentStep + 1))}>Next</button>
115
+ </div>
116
+ </div>
117
+ );
118
+ }
119
+ ```
120
+
121
+ ### Registration Steps
122
+
123
+ ```tsx
124
+ import * as React from 'react';
125
+ import { Stepper } from '@xsolla/xui-stepper';
126
+
127
+ export default function RegistrationSteps() {
128
+ const steps = [
129
+ { title: 'Email', description: 'Verify your email', state: 'complete' as const },
130
+ { title: 'Profile', description: 'Set up your profile', state: 'current' as const },
131
+ { title: 'Preferences', description: 'Customize settings', state: 'incomplete' as const },
132
+ ];
133
+
134
+ return (
135
+ <Stepper
136
+ steps={steps}
137
+ direction="vertical"
138
+ variantUI="current"
139
+ size="md"
140
+ />
141
+ );
142
+ }
143
+ ```
144
+
145
+ ### Simple Variant with Tail
146
+
147
+ ```tsx
148
+ import * as React from 'react';
149
+ import { Stepper } from '@xsolla/xui-stepper';
150
+
151
+ export default function SimpleStepper() {
152
+ const steps = [
153
+ { title: 'Step 1', state: 'complete' as const },
154
+ { title: 'Step 2', state: 'current' as const },
155
+ { title: 'Step 3', state: 'incomplete' as const },
156
+ ];
157
+
158
+ return <Stepper steps={steps} variantUI="simple" tail />;
159
+ }
160
+ ```
161
+
162
+ ### Order Tracking
163
+
164
+ ```tsx
165
+ import * as React from 'react';
166
+ import { Stepper } from '@xsolla/xui-stepper';
167
+
168
+ export default function OrderTracking() {
169
+ const steps = [
170
+ { title: 'Order Placed', description: 'Jan 20, 2024', state: 'complete' as const },
171
+ { title: 'Processing', description: 'Jan 21, 2024', state: 'complete' as const },
172
+ { title: 'Shipped', description: 'In transit', state: 'loading' as const },
173
+ { title: 'Delivered', state: 'incomplete' as const },
174
+ ];
175
+
176
+ return (
177
+ <Stepper
178
+ steps={steps}
179
+ direction="vertical"
180
+ palette="brand"
181
+ />
182
+ );
183
+ }
184
+ ```
185
+
186
+ ## API Reference
187
+
188
+ ### Stepper
189
+
190
+ **StepperProps:**
191
+
192
+ | Prop | Type | Default | Description |
193
+ | :--- | :--- | :------ | :---------- |
194
+ | steps | `StepType[]` | - | Array of step definitions. |
195
+ | direction | `"horizontal" \| "vertical"` | `"horizontal"` | Layout direction. |
196
+ | size | `"sm" \| "md"` | `"md"` | Step size. |
197
+ | variantUI | `"current" \| "simple"` | `"current"` | Visual variant. |
198
+ | palette | `"brand" \| "brandSecondary"` | `"brand"` | Color palette. |
199
+ | tail | `boolean` | `false` | Show connecting lines (simple variant). |
200
+ | onClick | `StepClickType` | - | Step click handler. |
201
+ | aria-label | `string` | - | Accessible label for stepper. |
202
+
203
+ **StepType:**
204
+
205
+ ```typescript
206
+ interface StepType {
207
+ title: string | ReactElement;
208
+ description?: string | ReactElement;
209
+ state?: "current" | "incomplete" | "loading" | "complete" | "alert" | "warning";
210
+ disabled?: boolean;
211
+ key?: string;
212
+ noClick?: boolean;
213
+ }
214
+ ```
215
+
216
+ **StepClickType:**
217
+
218
+ ```typescript
219
+ type StepClickType = ({ number, step }: { number: number; step: StepType }) => void;
220
+ ```
221
+
222
+ ## Step States
223
+
224
+ | State | Description |
225
+ | :---- | :---------- |
226
+ | `current` | Active step, highlighted with brand color |
227
+ | `complete` | Finished step with checkmark |
228
+ | `incomplete` | Future step, muted appearance |
229
+ | `loading` | Step in progress with spinner |
230
+ | `alert` | Error state with alert color |
231
+ | `warning` | Warning state with warning color |
232
+
233
+ ## UI Variants
234
+
235
+ | Variant | Description |
236
+ | :------ | :---------- |
237
+ | `current` | Traditional stepper with step indicators and border line |
238
+ | `simple` | Minimalist stepper with optional connecting tail |
239
+
240
+ ## Accessibility
241
+
242
+ - Stepper uses `role="navigation"` for semantic meaning
243
+ - Each step is keyboard accessible when clickable
244
+ - `aria-label` provides context for screen readers
245
+ - Step states are conveyed through visual and accessible means
246
+ - Disabled steps are properly announced
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@xsolla/xui-stepper",
3
- "version": "0.141.1",
3
+ "version": "0.148.2",
4
+ "deprecated": "Use @xsolla/xui-b2b-stepper for B2B surfaces. This package will be removed in a future release.",
4
5
  "main": "./web/index.js",
5
6
  "module": "./web/index.mjs",
6
7
  "types": "./web/index.d.ts",
@@ -14,9 +15,9 @@
14
15
  "test:coverage": "vitest run --coverage"
15
16
  },
16
17
  "dependencies": {
17
- "@xsolla/xui-core": "0.141.1",
18
- "@xsolla/xui-icons": "0.141.1",
19
- "@xsolla/xui-primitives-core": "0.141.1"
18
+ "@xsolla/xui-core": "0.148.2",
19
+ "@xsolla/xui-icons": "0.148.2",
20
+ "@xsolla/xui-primitives-core": "0.148.2"
20
21
  },
21
22
  "peerDependencies": {
22
23
  "react": ">=16.8.0",