@xsolla/xui-stepper-native 0.64.0-pr56.1768348754

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