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