@xsolla/xui-button 0.89.0 → 0.90.0
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/native/index.js +50 -263
- package/native/index.js.map +1 -1
- package/native/index.mjs +37 -250
- package/native/index.mjs.map +1 -1
- package/package.json +5 -4
- package/web/index.js +50 -212
- package/web/index.js.map +1 -1
- package/web/index.mjs +37 -199
- package/web/index.mjs.map +1 -1
package/native/index.js
CHANGED
|
@@ -38,7 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(index_exports);
|
|
39
39
|
|
|
40
40
|
// src/Button.tsx
|
|
41
|
-
var
|
|
41
|
+
var import_react2 = __toESM(require("react"));
|
|
42
42
|
|
|
43
43
|
// ../primitives-native/src/Box.tsx
|
|
44
44
|
var import_react_native = require("react-native");
|
|
@@ -320,227 +320,14 @@ var Divider = ({
|
|
|
320
320
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native5.View, { style });
|
|
321
321
|
};
|
|
322
322
|
|
|
323
|
-
// ../primitives-native/src/Input.tsx
|
|
324
|
-
var import_react2 = require("react");
|
|
325
|
-
var import_react_native6 = require("react-native");
|
|
326
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
327
|
-
var keyboardTypeMap = {
|
|
328
|
-
text: "default",
|
|
329
|
-
number: "numeric",
|
|
330
|
-
email: "email-address",
|
|
331
|
-
tel: "phone-pad",
|
|
332
|
-
url: "url",
|
|
333
|
-
decimal: "decimal-pad"
|
|
334
|
-
};
|
|
335
|
-
var inputModeToKeyboardType = {
|
|
336
|
-
none: "default",
|
|
337
|
-
text: "default",
|
|
338
|
-
decimal: "decimal-pad",
|
|
339
|
-
numeric: "number-pad",
|
|
340
|
-
tel: "phone-pad",
|
|
341
|
-
search: "default",
|
|
342
|
-
email: "email-address",
|
|
343
|
-
url: "url"
|
|
344
|
-
};
|
|
345
|
-
var autoCompleteToTextContentType = {
|
|
346
|
-
"one-time-code": "oneTimeCode",
|
|
347
|
-
email: "emailAddress",
|
|
348
|
-
username: "username",
|
|
349
|
-
password: "password",
|
|
350
|
-
"new-password": "newPassword",
|
|
351
|
-
tel: "telephoneNumber",
|
|
352
|
-
"postal-code": "postalCode",
|
|
353
|
-
name: "name"
|
|
354
|
-
};
|
|
355
|
-
var InputPrimitive = (0, import_react2.forwardRef)(
|
|
356
|
-
({
|
|
357
|
-
value,
|
|
358
|
-
placeholder,
|
|
359
|
-
onChange,
|
|
360
|
-
onChangeText,
|
|
361
|
-
onFocus,
|
|
362
|
-
onBlur,
|
|
363
|
-
onKeyDown,
|
|
364
|
-
disabled,
|
|
365
|
-
secureTextEntry,
|
|
366
|
-
style,
|
|
367
|
-
color,
|
|
368
|
-
fontSize,
|
|
369
|
-
placeholderTextColor,
|
|
370
|
-
maxLength,
|
|
371
|
-
type,
|
|
372
|
-
inputMode,
|
|
373
|
-
autoComplete,
|
|
374
|
-
id,
|
|
375
|
-
"aria-describedby": ariaDescribedBy,
|
|
376
|
-
"aria-label": ariaLabel,
|
|
377
|
-
"aria-disabled": ariaDisabled,
|
|
378
|
-
"data-testid": dataTestId
|
|
379
|
-
}, ref) => {
|
|
380
|
-
const handleChangeText = (text) => {
|
|
381
|
-
onChangeText?.(text);
|
|
382
|
-
if (onChange) {
|
|
383
|
-
const syntheticEvent = {
|
|
384
|
-
target: { value: text },
|
|
385
|
-
currentTarget: { value: text },
|
|
386
|
-
type: "change",
|
|
387
|
-
nativeEvent: { text },
|
|
388
|
-
preventDefault: () => {
|
|
389
|
-
},
|
|
390
|
-
stopPropagation: () => {
|
|
391
|
-
},
|
|
392
|
-
isTrusted: false
|
|
393
|
-
};
|
|
394
|
-
onChange(syntheticEvent);
|
|
395
|
-
}
|
|
396
|
-
};
|
|
397
|
-
const keyboardType = inputMode ? inputModeToKeyboardType[inputMode] || "default" : type ? keyboardTypeMap[type] || "default" : "default";
|
|
398
|
-
const textContentType = autoComplete ? autoCompleteToTextContentType[autoComplete] : void 0;
|
|
399
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
400
|
-
import_react_native6.TextInput,
|
|
401
|
-
{
|
|
402
|
-
ref,
|
|
403
|
-
value,
|
|
404
|
-
placeholder,
|
|
405
|
-
onChangeText: handleChangeText,
|
|
406
|
-
onFocus,
|
|
407
|
-
onBlur,
|
|
408
|
-
onKeyPress: (e) => {
|
|
409
|
-
if (onKeyDown) {
|
|
410
|
-
onKeyDown({
|
|
411
|
-
key: e.nativeEvent.key,
|
|
412
|
-
preventDefault: () => {
|
|
413
|
-
}
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
},
|
|
417
|
-
editable: !disabled,
|
|
418
|
-
secureTextEntry: secureTextEntry || type === "password",
|
|
419
|
-
keyboardType,
|
|
420
|
-
textContentType,
|
|
421
|
-
style: [
|
|
422
|
-
{
|
|
423
|
-
color,
|
|
424
|
-
fontSize: typeof fontSize === "number" ? fontSize : void 0,
|
|
425
|
-
flex: 1,
|
|
426
|
-
padding: 0,
|
|
427
|
-
textAlign: style?.textAlign || "left"
|
|
428
|
-
},
|
|
429
|
-
style
|
|
430
|
-
],
|
|
431
|
-
placeholderTextColor,
|
|
432
|
-
maxLength,
|
|
433
|
-
testID: dataTestId || id,
|
|
434
|
-
accessibilityLabel: ariaLabel,
|
|
435
|
-
accessibilityHint: ariaDescribedBy,
|
|
436
|
-
accessibilityState: {
|
|
437
|
-
disabled: disabled || ariaDisabled
|
|
438
|
-
},
|
|
439
|
-
accessible: true
|
|
440
|
-
}
|
|
441
|
-
);
|
|
442
|
-
}
|
|
443
|
-
);
|
|
444
|
-
InputPrimitive.displayName = "InputPrimitive";
|
|
445
|
-
|
|
446
|
-
// ../primitives-native/src/TextArea.tsx
|
|
447
|
-
var import_react3 = require("react");
|
|
448
|
-
var import_react_native7 = require("react-native");
|
|
449
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
450
|
-
var TextAreaPrimitive = (0, import_react3.forwardRef)(
|
|
451
|
-
({
|
|
452
|
-
value,
|
|
453
|
-
placeholder,
|
|
454
|
-
onChange,
|
|
455
|
-
onChangeText,
|
|
456
|
-
onFocus,
|
|
457
|
-
onBlur,
|
|
458
|
-
onKeyDown,
|
|
459
|
-
disabled,
|
|
460
|
-
style,
|
|
461
|
-
color,
|
|
462
|
-
fontSize,
|
|
463
|
-
placeholderTextColor,
|
|
464
|
-
maxLength,
|
|
465
|
-
rows,
|
|
466
|
-
id,
|
|
467
|
-
"aria-describedby": ariaDescribedBy,
|
|
468
|
-
"aria-label": ariaLabel,
|
|
469
|
-
"aria-disabled": ariaDisabled,
|
|
470
|
-
"data-testid": dataTestId
|
|
471
|
-
}, ref) => {
|
|
472
|
-
const handleChangeText = (text) => {
|
|
473
|
-
onChangeText?.(text);
|
|
474
|
-
if (onChange) {
|
|
475
|
-
const syntheticEvent = {
|
|
476
|
-
target: { value: text },
|
|
477
|
-
currentTarget: { value: text },
|
|
478
|
-
type: "change",
|
|
479
|
-
nativeEvent: { text },
|
|
480
|
-
preventDefault: () => {
|
|
481
|
-
},
|
|
482
|
-
stopPropagation: () => {
|
|
483
|
-
},
|
|
484
|
-
isTrusted: false
|
|
485
|
-
};
|
|
486
|
-
onChange(syntheticEvent);
|
|
487
|
-
}
|
|
488
|
-
};
|
|
489
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
490
|
-
import_react_native7.TextInput,
|
|
491
|
-
{
|
|
492
|
-
ref,
|
|
493
|
-
value,
|
|
494
|
-
placeholder,
|
|
495
|
-
onChangeText: handleChangeText,
|
|
496
|
-
onFocus,
|
|
497
|
-
onBlur,
|
|
498
|
-
onKeyPress: (e) => {
|
|
499
|
-
if (onKeyDown) {
|
|
500
|
-
onKeyDown({
|
|
501
|
-
key: e.nativeEvent.key,
|
|
502
|
-
preventDefault: () => {
|
|
503
|
-
}
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
},
|
|
507
|
-
editable: !disabled,
|
|
508
|
-
multiline: true,
|
|
509
|
-
numberOfLines: rows || 4,
|
|
510
|
-
style: [
|
|
511
|
-
{
|
|
512
|
-
color,
|
|
513
|
-
fontSize: typeof fontSize === "number" ? fontSize : void 0,
|
|
514
|
-
flex: 1,
|
|
515
|
-
padding: 0,
|
|
516
|
-
textAlignVertical: "top",
|
|
517
|
-
textAlign: style?.textAlign || "left"
|
|
518
|
-
},
|
|
519
|
-
style
|
|
520
|
-
],
|
|
521
|
-
placeholderTextColor,
|
|
522
|
-
maxLength,
|
|
523
|
-
testID: dataTestId || id,
|
|
524
|
-
accessibilityLabel: ariaLabel,
|
|
525
|
-
accessibilityHint: ariaDescribedBy,
|
|
526
|
-
accessibilityState: {
|
|
527
|
-
disabled: disabled || ariaDisabled
|
|
528
|
-
},
|
|
529
|
-
accessible: true
|
|
530
|
-
}
|
|
531
|
-
);
|
|
532
|
-
}
|
|
533
|
-
);
|
|
534
|
-
TextAreaPrimitive.displayName = "TextAreaPrimitive";
|
|
535
|
-
|
|
536
323
|
// src/Button.tsx
|
|
537
324
|
var import_xui_core = require("@xsolla/xui-core");
|
|
538
|
-
var
|
|
325
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
539
326
|
var cloneIconWithDefaults = (icon, defaultSize, defaultColor) => {
|
|
540
|
-
if (!
|
|
327
|
+
if (!import_react2.default.isValidElement(icon)) return icon;
|
|
541
328
|
const iconElement = icon;
|
|
542
329
|
const existingProps = iconElement.props || {};
|
|
543
|
-
return
|
|
330
|
+
return import_react2.default.cloneElement(iconElement, {
|
|
544
331
|
...existingProps,
|
|
545
332
|
// Preserve existing props (including accessibility attributes)
|
|
546
333
|
size: existingProps.size ?? defaultSize,
|
|
@@ -574,7 +361,7 @@ var Button = ({
|
|
|
574
361
|
fullWidth = false
|
|
575
362
|
}) => {
|
|
576
363
|
const { theme } = (0, import_xui_core.useDesignSystem)();
|
|
577
|
-
const [isKeyboardPressed, setIsKeyboardPressed] = (0,
|
|
364
|
+
const [isKeyboardPressed, setIsKeyboardPressed] = (0, import_react2.useState)(false);
|
|
578
365
|
const isDisabled = disabled || loading;
|
|
579
366
|
const sizeStyles = theme.sizing.button(size);
|
|
580
367
|
const controlTone = theme?.colors?.control?.[tone];
|
|
@@ -625,7 +412,7 @@ var Button = ({
|
|
|
625
412
|
const hasIcon = Boolean(iconLeft || iconRight);
|
|
626
413
|
const showDivider = divider !== void 0 ? divider : hasIcon;
|
|
627
414
|
const computedAriaLabel = ariaLabel;
|
|
628
|
-
return /* @__PURE__ */ (0,
|
|
415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
629
416
|
Box,
|
|
630
417
|
{
|
|
631
418
|
as: "button",
|
|
@@ -670,7 +457,7 @@ var Button = ({
|
|
|
670
457
|
outlineStyle: "solid"
|
|
671
458
|
},
|
|
672
459
|
children: [
|
|
673
|
-
loading && /* @__PURE__ */ (0,
|
|
460
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
674
461
|
Box,
|
|
675
462
|
{
|
|
676
463
|
position: "absolute",
|
|
@@ -681,7 +468,7 @@ var Button = ({
|
|
|
681
468
|
alignItems: "center",
|
|
682
469
|
justifyContent: "center",
|
|
683
470
|
zIndex: 1,
|
|
684
|
-
children: /* @__PURE__ */ (0,
|
|
471
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
685
472
|
Spinner,
|
|
686
473
|
{
|
|
687
474
|
color: textColor,
|
|
@@ -691,7 +478,7 @@ var Button = ({
|
|
|
691
478
|
)
|
|
692
479
|
}
|
|
693
480
|
),
|
|
694
|
-
iconLeft && /* @__PURE__ */ (0,
|
|
481
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
695
482
|
Box,
|
|
696
483
|
{
|
|
697
484
|
height: "100%",
|
|
@@ -703,7 +490,7 @@ var Button = ({
|
|
|
703
490
|
pointerEvents: loading ? "none" : "auto"
|
|
704
491
|
},
|
|
705
492
|
children: [
|
|
706
|
-
/* @__PURE__ */ (0,
|
|
493
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
707
494
|
Box,
|
|
708
495
|
{
|
|
709
496
|
width: sizeStyles.iconContainerSize,
|
|
@@ -713,11 +500,11 @@ var Button = ({
|
|
|
713
500
|
children: cloneIconWithDefaults(iconLeft, sizeStyles.iconSize, textColor)
|
|
714
501
|
}
|
|
715
502
|
),
|
|
716
|
-
showDivider && /* @__PURE__ */ (0,
|
|
503
|
+
showDivider && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Divider, { vertical: true, color: dividerLineColor, height: "100%" })
|
|
717
504
|
]
|
|
718
505
|
}
|
|
719
506
|
),
|
|
720
|
-
/* @__PURE__ */ (0,
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
721
508
|
Box,
|
|
722
509
|
{
|
|
723
510
|
flex: fullWidth ? 1 : void 0,
|
|
@@ -733,13 +520,13 @@ var Button = ({
|
|
|
733
520
|
},
|
|
734
521
|
"aria-hidden": loading ? true : void 0,
|
|
735
522
|
children: [
|
|
736
|
-
labelIcon && /* @__PURE__ */ (0,
|
|
523
|
+
labelIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box, { "aria-hidden": true, children: cloneIconWithDefaults(
|
|
737
524
|
labelIcon,
|
|
738
525
|
sizeStyles.labelIconSize,
|
|
739
526
|
textColor
|
|
740
527
|
) }),
|
|
741
|
-
/* @__PURE__ */ (0,
|
|
742
|
-
sublabel && /* @__PURE__ */ (0,
|
|
528
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: textColor, fontSize: sizeStyles.fontSize, fontWeight: "500", children }),
|
|
529
|
+
sublabel && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
743
530
|
Text,
|
|
744
531
|
{
|
|
745
532
|
color: textColor,
|
|
@@ -749,11 +536,11 @@ var Button = ({
|
|
|
749
536
|
children: sublabel
|
|
750
537
|
}
|
|
751
538
|
),
|
|
752
|
-
customContent && /* @__PURE__ */ (0,
|
|
539
|
+
customContent && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box, { "aria-hidden": true, children: customContent })
|
|
753
540
|
]
|
|
754
541
|
}
|
|
755
542
|
),
|
|
756
|
-
iconRight && /* @__PURE__ */ (0,
|
|
543
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
757
544
|
Box,
|
|
758
545
|
{
|
|
759
546
|
height: "100%",
|
|
@@ -765,8 +552,8 @@ var Button = ({
|
|
|
765
552
|
pointerEvents: loading ? "none" : "auto"
|
|
766
553
|
},
|
|
767
554
|
children: [
|
|
768
|
-
showDivider && /* @__PURE__ */ (0,
|
|
769
|
-
/* @__PURE__ */ (0,
|
|
555
|
+
showDivider && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Divider, { vertical: true, color: dividerLineColor, height: "100%" }),
|
|
556
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
770
557
|
Box,
|
|
771
558
|
{
|
|
772
559
|
width: sizeStyles.iconContainerSize,
|
|
@@ -786,14 +573,14 @@ var Button = ({
|
|
|
786
573
|
Button.displayName = "Button";
|
|
787
574
|
|
|
788
575
|
// src/IconButton.tsx
|
|
789
|
-
var
|
|
576
|
+
var import_react3 = __toESM(require("react"));
|
|
790
577
|
var import_xui_core2 = require("@xsolla/xui-core");
|
|
791
|
-
var
|
|
578
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
792
579
|
var cloneIconWithDefaults2 = (icon, defaultSize, defaultColor) => {
|
|
793
|
-
if (!
|
|
580
|
+
if (!import_react3.default.isValidElement(icon)) return icon;
|
|
794
581
|
const iconElement = icon;
|
|
795
582
|
const existingProps = iconElement.props || {};
|
|
796
|
-
return
|
|
583
|
+
return import_react3.default.cloneElement(iconElement, {
|
|
797
584
|
...existingProps,
|
|
798
585
|
// Preserve existing props (including accessibility attributes)
|
|
799
586
|
size: existingProps.size ?? defaultSize,
|
|
@@ -819,7 +606,7 @@ var IconButton = ({
|
|
|
819
606
|
type = "button"
|
|
820
607
|
}) => {
|
|
821
608
|
const { theme } = (0, import_xui_core2.useDesignSystem)();
|
|
822
|
-
const [isKeyboardPressed, setIsKeyboardPressed] = (0,
|
|
609
|
+
const [isKeyboardPressed, setIsKeyboardPressed] = (0, import_react3.useState)(false);
|
|
823
610
|
const isDisabled = disabled || loading;
|
|
824
611
|
const sizeStyles = theme.sizing.button(size);
|
|
825
612
|
const controlTone = theme?.colors?.control?.[tone];
|
|
@@ -864,7 +651,7 @@ var IconButton = ({
|
|
|
864
651
|
}
|
|
865
652
|
const borderColor = disabled ? variantStyles.borderDisable || variantStyles.border : variantStyles.border;
|
|
866
653
|
const textColor = disabled ? variantStyles.text?.disable || variantStyles.text?.primary : variantStyles.text?.primary;
|
|
867
|
-
return /* @__PURE__ */ (0,
|
|
654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
868
655
|
Box,
|
|
869
656
|
{
|
|
870
657
|
as: "button",
|
|
@@ -909,7 +696,7 @@ var IconButton = ({
|
|
|
909
696
|
outlineStyle: "solid"
|
|
910
697
|
},
|
|
911
698
|
children: [
|
|
912
|
-
loading && /* @__PURE__ */ (0,
|
|
699
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
913
700
|
Box,
|
|
914
701
|
{
|
|
915
702
|
position: "absolute",
|
|
@@ -920,7 +707,7 @@ var IconButton = ({
|
|
|
920
707
|
alignItems: "center",
|
|
921
708
|
justifyContent: "center",
|
|
922
709
|
zIndex: 1,
|
|
923
|
-
children: /* @__PURE__ */ (0,
|
|
710
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
924
711
|
Spinner,
|
|
925
712
|
{
|
|
926
713
|
color: textColor,
|
|
@@ -930,7 +717,7 @@ var IconButton = ({
|
|
|
930
717
|
)
|
|
931
718
|
}
|
|
932
719
|
),
|
|
933
|
-
/* @__PURE__ */ (0,
|
|
720
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
934
721
|
Box,
|
|
935
722
|
{
|
|
936
723
|
"aria-hidden": true,
|
|
@@ -948,9 +735,9 @@ var IconButton = ({
|
|
|
948
735
|
IconButton.displayName = "IconButton";
|
|
949
736
|
|
|
950
737
|
// src/FlexButton.tsx
|
|
951
|
-
var
|
|
738
|
+
var import_react4 = require("react");
|
|
952
739
|
var import_xui_core3 = require("@xsolla/xui-core");
|
|
953
|
-
var
|
|
740
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
954
741
|
var ICON_SIZES = {
|
|
955
742
|
xs: 12,
|
|
956
743
|
sm: 14,
|
|
@@ -1010,9 +797,9 @@ var FlexButton = ({
|
|
|
1010
797
|
...buttonProps
|
|
1011
798
|
}) => {
|
|
1012
799
|
const { theme } = (0, import_xui_core3.useDesignSystem)();
|
|
1013
|
-
const [state, setState] = (0,
|
|
1014
|
-
const [isFocused, setIsFocused] = (0,
|
|
1015
|
-
const isMouseOverRef = (0,
|
|
800
|
+
const [state, setState] = (0, import_react4.useState)("default");
|
|
801
|
+
const [isFocused, setIsFocused] = (0, import_react4.useState)(false);
|
|
802
|
+
const isMouseOverRef = (0, import_react4.useRef)(false);
|
|
1016
803
|
const isDisabled = disabled || loading;
|
|
1017
804
|
const getVariantColors = (currentState) => {
|
|
1018
805
|
if (isDisabled) {
|
|
@@ -1245,7 +1032,7 @@ var FlexButton = ({
|
|
|
1245
1032
|
height: lineHeight
|
|
1246
1033
|
};
|
|
1247
1034
|
const computedAriaLabel = ariaLabel || (typeof children === "string" ? children : void 0);
|
|
1248
|
-
return /* @__PURE__ */ (0,
|
|
1035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1249
1036
|
"button",
|
|
1250
1037
|
{
|
|
1251
1038
|
...buttonProps,
|
|
@@ -1272,10 +1059,10 @@ var FlexButton = ({
|
|
|
1272
1059
|
tabIndex,
|
|
1273
1060
|
style: buttonStyle,
|
|
1274
1061
|
"data-testid": testID || "flex-button",
|
|
1275
|
-
children: /* @__PURE__ */ (0,
|
|
1276
|
-
iconLeft && /* @__PURE__ */ (0,
|
|
1277
|
-
/* @__PURE__ */ (0,
|
|
1278
|
-
iconRight && /* @__PURE__ */ (0,
|
|
1062
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: contentStyle, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: spinnerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Spinner, { size: spinnerSize, color: spinnerColor }) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1063
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { size: iconSize, color: colors.text, children: iconLeft }),
|
|
1064
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children }),
|
|
1065
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { size: iconSize, color: colors.text, children: iconRight })
|
|
1279
1066
|
] }) })
|
|
1280
1067
|
}
|
|
1281
1068
|
);
|
|
@@ -1283,9 +1070,9 @@ var FlexButton = ({
|
|
|
1283
1070
|
FlexButton.displayName = "FlexButton";
|
|
1284
1071
|
|
|
1285
1072
|
// src/ButtonGroup.tsx
|
|
1286
|
-
var
|
|
1073
|
+
var import_react5 = __toESM(require("react"));
|
|
1287
1074
|
var import_xui_core4 = require("@xsolla/xui-core");
|
|
1288
|
-
var
|
|
1075
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1289
1076
|
var ButtonGroup = ({
|
|
1290
1077
|
orientation = "horizontal",
|
|
1291
1078
|
size = "md",
|
|
@@ -1302,8 +1089,8 @@ var ButtonGroup = ({
|
|
|
1302
1089
|
const { theme } = (0, import_xui_core4.useDesignSystem)();
|
|
1303
1090
|
const flattenChildren = (children2) => {
|
|
1304
1091
|
const result = [];
|
|
1305
|
-
|
|
1306
|
-
if (
|
|
1092
|
+
import_react5.default.Children.forEach(children2, (child) => {
|
|
1093
|
+
if (import_react5.default.isValidElement(child) && child.type === import_react5.default.Fragment) {
|
|
1307
1094
|
result.push(...flattenChildren(child.props.children));
|
|
1308
1095
|
} else if (child !== null && child !== void 0) {
|
|
1309
1096
|
result.push(child);
|
|
@@ -1339,8 +1126,8 @@ var ButtonGroup = ({
|
|
|
1339
1126
|
const processChildren = (childrenToProcess) => {
|
|
1340
1127
|
if (orientation === "vertical") {
|
|
1341
1128
|
return childrenToProcess.map((child, index) => {
|
|
1342
|
-
if (
|
|
1343
|
-
return
|
|
1129
|
+
if (import_react5.default.isValidElement(child)) {
|
|
1130
|
+
return import_react5.default.cloneElement(child, {
|
|
1344
1131
|
...child.props,
|
|
1345
1132
|
fullWidth: true,
|
|
1346
1133
|
key: child.key ?? index
|
|
@@ -1356,9 +1143,9 @@ var ButtonGroup = ({
|
|
|
1356
1143
|
if (useSpaceBetween) {
|
|
1357
1144
|
const firstChild = processedChildren[0];
|
|
1358
1145
|
const restChildren = processedChildren.slice(1);
|
|
1359
|
-
return /* @__PURE__ */ (0,
|
|
1146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1360
1147
|
firstChild,
|
|
1361
|
-
/* @__PURE__ */ (0,
|
|
1148
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { flexDirection: "row", gap: computedGap, children: restChildren })
|
|
1362
1149
|
] });
|
|
1363
1150
|
}
|
|
1364
1151
|
if (orientation === "vertical") {
|
|
@@ -1366,8 +1153,8 @@ var ButtonGroup = ({
|
|
|
1366
1153
|
}
|
|
1367
1154
|
return children;
|
|
1368
1155
|
};
|
|
1369
|
-
return /* @__PURE__ */ (0,
|
|
1370
|
-
/* @__PURE__ */ (0,
|
|
1156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box, { flexDirection: "column", width: "100%", gap: 8, children: [
|
|
1157
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1371
1158
|
Box,
|
|
1372
1159
|
{
|
|
1373
1160
|
role: "group",
|
|
@@ -1384,7 +1171,7 @@ var ButtonGroup = ({
|
|
|
1384
1171
|
children: renderChildren()
|
|
1385
1172
|
}
|
|
1386
1173
|
),
|
|
1387
|
-
error && /* @__PURE__ */ (0,
|
|
1174
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { marginTop: 4, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1388
1175
|
Text,
|
|
1389
1176
|
{
|
|
1390
1177
|
id: errorId,
|
|
@@ -1397,7 +1184,7 @@ var ButtonGroup = ({
|
|
|
1397
1184
|
children: error
|
|
1398
1185
|
}
|
|
1399
1186
|
) }),
|
|
1400
|
-
description && /* @__PURE__ */ (0,
|
|
1187
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { marginTop: 4, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1401
1188
|
Text,
|
|
1402
1189
|
{
|
|
1403
1190
|
id: descriptionId,
|