@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.mjs ADDED
@@ -0,0 +1,972 @@
1
+ // src/Stepper.tsx
2
+ import { forwardRef } from "react";
3
+
4
+ // ../../foundation/primitives-web/src/Box.tsx
5
+ import React2 from "react";
6
+ import styled from "styled-components";
7
+
8
+ // ../../foundation/primitives-web/src/filterDOMProps.ts
9
+ import React from "react";
10
+
11
+ // ../../../node_modules/@emotion/memoize/dist/memoize.esm.js
12
+ function memoize(fn) {
13
+ var cache = {};
14
+ return function(arg) {
15
+ if (cache[arg] === void 0) cache[arg] = fn(arg);
16
+ return cache[arg];
17
+ };
18
+ }
19
+ var memoize_esm_default = memoize;
20
+
21
+ // ../../../node_modules/@emotion/is-prop-valid/dist/is-prop-valid.esm.js
22
+ 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)-.*))$/;
23
+ var index = memoize_esm_default(
24
+ function(prop) {
25
+ return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
26
+ }
27
+ /* Z+1 */
28
+ );
29
+ var is_prop_valid_esm_default = index;
30
+
31
+ // ../../foundation/primitives-web/src/filterDOMProps.ts
32
+ var ADDITIONAL_BLOCKED_PROPS = /* @__PURE__ */ new Set([
33
+ // RN-only event handlers (pass isPropValid's on* pattern)
34
+ "onPress",
35
+ "onChangeText",
36
+ "onLayout",
37
+ "onMoveShouldSetResponder",
38
+ "onResponderGrant",
39
+ "onResponderMove",
40
+ "onResponderRelease",
41
+ "onResponderTerminate",
42
+ // SVG attributes that pass isPropValid
43
+ "strokeWidth",
44
+ // CSS properties that pass isPropValid but are used as component props
45
+ "overflow",
46
+ "cursor",
47
+ "fontSize",
48
+ "fontWeight",
49
+ "fontFamily",
50
+ "textDecoration"
51
+ ]);
52
+ function shouldForwardProp(key) {
53
+ if (ADDITIONAL_BLOCKED_PROPS.has(key)) return false;
54
+ return is_prop_valid_esm_default(key);
55
+ }
56
+ function createFilteredElement(defaultTag) {
57
+ const Component = React.forwardRef(
58
+ ({ children, elementType, ...props }, ref) => {
59
+ const Tag = elementType || defaultTag;
60
+ const htmlProps = {};
61
+ for (const key of Object.keys(props)) {
62
+ if (shouldForwardProp(key)) {
63
+ htmlProps[key] = props[key];
64
+ }
65
+ }
66
+ return React.createElement(
67
+ Tag,
68
+ { ref, ...htmlProps },
69
+ children
70
+ );
71
+ }
72
+ );
73
+ Component.displayName = `Filtered(${defaultTag})`;
74
+ return Component;
75
+ }
76
+
77
+ // ../../foundation/primitives-web/src/Box.tsx
78
+ import { jsx } from "react/jsx-runtime";
79
+ var FilteredDiv = createFilteredElement("div");
80
+ var StyledBox = styled(FilteredDiv)`
81
+ display: flex;
82
+ box-sizing: border-box;
83
+ background-color: ${(props) => props.backgroundColor || "transparent"};
84
+ border-color: ${(props) => props.borderColor || "transparent"};
85
+ border-width: ${(props) => typeof props.borderWidth === "number" ? `${props.borderWidth}px` : props.borderWidth || 0};
86
+
87
+ ${(props) => props.borderBottomWidth !== void 0 && `
88
+ border-bottom-width: ${typeof props.borderBottomWidth === "number" ? `${props.borderBottomWidth}px` : props.borderBottomWidth};
89
+ border-bottom-color: ${props.borderBottomColor || props.borderColor || "transparent"};
90
+ border-bottom-style: solid;
91
+ `}
92
+ ${(props) => props.borderTopWidth !== void 0 && `
93
+ border-top-width: ${typeof props.borderTopWidth === "number" ? `${props.borderTopWidth}px` : props.borderTopWidth};
94
+ border-top-color: ${props.borderTopColor || props.borderColor || "transparent"};
95
+ border-top-style: solid;
96
+ `}
97
+ ${(props) => props.borderLeftWidth !== void 0 && `
98
+ border-left-width: ${typeof props.borderLeftWidth === "number" ? `${props.borderLeftWidth}px` : props.borderLeftWidth};
99
+ border-left-color: ${props.borderLeftColor || props.borderColor || "transparent"};
100
+ border-left-style: solid;
101
+ `}
102
+ ${(props) => props.borderRightWidth !== void 0 && `
103
+ border-right-width: ${typeof props.borderRightWidth === "number" ? `${props.borderRightWidth}px` : props.borderRightWidth};
104
+ border-right-color: ${props.borderRightColor || props.borderColor || "transparent"};
105
+ border-right-style: solid;
106
+ `}
107
+
108
+ border-style: ${(props) => props.borderStyle || (props.borderWidth || props.borderBottomWidth || props.borderTopWidth || props.borderLeftWidth || props.borderRightWidth ? "solid" : "none")};
109
+ border-radius: ${(props) => typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius || 0};
110
+ height: ${(props) => typeof props.height === "number" ? `${props.height}px` : props.height || "auto"};
111
+ width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
112
+ min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
113
+ min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
114
+ max-width: ${(props) => typeof props.maxWidth === "number" ? `${props.maxWidth}px` : props.maxWidth || "none"};
115
+ max-height: ${(props) => typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight || "none"};
116
+
117
+ padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
118
+ ${(props) => props.paddingHorizontal && `
119
+ padding-left: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
120
+ padding-right: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
121
+ `}
122
+ ${(props) => props.paddingVertical && `
123
+ padding-top: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
124
+ padding-bottom: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
125
+ `}
126
+ ${(props) => props.paddingTop !== void 0 && `padding-top: ${typeof props.paddingTop === "number" ? `${props.paddingTop}px` : props.paddingTop};`}
127
+ ${(props) => props.paddingBottom !== void 0 && `padding-bottom: ${typeof props.paddingBottom === "number" ? `${props.paddingBottom}px` : props.paddingBottom};`}
128
+ ${(props) => props.paddingLeft !== void 0 && `padding-left: ${typeof props.paddingLeft === "number" ? `${props.paddingLeft}px` : props.paddingLeft};`}
129
+ ${(props) => props.paddingRight !== void 0 && `padding-right: ${typeof props.paddingRight === "number" ? `${props.paddingRight}px` : props.paddingRight};`}
130
+
131
+ margin: ${(props) => typeof props.margin === "number" ? `${props.margin}px` : props.margin || 0};
132
+ ${(props) => props.marginTop !== void 0 && `margin-top: ${typeof props.marginTop === "number" ? `${props.marginTop}px` : props.marginTop};`}
133
+ ${(props) => props.marginBottom !== void 0 && `margin-bottom: ${typeof props.marginBottom === "number" ? `${props.marginBottom}px` : props.marginBottom};`}
134
+ ${(props) => props.marginLeft !== void 0 && `margin-left: ${typeof props.marginLeft === "number" ? `${props.marginLeft}px` : props.marginLeft};`}
135
+ ${(props) => props.marginRight !== void 0 && `margin-right: ${typeof props.marginRight === "number" ? `${props.marginRight}px` : props.marginRight};`}
136
+
137
+ flex-direction: ${(props) => props.flexDirection || "column"};
138
+ flex-wrap: ${(props) => props.flexWrap || "nowrap"};
139
+ align-items: ${(props) => props.alignItems || "stretch"};
140
+ justify-content: ${(props) => props.justifyContent || "flex-start"};
141
+ cursor: ${(props) => props.cursor ? props.cursor : props.onClick || props.onPress ? "pointer" : "inherit"};
142
+ position: ${(props) => props.position || "static"};
143
+ top: ${(props) => typeof props.top === "number" ? `${props.top}px` : props.top};
144
+ bottom: ${(props) => typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom};
145
+ left: ${(props) => typeof props.left === "number" ? `${props.left}px` : props.left};
146
+ right: ${(props) => typeof props.right === "number" ? `${props.right}px` : props.right};
147
+ flex: ${(props) => props.flex};
148
+ flex-shrink: ${(props) => props.flexShrink ?? 1};
149
+ gap: ${(props) => typeof props.gap === "number" ? `${props.gap}px` : props.gap || 0};
150
+ align-self: ${(props) => props.alignSelf || "auto"};
151
+ overflow: ${(props) => props.overflow || "visible"};
152
+ overflow-x: ${(props) => props.overflowX || "visible"};
153
+ overflow-y: ${(props) => props.overflowY || "visible"};
154
+ z-index: ${(props) => props.zIndex};
155
+ opacity: ${(props) => props.disabled ? 0.5 : 1};
156
+ pointer-events: ${(props) => props.disabled ? "none" : "auto"};
157
+
158
+ &:hover {
159
+ ${(props) => props.hoverStyle?.backgroundColor && `background-color: ${props.hoverStyle.backgroundColor};`}
160
+ ${(props) => props.hoverStyle?.borderColor && `border-color: ${props.hoverStyle.borderColor};`}
161
+ }
162
+
163
+ &:active {
164
+ ${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
165
+ }
166
+ `;
167
+ var Box = React2.forwardRef(
168
+ ({
169
+ children,
170
+ onPress,
171
+ onKeyDown,
172
+ onKeyUp,
173
+ role,
174
+ "aria-label": ariaLabel,
175
+ "aria-labelledby": ariaLabelledBy,
176
+ "aria-current": ariaCurrent,
177
+ "aria-disabled": ariaDisabled,
178
+ "aria-live": ariaLive,
179
+ "aria-busy": ariaBusy,
180
+ "aria-describedby": ariaDescribedBy,
181
+ "aria-expanded": ariaExpanded,
182
+ "aria-haspopup": ariaHasPopup,
183
+ "aria-pressed": ariaPressed,
184
+ "aria-controls": ariaControls,
185
+ tabIndex,
186
+ as,
187
+ src,
188
+ alt,
189
+ type,
190
+ disabled,
191
+ id,
192
+ testID,
193
+ "data-testid": dataTestId,
194
+ ...props
195
+ }, ref) => {
196
+ if (as === "img" && src) {
197
+ return /* @__PURE__ */ jsx(
198
+ "img",
199
+ {
200
+ src,
201
+ alt: alt || "",
202
+ style: {
203
+ display: "block",
204
+ objectFit: "cover",
205
+ width: typeof props.width === "number" ? `${props.width}px` : props.width,
206
+ height: typeof props.height === "number" ? `${props.height}px` : props.height,
207
+ borderRadius: typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius,
208
+ position: props.position,
209
+ top: typeof props.top === "number" ? `${props.top}px` : props.top,
210
+ left: typeof props.left === "number" ? `${props.left}px` : props.left,
211
+ right: typeof props.right === "number" ? `${props.right}px` : props.right,
212
+ bottom: typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom
213
+ }
214
+ }
215
+ );
216
+ }
217
+ return /* @__PURE__ */ jsx(
218
+ StyledBox,
219
+ {
220
+ ref,
221
+ elementType: as,
222
+ id,
223
+ type: as === "button" ? type || "button" : void 0,
224
+ disabled: as === "button" ? disabled : void 0,
225
+ onClick: onPress,
226
+ onKeyDown,
227
+ onKeyUp,
228
+ role,
229
+ "aria-label": ariaLabel,
230
+ "aria-labelledby": ariaLabelledBy,
231
+ "aria-current": ariaCurrent,
232
+ "aria-disabled": ariaDisabled,
233
+ "aria-busy": ariaBusy,
234
+ "aria-describedby": ariaDescribedBy,
235
+ "aria-expanded": ariaExpanded,
236
+ "aria-haspopup": ariaHasPopup,
237
+ "aria-pressed": ariaPressed,
238
+ "aria-controls": ariaControls,
239
+ "aria-live": ariaLive,
240
+ tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
241
+ "data-testid": dataTestId || testID,
242
+ ...props,
243
+ children
244
+ }
245
+ );
246
+ }
247
+ );
248
+ Box.displayName = "Box";
249
+
250
+ // ../../foundation/primitives-web/src/Text.tsx
251
+ import styled2 from "styled-components";
252
+ import { jsx as jsx2 } from "react/jsx-runtime";
253
+ var FilteredSpan = createFilteredElement("span");
254
+ var StyledText = styled2(FilteredSpan)`
255
+ color: ${(props) => props.color || "inherit"};
256
+ font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
257
+ font-weight: ${(props) => props.fontWeight || "normal"};
258
+ font-family: ${(props) => props.fontFamily || '"Aktiv Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'};
259
+ line-height: ${(props) => typeof props.lineHeight === "number" ? `${props.lineHeight}px` : props.lineHeight || "inherit"};
260
+ white-space: ${(props) => props.whiteSpace || "normal"};
261
+ text-align: ${(props) => props.textAlign || "inherit"};
262
+ text-decoration: ${(props) => props.textDecoration || "none"};
263
+ `;
264
+ var Text = ({
265
+ style,
266
+ className,
267
+ id,
268
+ role,
269
+ numberOfLines: _numberOfLines,
270
+ ...props
271
+ }) => {
272
+ return /* @__PURE__ */ jsx2(
273
+ StyledText,
274
+ {
275
+ ...props,
276
+ style,
277
+ className,
278
+ id,
279
+ role
280
+ }
281
+ );
282
+ };
283
+
284
+ // ../../foundation/primitives-web/src/Spinner.tsx
285
+ import styled3, { keyframes } from "styled-components";
286
+ import { jsx as jsx3 } from "react/jsx-runtime";
287
+ var rotate = keyframes`
288
+ from {
289
+ transform: rotate(0deg);
290
+ }
291
+ to {
292
+ transform: rotate(360deg);
293
+ }
294
+ `;
295
+ var FilteredDiv2 = createFilteredElement("div");
296
+ var StyledSpinner = styled3(FilteredDiv2)`
297
+ width: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
298
+ height: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
299
+ border: ${(props) => props.strokeWidth || 2}px solid
300
+ ${(props) => props.color || "currentColor"};
301
+ border-bottom-color: transparent;
302
+ border-radius: 50%;
303
+ display: inline-block;
304
+ box-sizing: border-box;
305
+ animation: ${rotate} 1s linear infinite;
306
+ `;
307
+ var Spinner = ({
308
+ role = "status",
309
+ "aria-label": ariaLabel,
310
+ "aria-live": ariaLive = "polite",
311
+ "aria-describedby": ariaDescribedBy,
312
+ testID,
313
+ ...props
314
+ }) => {
315
+ return /* @__PURE__ */ jsx3(
316
+ StyledSpinner,
317
+ {
318
+ role,
319
+ "aria-label": ariaLabel,
320
+ "aria-live": ariaLive,
321
+ "aria-describedby": ariaDescribedBy,
322
+ "data-testid": testID,
323
+ ...props
324
+ }
325
+ );
326
+ };
327
+ Spinner.displayName = "Spinner";
328
+
329
+ // src/Stepper.tsx
330
+ import { useResolvedTheme } from "@xsolla/xui-core";
331
+
332
+ // src/Step.tsx
333
+ import { useCallback, useMemo } from "react";
334
+
335
+ // src/StepChip.tsx
336
+ import { memo } from "react";
337
+ import { Check, InfoCr, Remove } from "@xsolla/xui-icons-base";
338
+ import { jsx as jsx4 } from "react/jsx-runtime";
339
+ var getChipBackground = (state, theme) => {
340
+ switch (state) {
341
+ case "current":
342
+ return theme.colors.background.brand.secondary;
343
+ case "loading":
344
+ return theme.colors.overlay.brand;
345
+ case "complete":
346
+ return theme.colors.background.success.secondary;
347
+ case "warning":
348
+ return theme.colors.background.warning.secondary;
349
+ case "alert":
350
+ return theme.colors.background.alert.secondary;
351
+ case "incomplete":
352
+ default:
353
+ return theme.colors.overlay.mono;
354
+ }
355
+ };
356
+ var StepChip = memo(
357
+ ({ state, stepNumber, sizing, theme }) => {
358
+ const numberColor = theme.colors.content.primary;
359
+ const bg = getChipBackground(state, theme);
360
+ const renderContent = () => {
361
+ switch (state) {
362
+ case "loading":
363
+ return /* @__PURE__ */ jsx4(
364
+ Spinner,
365
+ {
366
+ size: sizing.chipIconSize,
367
+ color: theme.colors.content.brand.primary,
368
+ strokeWidth: 2
369
+ }
370
+ );
371
+ case "complete":
372
+ return /* @__PURE__ */ jsx4(
373
+ Check,
374
+ {
375
+ size: sizing.chipIconSize,
376
+ color: theme.colors.content.success.primary
377
+ }
378
+ );
379
+ case "warning":
380
+ return /* @__PURE__ */ jsx4(
381
+ InfoCr,
382
+ {
383
+ size: sizing.chipIconSize,
384
+ color: theme.colors.content.warning.primary
385
+ }
386
+ );
387
+ case "alert":
388
+ return /* @__PURE__ */ jsx4(
389
+ Remove,
390
+ {
391
+ size: sizing.chipIconSize,
392
+ color: theme.colors.content.alert.primary
393
+ }
394
+ );
395
+ case "current":
396
+ case "incomplete":
397
+ default:
398
+ return /* @__PURE__ */ jsx4(
399
+ Text,
400
+ {
401
+ color: numberColor,
402
+ fontSize: sizing.numberFontSize,
403
+ lineHeight: sizing.numberLineHeight,
404
+ fontWeight: "500",
405
+ textAlign: "center",
406
+ children: stepNumber
407
+ }
408
+ );
409
+ }
410
+ };
411
+ return /* @__PURE__ */ jsx4(
412
+ Box,
413
+ {
414
+ width: sizing.chipSize,
415
+ height: sizing.chipSize,
416
+ borderRadius: sizing.chipRadius,
417
+ backgroundColor: bg,
418
+ alignItems: "center",
419
+ justifyContent: "center",
420
+ flexShrink: 0,
421
+ style: {
422
+ paddingTop: sizing.chipPaddingTop,
423
+ paddingBottom: sizing.chipPaddingBottom,
424
+ paddingLeft: sizing.chipPaddingX,
425
+ paddingRight: sizing.chipPaddingX
426
+ },
427
+ children: renderContent()
428
+ }
429
+ );
430
+ }
431
+ );
432
+ StepChip.displayName = "StepChip";
433
+
434
+ // src/StepConnector.tsx
435
+ import { memo as memo2 } from "react";
436
+ import { jsx as jsx5 } from "react/jsx-runtime";
437
+ var StepConnector = memo2(
438
+ ({ direction, color, length }) => {
439
+ if (direction === "vertical") {
440
+ return /* @__PURE__ */ jsx5(
441
+ Box,
442
+ {
443
+ style: {
444
+ width: 1,
445
+ height: length ?? 48,
446
+ backgroundColor: color,
447
+ flexShrink: 0
448
+ }
449
+ }
450
+ );
451
+ }
452
+ return /* @__PURE__ */ jsx5(
453
+ Box,
454
+ {
455
+ style: {
456
+ height: 1,
457
+ flex: 1,
458
+ minWidth: length ?? 24,
459
+ backgroundColor: color,
460
+ alignSelf: "center"
461
+ }
462
+ }
463
+ );
464
+ }
465
+ );
466
+ StepConnector.displayName = "StepConnector";
467
+
468
+ // src/Step.tsx
469
+ import { jsx as jsx6, jsxs } from "react/jsx-runtime";
470
+ var ACTIVE_CARD_STATES = [
471
+ "current",
472
+ "loading",
473
+ "warning",
474
+ "alert"
475
+ ];
476
+ var Step = ({
477
+ step,
478
+ stepNumber,
479
+ isLast,
480
+ isFirst,
481
+ direction,
482
+ simple = false,
483
+ overlapBottom = 0,
484
+ zIndex,
485
+ onClick,
486
+ sizing,
487
+ theme
488
+ }) => {
489
+ const {
490
+ title,
491
+ description,
492
+ caption,
493
+ state = "incomplete",
494
+ disabled = false,
495
+ noClick = false
496
+ } = step;
497
+ const isHorizontal = direction === "horizontal";
498
+ const isActive = ACTIVE_CARD_STATES.includes(state);
499
+ const isCurrent = state === "current";
500
+ const isInteractive = !!onClick && !disabled && !noClick;
501
+ const handleClick = useCallback(() => {
502
+ if (isInteractive) {
503
+ onClick({ number: stepNumber, step });
504
+ }
505
+ }, [isInteractive, onClick, stepNumber, step]);
506
+ const handleKeyDown = useCallback(
507
+ (event) => {
508
+ if (!isInteractive) return;
509
+ if (event.key === "Enter") {
510
+ event.preventDefault();
511
+ handleClick();
512
+ } else if (event.key === " ") {
513
+ event.preventDefault();
514
+ }
515
+ },
516
+ [isInteractive, handleClick]
517
+ );
518
+ const handleKeyUp = useCallback(
519
+ (event) => {
520
+ if (!isInteractive) return;
521
+ if (event.key === " ") {
522
+ event.preventDefault();
523
+ handleClick();
524
+ }
525
+ },
526
+ [isInteractive, handleClick]
527
+ );
528
+ const ariaLabel = useMemo(() => {
529
+ const titleText = typeof title === "string" ? title : `Step ${stepNumber}`;
530
+ const descText = typeof description === "string" ? `, ${description}` : "";
531
+ return `Step ${stepNumber}: ${titleText}${descText}, ${state}`;
532
+ }, [stepNumber, title, description, state]);
533
+ const interactiveProps = isInteractive ? {
534
+ role: "button",
535
+ tabIndex: 0,
536
+ onClick: handleClick,
537
+ onKeyDown: handleKeyDown,
538
+ onKeyUp: handleKeyUp,
539
+ style: { cursor: "pointer" }
540
+ } : {
541
+ "aria-disabled": disabled || noClick ? true : void 0
542
+ };
543
+ const textBlockSizing = isHorizontal ? { flex: 1, minWidth: 0 } : { width: sizing.contentWidth, flexShrink: 0 };
544
+ const textBlock = /* @__PURE__ */ jsxs(
545
+ Box,
546
+ {
547
+ flexDirection: "column",
548
+ alignItems: "flex-start",
549
+ justifyContent: "center",
550
+ style: {
551
+ gap: sizing.contentGap,
552
+ minHeight: sizing.contentMinHeight,
553
+ ...textBlockSizing
554
+ },
555
+ children: [
556
+ caption !== null && (typeof caption === "string" || typeof caption === "number" ? /* @__PURE__ */ jsx6(
557
+ Text,
558
+ {
559
+ color: theme.colors.content.tertiary,
560
+ fontSize: sizing.captionFontSize,
561
+ lineHeight: sizing.captionLineHeight,
562
+ fontWeight: "400",
563
+ children: caption
564
+ }
565
+ ) : caption),
566
+ typeof title === "string" || typeof title === "number" ? /* @__PURE__ */ jsx6(
567
+ Text,
568
+ {
569
+ color: theme.colors.content.primary,
570
+ fontSize: sizing.titleFontSize,
571
+ lineHeight: sizing.titleLineHeight,
572
+ fontWeight: "500",
573
+ children: title
574
+ }
575
+ ) : title,
576
+ description !== null && (typeof description === "string" || typeof description === "number" ? /* @__PURE__ */ jsx6(
577
+ Text,
578
+ {
579
+ color: theme.colors.content.tertiary,
580
+ fontSize: sizing.descriptionFontSize,
581
+ lineHeight: sizing.descriptionLineHeight,
582
+ fontWeight: "400",
583
+ children: description
584
+ }
585
+ ) : description)
586
+ ]
587
+ }
588
+ );
589
+ if (simple) {
590
+ if (isHorizontal) {
591
+ return /* @__PURE__ */ jsxs(
592
+ Box,
593
+ {
594
+ flexDirection: "row",
595
+ alignItems: "center",
596
+ flex: isLast ? void 0 : 1,
597
+ "data-testid": "step",
598
+ "data-step-state": state,
599
+ "aria-current": isCurrent ? "step" : void 0,
600
+ "aria-label": ariaLabel,
601
+ ...interactiveProps,
602
+ children: [
603
+ /* @__PURE__ */ jsx6(
604
+ Box,
605
+ {
606
+ flexDirection: "row",
607
+ alignItems: "center",
608
+ justifyContent: "center",
609
+ backgroundColor: isActive ? theme.colors.background.primary : void 0,
610
+ borderRadius: isActive ? sizing.simpleCardRadius : void 0,
611
+ style: {
612
+ padding: sizing.simpleCardPadding,
613
+ gap: sizing.simpleCardGap,
614
+ flexShrink: 0
615
+ },
616
+ children: /* @__PURE__ */ jsx6(
617
+ StepChip,
618
+ {
619
+ state,
620
+ stepNumber,
621
+ sizing,
622
+ theme
623
+ }
624
+ )
625
+ }
626
+ ),
627
+ !isLast && /* @__PURE__ */ jsx6(
628
+ Box,
629
+ {
630
+ flexDirection: "row",
631
+ alignItems: "center",
632
+ style: { flex: 1, minWidth: sizing.simpleHorizontalCellWidth },
633
+ children: /* @__PURE__ */ jsx6(
634
+ Box,
635
+ {
636
+ style: {
637
+ flex: 1,
638
+ height: 1,
639
+ backgroundColor: theme.colors.border.secondary
640
+ }
641
+ }
642
+ )
643
+ }
644
+ )
645
+ ]
646
+ }
647
+ );
648
+ }
649
+ return /* @__PURE__ */ jsxs(
650
+ Box,
651
+ {
652
+ flexDirection: "column",
653
+ alignItems: "flex-start",
654
+ "data-testid": "step",
655
+ "data-step-state": state,
656
+ "aria-current": isCurrent ? "step" : void 0,
657
+ "aria-label": ariaLabel,
658
+ ...interactiveProps,
659
+ style: {
660
+ ...isInteractive ? { cursor: "pointer" } : {},
661
+ gap: sizing.simpleItemGap
662
+ },
663
+ children: [
664
+ /* @__PURE__ */ jsx6(
665
+ Box,
666
+ {
667
+ flexDirection: "column",
668
+ alignItems: "center",
669
+ justifyContent: "center",
670
+ backgroundColor: isActive ? theme.colors.background.primary : void 0,
671
+ borderRadius: isActive ? sizing.simpleCardRadius : void 0,
672
+ style: {
673
+ padding: sizing.simpleCardPadding,
674
+ gap: sizing.simpleCardGap
675
+ },
676
+ children: /* @__PURE__ */ jsx6(
677
+ StepChip,
678
+ {
679
+ state,
680
+ stepNumber,
681
+ sizing,
682
+ theme
683
+ }
684
+ )
685
+ }
686
+ ),
687
+ !isLast && /* @__PURE__ */ jsx6(
688
+ Box,
689
+ {
690
+ style: {
691
+ marginLeft: sizing.simpleCardPadding + sizing.chipSize / 2 - 0.5
692
+ },
693
+ children: /* @__PURE__ */ jsx6(
694
+ StepConnector,
695
+ {
696
+ direction: "vertical",
697
+ color: theme.colors.border.secondary,
698
+ length: sizing.connectorCellHeight
699
+ }
700
+ )
701
+ }
702
+ )
703
+ ]
704
+ }
705
+ );
706
+ }
707
+ if (isHorizontal) {
708
+ const cardBackground = isActive ? theme.colors.background.primary : void 0;
709
+ const cardWidth = isFirst ? sizing.horizontalFirstItemWidth : sizing.horizontalItemWidth;
710
+ return /* @__PURE__ */ jsxs(
711
+ Box,
712
+ {
713
+ flexDirection: "row",
714
+ alignItems: "center",
715
+ flex: 1,
716
+ "data-testid": "step",
717
+ "data-step-state": state,
718
+ "aria-current": isCurrent ? "step" : void 0,
719
+ "aria-label": ariaLabel,
720
+ ...interactiveProps,
721
+ children: [
722
+ /* @__PURE__ */ jsxs(
723
+ Box,
724
+ {
725
+ flexDirection: "row",
726
+ alignItems: "center",
727
+ backgroundColor: cardBackground,
728
+ borderRadius: isActive ? sizing.activeCardRadiusHorizontal : void 0,
729
+ style: {
730
+ gap: sizing.activeCardGapHorizontal,
731
+ width: cardWidth,
732
+ flexShrink: 0,
733
+ paddingTop: sizing.activeCardPaddingYHorizontal,
734
+ paddingBottom: sizing.activeCardPaddingYHorizontal,
735
+ paddingLeft: sizing.activeCardPaddingLeftHorizontal,
736
+ paddingRight: 0
737
+ },
738
+ children: [
739
+ /* @__PURE__ */ jsxs(
740
+ Box,
741
+ {
742
+ flexDirection: "row",
743
+ alignItems: "flex-start",
744
+ style: {
745
+ gap: sizing.itemGap,
746
+ flex: 1,
747
+ minWidth: 0
748
+ },
749
+ children: [
750
+ /* @__PURE__ */ jsx6(
751
+ StepChip,
752
+ {
753
+ state,
754
+ stepNumber,
755
+ sizing,
756
+ theme
757
+ }
758
+ ),
759
+ textBlock
760
+ ]
761
+ }
762
+ ),
763
+ !isLast && /* @__PURE__ */ jsxs(
764
+ Box,
765
+ {
766
+ flexDirection: "row",
767
+ alignItems: "center",
768
+ style: { flexShrink: 0 },
769
+ children: [
770
+ /* @__PURE__ */ jsx6(
771
+ Box,
772
+ {
773
+ style: {
774
+ width: sizing.horizontalConnectorSegment,
775
+ height: 1,
776
+ backgroundColor: theme.colors.border.secondary
777
+ }
778
+ }
779
+ ),
780
+ /* @__PURE__ */ jsx6(
781
+ Box,
782
+ {
783
+ style: {
784
+ width: sizing.horizontalConnectorGap,
785
+ height: 1,
786
+ backgroundColor: theme.colors.border.secondary
787
+ }
788
+ }
789
+ )
790
+ ]
791
+ }
792
+ )
793
+ ]
794
+ }
795
+ ),
796
+ !isLast && /* @__PURE__ */ jsx6(
797
+ StepConnector,
798
+ {
799
+ direction: "horizontal",
800
+ color: theme.colors.border.secondary
801
+ }
802
+ )
803
+ ]
804
+ }
805
+ );
806
+ }
807
+ const innerConnectorOffset = sizing.activeCardPaddingX + sizing.chipSize / 2 - 0.5;
808
+ const verticalContainerStyle = {
809
+ ...interactiveProps.style,
810
+ marginBottom: overlapBottom ? -overlapBottom : void 0,
811
+ position: zIndex !== void 0 ? "relative" : void 0,
812
+ zIndex
813
+ };
814
+ return /* @__PURE__ */ jsxs(
815
+ Box,
816
+ {
817
+ flexDirection: "column",
818
+ alignItems: "flex-start",
819
+ "data-testid": "step",
820
+ "data-step-state": state,
821
+ "aria-current": isCurrent ? "step" : void 0,
822
+ "aria-label": ariaLabel,
823
+ ...interactiveProps,
824
+ style: verticalContainerStyle,
825
+ children: [
826
+ /* @__PURE__ */ jsxs(
827
+ Box,
828
+ {
829
+ flexDirection: "row",
830
+ alignItems: "flex-start",
831
+ gap: sizing.itemGap,
832
+ style: {
833
+ paddingTop: sizing.activeCardPaddingTop,
834
+ paddingLeft: sizing.activeCardPaddingX,
835
+ paddingRight: sizing.activeCardPaddingX,
836
+ paddingBottom: 0,
837
+ backgroundColor: isActive ? theme.colors.background.primary : void 0,
838
+ borderRadius: isActive ? sizing.activeCardRadiusVertical : void 0
839
+ },
840
+ children: [
841
+ /* @__PURE__ */ jsxs(
842
+ Box,
843
+ {
844
+ flexDirection: "column",
845
+ alignItems: "center",
846
+ gap: 8,
847
+ style: { flexShrink: 0 },
848
+ children: [
849
+ /* @__PURE__ */ jsx6(
850
+ StepChip,
851
+ {
852
+ state,
853
+ stepNumber,
854
+ sizing,
855
+ theme
856
+ }
857
+ ),
858
+ /* @__PURE__ */ jsx6(
859
+ Box,
860
+ {
861
+ style: { visibility: isLast ? "hidden" : "visible" },
862
+ "aria-hidden": isLast ? "true" : void 0,
863
+ children: /* @__PURE__ */ jsx6(
864
+ StepConnector,
865
+ {
866
+ direction: "vertical",
867
+ color: theme.colors.border.secondary,
868
+ length: sizing.innerConnectorLength
869
+ }
870
+ )
871
+ }
872
+ )
873
+ ]
874
+ }
875
+ ),
876
+ textBlock
877
+ ]
878
+ }
879
+ ),
880
+ !isLast && /* @__PURE__ */ jsx6(
881
+ Box,
882
+ {
883
+ alignItems: "flex-start",
884
+ justifyContent: "flex-start",
885
+ style: {
886
+ height: sizing.connectorCellHeight,
887
+ width: sizing.connectorCellWidth,
888
+ paddingLeft: innerConnectorOffset,
889
+ flexShrink: 0
890
+ },
891
+ children: /* @__PURE__ */ jsx6(
892
+ StepConnector,
893
+ {
894
+ direction: "vertical",
895
+ color: theme.colors.border.secondary,
896
+ length: sizing.connectorCellHeight
897
+ }
898
+ )
899
+ }
900
+ )
901
+ ]
902
+ }
903
+ );
904
+ };
905
+ Step.displayName = "Step";
906
+
907
+ // src/Stepper.tsx
908
+ import { jsx as jsx7 } from "react/jsx-runtime";
909
+ var Stepper = forwardRef(
910
+ ({
911
+ steps,
912
+ direction = "vertical",
913
+ surface = false,
914
+ simple = false,
915
+ onClick,
916
+ className,
917
+ "aria-label": ariaLabel,
918
+ themeMode,
919
+ themeProductContext,
920
+ ...rest
921
+ }, ref) => {
922
+ const { theme } = useResolvedTheme({ themeMode, themeProductContext });
923
+ const sizing = theme.sizing.stepperB2b();
924
+ const isHorizontal = direction === "horizontal";
925
+ const isSurface = surface;
926
+ const defaultAriaLabel = `Stepper with ${steps.length} step${steps.length === 1 ? "" : "s"}`;
927
+ const surfaceBackground = isSurface ? `linear-gradient(0deg, ${theme.colors.overlay.mono} 0%, ${theme.colors.overlay.mono} 100%), ${theme.colors.background.secondary}` : void 0;
928
+ const useOverlap = !isHorizontal && !simple;
929
+ return /* @__PURE__ */ jsx7(
930
+ Box,
931
+ {
932
+ ref,
933
+ role: "navigation",
934
+ "aria-label": ariaLabel ?? defaultAriaLabel,
935
+ className,
936
+ flexDirection: isHorizontal ? "row" : "column",
937
+ alignItems: isHorizontal ? "flex-start" : "stretch",
938
+ borderRadius: isSurface ? sizing.surfaceRadius : void 0,
939
+ style: {
940
+ background: surfaceBackground,
941
+ padding: isSurface ? isHorizontal ? sizing.surfacePaddingHorizontal : sizing.surfacePaddingVertical : 0,
942
+ gap: isHorizontal ? sizing.horizontalItemGap : 0,
943
+ width: isHorizontal ? "100%" : void 0,
944
+ isolation: useOverlap ? "isolate" : void 0
945
+ },
946
+ ...rest,
947
+ children: steps.map((step, i) => /* @__PURE__ */ jsx7(
948
+ Step,
949
+ {
950
+ step,
951
+ stepNumber: i + 1,
952
+ isFirst: i === 0,
953
+ isLast: i === steps.length - 1,
954
+ direction,
955
+ simple,
956
+ onClick,
957
+ sizing,
958
+ theme,
959
+ zIndex: useOverlap ? steps.length - i : void 0,
960
+ overlapBottom: useOverlap && i < steps.length - 1 ? 16 : 0
961
+ },
962
+ step.key ?? `stepper-${i}`
963
+ ))
964
+ }
965
+ );
966
+ }
967
+ );
968
+ Stepper.displayName = "Stepper";
969
+ export {
970
+ Stepper
971
+ };
972
+ //# sourceMappingURL=index.mjs.map