@xsolla/xui-b2b-stepper 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 +179 -0
  2. package/package.json +4 -4
package/README.md ADDED
@@ -0,0 +1,179 @@
1
+ # B2B Stepper
2
+
3
+ A multi-step progress indicator for B2B surfaces. Supports vertical and horizontal layouts, interactive step navigation, a chip-only "simple" mode, and an optional tinted surface container. Designed to match the B2B Figma component library.
4
+
5
+ > **Prefer this over `@xsolla/xui-stepper`** for all B2B surfaces. The base stepper package is deprecated for B2B use.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @xsolla/xui-b2b-stepper
11
+ # or
12
+ yarn add @xsolla/xui-b2b-stepper
13
+ ```
14
+
15
+ ## Demo
16
+
17
+ ### Basic Vertical Stepper
18
+
19
+ ```tsx
20
+ import React from 'react';
21
+ import { Stepper } from '@xsolla/xui-b2b-stepper';
22
+
23
+ export default function BasicStepper() {
24
+ const steps = [
25
+ { title: 'Account details', description: 'Name, email, password', state: 'current' as const },
26
+ { title: 'Billing', description: 'Payment method' },
27
+ { title: 'Confirm', description: 'Review and submit' },
28
+ ];
29
+
30
+ return <Stepper steps={steps} direction="vertical" />;
31
+ }
32
+ ```
33
+
34
+ ### Horizontal Stepper
35
+
36
+ ```tsx
37
+ <Stepper steps={steps} direction="horizontal" />
38
+ ```
39
+
40
+ ### With Surface Container
41
+
42
+ Wraps the stepper in a tinted card (background-secondary + overlay-mono). Recommended when embedding inside a `Drawer` sidebar.
43
+
44
+ ```tsx
45
+ <Stepper steps={steps} direction="vertical" surface />
46
+ ```
47
+
48
+ ### Interactive (Clickable Steps)
49
+
50
+ ```tsx
51
+ import React, { useState } from 'react';
52
+ import { Stepper, type StepType } from '@xsolla/xui-b2b-stepper';
53
+
54
+ const STEPS = [
55
+ { title: 'Account details', description: 'Name, email, password' },
56
+ { title: 'Billing', description: 'Payment method' },
57
+ { title: 'Confirm', description: 'Review and submit' },
58
+ ];
59
+
60
+ export default function ClickableStepper() {
61
+ const [active, setActive] = useState(1);
62
+
63
+ const steps: StepType[] = STEPS.map((s, i) => ({
64
+ ...s,
65
+ state:
66
+ i + 1 < active ? 'complete' :
67
+ i + 1 === active ? 'current' : 'incomplete',
68
+ }));
69
+
70
+ return (
71
+ <Stepper
72
+ steps={steps}
73
+ direction="vertical"
74
+ onClick={({ number }) => setActive(number)}
75
+ />
76
+ );
77
+ }
78
+ ```
79
+
80
+ ### Simple (Numbers Only)
81
+
82
+ Renders only the numbered chip without heading, description, or caption. Best for horizontal status bars.
83
+
84
+ ```tsx
85
+ <Stepper
86
+ steps={[
87
+ { title: 'Step 1', state: 'complete' },
88
+ { title: 'Step 2', state: 'current' },
89
+ { title: 'Step 3' },
90
+ ]}
91
+ direction="horizontal"
92
+ simple
93
+ />
94
+ ```
95
+
96
+ ### With Step Captions
97
+
98
+ Small caption text rendered above the title (e.g. "Optional", "Step 1 of 3").
99
+
100
+ ```tsx
101
+ <Stepper
102
+ steps={[
103
+ { caption: 'Step 1', title: 'Account details', state: 'current' },
104
+ { caption: 'Step 2', title: 'Billing' },
105
+ { caption: 'Step 3', title: 'Confirm' },
106
+ ]}
107
+ direction="vertical"
108
+ />
109
+ ```
110
+
111
+ ### All Step States
112
+
113
+ ```tsx
114
+ <Stepper
115
+ direction="vertical"
116
+ steps={[
117
+ { title: 'Complete', state: 'complete' },
118
+ { title: 'Current', state: 'current' },
119
+ { title: 'Loading', state: 'loading' },
120
+ { title: 'Warning', state: 'warning' },
121
+ { title: 'Alert', state: 'alert' },
122
+ { title: 'Incomplete', state: 'incomplete' },
123
+ ]}
124
+ />
125
+ ```
126
+
127
+ ## API Reference
128
+
129
+ ### Stepper
130
+
131
+ | Prop | Type | Default | Description |
132
+ | :--- | :--- | :------ | :---------- |
133
+ | `steps` | `StepType[]` | — | Array of step definitions. |
134
+ | `direction` | `"vertical" \| "horizontal"` | `"vertical"` | Layout direction. |
135
+ | `surface` | `boolean` | `false` | Wrap in a tinted surface card (background-secondary + overlay-mono, radius 8). |
136
+ | `simple` | `boolean` | `false` | Render chip only — no title, description, or caption. |
137
+ | `onClick` | `StepClickType` | — | Called when a step is clicked. Receives `{ number, step }`. |
138
+ | `aria-label` | `string` | auto | Accessible label for the stepper navigation. Defaults to `"Stepper with N steps"`. |
139
+ | `className` | `string` | — | CSS class applied to the root element. |
140
+ | `themeMode` | `string` | — | Override the global theme mode for this component. |
141
+ | `themeProductContext` | `string` | — | Override the global product context for this component. |
142
+
143
+ ### StepType
144
+
145
+ | Field | Type | Default | Description |
146
+ | :---- | :--- | :------ | :---------- |
147
+ | `title` | `ReactNode` | — | Step heading. |
148
+ | `description` | `ReactNode` | — | Secondary text below the title. |
149
+ | `caption` | `ReactNode` | — | Small caption rendered above the title (body-xs, tertiary color). |
150
+ | `state` | `StepStateType` | `"incomplete"` | Visual state of the step. |
151
+ | `disabled` | `boolean` | `false` | Prevents click interaction. |
152
+ | `noClick` | `boolean` | `false` | Suppresses click even when `onClick` is provided. |
153
+ | `key` | `string` | — | Stable React key override (falls back to index). |
154
+
155
+ ### StepStateType
156
+
157
+ | Value | Appearance |
158
+ | :---- | :--------- |
159
+ | `"current"` | Active step — highlighted chip, white card background. |
160
+ | `"complete"` | Finished — checkmark icon in chip. |
161
+ | `"incomplete"` | Future step — muted appearance. |
162
+ | `"loading"` | In progress — spinner in chip, card background. |
163
+ | `"warning"` | Needs attention — warning icon in chip, card background. |
164
+ | `"alert"` | Error/failed — alert icon in chip, card background. |
165
+
166
+ ### StepClickType
167
+
168
+ ```typescript
169
+ type StepClickType = (args: { number: number; step: StepType }) => void;
170
+ // number: 1-based index of the clicked step
171
+ ```
172
+
173
+ ## Accessibility
174
+
175
+ - `role="navigation"` with `aria-label` on the root.
176
+ - Active step marked with `aria-current="step"`.
177
+ - Clickable steps use `role="button"`, `tabIndex={0}`, and respond to Enter/Space.
178
+ - Disabled steps have `aria-disabled="true"`.
179
+ - Connector lines between the last step are `aria-hidden`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/xui-b2b-stepper",
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",
@@ -13,9 +13,9 @@
13
13
  "test:coverage": "vitest run --coverage"
14
14
  },
15
15
  "dependencies": {
16
- "@xsolla/xui-core": "0.148.0",
17
- "@xsolla/xui-icons-base": "0.148.0",
18
- "@xsolla/xui-primitives-core": "0.148.0"
16
+ "@xsolla/xui-core": "0.148.1",
17
+ "@xsolla/xui-icons-base": "0.148.1",
18
+ "@xsolla/xui-primitives-core": "0.148.1"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "react": ">=16.8.0",