@xsolla/xui-b2b-stepper 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.
package/web/index.js ADDED
@@ -0,0 +1,1009 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.tsx
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ Stepper: () => Stepper
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/Stepper.tsx
38
+ var import_react6 = require("react");
39
+
40
+ // ../../foundation/primitives-web/src/Box.tsx
41
+ var import_react2 = __toESM(require("react"));
42
+ var import_styled_components = __toESM(require("styled-components"));
43
+
44
+ // ../../foundation/primitives-web/src/filterDOMProps.ts
45
+ var import_react = __toESM(require("react"));
46
+
47
+ // ../../../node_modules/@emotion/memoize/dist/memoize.esm.js
48
+ function memoize(fn) {
49
+ var cache = {};
50
+ return function(arg) {
51
+ if (cache[arg] === void 0) cache[arg] = fn(arg);
52
+ return cache[arg];
53
+ };
54
+ }
55
+ var memoize_esm_default = memoize;
56
+
57
+ // ../../../node_modules/@emotion/is-prop-valid/dist/is-prop-valid.esm.js
58
+ var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
59
+ var index = memoize_esm_default(
60
+ function(prop) {
61
+ return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
62
+ }
63
+ /* Z+1 */
64
+ );
65
+ var is_prop_valid_esm_default = index;
66
+
67
+ // ../../foundation/primitives-web/src/filterDOMProps.ts
68
+ var ADDITIONAL_BLOCKED_PROPS = /* @__PURE__ */ new Set([
69
+ // RN-only event handlers (pass isPropValid's on* pattern)
70
+ "onPress",
71
+ "onChangeText",
72
+ "onLayout",
73
+ "onMoveShouldSetResponder",
74
+ "onResponderGrant",
75
+ "onResponderMove",
76
+ "onResponderRelease",
77
+ "onResponderTerminate",
78
+ // SVG attributes that pass isPropValid
79
+ "strokeWidth",
80
+ // CSS properties that pass isPropValid but are used as component props
81
+ "overflow",
82
+ "cursor",
83
+ "fontSize",
84
+ "fontWeight",
85
+ "fontFamily",
86
+ "textDecoration"
87
+ ]);
88
+ function shouldForwardProp(key) {
89
+ if (ADDITIONAL_BLOCKED_PROPS.has(key)) return false;
90
+ return is_prop_valid_esm_default(key);
91
+ }
92
+ function createFilteredElement(defaultTag) {
93
+ const Component = import_react.default.forwardRef(
94
+ ({ children, elementType, ...props }, ref) => {
95
+ const Tag = elementType || defaultTag;
96
+ const htmlProps = {};
97
+ for (const key of Object.keys(props)) {
98
+ if (shouldForwardProp(key)) {
99
+ htmlProps[key] = props[key];
100
+ }
101
+ }
102
+ return import_react.default.createElement(
103
+ Tag,
104
+ { ref, ...htmlProps },
105
+ children
106
+ );
107
+ }
108
+ );
109
+ Component.displayName = `Filtered(${defaultTag})`;
110
+ return Component;
111
+ }
112
+
113
+ // ../../foundation/primitives-web/src/Box.tsx
114
+ var import_jsx_runtime = require("react/jsx-runtime");
115
+ var FilteredDiv = createFilteredElement("div");
116
+ var StyledBox = (0, import_styled_components.default)(FilteredDiv)`
117
+ display: flex;
118
+ box-sizing: border-box;
119
+ background-color: ${(props) => props.backgroundColor || "transparent"};
120
+ border-color: ${(props) => props.borderColor || "transparent"};
121
+ border-width: ${(props) => typeof props.borderWidth === "number" ? `${props.borderWidth}px` : props.borderWidth || 0};
122
+
123
+ ${(props) => props.borderBottomWidth !== void 0 && `
124
+ border-bottom-width: ${typeof props.borderBottomWidth === "number" ? `${props.borderBottomWidth}px` : props.borderBottomWidth};
125
+ border-bottom-color: ${props.borderBottomColor || props.borderColor || "transparent"};
126
+ border-bottom-style: solid;
127
+ `}
128
+ ${(props) => props.borderTopWidth !== void 0 && `
129
+ border-top-width: ${typeof props.borderTopWidth === "number" ? `${props.borderTopWidth}px` : props.borderTopWidth};
130
+ border-top-color: ${props.borderTopColor || props.borderColor || "transparent"};
131
+ border-top-style: solid;
132
+ `}
133
+ ${(props) => props.borderLeftWidth !== void 0 && `
134
+ border-left-width: ${typeof props.borderLeftWidth === "number" ? `${props.borderLeftWidth}px` : props.borderLeftWidth};
135
+ border-left-color: ${props.borderLeftColor || props.borderColor || "transparent"};
136
+ border-left-style: solid;
137
+ `}
138
+ ${(props) => props.borderRightWidth !== void 0 && `
139
+ border-right-width: ${typeof props.borderRightWidth === "number" ? `${props.borderRightWidth}px` : props.borderRightWidth};
140
+ border-right-color: ${props.borderRightColor || props.borderColor || "transparent"};
141
+ border-right-style: solid;
142
+ `}
143
+
144
+ border-style: ${(props) => props.borderStyle || (props.borderWidth || props.borderBottomWidth || props.borderTopWidth || props.borderLeftWidth || props.borderRightWidth ? "solid" : "none")};
145
+ border-radius: ${(props) => typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius || 0};
146
+ height: ${(props) => typeof props.height === "number" ? `${props.height}px` : props.height || "auto"};
147
+ width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
148
+ min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
149
+ min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
150
+ max-width: ${(props) => typeof props.maxWidth === "number" ? `${props.maxWidth}px` : props.maxWidth || "none"};
151
+ max-height: ${(props) => typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight || "none"};
152
+
153
+ padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
154
+ ${(props) => props.paddingHorizontal && `
155
+ padding-left: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
156
+ padding-right: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
157
+ `}
158
+ ${(props) => props.paddingVertical && `
159
+ padding-top: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
160
+ padding-bottom: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
161
+ `}
162
+ ${(props) => props.paddingTop !== void 0 && `padding-top: ${typeof props.paddingTop === "number" ? `${props.paddingTop}px` : props.paddingTop};`}
163
+ ${(props) => props.paddingBottom !== void 0 && `padding-bottom: ${typeof props.paddingBottom === "number" ? `${props.paddingBottom}px` : props.paddingBottom};`}
164
+ ${(props) => props.paddingLeft !== void 0 && `padding-left: ${typeof props.paddingLeft === "number" ? `${props.paddingLeft}px` : props.paddingLeft};`}
165
+ ${(props) => props.paddingRight !== void 0 && `padding-right: ${typeof props.paddingRight === "number" ? `${props.paddingRight}px` : props.paddingRight};`}
166
+
167
+ margin: ${(props) => typeof props.margin === "number" ? `${props.margin}px` : props.margin || 0};
168
+ ${(props) => props.marginTop !== void 0 && `margin-top: ${typeof props.marginTop === "number" ? `${props.marginTop}px` : props.marginTop};`}
169
+ ${(props) => props.marginBottom !== void 0 && `margin-bottom: ${typeof props.marginBottom === "number" ? `${props.marginBottom}px` : props.marginBottom};`}
170
+ ${(props) => props.marginLeft !== void 0 && `margin-left: ${typeof props.marginLeft === "number" ? `${props.marginLeft}px` : props.marginLeft};`}
171
+ ${(props) => props.marginRight !== void 0 && `margin-right: ${typeof props.marginRight === "number" ? `${props.marginRight}px` : props.marginRight};`}
172
+
173
+ flex-direction: ${(props) => props.flexDirection || "column"};
174
+ flex-wrap: ${(props) => props.flexWrap || "nowrap"};
175
+ align-items: ${(props) => props.alignItems || "stretch"};
176
+ justify-content: ${(props) => props.justifyContent || "flex-start"};
177
+ cursor: ${(props) => props.cursor ? props.cursor : props.onClick || props.onPress ? "pointer" : "inherit"};
178
+ position: ${(props) => props.position || "static"};
179
+ top: ${(props) => typeof props.top === "number" ? `${props.top}px` : props.top};
180
+ bottom: ${(props) => typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom};
181
+ left: ${(props) => typeof props.left === "number" ? `${props.left}px` : props.left};
182
+ right: ${(props) => typeof props.right === "number" ? `${props.right}px` : props.right};
183
+ flex: ${(props) => props.flex};
184
+ flex-shrink: ${(props) => props.flexShrink ?? 1};
185
+ gap: ${(props) => typeof props.gap === "number" ? `${props.gap}px` : props.gap || 0};
186
+ align-self: ${(props) => props.alignSelf || "auto"};
187
+ overflow: ${(props) => props.overflow || "visible"};
188
+ overflow-x: ${(props) => props.overflowX || "visible"};
189
+ overflow-y: ${(props) => props.overflowY || "visible"};
190
+ z-index: ${(props) => props.zIndex};
191
+ opacity: ${(props) => props.disabled ? 0.5 : 1};
192
+ pointer-events: ${(props) => props.disabled ? "none" : "auto"};
193
+
194
+ &:hover {
195
+ ${(props) => props.hoverStyle?.backgroundColor && `background-color: ${props.hoverStyle.backgroundColor};`}
196
+ ${(props) => props.hoverStyle?.borderColor && `border-color: ${props.hoverStyle.borderColor};`}
197
+ }
198
+
199
+ &:active {
200
+ ${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
201
+ }
202
+ `;
203
+ var Box = import_react2.default.forwardRef(
204
+ ({
205
+ children,
206
+ onPress,
207
+ onKeyDown,
208
+ onKeyUp,
209
+ role,
210
+ "aria-label": ariaLabel,
211
+ "aria-labelledby": ariaLabelledBy,
212
+ "aria-current": ariaCurrent,
213
+ "aria-disabled": ariaDisabled,
214
+ "aria-live": ariaLive,
215
+ "aria-busy": ariaBusy,
216
+ "aria-describedby": ariaDescribedBy,
217
+ "aria-expanded": ariaExpanded,
218
+ "aria-haspopup": ariaHasPopup,
219
+ "aria-pressed": ariaPressed,
220
+ "aria-controls": ariaControls,
221
+ tabIndex,
222
+ as,
223
+ src,
224
+ alt,
225
+ type,
226
+ disabled,
227
+ id,
228
+ testID,
229
+ "data-testid": dataTestId,
230
+ ...props
231
+ }, ref) => {
232
+ if (as === "img" && src) {
233
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
234
+ "img",
235
+ {
236
+ src,
237
+ alt: alt || "",
238
+ style: {
239
+ display: "block",
240
+ objectFit: "cover",
241
+ width: typeof props.width === "number" ? `${props.width}px` : props.width,
242
+ height: typeof props.height === "number" ? `${props.height}px` : props.height,
243
+ borderRadius: typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius,
244
+ position: props.position,
245
+ top: typeof props.top === "number" ? `${props.top}px` : props.top,
246
+ left: typeof props.left === "number" ? `${props.left}px` : props.left,
247
+ right: typeof props.right === "number" ? `${props.right}px` : props.right,
248
+ bottom: typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom
249
+ }
250
+ }
251
+ );
252
+ }
253
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
254
+ StyledBox,
255
+ {
256
+ ref,
257
+ elementType: as,
258
+ id,
259
+ type: as === "button" ? type || "button" : void 0,
260
+ disabled: as === "button" ? disabled : void 0,
261
+ onClick: onPress,
262
+ onKeyDown,
263
+ onKeyUp,
264
+ role,
265
+ "aria-label": ariaLabel,
266
+ "aria-labelledby": ariaLabelledBy,
267
+ "aria-current": ariaCurrent,
268
+ "aria-disabled": ariaDisabled,
269
+ "aria-busy": ariaBusy,
270
+ "aria-describedby": ariaDescribedBy,
271
+ "aria-expanded": ariaExpanded,
272
+ "aria-haspopup": ariaHasPopup,
273
+ "aria-pressed": ariaPressed,
274
+ "aria-controls": ariaControls,
275
+ "aria-live": ariaLive,
276
+ tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
277
+ "data-testid": dataTestId || testID,
278
+ ...props,
279
+ children
280
+ }
281
+ );
282
+ }
283
+ );
284
+ Box.displayName = "Box";
285
+
286
+ // ../../foundation/primitives-web/src/Text.tsx
287
+ var import_styled_components2 = __toESM(require("styled-components"));
288
+ var import_jsx_runtime2 = require("react/jsx-runtime");
289
+ var FilteredSpan = createFilteredElement("span");
290
+ var StyledText = (0, import_styled_components2.default)(FilteredSpan)`
291
+ color: ${(props) => props.color || "inherit"};
292
+ font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
293
+ font-weight: ${(props) => props.fontWeight || "normal"};
294
+ font-family: ${(props) => props.fontFamily || '"Aktiv Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'};
295
+ line-height: ${(props) => typeof props.lineHeight === "number" ? `${props.lineHeight}px` : props.lineHeight || "inherit"};
296
+ white-space: ${(props) => props.whiteSpace || "normal"};
297
+ text-align: ${(props) => props.textAlign || "inherit"};
298
+ text-decoration: ${(props) => props.textDecoration || "none"};
299
+ `;
300
+ var Text = ({
301
+ style,
302
+ className,
303
+ id,
304
+ role,
305
+ numberOfLines: _numberOfLines,
306
+ ...props
307
+ }) => {
308
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
309
+ StyledText,
310
+ {
311
+ ...props,
312
+ style,
313
+ className,
314
+ id,
315
+ role
316
+ }
317
+ );
318
+ };
319
+
320
+ // ../../foundation/primitives-web/src/Spinner.tsx
321
+ var import_styled_components3 = __toESM(require("styled-components"));
322
+ var import_jsx_runtime3 = require("react/jsx-runtime");
323
+ var rotate = import_styled_components3.keyframes`
324
+ from {
325
+ transform: rotate(0deg);
326
+ }
327
+ to {
328
+ transform: rotate(360deg);
329
+ }
330
+ `;
331
+ var FilteredDiv2 = createFilteredElement("div");
332
+ var StyledSpinner = (0, import_styled_components3.default)(FilteredDiv2)`
333
+ width: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
334
+ height: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
335
+ border: ${(props) => props.strokeWidth || 2}px solid
336
+ ${(props) => props.color || "currentColor"};
337
+ border-bottom-color: transparent;
338
+ border-radius: 50%;
339
+ display: inline-block;
340
+ box-sizing: border-box;
341
+ animation: ${rotate} 1s linear infinite;
342
+ `;
343
+ var Spinner = ({
344
+ role = "status",
345
+ "aria-label": ariaLabel,
346
+ "aria-live": ariaLive = "polite",
347
+ "aria-describedby": ariaDescribedBy,
348
+ testID,
349
+ ...props
350
+ }) => {
351
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
352
+ StyledSpinner,
353
+ {
354
+ role,
355
+ "aria-label": ariaLabel,
356
+ "aria-live": ariaLive,
357
+ "aria-describedby": ariaDescribedBy,
358
+ "data-testid": testID,
359
+ ...props
360
+ }
361
+ );
362
+ };
363
+ Spinner.displayName = "Spinner";
364
+
365
+ // src/Stepper.tsx
366
+ var import_xui_core = require("@xsolla/xui-core");
367
+
368
+ // src/Step.tsx
369
+ var import_react5 = require("react");
370
+
371
+ // src/StepChip.tsx
372
+ var import_react3 = require("react");
373
+ var import_xui_icons_base = require("@xsolla/xui-icons-base");
374
+ var import_jsx_runtime4 = require("react/jsx-runtime");
375
+ var getChipBackground = (state, theme) => {
376
+ switch (state) {
377
+ case "current":
378
+ return theme.colors.background.brand.secondary;
379
+ case "loading":
380
+ return theme.colors.overlay.brand;
381
+ case "complete":
382
+ return theme.colors.background.success.secondary;
383
+ case "warning":
384
+ return theme.colors.background.warning.secondary;
385
+ case "alert":
386
+ return theme.colors.background.alert.secondary;
387
+ case "incomplete":
388
+ default:
389
+ return theme.colors.overlay.mono;
390
+ }
391
+ };
392
+ var StepChip = (0, import_react3.memo)(
393
+ ({ state, stepNumber, sizing, theme }) => {
394
+ const numberColor = theme.colors.content.primary;
395
+ const bg = getChipBackground(state, theme);
396
+ const renderContent = () => {
397
+ switch (state) {
398
+ case "loading":
399
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
400
+ Spinner,
401
+ {
402
+ size: sizing.chipIconSize,
403
+ color: theme.colors.content.brand.primary,
404
+ strokeWidth: 2
405
+ }
406
+ );
407
+ case "complete":
408
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
409
+ import_xui_icons_base.Check,
410
+ {
411
+ size: sizing.chipIconSize,
412
+ color: theme.colors.content.success.primary
413
+ }
414
+ );
415
+ case "warning":
416
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
417
+ import_xui_icons_base.InfoCr,
418
+ {
419
+ size: sizing.chipIconSize,
420
+ color: theme.colors.content.warning.primary
421
+ }
422
+ );
423
+ case "alert":
424
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
425
+ import_xui_icons_base.Remove,
426
+ {
427
+ size: sizing.chipIconSize,
428
+ color: theme.colors.content.alert.primary
429
+ }
430
+ );
431
+ case "current":
432
+ case "incomplete":
433
+ default:
434
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
435
+ Text,
436
+ {
437
+ color: numberColor,
438
+ fontSize: sizing.numberFontSize,
439
+ lineHeight: sizing.numberLineHeight,
440
+ fontWeight: "500",
441
+ textAlign: "center",
442
+ children: stepNumber
443
+ }
444
+ );
445
+ }
446
+ };
447
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
448
+ Box,
449
+ {
450
+ width: sizing.chipSize,
451
+ height: sizing.chipSize,
452
+ borderRadius: sizing.chipRadius,
453
+ backgroundColor: bg,
454
+ alignItems: "center",
455
+ justifyContent: "center",
456
+ flexShrink: 0,
457
+ style: {
458
+ paddingTop: sizing.chipPaddingTop,
459
+ paddingBottom: sizing.chipPaddingBottom,
460
+ paddingLeft: sizing.chipPaddingX,
461
+ paddingRight: sizing.chipPaddingX
462
+ },
463
+ children: renderContent()
464
+ }
465
+ );
466
+ }
467
+ );
468
+ StepChip.displayName = "StepChip";
469
+
470
+ // src/StepConnector.tsx
471
+ var import_react4 = require("react");
472
+ var import_jsx_runtime5 = require("react/jsx-runtime");
473
+ var StepConnector = (0, import_react4.memo)(
474
+ ({ direction, color, length }) => {
475
+ if (direction === "vertical") {
476
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
477
+ Box,
478
+ {
479
+ style: {
480
+ width: 1,
481
+ height: length ?? 48,
482
+ backgroundColor: color,
483
+ flexShrink: 0
484
+ }
485
+ }
486
+ );
487
+ }
488
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
489
+ Box,
490
+ {
491
+ style: {
492
+ height: 1,
493
+ flex: 1,
494
+ minWidth: length ?? 24,
495
+ backgroundColor: color,
496
+ alignSelf: "center"
497
+ }
498
+ }
499
+ );
500
+ }
501
+ );
502
+ StepConnector.displayName = "StepConnector";
503
+
504
+ // src/Step.tsx
505
+ var import_jsx_runtime6 = require("react/jsx-runtime");
506
+ var ACTIVE_CARD_STATES = [
507
+ "current",
508
+ "loading",
509
+ "warning",
510
+ "alert"
511
+ ];
512
+ var Step = ({
513
+ step,
514
+ stepNumber,
515
+ isLast,
516
+ isFirst,
517
+ direction,
518
+ simple = false,
519
+ overlapBottom = 0,
520
+ zIndex,
521
+ onClick,
522
+ sizing,
523
+ theme
524
+ }) => {
525
+ const {
526
+ title,
527
+ description,
528
+ caption,
529
+ state = "incomplete",
530
+ disabled = false,
531
+ noClick = false
532
+ } = step;
533
+ const isHorizontal = direction === "horizontal";
534
+ const isActive = ACTIVE_CARD_STATES.includes(state);
535
+ const isCurrent = state === "current";
536
+ const isInteractive = !!onClick && !disabled && !noClick;
537
+ const handleClick = (0, import_react5.useCallback)(() => {
538
+ if (isInteractive) {
539
+ onClick({ number: stepNumber, step });
540
+ }
541
+ }, [isInteractive, onClick, stepNumber, step]);
542
+ const handleKeyDown = (0, import_react5.useCallback)(
543
+ (event) => {
544
+ if (!isInteractive) return;
545
+ if (event.key === "Enter") {
546
+ event.preventDefault();
547
+ handleClick();
548
+ } else if (event.key === " ") {
549
+ event.preventDefault();
550
+ }
551
+ },
552
+ [isInteractive, handleClick]
553
+ );
554
+ const handleKeyUp = (0, import_react5.useCallback)(
555
+ (event) => {
556
+ if (!isInteractive) return;
557
+ if (event.key === " ") {
558
+ event.preventDefault();
559
+ handleClick();
560
+ }
561
+ },
562
+ [isInteractive, handleClick]
563
+ );
564
+ const ariaLabel = (0, import_react5.useMemo)(() => {
565
+ const titleText = typeof title === "string" ? title : `Step ${stepNumber}`;
566
+ const descText = typeof description === "string" ? `, ${description}` : "";
567
+ return `Step ${stepNumber}: ${titleText}${descText}, ${state}`;
568
+ }, [stepNumber, title, description, state]);
569
+ const interactiveProps = isInteractive ? {
570
+ role: "button",
571
+ tabIndex: 0,
572
+ onClick: handleClick,
573
+ onKeyDown: handleKeyDown,
574
+ onKeyUp: handleKeyUp,
575
+ style: { cursor: "pointer" }
576
+ } : {
577
+ "aria-disabled": disabled || noClick ? true : void 0
578
+ };
579
+ const textBlockSizing = isHorizontal ? { flex: 1, minWidth: 0 } : { width: sizing.contentWidth, flexShrink: 0 };
580
+ const textBlock = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
581
+ Box,
582
+ {
583
+ flexDirection: "column",
584
+ alignItems: "flex-start",
585
+ justifyContent: "center",
586
+ style: {
587
+ gap: sizing.contentGap,
588
+ minHeight: sizing.contentMinHeight,
589
+ ...textBlockSizing
590
+ },
591
+ children: [
592
+ caption !== null && (typeof caption === "string" || typeof caption === "number" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
593
+ Text,
594
+ {
595
+ color: theme.colors.content.tertiary,
596
+ fontSize: sizing.captionFontSize,
597
+ lineHeight: sizing.captionLineHeight,
598
+ fontWeight: "400",
599
+ children: caption
600
+ }
601
+ ) : caption),
602
+ typeof title === "string" || typeof title === "number" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
603
+ Text,
604
+ {
605
+ color: theme.colors.content.primary,
606
+ fontSize: sizing.titleFontSize,
607
+ lineHeight: sizing.titleLineHeight,
608
+ fontWeight: "500",
609
+ children: title
610
+ }
611
+ ) : title,
612
+ description !== null && (typeof description === "string" || typeof description === "number" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
613
+ Text,
614
+ {
615
+ color: theme.colors.content.tertiary,
616
+ fontSize: sizing.descriptionFontSize,
617
+ lineHeight: sizing.descriptionLineHeight,
618
+ fontWeight: "400",
619
+ children: description
620
+ }
621
+ ) : description)
622
+ ]
623
+ }
624
+ );
625
+ if (simple) {
626
+ if (isHorizontal) {
627
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
628
+ Box,
629
+ {
630
+ flexDirection: "row",
631
+ alignItems: "center",
632
+ flex: isLast ? void 0 : 1,
633
+ "data-testid": "step",
634
+ "data-step-state": state,
635
+ "aria-current": isCurrent ? "step" : void 0,
636
+ "aria-label": ariaLabel,
637
+ ...interactiveProps,
638
+ children: [
639
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
640
+ Box,
641
+ {
642
+ flexDirection: "row",
643
+ alignItems: "center",
644
+ justifyContent: "center",
645
+ backgroundColor: isActive ? theme.colors.background.primary : void 0,
646
+ borderRadius: isActive ? sizing.simpleCardRadius : void 0,
647
+ style: {
648
+ padding: sizing.simpleCardPadding,
649
+ gap: sizing.simpleCardGap,
650
+ flexShrink: 0
651
+ },
652
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
653
+ StepChip,
654
+ {
655
+ state,
656
+ stepNumber,
657
+ sizing,
658
+ theme
659
+ }
660
+ )
661
+ }
662
+ ),
663
+ !isLast && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
664
+ Box,
665
+ {
666
+ flexDirection: "row",
667
+ alignItems: "center",
668
+ style: { flex: 1, minWidth: sizing.simpleHorizontalCellWidth },
669
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
670
+ Box,
671
+ {
672
+ style: {
673
+ flex: 1,
674
+ height: 1,
675
+ backgroundColor: theme.colors.border.secondary
676
+ }
677
+ }
678
+ )
679
+ }
680
+ )
681
+ ]
682
+ }
683
+ );
684
+ }
685
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
686
+ Box,
687
+ {
688
+ flexDirection: "column",
689
+ alignItems: "flex-start",
690
+ "data-testid": "step",
691
+ "data-step-state": state,
692
+ "aria-current": isCurrent ? "step" : void 0,
693
+ "aria-label": ariaLabel,
694
+ ...interactiveProps,
695
+ style: {
696
+ ...isInteractive ? { cursor: "pointer" } : {},
697
+ gap: sizing.simpleItemGap
698
+ },
699
+ children: [
700
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
701
+ Box,
702
+ {
703
+ flexDirection: "column",
704
+ alignItems: "center",
705
+ justifyContent: "center",
706
+ backgroundColor: isActive ? theme.colors.background.primary : void 0,
707
+ borderRadius: isActive ? sizing.simpleCardRadius : void 0,
708
+ style: {
709
+ padding: sizing.simpleCardPadding,
710
+ gap: sizing.simpleCardGap
711
+ },
712
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
713
+ StepChip,
714
+ {
715
+ state,
716
+ stepNumber,
717
+ sizing,
718
+ theme
719
+ }
720
+ )
721
+ }
722
+ ),
723
+ !isLast && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
724
+ Box,
725
+ {
726
+ style: {
727
+ marginLeft: sizing.simpleCardPadding + sizing.chipSize / 2 - 0.5
728
+ },
729
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
730
+ StepConnector,
731
+ {
732
+ direction: "vertical",
733
+ color: theme.colors.border.secondary,
734
+ length: sizing.connectorCellHeight
735
+ }
736
+ )
737
+ }
738
+ )
739
+ ]
740
+ }
741
+ );
742
+ }
743
+ if (isHorizontal) {
744
+ const cardBackground = isActive ? theme.colors.background.primary : void 0;
745
+ const cardWidth = isFirst ? sizing.horizontalFirstItemWidth : sizing.horizontalItemWidth;
746
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
747
+ Box,
748
+ {
749
+ flexDirection: "row",
750
+ alignItems: "center",
751
+ flex: 1,
752
+ "data-testid": "step",
753
+ "data-step-state": state,
754
+ "aria-current": isCurrent ? "step" : void 0,
755
+ "aria-label": ariaLabel,
756
+ ...interactiveProps,
757
+ children: [
758
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
759
+ Box,
760
+ {
761
+ flexDirection: "row",
762
+ alignItems: "center",
763
+ backgroundColor: cardBackground,
764
+ borderRadius: isActive ? sizing.activeCardRadiusHorizontal : void 0,
765
+ style: {
766
+ gap: sizing.activeCardGapHorizontal,
767
+ width: cardWidth,
768
+ flexShrink: 0,
769
+ paddingTop: sizing.activeCardPaddingYHorizontal,
770
+ paddingBottom: sizing.activeCardPaddingYHorizontal,
771
+ paddingLeft: sizing.activeCardPaddingLeftHorizontal,
772
+ paddingRight: 0
773
+ },
774
+ children: [
775
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
776
+ Box,
777
+ {
778
+ flexDirection: "row",
779
+ alignItems: "flex-start",
780
+ style: {
781
+ gap: sizing.itemGap,
782
+ flex: 1,
783
+ minWidth: 0
784
+ },
785
+ children: [
786
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
787
+ StepChip,
788
+ {
789
+ state,
790
+ stepNumber,
791
+ sizing,
792
+ theme
793
+ }
794
+ ),
795
+ textBlock
796
+ ]
797
+ }
798
+ ),
799
+ !isLast && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
800
+ Box,
801
+ {
802
+ flexDirection: "row",
803
+ alignItems: "center",
804
+ style: { flexShrink: 0 },
805
+ children: [
806
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
807
+ Box,
808
+ {
809
+ style: {
810
+ width: sizing.horizontalConnectorSegment,
811
+ height: 1,
812
+ backgroundColor: theme.colors.border.secondary
813
+ }
814
+ }
815
+ ),
816
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
817
+ Box,
818
+ {
819
+ style: {
820
+ width: sizing.horizontalConnectorGap,
821
+ height: 1,
822
+ backgroundColor: theme.colors.border.secondary
823
+ }
824
+ }
825
+ )
826
+ ]
827
+ }
828
+ )
829
+ ]
830
+ }
831
+ ),
832
+ !isLast && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
833
+ StepConnector,
834
+ {
835
+ direction: "horizontal",
836
+ color: theme.colors.border.secondary
837
+ }
838
+ )
839
+ ]
840
+ }
841
+ );
842
+ }
843
+ const innerConnectorOffset = sizing.activeCardPaddingX + sizing.chipSize / 2 - 0.5;
844
+ const verticalContainerStyle = {
845
+ ...interactiveProps.style,
846
+ marginBottom: overlapBottom ? -overlapBottom : void 0,
847
+ position: zIndex !== void 0 ? "relative" : void 0,
848
+ zIndex
849
+ };
850
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
851
+ Box,
852
+ {
853
+ flexDirection: "column",
854
+ alignItems: "flex-start",
855
+ "data-testid": "step",
856
+ "data-step-state": state,
857
+ "aria-current": isCurrent ? "step" : void 0,
858
+ "aria-label": ariaLabel,
859
+ ...interactiveProps,
860
+ style: verticalContainerStyle,
861
+ children: [
862
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
863
+ Box,
864
+ {
865
+ flexDirection: "row",
866
+ alignItems: "flex-start",
867
+ gap: sizing.itemGap,
868
+ style: {
869
+ paddingTop: sizing.activeCardPaddingTop,
870
+ paddingLeft: sizing.activeCardPaddingX,
871
+ paddingRight: sizing.activeCardPaddingX,
872
+ paddingBottom: 0,
873
+ backgroundColor: isActive ? theme.colors.background.primary : void 0,
874
+ borderRadius: isActive ? sizing.activeCardRadiusVertical : void 0
875
+ },
876
+ children: [
877
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
878
+ Box,
879
+ {
880
+ flexDirection: "column",
881
+ alignItems: "center",
882
+ gap: 8,
883
+ style: { flexShrink: 0 },
884
+ children: [
885
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
886
+ StepChip,
887
+ {
888
+ state,
889
+ stepNumber,
890
+ sizing,
891
+ theme
892
+ }
893
+ ),
894
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
895
+ Box,
896
+ {
897
+ style: { visibility: isLast ? "hidden" : "visible" },
898
+ "aria-hidden": isLast ? "true" : void 0,
899
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
900
+ StepConnector,
901
+ {
902
+ direction: "vertical",
903
+ color: theme.colors.border.secondary,
904
+ length: sizing.innerConnectorLength
905
+ }
906
+ )
907
+ }
908
+ )
909
+ ]
910
+ }
911
+ ),
912
+ textBlock
913
+ ]
914
+ }
915
+ ),
916
+ !isLast && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
917
+ Box,
918
+ {
919
+ alignItems: "flex-start",
920
+ justifyContent: "flex-start",
921
+ style: {
922
+ height: sizing.connectorCellHeight,
923
+ width: sizing.connectorCellWidth,
924
+ paddingLeft: innerConnectorOffset,
925
+ flexShrink: 0
926
+ },
927
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
928
+ StepConnector,
929
+ {
930
+ direction: "vertical",
931
+ color: theme.colors.border.secondary,
932
+ length: sizing.connectorCellHeight
933
+ }
934
+ )
935
+ }
936
+ )
937
+ ]
938
+ }
939
+ );
940
+ };
941
+ Step.displayName = "Step";
942
+
943
+ // src/Stepper.tsx
944
+ var import_jsx_runtime7 = require("react/jsx-runtime");
945
+ var Stepper = (0, import_react6.forwardRef)(
946
+ ({
947
+ steps,
948
+ direction = "vertical",
949
+ surface = false,
950
+ simple = false,
951
+ onClick,
952
+ className,
953
+ "aria-label": ariaLabel,
954
+ themeMode,
955
+ themeProductContext,
956
+ ...rest
957
+ }, ref) => {
958
+ const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
959
+ const sizing = theme.sizing.stepperB2b();
960
+ const isHorizontal = direction === "horizontal";
961
+ const isSurface = surface;
962
+ const defaultAriaLabel = `Stepper with ${steps.length} step${steps.length === 1 ? "" : "s"}`;
963
+ const surfaceBackground = isSurface ? `linear-gradient(0deg, ${theme.colors.overlay.mono} 0%, ${theme.colors.overlay.mono} 100%), ${theme.colors.background.secondary}` : void 0;
964
+ const useOverlap = !isHorizontal && !simple;
965
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
966
+ Box,
967
+ {
968
+ ref,
969
+ role: "navigation",
970
+ "aria-label": ariaLabel ?? defaultAriaLabel,
971
+ className,
972
+ flexDirection: isHorizontal ? "row" : "column",
973
+ alignItems: isHorizontal ? "flex-start" : "stretch",
974
+ borderRadius: isSurface ? sizing.surfaceRadius : void 0,
975
+ style: {
976
+ background: surfaceBackground,
977
+ padding: isSurface ? isHorizontal ? sizing.surfacePaddingHorizontal : sizing.surfacePaddingVertical : 0,
978
+ gap: isHorizontal ? sizing.horizontalItemGap : 0,
979
+ width: isHorizontal ? "100%" : void 0,
980
+ isolation: useOverlap ? "isolate" : void 0
981
+ },
982
+ ...rest,
983
+ children: steps.map((step, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
984
+ Step,
985
+ {
986
+ step,
987
+ stepNumber: i + 1,
988
+ isFirst: i === 0,
989
+ isLast: i === steps.length - 1,
990
+ direction,
991
+ simple,
992
+ onClick,
993
+ sizing,
994
+ theme,
995
+ zIndex: useOverlap ? steps.length - i : void 0,
996
+ overlapBottom: useOverlap && i < steps.length - 1 ? 16 : 0
997
+ },
998
+ step.key ?? `stepper-${i}`
999
+ ))
1000
+ }
1001
+ );
1002
+ }
1003
+ );
1004
+ Stepper.displayName = "Stepper";
1005
+ // Annotate the CommonJS export names for ESM import in node:
1006
+ 0 && (module.exports = {
1007
+ Stepper
1008
+ });
1009
+ //# sourceMappingURL=index.js.map