@xsolla/xui-stepper 0.64.0-pr56.1768440195

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,1773 @@
1
+ // src/Stepper.tsx
2
+ import { forwardRef as forwardRef3 } from "react";
3
+
4
+ // ../primitives-web/src/Box.tsx
5
+ import React from "react";
6
+ import styled from "styled-components";
7
+ import { jsx } from "react/jsx-runtime";
8
+ var StyledBox = styled.div`
9
+ display: flex;
10
+ box-sizing: border-box;
11
+ background-color: ${(props) => props.backgroundColor || "transparent"};
12
+ border-color: ${(props) => props.borderColor || "transparent"};
13
+ border-width: ${(props) => typeof props.borderWidth === "number" ? `${props.borderWidth}px` : props.borderWidth || 0};
14
+
15
+ ${(props) => props.borderBottomWidth !== void 0 && `
16
+ border-bottom-width: ${typeof props.borderBottomWidth === "number" ? `${props.borderBottomWidth}px` : props.borderBottomWidth};
17
+ border-bottom-color: ${props.borderBottomColor || props.borderColor || "transparent"};
18
+ border-bottom-style: solid;
19
+ `}
20
+ ${(props) => props.borderTopWidth !== void 0 && `
21
+ border-top-width: ${typeof props.borderTopWidth === "number" ? `${props.borderTopWidth}px` : props.borderTopWidth};
22
+ border-top-color: ${props.borderTopColor || props.borderColor || "transparent"};
23
+ border-top-style: solid;
24
+ `}
25
+ ${(props) => props.borderLeftWidth !== void 0 && `
26
+ border-left-width: ${typeof props.borderLeftWidth === "number" ? `${props.borderLeftWidth}px` : props.borderLeftWidth};
27
+ border-left-color: ${props.borderLeftColor || props.borderColor || "transparent"};
28
+ border-left-style: solid;
29
+ `}
30
+ ${(props) => props.borderRightWidth !== void 0 && `
31
+ border-right-width: ${typeof props.borderRightWidth === "number" ? `${props.borderRightWidth}px` : props.borderRightWidth};
32
+ border-right-color: ${props.borderRightColor || props.borderColor || "transparent"};
33
+ border-right-style: solid;
34
+ `}
35
+
36
+ border-style: ${(props) => props.borderStyle || (props.borderWidth || props.borderBottomWidth || props.borderTopWidth || props.borderLeftWidth || props.borderRightWidth ? "solid" : "none")};
37
+ border-radius: ${(props) => typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius || 0};
38
+ height: ${(props) => typeof props.height === "number" ? `${props.height}px` : props.height || "auto"};
39
+ width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
40
+ min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
41
+ min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
42
+
43
+ padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
44
+ ${(props) => props.paddingHorizontal && `
45
+ padding-left: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
46
+ padding-right: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
47
+ `}
48
+ ${(props) => props.paddingVertical && `
49
+ padding-top: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
50
+ padding-bottom: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
51
+ `}
52
+ ${(props) => props.paddingTop !== void 0 && `padding-top: ${typeof props.paddingTop === "number" ? `${props.paddingTop}px` : props.paddingTop};`}
53
+ ${(props) => props.paddingBottom !== void 0 && `padding-bottom: ${typeof props.paddingBottom === "number" ? `${props.paddingBottom}px` : props.paddingBottom};`}
54
+ ${(props) => props.paddingLeft !== void 0 && `padding-left: ${typeof props.paddingLeft === "number" ? `${props.paddingLeft}px` : props.paddingLeft};`}
55
+ ${(props) => props.paddingRight !== void 0 && `padding-right: ${typeof props.paddingRight === "number" ? `${props.paddingRight}px` : props.paddingRight};`}
56
+
57
+ margin: ${(props) => typeof props.margin === "number" ? `${props.margin}px` : props.margin || 0};
58
+ ${(props) => props.marginTop !== void 0 && `margin-top: ${typeof props.marginTop === "number" ? `${props.marginTop}px` : props.marginTop};`}
59
+ ${(props) => props.marginBottom !== void 0 && `margin-bottom: ${typeof props.marginBottom === "number" ? `${props.marginBottom}px` : props.marginBottom};`}
60
+ ${(props) => props.marginLeft !== void 0 && `margin-left: ${typeof props.marginLeft === "number" ? `${props.marginLeft}px` : props.marginLeft};`}
61
+ ${(props) => props.marginRight !== void 0 && `margin-right: ${typeof props.marginRight === "number" ? `${props.marginRight}px` : props.marginRight};`}
62
+
63
+ flex-direction: ${(props) => props.flexDirection || "column"};
64
+ flex-wrap: ${(props) => props.flexWrap || "nowrap"};
65
+ align-items: ${(props) => props.alignItems || "stretch"};
66
+ justify-content: ${(props) => props.justifyContent || "flex-start"};
67
+ cursor: ${(props) => props.cursor ? props.cursor : props.onClick || props.onPress ? "pointer" : "inherit"};
68
+ position: ${(props) => props.position || "static"};
69
+ top: ${(props) => typeof props.top === "number" ? `${props.top}px` : props.top};
70
+ bottom: ${(props) => typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom};
71
+ left: ${(props) => typeof props.left === "number" ? `${props.left}px` : props.left};
72
+ right: ${(props) => typeof props.right === "number" ? `${props.right}px` : props.right};
73
+ flex: ${(props) => props.flex};
74
+ flex-shrink: ${(props) => props.flexShrink ?? 1};
75
+ gap: ${(props) => typeof props.gap === "number" ? `${props.gap}px` : props.gap || 0};
76
+ align-self: ${(props) => props.alignSelf || "auto"};
77
+ overflow: ${(props) => props.overflow || "visible"};
78
+ overflow-x: ${(props) => props.overflowX || "visible"};
79
+ overflow-y: ${(props) => props.overflowY || "visible"};
80
+ z-index: ${(props) => props.zIndex};
81
+ opacity: ${(props) => props.disabled ? 0.5 : 1};
82
+ pointer-events: ${(props) => props.disabled ? "none" : "auto"};
83
+
84
+ &:hover {
85
+ ${(props) => props.hoverStyle?.backgroundColor && `background-color: ${props.hoverStyle.backgroundColor};`}
86
+ ${(props) => props.hoverStyle?.borderColor && `border-color: ${props.hoverStyle.borderColor};`}
87
+ }
88
+
89
+ &:active {
90
+ ${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
91
+ }
92
+ `;
93
+ var Box = React.forwardRef(
94
+ ({
95
+ children,
96
+ onPress,
97
+ onKeyDown,
98
+ onKeyUp,
99
+ role,
100
+ "aria-label": ariaLabel,
101
+ "aria-labelledby": ariaLabelledBy,
102
+ "aria-current": ariaCurrent,
103
+ "aria-disabled": ariaDisabled,
104
+ "aria-live": ariaLive,
105
+ "aria-busy": ariaBusy,
106
+ "aria-describedby": ariaDescribedBy,
107
+ "aria-expanded": ariaExpanded,
108
+ "aria-haspopup": ariaHasPopup,
109
+ "aria-pressed": ariaPressed,
110
+ "aria-controls": ariaControls,
111
+ tabIndex,
112
+ as,
113
+ src,
114
+ alt,
115
+ type,
116
+ disabled,
117
+ id,
118
+ ...props
119
+ }, ref) => {
120
+ if (as === "img" && src) {
121
+ return /* @__PURE__ */ jsx(
122
+ "img",
123
+ {
124
+ src,
125
+ alt: alt || "",
126
+ style: {
127
+ display: "block",
128
+ objectFit: "cover",
129
+ width: typeof props.width === "number" ? `${props.width}px` : props.width,
130
+ height: typeof props.height === "number" ? `${props.height}px` : props.height,
131
+ borderRadius: typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius,
132
+ position: props.position,
133
+ top: typeof props.top === "number" ? `${props.top}px` : props.top,
134
+ left: typeof props.left === "number" ? `${props.left}px` : props.left,
135
+ right: typeof props.right === "number" ? `${props.right}px` : props.right,
136
+ bottom: typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom
137
+ }
138
+ }
139
+ );
140
+ }
141
+ return /* @__PURE__ */ jsx(
142
+ StyledBox,
143
+ {
144
+ ref,
145
+ as,
146
+ id,
147
+ type: as === "button" ? type || "button" : void 0,
148
+ disabled: as === "button" ? disabled : void 0,
149
+ onClick: onPress,
150
+ onKeyDown,
151
+ onKeyUp,
152
+ role,
153
+ "aria-label": ariaLabel,
154
+ "aria-labelledby": ariaLabelledBy,
155
+ "aria-current": ariaCurrent,
156
+ "aria-disabled": ariaDisabled,
157
+ "aria-busy": ariaBusy,
158
+ "aria-describedby": ariaDescribedBy,
159
+ "aria-expanded": ariaExpanded,
160
+ "aria-haspopup": ariaHasPopup,
161
+ "aria-pressed": ariaPressed,
162
+ "aria-controls": ariaControls,
163
+ "aria-live": ariaLive,
164
+ tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
165
+ ...props,
166
+ children
167
+ }
168
+ );
169
+ }
170
+ );
171
+ Box.displayName = "Box";
172
+
173
+ // ../primitives-web/src/Text.tsx
174
+ import styled2 from "styled-components";
175
+ import { jsx as jsx2 } from "react/jsx-runtime";
176
+ var StyledText = styled2.span`
177
+ color: ${(props) => props.color || "inherit"};
178
+ font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
179
+ font-weight: ${(props) => props.fontWeight || "normal"};
180
+ font-family: ${(props) => props.fontFamily || '"Pilat Wide Bold", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important'};
181
+ line-height: ${(props) => typeof props.lineHeight === "number" ? `${props.lineHeight}px` : props.lineHeight || "inherit"};
182
+ white-space: ${(props) => props.whiteSpace || "normal"};
183
+ text-align: ${(props) => props.textAlign || "inherit"};
184
+ text-decoration: ${(props) => props.textDecoration || "none"};
185
+ `;
186
+ var Text = ({
187
+ style,
188
+ className,
189
+ id,
190
+ role,
191
+ ...props
192
+ }) => {
193
+ return /* @__PURE__ */ jsx2(
194
+ StyledText,
195
+ {
196
+ ...props,
197
+ style,
198
+ className,
199
+ id,
200
+ role
201
+ }
202
+ );
203
+ };
204
+
205
+ // ../primitives-web/src/Spinner.tsx
206
+ import styled3, { keyframes } from "styled-components";
207
+ import { jsx as jsx3 } from "react/jsx-runtime";
208
+ var rotate = keyframes`
209
+ from {
210
+ transform: rotate(0deg);
211
+ }
212
+ to {
213
+ transform: rotate(360deg);
214
+ }
215
+ `;
216
+ var StyledSpinner = styled3.div`
217
+ width: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
218
+ height: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
219
+ border: ${(props) => props.strokeWidth || 2}px solid
220
+ ${(props) => props.color || "currentColor"};
221
+ border-bottom-color: transparent;
222
+ border-radius: 50%;
223
+ display: inline-block;
224
+ box-sizing: border-box;
225
+ animation: ${rotate} 1s linear infinite;
226
+ `;
227
+ var Spinner = ({
228
+ role = "status",
229
+ "aria-label": ariaLabel,
230
+ "aria-live": ariaLive = "polite",
231
+ "aria-describedby": ariaDescribedBy,
232
+ testID,
233
+ ...props
234
+ }) => {
235
+ return /* @__PURE__ */ jsx3(
236
+ StyledSpinner,
237
+ {
238
+ role,
239
+ "aria-label": ariaLabel,
240
+ "aria-live": ariaLive,
241
+ "aria-describedby": ariaDescribedBy,
242
+ "data-testid": testID,
243
+ ...props
244
+ }
245
+ );
246
+ };
247
+ Spinner.displayName = "Spinner";
248
+
249
+ // ../primitives-web/src/Icon.tsx
250
+ import styled4 from "styled-components";
251
+ import { jsx as jsx4 } from "react/jsx-runtime";
252
+ var StyledIcon = styled4.div`
253
+ display: flex;
254
+ align-items: center;
255
+ justify-content: center;
256
+ width: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
257
+ height: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
258
+ color: ${(props) => props.color || "currentColor"};
259
+
260
+ svg {
261
+ width: 100%;
262
+ height: 100%;
263
+ fill: none;
264
+ stroke: currentColor;
265
+ }
266
+ `;
267
+
268
+ // ../primitives-web/src/Divider.tsx
269
+ import styled5 from "styled-components";
270
+ import { jsx as jsx5 } from "react/jsx-runtime";
271
+ var StyledDivider = styled5.div`
272
+ background-color: ${(props) => props.dashStroke ? "transparent" : props.color || "rgba(255, 255, 255, 0.15)"};
273
+ width: ${(props) => props.vertical ? typeof props.width === "number" ? `${props.width}px` : props.width || "1px" : "100%"};
274
+ height: ${(props) => props.vertical ? "100%" : typeof props.height === "number" ? `${props.height}px` : props.height || "1px"};
275
+
276
+ ${(props) => props.dashStroke && `
277
+ border-style: dashed;
278
+ border-color: ${props.color || "rgba(255, 255, 255, 0.15)"};
279
+ border-width: 0;
280
+ ${props.vertical ? `
281
+ border-left-width: ${typeof props.width === "number" ? `${props.width}px` : props.width || "1px"};
282
+ height: 100%;
283
+ ` : `
284
+ border-top-width: ${typeof props.height === "number" ? `${props.height}px` : props.height || "1px"};
285
+ width: 100%;
286
+ `}
287
+ `}
288
+ `;
289
+ var Divider = (props) => {
290
+ return /* @__PURE__ */ jsx5(StyledDivider, { ...props });
291
+ };
292
+
293
+ // ../primitives-web/src/Input.tsx
294
+ import { forwardRef } from "react";
295
+ import styled6 from "styled-components";
296
+ import { jsx as jsx6 } from "react/jsx-runtime";
297
+ var StyledInput = styled6.input`
298
+ background: transparent;
299
+ border: none;
300
+ outline: none;
301
+ width: 100%;
302
+ height: 100%;
303
+ padding: 0;
304
+ margin: 0;
305
+ color: ${(props) => props.color || "inherit"};
306
+ font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
307
+ font-family: inherit;
308
+ text-align: inherit;
309
+
310
+ &::placeholder {
311
+ color: ${(props) => props.placeholderTextColor || "rgba(255, 255, 255, 0.5)"};
312
+ }
313
+
314
+ &:disabled {
315
+ cursor: not-allowed;
316
+ }
317
+ `;
318
+ var InputPrimitive = forwardRef(
319
+ ({
320
+ value,
321
+ placeholder,
322
+ onChange,
323
+ onChangeText,
324
+ onFocus,
325
+ onBlur,
326
+ onKeyDown,
327
+ disabled,
328
+ secureTextEntry,
329
+ style,
330
+ color,
331
+ fontSize,
332
+ placeholderTextColor,
333
+ maxLength,
334
+ name,
335
+ type,
336
+ inputMode,
337
+ autoComplete,
338
+ id,
339
+ "aria-invalid": ariaInvalid,
340
+ "aria-describedby": ariaDescribedBy,
341
+ "aria-labelledby": ariaLabelledBy,
342
+ "aria-label": ariaLabel,
343
+ "aria-disabled": ariaDisabled,
344
+ "data-testid": dataTestId,
345
+ ...rest
346
+ }, ref) => {
347
+ const handleChange = (e) => {
348
+ if (onChange) {
349
+ onChange(e);
350
+ }
351
+ if (onChangeText) {
352
+ onChangeText(e.target.value);
353
+ }
354
+ };
355
+ const inputValue = value !== void 0 ? value : "";
356
+ return /* @__PURE__ */ jsx6(
357
+ StyledInput,
358
+ {
359
+ ref,
360
+ id,
361
+ value: inputValue,
362
+ name,
363
+ placeholder,
364
+ onChange: handleChange,
365
+ onFocus,
366
+ onBlur,
367
+ onKeyDown,
368
+ disabled,
369
+ type: secureTextEntry ? "password" : type || "text",
370
+ inputMode,
371
+ autoComplete,
372
+ style,
373
+ color,
374
+ fontSize,
375
+ placeholderTextColor,
376
+ maxLength,
377
+ "aria-invalid": ariaInvalid,
378
+ "aria-describedby": ariaDescribedBy,
379
+ "aria-labelledby": ariaLabelledBy,
380
+ "aria-label": ariaLabel,
381
+ "aria-disabled": ariaDisabled,
382
+ "data-testid": dataTestId,
383
+ ...rest
384
+ }
385
+ );
386
+ }
387
+ );
388
+ InputPrimitive.displayName = "InputPrimitive";
389
+
390
+ // ../primitives-web/src/TextArea.tsx
391
+ import { forwardRef as forwardRef2 } from "react";
392
+ import styled7 from "styled-components";
393
+ import { jsx as jsx7 } from "react/jsx-runtime";
394
+ var StyledTextArea = styled7.textarea`
395
+ background: transparent;
396
+ border: none;
397
+ outline: none;
398
+ width: 100%;
399
+ height: 100%;
400
+ padding: 0;
401
+ margin: 0;
402
+ color: ${(props) => props.color || "inherit"};
403
+ font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
404
+ font-family: inherit;
405
+ text-align: inherit;
406
+ resize: none;
407
+
408
+ &::placeholder {
409
+ color: ${(props) => props.placeholderTextColor || "rgba(255, 255, 255, 0.5)"};
410
+ }
411
+
412
+ &:disabled {
413
+ cursor: not-allowed;
414
+ }
415
+ `;
416
+ var TextAreaPrimitive = forwardRef2(
417
+ ({
418
+ value,
419
+ placeholder,
420
+ onChangeText,
421
+ onFocus,
422
+ onBlur,
423
+ onKeyDown,
424
+ disabled,
425
+ style,
426
+ color,
427
+ fontSize,
428
+ placeholderTextColor,
429
+ maxLength,
430
+ rows
431
+ }, ref) => {
432
+ return /* @__PURE__ */ jsx7(
433
+ StyledTextArea,
434
+ {
435
+ ref,
436
+ value,
437
+ placeholder,
438
+ onChange: (e) => onChangeText?.(e.target.value),
439
+ onFocus,
440
+ onBlur,
441
+ onKeyDown,
442
+ disabled,
443
+ style,
444
+ color,
445
+ fontSize,
446
+ placeholderTextColor,
447
+ maxLength,
448
+ rows
449
+ }
450
+ );
451
+ }
452
+ );
453
+ TextAreaPrimitive.displayName = "TextAreaPrimitive";
454
+
455
+ // src/Stepper.tsx
456
+ import { useDesignSystem as useDesignSystem3 } from "@xsolla/xui-core";
457
+
458
+ // src/Step.tsx
459
+ import { useCallback, useMemo } from "react";
460
+ import { useDesignSystem as useDesignSystem2 } from "@xsolla/xui-core";
461
+ import { Check, X, AlertCircle } from "@xsolla/xui-icons";
462
+
463
+ // src/utils/colors.ts
464
+ var getPaletteColor = (palette, theme, type = "text") => {
465
+ const fallback = type === "active" ? "#00d4ff" : "#00d4ff";
466
+ if (palette === "brand") {
467
+ const brandText2 = theme.colors?.content?.brand?.secondary;
468
+ const brandActive2 = theme.colors?.control?.brand?.primary?.bgHover || brandText2;
469
+ if (type === "active") {
470
+ return brandActive2 || fallback;
471
+ }
472
+ return brandText2 || fallback;
473
+ }
474
+ if (palette === "brandSecondary") {
475
+ const extraText = theme.colors?.content?.brandExtra?.primary;
476
+ const extraActive = theme.colors?.control?.brandExtra?.primary?.bgHover || extraText;
477
+ if (type === "active") {
478
+ return extraActive || "#d9ff66";
479
+ }
480
+ return extraText || "#d9ff66";
481
+ }
482
+ const brandText = theme.colors?.content?.brand?.secondary;
483
+ const brandActive = theme.colors?.control?.brand?.primary?.bgHover || brandText;
484
+ return (type === "active" ? brandActive : brandText) || fallback;
485
+ };
486
+ var hexToRgba = (hex, opacity) => {
487
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
488
+ if (result) {
489
+ const r = parseInt(result[1], 16);
490
+ const g = parseInt(result[2], 16);
491
+ const b = parseInt(result[3], 16);
492
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`;
493
+ }
494
+ return hex;
495
+ };
496
+
497
+ // src/utils/platform.ts
498
+ var isWeb = () => {
499
+ return typeof window !== "undefined" && typeof document !== "undefined";
500
+ };
501
+
502
+ // src/StepTail.tsx
503
+ import { useDesignSystem } from "@xsolla/xui-core";
504
+ import { jsx as jsx8 } from "react/jsx-runtime";
505
+ var StepTail = ({
506
+ variantUI,
507
+ direction,
508
+ size,
509
+ state,
510
+ isLast,
511
+ isFirstColoredTail,
512
+ isLastColoredTail,
513
+ palette
514
+ }) => {
515
+ const { theme } = useDesignSystem();
516
+ if (variantUI !== "current" || isLast) {
517
+ return null;
518
+ }
519
+ const tailSize = size === "sm" ? 3 : 5;
520
+ const verticalTailWidth = size === "sm" ? 2 : 4;
521
+ const isHorizontal = direction === "horizontal";
522
+ let tailBgColor = "transparent";
523
+ let tailHeight = tailSize;
524
+ let tailWidth = tailSize;
525
+ let borderRadius = 0;
526
+ let borderRadiusStyle;
527
+ try {
528
+ if (isFirstColoredTail && isLastColoredTail) {
529
+ borderRadius = 4;
530
+ } else if (isFirstColoredTail) {
531
+ if (isWeb()) {
532
+ borderRadiusStyle = isHorizontal ? { borderRadius: "4px 0 0 4px" } : { borderRadius: "4px 4px 0 0" };
533
+ } else {
534
+ if (isHorizontal) {
535
+ borderRadiusStyle = {
536
+ borderTopLeftRadius: 4,
537
+ borderBottomLeftRadius: 4
538
+ };
539
+ } else {
540
+ borderRadiusStyle = {
541
+ borderTopLeftRadius: 4,
542
+ borderTopRightRadius: 4
543
+ };
544
+ }
545
+ }
546
+ } else if (isLastColoredTail) {
547
+ if (isWeb()) {
548
+ borderRadiusStyle = isHorizontal ? { borderRadius: "0 4px 4px 0" } : { borderRadius: "0 0 4px 4px" };
549
+ } else {
550
+ if (isHorizontal) {
551
+ borderRadiusStyle = {
552
+ borderTopRightRadius: 4,
553
+ borderBottomRightRadius: 4
554
+ };
555
+ } else {
556
+ borderRadiusStyle = {
557
+ borderBottomLeftRadius: 4,
558
+ borderBottomRightRadius: 4
559
+ };
560
+ }
561
+ }
562
+ }
563
+ if (state === "current" || state === "loading") {
564
+ tailBgColor = getPaletteColor(palette, theme, "active");
565
+ tailHeight = tailSize;
566
+ tailWidth = isHorizontal ? tailSize : verticalTailWidth;
567
+ } else if (state === "alert") {
568
+ tailBgColor = theme.colors.content.alert.primary;
569
+ tailHeight = tailSize;
570
+ tailWidth = isHorizontal ? tailSize : verticalTailWidth;
571
+ } else if (state === "warning") {
572
+ tailBgColor = theme.colors.content.warning.primary;
573
+ tailHeight = tailSize;
574
+ tailWidth = isHorizontal ? tailSize : verticalTailWidth;
575
+ } else if (state === "complete") {
576
+ return null;
577
+ } else {
578
+ const paletteColor = getPaletteColor(palette, theme, "active");
579
+ tailBgColor = hexToRgba(paletteColor, 0.15);
580
+ tailHeight = 2;
581
+ tailWidth = isHorizontal ? 2 : 2;
582
+ borderRadius = 0;
583
+ }
584
+ } catch {
585
+ return null;
586
+ }
587
+ const borderOffset = isHorizontal ? -(tailHeight / 2 + 0.5) : -3;
588
+ if (isHorizontal) {
589
+ return /* @__PURE__ */ jsx8(
590
+ Box,
591
+ {
592
+ position: "absolute",
593
+ bottom: borderOffset,
594
+ left: 0,
595
+ width: "100%",
596
+ height: tailHeight,
597
+ backgroundColor: tailBgColor,
598
+ borderRadius,
599
+ zIndex: 1,
600
+ style: borderRadiusStyle
601
+ }
602
+ );
603
+ }
604
+ return /* @__PURE__ */ jsx8(
605
+ Box,
606
+ {
607
+ position: "absolute",
608
+ top: 0,
609
+ left: borderOffset,
610
+ height: "100%",
611
+ width: tailWidth,
612
+ backgroundColor: tailBgColor,
613
+ borderRadius,
614
+ zIndex: 1,
615
+ style: borderRadiusStyle
616
+ }
617
+ );
618
+ };
619
+
620
+ // src/hooks/useStepHoverStyles.ts
621
+ import { useEffect } from "react";
622
+ var useStepHoverStyles = (variantUI, state, className, theme, isLast, disabled, noClick, palette) => {
623
+ useEffect(() => {
624
+ if (!isWeb()) {
625
+ return;
626
+ }
627
+ const styleId = `step-hover-styles-${className}`;
628
+ let styleElement = document.getElementById(
629
+ styleId
630
+ );
631
+ if (!styleElement) {
632
+ styleElement = document.createElement("style");
633
+ styleElement.id = styleId;
634
+ document.head.appendChild(styleElement);
635
+ }
636
+ const getHoverTextColor = () => {
637
+ if (state === "alert") {
638
+ return theme.colors.content.alert.primary;
639
+ } else if (state === "warning") {
640
+ return theme.colors.content.warning.primary;
641
+ } else {
642
+ return getPaletteColor(palette, theme, "text");
643
+ }
644
+ };
645
+ let hoverCss = "";
646
+ if (!disabled && !noClick) {
647
+ const hoverTextColor = getHoverTextColor();
648
+ const hoverPaletteColor = getPaletteColor(palette, theme, "active");
649
+ let circleHoverCss = "";
650
+ if (isLast) {
651
+ const whiteColor = theme.colors.content.static.light;
652
+ circleHoverCss = `
653
+ .step-icon-${className} {
654
+ background-color: ${hoverPaletteColor} !important;
655
+ border-color: ${hoverPaletteColor} !important;
656
+ color: ${whiteColor} !important;
657
+ }
658
+ `;
659
+ } else {
660
+ if (variantUI === "simple") {
661
+ if (state === "incomplete") {
662
+ const whiteColor = theme.colors.content.static.light;
663
+ circleHoverCss = `
664
+ .step-icon-${className} {
665
+ background-color: ${hoverPaletteColor} !important;
666
+ border-color: ${hoverPaletteColor} !important;
667
+ color: ${whiteColor} !important;
668
+ }
669
+ `;
670
+ } else if (state === "complete") {
671
+ circleHoverCss = `
672
+ .step-icon-${className} {
673
+ border-color: ${hoverPaletteColor} !important;
674
+ color: ${hoverPaletteColor} !important;
675
+ }
676
+ `;
677
+ } else if (state === "loading") {
678
+ circleHoverCss = `
679
+ .step-icon-${className} {
680
+ color: ${hoverPaletteColor} !important;
681
+ }
682
+ `;
683
+ }
684
+ } else {
685
+ if (state === "incomplete") {
686
+ const whiteColor = theme.colors.content.static.light;
687
+ circleHoverCss = `
688
+ .step-icon-${className} {
689
+ background-color: ${hoverPaletteColor} !important;
690
+ border-color: ${hoverPaletteColor} !important;
691
+ color: ${whiteColor} !important;
692
+ }
693
+ `;
694
+ } else if (state === "complete") {
695
+ circleHoverCss = `
696
+ .step-icon-${className} {
697
+ border-color: ${hoverPaletteColor} !important;
698
+ color: ${hoverPaletteColor} !important;
699
+ }
700
+ `;
701
+ } else if (state === "loading") {
702
+ circleHoverCss = `
703
+ .step-icon-${className} {
704
+ color: ${hoverPaletteColor} !important;
705
+ }
706
+ `;
707
+ }
708
+ }
709
+ }
710
+ hoverCss = `
711
+ &:hover {
712
+ .step-title-${className} {
713
+ color: ${hoverTextColor} !important;
714
+ }
715
+ .step-description-${className} {
716
+ color: ${hoverTextColor} !important;
717
+ }
718
+ ${circleHoverCss}
719
+ }
720
+ `;
721
+ }
722
+ const css = `
723
+ .${className} {
724
+ ${hoverCss}
725
+ }
726
+ `;
727
+ styleElement.textContent = css;
728
+ return () => {
729
+ if (styleElement && styleElement.parentNode) {
730
+ styleElement.parentNode.removeChild(styleElement);
731
+ }
732
+ };
733
+ }, [variantUI, state, className, isLast, disabled, noClick, palette, theme]);
734
+ };
735
+
736
+ // src/Step.tsx
737
+ import { jsx as jsx9, jsxs } from "react/jsx-runtime";
738
+ var StepState = ({
739
+ state,
740
+ size,
741
+ step,
742
+ variantUI,
743
+ disabled,
744
+ noClick,
745
+ palette,
746
+ theme,
747
+ mode,
748
+ sizeStyles,
749
+ className,
750
+ isLast = false
751
+ }) => {
752
+ const paletteColor = getPaletteColor(palette, theme, "active");
753
+ const paletteTextColor = getPaletteColor(palette, theme, "text");
754
+ const iconStyles = useMemo(() => {
755
+ if (variantUI === "simple") {
756
+ switch (state) {
757
+ case "current":
758
+ return {
759
+ backgroundColor: paletteColor,
760
+ borderColor: paletteColor,
761
+ color: theme.colors.content.static.light
762
+ };
763
+ case "incomplete":
764
+ return {
765
+ backgroundColor: "transparent",
766
+ borderColor: theme.colors.control.input.bgDisable,
767
+ color: theme.colors.control.input.textDisable
768
+ };
769
+ case "loading":
770
+ const loadingBg = hexToRgba(paletteColor, 0.05);
771
+ return {
772
+ backgroundColor: loadingBg,
773
+ borderColor: "transparent",
774
+ color: paletteColor
775
+ };
776
+ case "complete":
777
+ return {
778
+ backgroundColor: "transparent",
779
+ borderColor: paletteColor,
780
+ color: paletteColor
781
+ };
782
+ case "alert":
783
+ return {
784
+ backgroundColor: theme.colors.content.alert.primary,
785
+ borderColor: theme.colors.content.alert.primary,
786
+ color: theme.colors.content.static.light
787
+ };
788
+ case "warning":
789
+ return {
790
+ backgroundColor: theme.colors.content.warning.primary,
791
+ borderColor: theme.colors.content.warning.primary,
792
+ color: theme.colors.content.static.light
793
+ };
794
+ default:
795
+ return {
796
+ backgroundColor: "transparent",
797
+ borderColor: theme.colors.control.input.bgDisable,
798
+ color: theme.colors.control.input.textDisable
799
+ };
800
+ }
801
+ } else {
802
+ switch (state) {
803
+ case "current":
804
+ return {
805
+ backgroundColor: paletteColor,
806
+ borderColor: paletteColor,
807
+ color: theme.colors.content.static.light
808
+ };
809
+ case "incomplete":
810
+ if (mode === "light") {
811
+ return {
812
+ backgroundColor: theme.colors.content.static.dark,
813
+ borderColor: theme.colors.content.static.dark,
814
+ color: theme.colors.content.static.light
815
+ };
816
+ } else {
817
+ return {
818
+ backgroundColor: theme.colors.content.static.light,
819
+ borderColor: theme.colors.content.static.light,
820
+ color: theme.colors.content.static.dark
821
+ };
822
+ }
823
+ case "loading":
824
+ const loadingBg = hexToRgba(paletteColor, 0.05);
825
+ return {
826
+ backgroundColor: loadingBg,
827
+ borderColor: "transparent",
828
+ color: paletteColor
829
+ };
830
+ case "complete":
831
+ return {
832
+ backgroundColor: paletteColor,
833
+ borderColor: paletteColor,
834
+ color: theme.colors.content.static.light
835
+ };
836
+ case "alert":
837
+ return {
838
+ backgroundColor: theme.colors.content.alert.primary,
839
+ borderColor: theme.colors.content.alert.primary,
840
+ color: theme.colors.content.static.light
841
+ };
842
+ case "warning":
843
+ return {
844
+ backgroundColor: theme.colors.content.warning.primary,
845
+ borderColor: theme.colors.content.warning.primary,
846
+ color: theme.colors.content.static.light
847
+ };
848
+ default:
849
+ return {
850
+ backgroundColor: theme.colors.control.input.bg,
851
+ borderColor: theme.colors.control.input.bg,
852
+ color: theme.colors.control.brand.primary.text.primary
853
+ };
854
+ }
855
+ }
856
+ }, [state, variantUI, theme, paletteColor]);
857
+ const iconHoverStyles = useMemo(() => {
858
+ if (disabled || noClick) return {};
859
+ if (variantUI === "simple") {
860
+ if (isLast) {
861
+ return {
862
+ backgroundColor: paletteColor,
863
+ borderColor: paletteColor,
864
+ color: theme.colors.content.static.light,
865
+ opacity: 0.9
866
+ };
867
+ }
868
+ switch (state) {
869
+ case "current":
870
+ return {
871
+ backgroundColor: paletteColor,
872
+ borderColor: paletteColor,
873
+ opacity: 0.9
874
+ };
875
+ case "incomplete":
876
+ return {
877
+ borderColor: paletteColor,
878
+ color: paletteColor,
879
+ opacity: 0.9
880
+ };
881
+ case "loading":
882
+ return {
883
+ color: paletteColor,
884
+ opacity: 0.9
885
+ };
886
+ case "complete":
887
+ return {
888
+ borderColor: paletteColor,
889
+ color: paletteColor,
890
+ opacity: 0.9
891
+ };
892
+ case "alert":
893
+ case "warning":
894
+ return {};
895
+ default:
896
+ return {};
897
+ }
898
+ } else {
899
+ switch (state) {
900
+ case "current":
901
+ return {
902
+ backgroundColor: theme.colors.control.brand.primary.bgHover
903
+ };
904
+ case "incomplete":
905
+ return {
906
+ backgroundColor: theme.colors.control.input.bgHover || theme.colors.control.input.bg
907
+ };
908
+ case "loading":
909
+ return {
910
+ color: theme.colors.control.brand.primary.bgHover
911
+ };
912
+ case "complete":
913
+ return {
914
+ backgroundColor: theme.colors.control.brand.primary.bgHover
915
+ };
916
+ case "alert":
917
+ case "warning":
918
+ return {};
919
+ default:
920
+ return {};
921
+ }
922
+ }
923
+ }, [state, variantUI, disabled, noClick, theme, paletteColor]);
924
+ const iconSize = size === "sm" ? 18 : 18;
925
+ return /* @__PURE__ */ jsx9(
926
+ Box,
927
+ {
928
+ className,
929
+ width: sizeStyles.iconSize,
930
+ height: sizeStyles.iconSize,
931
+ borderRadius: sizeStyles.iconSize / 2,
932
+ backgroundColor: iconStyles.backgroundColor,
933
+ borderColor: iconStyles.borderColor,
934
+ borderWidth: iconStyles.borderColor !== "transparent" ? 1 : 0,
935
+ alignItems: "center",
936
+ justifyContent: "center",
937
+ flexShrink: 0,
938
+ children: state === "loading" ? /* @__PURE__ */ jsx9(Spinner, { size: size === "sm" ? 16 : 20, color: iconStyles.color }) : state === "complete" ? /* @__PURE__ */ jsx9(Check, { size: iconSize, color: iconStyles.color }) : state === "alert" ? /* @__PURE__ */ jsx9(X, { size: iconSize, color: iconStyles.color }) : state === "warning" ? /* @__PURE__ */ jsx9(AlertCircle, { size: iconSize, color: iconStyles.color }) : /* @__PURE__ */ jsx9(
939
+ Text,
940
+ {
941
+ color: iconStyles.color,
942
+ fontSize: size === "sm" ? 12 : 14,
943
+ fontWeight: "600",
944
+ children: step
945
+ }
946
+ )
947
+ }
948
+ );
949
+ };
950
+ var Step = ({
951
+ title,
952
+ state = "incomplete",
953
+ description,
954
+ size,
955
+ onClick,
956
+ tail,
957
+ stepNumber,
958
+ disabled = false,
959
+ direction,
960
+ variantUI,
961
+ noClick = false,
962
+ palette = "brand",
963
+ isLast = false,
964
+ isFirstColoredTail = false,
965
+ isLastColoredTail = false
966
+ }) => {
967
+ const { theme, mode } = useDesignSystem2();
968
+ const sizeStyles = theme.sizing.stepper(size);
969
+ const stepClassName = useMemo(
970
+ () => `step-${stepNumber}-${variantUI}-${direction}-${size}-${state}-${palette}`,
971
+ [stepNumber, variantUI, direction, size, state, palette]
972
+ );
973
+ useStepHoverStyles(
974
+ variantUI,
975
+ state,
976
+ stepClassName,
977
+ theme,
978
+ isLast,
979
+ disabled,
980
+ noClick,
981
+ palette
982
+ );
983
+ const stepClick = useCallback(() => {
984
+ if (onClick && !disabled && !noClick) {
985
+ onClick({
986
+ number: stepNumber,
987
+ step: {
988
+ title,
989
+ description,
990
+ state,
991
+ disabled
992
+ }
993
+ });
994
+ }
995
+ }, [onClick, disabled, noClick, stepNumber, title, description, state]);
996
+ const stepAriaLabel = useMemo(() => {
997
+ const stepNum = stepNumber + 1;
998
+ const titleText = typeof title === "string" ? title : "Step";
999
+ const descriptionText = description && typeof description === "string" ? description : "";
1000
+ const stateText = {
1001
+ current: "current",
1002
+ incomplete: "incomplete",
1003
+ loading: "loading",
1004
+ complete: "complete",
1005
+ alert: "alert",
1006
+ warning: "warning"
1007
+ }[state] || "incomplete";
1008
+ let label = `Step ${stepNum}: ${titleText}`;
1009
+ if (descriptionText) {
1010
+ label += `, ${descriptionText}`;
1011
+ }
1012
+ label += `, ${stateText}`;
1013
+ if (isLast) {
1014
+ label += ", last step";
1015
+ }
1016
+ return label;
1017
+ }, [stepNumber, title, description, state, isLast]);
1018
+ const handleKeyDown = useCallback(
1019
+ (event) => {
1020
+ if (event.key === "Enter" && !disabled && !noClick) {
1021
+ event.preventDefault();
1022
+ stepClick();
1023
+ }
1024
+ if (event.key === " " && !disabled && !noClick) {
1025
+ event.preventDefault();
1026
+ }
1027
+ },
1028
+ [stepClick, disabled, noClick]
1029
+ );
1030
+ const handleKeyUp = useCallback(
1031
+ (event) => {
1032
+ if (event.key === " " && !disabled && !noClick) {
1033
+ event.preventDefault();
1034
+ stepClick();
1035
+ }
1036
+ },
1037
+ [stepClick, disabled, noClick]
1038
+ );
1039
+ const isInteractive = !disabled && !noClick && !!onClick;
1040
+ const isCurrent = state === "current";
1041
+ const titleStyles = useMemo(() => {
1042
+ if (variantUI === "simple") {
1043
+ const sizeStylesMap = {
1044
+ sm: {
1045
+ fontSize: 14,
1046
+ lineHeight: 22,
1047
+ paddingTop: 1,
1048
+ paddingBottom: 1
1049
+ },
1050
+ md: {
1051
+ fontSize: 16,
1052
+ lineHeight: 24,
1053
+ paddingTop: 4,
1054
+ paddingBottom: 4
1055
+ }
1056
+ };
1057
+ return {
1058
+ ...sizeStylesMap[size],
1059
+ color: state === "incomplete" ? theme.colors.control.input.textDisable : theme.colors.content.primary,
1060
+ fontWeight: "500"
1061
+ };
1062
+ } else {
1063
+ const sizeDirectionStyles = {
1064
+ sm_horizontal: {
1065
+ fontSize: 16,
1066
+ lineHeight: 20,
1067
+ fontWeight: "500"
1068
+ },
1069
+ md_horizontal: {
1070
+ fontSize: 18,
1071
+ lineHeight: 24,
1072
+ fontWeight: "500"
1073
+ },
1074
+ sm_vertical: {
1075
+ fontSize: 18,
1076
+ lineHeight: 20,
1077
+ fontWeight: "500"
1078
+ },
1079
+ md_vertical: {
1080
+ fontSize: 18,
1081
+ lineHeight: 24,
1082
+ fontWeight: "500"
1083
+ }
1084
+ };
1085
+ const stateColors = {
1086
+ incomplete: theme.colors.content.secondary,
1087
+ current: getPaletteColor(palette, theme, "text"),
1088
+ loading: getPaletteColor(palette, theme, "text"),
1089
+ alert: theme.colors.content.primary,
1090
+ warning: theme.colors.content.primary,
1091
+ complete: theme.colors.content.primary
1092
+ };
1093
+ return {
1094
+ ...sizeDirectionStyles[`${size}_${direction}`],
1095
+ color: stateColors[state] || theme.colors.content.primary
1096
+ };
1097
+ }
1098
+ }, [variantUI, direction, size, state, theme, palette]);
1099
+ const descriptionStyles = useMemo(() => {
1100
+ const sizeStylesMap = {
1101
+ sm: {
1102
+ fontSize: 12,
1103
+ lineHeight: variantUI === "simple" ? 20 : 18,
1104
+ marginTop: variantUI === "simple" ? 0 : 2
1105
+ },
1106
+ md: {
1107
+ fontSize: 14,
1108
+ lineHeight: variantUI === "simple" ? 22 : 20,
1109
+ marginTop: variantUI === "simple" ? 0 : 4
1110
+ }
1111
+ };
1112
+ let descriptionColor = theme.colors.content.secondary;
1113
+ if (variantUI === "current" && (state === "incomplete" || !state)) {
1114
+ descriptionColor = theme.colors.content.tertiary || "rgba(24, 23, 28, 0.5)";
1115
+ }
1116
+ return {
1117
+ ...sizeStylesMap[size],
1118
+ color: descriptionColor,
1119
+ fontWeight: "400"
1120
+ };
1121
+ }, [size, variantUI, state, theme]);
1122
+ const contentWrapperStyles = useMemo(() => {
1123
+ if (variantUI === "simple") {
1124
+ if (direction === "horizontal") {
1125
+ return {
1126
+ marginLeft: size === "sm" ? 8 : 12,
1127
+ flex: 1
1128
+ };
1129
+ }
1130
+ return {
1131
+ marginLeft: size === "sm" ? 8 : 12
1132
+ };
1133
+ } else {
1134
+ const baseStyles = {
1135
+ marginTop: size === "sm" ? 10 : 12
1136
+ };
1137
+ if (direction === "horizontal") {
1138
+ return {
1139
+ ...baseStyles,
1140
+ paddingLeft: size === "sm" ? 20 : 24,
1141
+ paddingRight: size === "sm" ? 20 : 24,
1142
+ gap: 12
1143
+ };
1144
+ } else {
1145
+ return {};
1146
+ }
1147
+ return baseStyles;
1148
+ }
1149
+ }, [variantUI, direction, size]);
1150
+ const stepWrapperStyles = useMemo(() => {
1151
+ if (variantUI === "current") {
1152
+ if (direction === "horizontal") {
1153
+ return {
1154
+ flex: 1,
1155
+ minWidth: 0,
1156
+ flexShrink: 0,
1157
+ paddingBottom: size === "sm" ? 27 : 37
1158
+ };
1159
+ } else {
1160
+ return {
1161
+ paddingTop: size === "sm" ? 20 : 24,
1162
+ paddingBottom: size === "sm" ? 20 : 24,
1163
+ paddingLeft: size === "sm" ? 24 : 32,
1164
+ paddingRight: size === "sm" ? 10 : 10,
1165
+ minWidth: 184
1166
+ };
1167
+ }
1168
+ } else {
1169
+ if (direction === "horizontal") {
1170
+ return {
1171
+ flexShrink: 0,
1172
+ marginRight: isLast ? 0 : size === "sm" ? 8 : 12
1173
+ };
1174
+ } else {
1175
+ return {
1176
+ marginBottom: isLast ? 0 : 8,
1177
+ minHeight: 56
1178
+ };
1179
+ }
1180
+ }
1181
+ }, [variantUI, direction, size, isLast]);
1182
+ if (variantUI === "current" && direction === "horizontal") {
1183
+ return /* @__PURE__ */ jsxs(
1184
+ Box,
1185
+ {
1186
+ role: isWeb() ? "button" : void 0,
1187
+ "aria-label": isWeb() ? stepAriaLabel : void 0,
1188
+ "aria-current": isWeb() && isCurrent ? "step" : void 0,
1189
+ "aria-disabled": isWeb() && (disabled || noClick) ? true : void 0,
1190
+ tabIndex: isWeb() && isInteractive ? 0 : void 0,
1191
+ onPress: stepClick,
1192
+ onKeyDown: isWeb() && isInteractive ? handleKeyDown : void 0,
1193
+ onKeyUp: isWeb() && isInteractive ? handleKeyUp : void 0,
1194
+ disabled,
1195
+ "data-testid": "step",
1196
+ className: stepClassName,
1197
+ flexDirection: "column",
1198
+ alignItems: "flex-start",
1199
+ justifyContent: "flex-start",
1200
+ position: "relative",
1201
+ ...stepWrapperStyles,
1202
+ ...isWeb() && {
1203
+ cursor: disabled || noClick ? "default" : "pointer"
1204
+ },
1205
+ children: [
1206
+ /* @__PURE__ */ jsx9(
1207
+ StepTail,
1208
+ {
1209
+ variantUI,
1210
+ direction,
1211
+ size,
1212
+ state,
1213
+ isLast,
1214
+ isFirstColoredTail,
1215
+ isLastColoredTail,
1216
+ palette
1217
+ }
1218
+ ),
1219
+ /* @__PURE__ */ jsxs(
1220
+ Box,
1221
+ {
1222
+ flexDirection: "column",
1223
+ alignItems: "flex-start",
1224
+ justifyContent: "flex-start",
1225
+ gap: 12,
1226
+ paddingLeft: size === "sm" ? 20 : 24,
1227
+ paddingRight: size === "sm" ? 20 : 24,
1228
+ width: "100%",
1229
+ children: [
1230
+ /* @__PURE__ */ jsx9(Box, { flexDirection: "column", alignItems: "flex-start", children: /* @__PURE__ */ jsx9(
1231
+ StepState,
1232
+ {
1233
+ state,
1234
+ size,
1235
+ step: stepNumber + 1,
1236
+ variantUI,
1237
+ disabled,
1238
+ noClick,
1239
+ palette,
1240
+ theme,
1241
+ mode,
1242
+ sizeStyles,
1243
+ className: `step-icon-${stepClassName}`,
1244
+ isLast
1245
+ }
1246
+ ) }),
1247
+ /* @__PURE__ */ jsxs(
1248
+ Box,
1249
+ {
1250
+ flexDirection: "column",
1251
+ alignItems: "flex-start",
1252
+ justifyContent: "flex-start",
1253
+ gap: 4,
1254
+ width: "100%",
1255
+ children: [
1256
+ typeof title === "string" ? /* @__PURE__ */ jsx9(
1257
+ Text,
1258
+ {
1259
+ className: `step-title-${stepClassName}`,
1260
+ color: titleStyles.color,
1261
+ fontSize: titleStyles.fontSize,
1262
+ fontWeight: titleStyles.fontWeight,
1263
+ lineHeight: titleStyles.lineHeight,
1264
+ children: title
1265
+ }
1266
+ ) : title,
1267
+ description && /* @__PURE__ */ jsx9(Box, { width: "100%", alignItems: "flex-start", children: typeof description === "string" || typeof description === "number" ? /* @__PURE__ */ jsx9(
1268
+ Text,
1269
+ {
1270
+ className: `step-description-${stepClassName}`,
1271
+ color: descriptionStyles.color,
1272
+ fontSize: descriptionStyles.fontSize,
1273
+ fontWeight: descriptionStyles.fontWeight,
1274
+ lineHeight: descriptionStyles.lineHeight,
1275
+ children: description
1276
+ }
1277
+ ) : description })
1278
+ ]
1279
+ }
1280
+ )
1281
+ ]
1282
+ }
1283
+ )
1284
+ ]
1285
+ }
1286
+ );
1287
+ }
1288
+ if (variantUI === "simple" && direction === "horizontal") {
1289
+ return /* @__PURE__ */ jsxs(
1290
+ Box,
1291
+ {
1292
+ role: isWeb() ? "button" : void 0,
1293
+ "aria-label": isWeb() ? stepAriaLabel : void 0,
1294
+ "aria-current": isWeb() && isCurrent ? "step" : void 0,
1295
+ "aria-disabled": isWeb() && (disabled || noClick) ? true : void 0,
1296
+ tabIndex: isWeb() && isInteractive ? 0 : void 0,
1297
+ onPress: stepClick,
1298
+ onKeyDown: isWeb() && isInteractive ? handleKeyDown : void 0,
1299
+ onKeyUp: isWeb() && isInteractive ? handleKeyUp : void 0,
1300
+ disabled,
1301
+ "data-testid": "step",
1302
+ className: stepClassName,
1303
+ flexDirection: "row",
1304
+ alignItems: "flex-start",
1305
+ ...stepWrapperStyles,
1306
+ ...isWeb() && {
1307
+ cursor: disabled || noClick ? "default" : "pointer"
1308
+ },
1309
+ children: [
1310
+ /* @__PURE__ */ jsx9(Box, { flexDirection: "column", children: /* @__PURE__ */ jsx9(
1311
+ StepState,
1312
+ {
1313
+ state,
1314
+ size,
1315
+ step: stepNumber + 1,
1316
+ variantUI,
1317
+ disabled,
1318
+ noClick,
1319
+ palette,
1320
+ theme,
1321
+ mode,
1322
+ sizeStyles,
1323
+ isLast
1324
+ }
1325
+ ) }),
1326
+ /* @__PURE__ */ jsxs(Box, { ...contentWrapperStyles, children: [
1327
+ /* @__PURE__ */ jsxs(
1328
+ Box,
1329
+ {
1330
+ flexDirection: "row",
1331
+ alignItems: "center",
1332
+ width: "100%",
1333
+ paddingTop: variantUI === "simple" ? size === "sm" ? 1 : 4 : void 0,
1334
+ paddingBottom: variantUI === "simple" ? size === "sm" ? 1 : 4 : void 0,
1335
+ children: [
1336
+ typeof title === "string" ? /* @__PURE__ */ jsx9(
1337
+ Text,
1338
+ {
1339
+ className: `step-title-${stepClassName}`,
1340
+ color: titleStyles.color,
1341
+ fontSize: titleStyles.fontSize,
1342
+ fontWeight: titleStyles.fontWeight,
1343
+ lineHeight: titleStyles.lineHeight,
1344
+ children: title
1345
+ }
1346
+ ) : title,
1347
+ tail && /* @__PURE__ */ jsx9(
1348
+ Box,
1349
+ {
1350
+ flex: 1,
1351
+ marginLeft: size === "sm" ? 8 : 12,
1352
+ alignItems: "center",
1353
+ justifyContent: "center",
1354
+ children: /* @__PURE__ */ jsx9(Divider, { color: theme.colors.border.secondary })
1355
+ }
1356
+ )
1357
+ ]
1358
+ }
1359
+ ),
1360
+ description && /* @__PURE__ */ jsx9(Box, { children: typeof description === "string" || typeof description === "number" ? /* @__PURE__ */ jsx9(
1361
+ Text,
1362
+ {
1363
+ className: `step-description-${stepClassName}`,
1364
+ color: descriptionStyles.color,
1365
+ fontSize: descriptionStyles.fontSize,
1366
+ fontWeight: descriptionStyles.fontWeight,
1367
+ lineHeight: descriptionStyles.lineHeight,
1368
+ children: description
1369
+ }
1370
+ ) : description })
1371
+ ] })
1372
+ ]
1373
+ }
1374
+ );
1375
+ }
1376
+ if (variantUI === "current" && direction === "vertical") {
1377
+ return /* @__PURE__ */ jsxs(
1378
+ Box,
1379
+ {
1380
+ role: isWeb() ? "button" : void 0,
1381
+ "aria-label": isWeb() ? stepAriaLabel : void 0,
1382
+ "aria-current": isWeb() && isCurrent ? "step" : void 0,
1383
+ "aria-disabled": isWeb() && (disabled || noClick) ? true : void 0,
1384
+ tabIndex: isWeb() && isInteractive ? 0 : void 0,
1385
+ onPress: stepClick,
1386
+ onKeyDown: isWeb() && isInteractive ? handleKeyDown : void 0,
1387
+ onKeyUp: isWeb() && isInteractive ? handleKeyUp : void 0,
1388
+ disabled,
1389
+ "data-testid": "step",
1390
+ className: stepClassName,
1391
+ flexDirection: "row",
1392
+ alignItems: "flex-start",
1393
+ position: "relative",
1394
+ ...stepWrapperStyles,
1395
+ ...isWeb() && {
1396
+ cursor: disabled || noClick ? "default" : "pointer"
1397
+ },
1398
+ children: [
1399
+ /* @__PURE__ */ jsx9(
1400
+ StepTail,
1401
+ {
1402
+ variantUI,
1403
+ direction,
1404
+ size,
1405
+ state,
1406
+ isLast,
1407
+ isFirstColoredTail,
1408
+ isLastColoredTail,
1409
+ palette
1410
+ }
1411
+ ),
1412
+ /* @__PURE__ */ jsxs(
1413
+ Box,
1414
+ {
1415
+ flexDirection: "column",
1416
+ alignItems: "flex-start",
1417
+ justifyContent: "flex-start",
1418
+ gap: 12,
1419
+ paddingTop: size === "sm" ? 20 : 24,
1420
+ paddingBottom: size === "sm" ? 20 : 24,
1421
+ flex: 1,
1422
+ children: [
1423
+ /* @__PURE__ */ jsx9(Box, { flexDirection: "column", alignItems: "flex-start", children: /* @__PURE__ */ jsx9(
1424
+ StepState,
1425
+ {
1426
+ state,
1427
+ size,
1428
+ step: stepNumber + 1,
1429
+ variantUI,
1430
+ disabled,
1431
+ noClick,
1432
+ palette,
1433
+ theme,
1434
+ mode,
1435
+ sizeStyles,
1436
+ className: `step-icon-${stepClassName}`,
1437
+ isLast
1438
+ }
1439
+ ) }),
1440
+ /* @__PURE__ */ jsxs(
1441
+ Box,
1442
+ {
1443
+ flexDirection: "column",
1444
+ alignItems: "flex-start",
1445
+ justifyContent: "flex-start",
1446
+ gap: 4,
1447
+ width: "100%",
1448
+ children: [
1449
+ typeof title === "string" ? /* @__PURE__ */ jsx9(
1450
+ Text,
1451
+ {
1452
+ className: `step-title-${stepClassName}`,
1453
+ color: titleStyles.color,
1454
+ fontSize: titleStyles.fontSize,
1455
+ fontWeight: titleStyles.fontWeight,
1456
+ lineHeight: titleStyles.lineHeight,
1457
+ children: title
1458
+ }
1459
+ ) : title,
1460
+ description && /* @__PURE__ */ jsx9(Box, { children: typeof description === "string" || typeof description === "number" ? /* @__PURE__ */ jsx9(
1461
+ Text,
1462
+ {
1463
+ className: `step-description-${stepClassName}`,
1464
+ color: descriptionStyles.color,
1465
+ fontSize: descriptionStyles.fontSize,
1466
+ fontWeight: descriptionStyles.fontWeight,
1467
+ lineHeight: descriptionStyles.lineHeight,
1468
+ children: description
1469
+ }
1470
+ ) : description })
1471
+ ]
1472
+ }
1473
+ )
1474
+ ]
1475
+ }
1476
+ )
1477
+ ]
1478
+ }
1479
+ );
1480
+ }
1481
+ return /* @__PURE__ */ jsxs(
1482
+ Box,
1483
+ {
1484
+ role: isWeb() ? "button" : void 0,
1485
+ "aria-label": isWeb() ? stepAriaLabel : void 0,
1486
+ "aria-current": isWeb() && isCurrent ? "step" : void 0,
1487
+ "aria-disabled": isWeb() && (disabled || noClick) ? true : void 0,
1488
+ tabIndex: isWeb() && isInteractive ? 0 : void 0,
1489
+ onPress: stepClick,
1490
+ onKeyDown: isWeb() && isInteractive ? handleKeyDown : void 0,
1491
+ onKeyUp: isWeb() && isInteractive ? handleKeyUp : void 0,
1492
+ disabled,
1493
+ "data-testid": "step",
1494
+ className: stepClassName,
1495
+ flexDirection: "row",
1496
+ alignItems: "flex-start",
1497
+ ...stepWrapperStyles,
1498
+ ...isWeb() && { cursor: disabled || noClick ? "default" : "pointer" },
1499
+ children: [
1500
+ /* @__PURE__ */ jsxs(Box, { flexDirection: "column", alignItems: "center", flexShrink: 0, children: [
1501
+ /* @__PURE__ */ jsx9(
1502
+ StepState,
1503
+ {
1504
+ state,
1505
+ size,
1506
+ step: stepNumber + 1,
1507
+ variantUI,
1508
+ disabled,
1509
+ noClick,
1510
+ palette,
1511
+ theme,
1512
+ mode,
1513
+ sizeStyles
1514
+ }
1515
+ ),
1516
+ tail && !isLast && /* @__PURE__ */ jsx9(
1517
+ Box,
1518
+ {
1519
+ width: 1,
1520
+ flex: 1,
1521
+ minHeight: 24,
1522
+ marginTop: 8,
1523
+ alignItems: "stretch",
1524
+ justifyContent: "flex-start",
1525
+ position: "relative",
1526
+ backgroundColor: theme.colors.border.secondary
1527
+ }
1528
+ )
1529
+ ] }),
1530
+ /* @__PURE__ */ jsxs(Box, { ...contentWrapperStyles, flex: 1, children: [
1531
+ typeof title === "string" ? /* @__PURE__ */ jsx9(
1532
+ Text,
1533
+ {
1534
+ color: titleStyles.color,
1535
+ fontSize: titleStyles.fontSize,
1536
+ fontWeight: titleStyles.fontWeight,
1537
+ lineHeight: titleStyles.lineHeight,
1538
+ children: title
1539
+ }
1540
+ ) : title,
1541
+ description && /* @__PURE__ */ jsx9(Box, { marginTop: descriptionStyles.marginTop, children: typeof description === "string" || typeof description === "number" ? /* @__PURE__ */ jsx9(
1542
+ Text,
1543
+ {
1544
+ color: descriptionStyles.color,
1545
+ fontSize: descriptionStyles.fontSize,
1546
+ fontWeight: descriptionStyles.fontWeight,
1547
+ lineHeight: descriptionStyles.lineHeight,
1548
+ children: description
1549
+ }
1550
+ ) : description })
1551
+ ] })
1552
+ ]
1553
+ }
1554
+ );
1555
+ };
1556
+
1557
+ // src/Stepper.tsx
1558
+ import { jsx as jsx10 } from "react/jsx-runtime";
1559
+ import { createElement } from "react";
1560
+ var Stepper = forwardRef3(
1561
+ ({
1562
+ direction = "horizontal",
1563
+ variantUI = "current",
1564
+ size = "md",
1565
+ steps,
1566
+ tail = false,
1567
+ onClick,
1568
+ className,
1569
+ customClass,
1570
+ palette = "brand",
1571
+ "aria-label": ariaLabel,
1572
+ ...rest
1573
+ }, ref) => {
1574
+ const { theme } = useDesignSystem3();
1575
+ const isHorizontal = direction === "horizontal";
1576
+ const isCurrentVariant = variantUI === "current";
1577
+ const tailSize = size === "sm" ? 3 : 5;
1578
+ const tailOffset = tailSize / 2;
1579
+ const defaultAriaLabel = `Stepper with ${steps.length} step${steps.length !== 1 ? "s" : ""}`;
1580
+ const stepperAriaLabel = ariaLabel || defaultAriaLabel;
1581
+ return /* @__PURE__ */ jsx10(
1582
+ Box,
1583
+ {
1584
+ ref,
1585
+ role: "navigation",
1586
+ "aria-label": stepperAriaLabel,
1587
+ flexDirection: isHorizontal ? "row" : "column",
1588
+ justifyContent: isHorizontal ? "flex-start" : void 0,
1589
+ width: "100%",
1590
+ height: "auto",
1591
+ overflowX: isHorizontal ? "auto" : void 0,
1592
+ overflowY: isHorizontal ? "hidden" : void 0,
1593
+ paddingBottom: isHorizontal && isCurrentVariant ? tailOffset : void 0,
1594
+ borderBottomWidth: isHorizontal && isCurrentVariant ? 1 : 0,
1595
+ borderBottomColor: isHorizontal && isCurrentVariant ? theme.colors.border.secondary : void 0,
1596
+ borderLeftWidth: !isHorizontal && isCurrentVariant ? 1 : 0,
1597
+ borderLeftColor: !isHorizontal && isCurrentVariant ? theme.colors.border.secondary : void 0,
1598
+ className: [className, customClass].filter(Boolean).join(" "),
1599
+ ...rest,
1600
+ children: (() => {
1601
+ const coloredTailStates = [
1602
+ "current",
1603
+ "loading",
1604
+ "alert",
1605
+ "warning"
1606
+ ];
1607
+ let firstColoredTailIndex = -1;
1608
+ let lastColoredTailIndex = -1;
1609
+ steps.forEach((step, index) => {
1610
+ if (step.state && coloredTailStates.includes(step.state) && index < steps.length - 1) {
1611
+ if (firstColoredTailIndex === -1) {
1612
+ firstColoredTailIndex = index;
1613
+ }
1614
+ lastColoredTailIndex = index;
1615
+ }
1616
+ });
1617
+ return steps.map((step, index) => {
1618
+ const isLast = index === steps.length - 1;
1619
+ const isFirstColoredTail = index === firstColoredTailIndex;
1620
+ const isLastColoredTail = index === lastColoredTailIndex;
1621
+ return /* @__PURE__ */ createElement(
1622
+ Step,
1623
+ {
1624
+ size,
1625
+ ...step,
1626
+ key: step.key || `stepper-${index}`,
1627
+ onClick,
1628
+ stepNumber: index,
1629
+ tail: tail && variantUI === "simple" && !isLast,
1630
+ direction,
1631
+ variantUI,
1632
+ palette,
1633
+ isLast,
1634
+ isFirstColoredTail,
1635
+ isLastColoredTail
1636
+ }
1637
+ );
1638
+ });
1639
+ })()
1640
+ }
1641
+ );
1642
+ }
1643
+ );
1644
+ Stepper.displayName = "Stepper";
1645
+
1646
+ // src/ProgressStep.tsx
1647
+ import { useDesignSystem as useDesignSystem5 } from "@xsolla/xui-core";
1648
+ import { ArrowLeft, ArrowRight } from "@xsolla/xui-icons";
1649
+
1650
+ // src/ProgressStepItem.tsx
1651
+ import { useDesignSystem as useDesignSystem4 } from "@xsolla/xui-core";
1652
+ import { jsx as jsx11 } from "react/jsx-runtime";
1653
+ var ProgressStepItem = ({
1654
+ state = "default",
1655
+ size = "md",
1656
+ className,
1657
+ onPress,
1658
+ onMouseEnter,
1659
+ onMouseLeave
1660
+ }) => {
1661
+ const { theme } = useDesignSystem4();
1662
+ const isActive = state === "active";
1663
+ const isHover = state === "hover";
1664
+ const isMD = size === "md";
1665
+ const width = isActive ? isMD ? 24 : 18 : isMD ? 8 : 6;
1666
+ const height = isMD ? 8 : 6;
1667
+ const borderRadius = isMD ? 2 : 1;
1668
+ let backgroundColor = theme.colors.content.primary;
1669
+ let opacity = 1;
1670
+ if (!isActive) {
1671
+ backgroundColor = theme.colors.content.tertiary || "rgba(0, 0, 0, 0.6)";
1672
+ opacity = isHover ? 0.5 : 0.2;
1673
+ }
1674
+ return /* @__PURE__ */ jsx11(
1675
+ Box,
1676
+ {
1677
+ className,
1678
+ width,
1679
+ height,
1680
+ borderRadius,
1681
+ backgroundColor,
1682
+ opacity,
1683
+ onPress,
1684
+ onMouseEnter,
1685
+ onMouseLeave,
1686
+ cursor: onPress ? "pointer" : "default"
1687
+ }
1688
+ );
1689
+ };
1690
+
1691
+ // src/ProgressStep.tsx
1692
+ import { jsx as jsx12, jsxs as jsxs2 } from "react/jsx-runtime";
1693
+ var ProgressStep = ({
1694
+ count,
1695
+ activeStep,
1696
+ size = "md",
1697
+ arrows = true,
1698
+ onStepPress,
1699
+ className
1700
+ }) => {
1701
+ const { theme } = useDesignSystem5();
1702
+ const handlePrev = () => {
1703
+ if (activeStep > 0 && onStepPress) {
1704
+ onStepPress(activeStep - 1);
1705
+ }
1706
+ };
1707
+ const handleNext = () => {
1708
+ if (activeStep < count - 1 && onStepPress) {
1709
+ onStepPress(activeStep + 1);
1710
+ }
1711
+ };
1712
+ const arrowSize = size === "md" ? 24 : 18;
1713
+ const iconSize = size === "md" ? 18 : 14;
1714
+ const isFirst = activeStep <= 0;
1715
+ const isLast = activeStep >= count - 1;
1716
+ return /* @__PURE__ */ jsxs2(
1717
+ Box,
1718
+ {
1719
+ className,
1720
+ flexDirection: "row",
1721
+ alignItems: "center",
1722
+ justifyContent: "center",
1723
+ gap: 4,
1724
+ height: size === "md" ? 24 : 18,
1725
+ children: [
1726
+ arrows && /* @__PURE__ */ jsx12(
1727
+ Box,
1728
+ {
1729
+ onPress: handlePrev,
1730
+ width: arrowSize,
1731
+ height: arrowSize,
1732
+ alignItems: "center",
1733
+ justifyContent: "center",
1734
+ borderRadius: 4,
1735
+ opacity: isFirst ? 0.2 : 1,
1736
+ cursor: isFirst ? "default" : "pointer",
1737
+ children: /* @__PURE__ */ jsx12(ArrowLeft, { size: iconSize, color: theme.colors.content.primary })
1738
+ }
1739
+ ),
1740
+ /* @__PURE__ */ jsx12(Box, { flexDirection: "row", alignItems: "center", gap: 4, children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsx12(
1741
+ ProgressStepItem,
1742
+ {
1743
+ size,
1744
+ state: i === activeStep ? "active" : "default",
1745
+ onPress: onStepPress ? () => onStepPress(i) : void 0
1746
+ },
1747
+ i
1748
+ )) }),
1749
+ arrows && /* @__PURE__ */ jsx12(
1750
+ Box,
1751
+ {
1752
+ onPress: handleNext,
1753
+ width: arrowSize,
1754
+ height: arrowSize,
1755
+ alignItems: "center",
1756
+ justifyContent: "center",
1757
+ borderRadius: 4,
1758
+ opacity: isLast ? 0.2 : 1,
1759
+ cursor: isLast ? "default" : "pointer",
1760
+ children: /* @__PURE__ */ jsx12(ArrowRight, { size: iconSize, color: theme.colors.content.primary })
1761
+ }
1762
+ )
1763
+ ]
1764
+ }
1765
+ );
1766
+ };
1767
+ export {
1768
+ ProgressStep,
1769
+ ProgressStepItem,
1770
+ Step,
1771
+ Stepper
1772
+ };
1773
+ //# sourceMappingURL=index.mjs.map