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