@xsolla/xui-button 0.101.0 → 0.102.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.d.mts +0 -2
- package/native/index.d.ts +0 -2
- package/native/index.js +45 -92
- package/native/index.js.flow +0 -5
- package/native/index.js.map +1 -1
- package/native/index.mjs +40 -87
- package/native/index.mjs.map +1 -1
- package/package.json +4 -4
- package/web/index.d.mts +0 -2
- package/web/index.d.ts +0 -2
- package/web/index.js +45 -93
- package/web/index.js.flow +0 -5
- package/web/index.js.map +1 -1
- package/web/index.mjs +40 -88
- package/web/index.mjs.map +1 -1
package/native/index.d.mts
CHANGED
|
@@ -27,8 +27,6 @@ interface ButtonProps {
|
|
|
27
27
|
* To override, specify size/color on the icon: `iconRight={<ArrowRight size={16} />}`
|
|
28
28
|
*/
|
|
29
29
|
iconRight?: React.ReactNode;
|
|
30
|
-
/** Show/hide vertical divider between icon and content (default: true when icon present) */
|
|
31
|
-
divider?: boolean;
|
|
32
30
|
/** Secondary text displayed inline with the main label (e.g., price), shown with 40% opacity */
|
|
33
31
|
sublabel?: string;
|
|
34
32
|
/** Alignment of the label text */
|
package/native/index.d.ts
CHANGED
|
@@ -27,8 +27,6 @@ interface ButtonProps {
|
|
|
27
27
|
* To override, specify size/color on the icon: `iconRight={<ArrowRight size={16} />}`
|
|
28
28
|
*/
|
|
29
29
|
iconRight?: React.ReactNode;
|
|
30
|
-
/** Show/hide vertical divider between icon and content (default: true when icon present) */
|
|
31
|
-
divider?: boolean;
|
|
32
30
|
/** Secondary text displayed inline with the main label (e.g., price), shown with 40% opacity */
|
|
33
31
|
sublabel?: string;
|
|
34
32
|
/** Alignment of the label text */
|
package/native/index.js
CHANGED
|
@@ -296,33 +296,9 @@ var Icon = ({ children, color, size }) => {
|
|
|
296
296
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.View, { style, children: childrenWithProps });
|
|
297
297
|
};
|
|
298
298
|
|
|
299
|
-
// ../primitives-native/src/Divider.tsx
|
|
300
|
-
var import_react_native5 = require("react-native");
|
|
301
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
302
|
-
var Divider = ({
|
|
303
|
-
color,
|
|
304
|
-
height,
|
|
305
|
-
width,
|
|
306
|
-
vertical,
|
|
307
|
-
dashStroke
|
|
308
|
-
}) => {
|
|
309
|
-
const style = {
|
|
310
|
-
backgroundColor: dashStroke ? "transparent" : color || "rgba(255, 255, 255, 0.15)",
|
|
311
|
-
width: vertical ? typeof width === "number" ? width : 1 : "100%",
|
|
312
|
-
height: vertical ? "100%" : typeof height === "number" ? height : 1,
|
|
313
|
-
...dashStroke && {
|
|
314
|
-
borderStyle: "dashed",
|
|
315
|
-
borderColor: color || "rgba(255, 255, 255, 0.15)",
|
|
316
|
-
borderWidth: 0,
|
|
317
|
-
...vertical ? { borderLeftWidth: typeof width === "number" ? width : 1 } : { borderTopWidth: typeof height === "number" ? height : 1 }
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native5.View, { style });
|
|
321
|
-
};
|
|
322
|
-
|
|
323
299
|
// src/Button.tsx
|
|
324
300
|
var import_xui_core = require("@xsolla/xui-core");
|
|
325
|
-
var
|
|
301
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
326
302
|
var cloneIconWithDefaults = (icon, defaultSize, defaultColor) => {
|
|
327
303
|
if (!import_react2.default.isValidElement(icon)) return icon;
|
|
328
304
|
const iconElement = icon;
|
|
@@ -344,7 +320,6 @@ var Button = ({
|
|
|
344
320
|
onPress,
|
|
345
321
|
iconLeft,
|
|
346
322
|
iconRight,
|
|
347
|
-
divider,
|
|
348
323
|
sublabel,
|
|
349
324
|
labelAlignment = "center",
|
|
350
325
|
labelIcon,
|
|
@@ -373,8 +348,13 @@ var Button = ({
|
|
|
373
348
|
border: "transparent",
|
|
374
349
|
borderHover: "transparent",
|
|
375
350
|
borderPress: "transparent",
|
|
376
|
-
borderDisable: "transparent"
|
|
377
|
-
|
|
351
|
+
borderDisable: "transparent"
|
|
352
|
+
};
|
|
353
|
+
const textStyles = controlTone?.text || theme?.colors?.control?.brand?.text || {
|
|
354
|
+
primary: "#000",
|
|
355
|
+
secondary: "#fff",
|
|
356
|
+
tertiary: "#888",
|
|
357
|
+
disable: "#666"
|
|
378
358
|
};
|
|
379
359
|
const handlePress = () => {
|
|
380
360
|
if (!isDisabled && onPress) {
|
|
@@ -405,14 +385,9 @@ var Button = ({
|
|
|
405
385
|
backgroundColor = variantStyles.bgPress || variantStyles.bg;
|
|
406
386
|
}
|
|
407
387
|
const borderColor = disabled ? variantStyles.borderDisable || variantStyles.border : variantStyles.border;
|
|
408
|
-
const textColor = disabled ?
|
|
409
|
-
const textColorStr = typeof textColor === "string" ? textColor : "";
|
|
410
|
-
const isDarkText = textColorStr === "#000000" || textColorStr === "black" || textColorStr.startsWith("rgba(0, 0, 0");
|
|
411
|
-
const dividerLineColor = isDarkText ? "rgba(0, 0, 0, 0.2)" : "rgba(255, 255, 255, 0.2)";
|
|
412
|
-
const hasIcon = Boolean(iconLeft || iconRight);
|
|
413
|
-
const showDivider = divider !== void 0 ? divider : hasIcon;
|
|
388
|
+
const textColor = disabled ? textStyles.disable : textStyles[variant];
|
|
414
389
|
const computedAriaLabel = ariaLabel;
|
|
415
|
-
return /* @__PURE__ */ (0,
|
|
390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
416
391
|
Box,
|
|
417
392
|
{
|
|
418
393
|
as: "button",
|
|
@@ -457,7 +432,7 @@ var Button = ({
|
|
|
457
432
|
outlineStyle: "solid"
|
|
458
433
|
},
|
|
459
434
|
children: [
|
|
460
|
-
loading && /* @__PURE__ */ (0,
|
|
435
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
461
436
|
Box,
|
|
462
437
|
{
|
|
463
438
|
position: "absolute",
|
|
@@ -468,7 +443,7 @@ var Button = ({
|
|
|
468
443
|
alignItems: "center",
|
|
469
444
|
justifyContent: "center",
|
|
470
445
|
zIndex: 1,
|
|
471
|
-
children: /* @__PURE__ */ (0,
|
|
446
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
472
447
|
Spinner,
|
|
473
448
|
{
|
|
474
449
|
color: textColor,
|
|
@@ -478,33 +453,22 @@ var Button = ({
|
|
|
478
453
|
)
|
|
479
454
|
}
|
|
480
455
|
),
|
|
481
|
-
iconLeft && /* @__PURE__ */ (0,
|
|
456
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
482
457
|
Box,
|
|
483
458
|
{
|
|
484
|
-
|
|
485
|
-
|
|
459
|
+
width: sizeStyles.iconContainerSize,
|
|
460
|
+
height: sizeStyles.iconContainerSize,
|
|
486
461
|
alignItems: "center",
|
|
462
|
+
justifyContent: "center",
|
|
487
463
|
"aria-hidden": true,
|
|
488
464
|
style: {
|
|
489
465
|
opacity: loading ? 0 : 1,
|
|
490
466
|
pointerEvents: loading ? "none" : "auto"
|
|
491
467
|
},
|
|
492
|
-
children:
|
|
493
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
494
|
-
Box,
|
|
495
|
-
{
|
|
496
|
-
width: sizeStyles.iconContainerSize,
|
|
497
|
-
height: sizeStyles.iconContainerSize,
|
|
498
|
-
alignItems: "center",
|
|
499
|
-
justifyContent: "center",
|
|
500
|
-
children: cloneIconWithDefaults(iconLeft, sizeStyles.iconSize, textColor)
|
|
501
|
-
}
|
|
502
|
-
),
|
|
503
|
-
showDivider && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Divider, { vertical: true, color: dividerLineColor, height: "100%" })
|
|
504
|
-
]
|
|
468
|
+
children: cloneIconWithDefaults(iconLeft, sizeStyles.iconSize, textColor)
|
|
505
469
|
}
|
|
506
470
|
),
|
|
507
|
-
/* @__PURE__ */ (0,
|
|
471
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
508
472
|
Box,
|
|
509
473
|
{
|
|
510
474
|
flex: fullWidth ? 1 : void 0,
|
|
@@ -520,13 +484,13 @@ var Button = ({
|
|
|
520
484
|
},
|
|
521
485
|
"aria-hidden": loading ? true : void 0,
|
|
522
486
|
children: [
|
|
523
|
-
labelIcon && /* @__PURE__ */ (0,
|
|
487
|
+
labelIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box, { "aria-hidden": true, children: cloneIconWithDefaults(
|
|
524
488
|
labelIcon,
|
|
525
489
|
sizeStyles.labelIconSize,
|
|
526
490
|
textColor
|
|
527
491
|
) }),
|
|
528
|
-
/* @__PURE__ */ (0,
|
|
529
|
-
sublabel && /* @__PURE__ */ (0,
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: textColor, fontSize: sizeStyles.fontSize, fontWeight: "500", children }),
|
|
493
|
+
sublabel && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
530
494
|
Text,
|
|
531
495
|
{
|
|
532
496
|
color: textColor,
|
|
@@ -536,34 +500,23 @@ var Button = ({
|
|
|
536
500
|
children: sublabel
|
|
537
501
|
}
|
|
538
502
|
),
|
|
539
|
-
customContent && /* @__PURE__ */ (0,
|
|
503
|
+
customContent && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box, { "aria-hidden": true, children: customContent })
|
|
540
504
|
]
|
|
541
505
|
}
|
|
542
506
|
),
|
|
543
|
-
iconRight && /* @__PURE__ */ (0,
|
|
507
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
544
508
|
Box,
|
|
545
509
|
{
|
|
546
|
-
|
|
547
|
-
|
|
510
|
+
width: sizeStyles.iconContainerSize,
|
|
511
|
+
height: sizeStyles.iconContainerSize,
|
|
548
512
|
alignItems: "center",
|
|
513
|
+
justifyContent: "center",
|
|
549
514
|
"aria-hidden": true,
|
|
550
515
|
style: {
|
|
551
516
|
opacity: loading ? 0 : 1,
|
|
552
517
|
pointerEvents: loading ? "none" : "auto"
|
|
553
518
|
},
|
|
554
|
-
children:
|
|
555
|
-
showDivider && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Divider, { vertical: true, color: dividerLineColor, height: "100%" }),
|
|
556
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
557
|
-
Box,
|
|
558
|
-
{
|
|
559
|
-
width: sizeStyles.iconContainerSize,
|
|
560
|
-
height: sizeStyles.iconContainerSize,
|
|
561
|
-
alignItems: "center",
|
|
562
|
-
justifyContent: "center",
|
|
563
|
-
children: cloneIconWithDefaults(iconRight, sizeStyles.iconSize, textColor)
|
|
564
|
-
}
|
|
565
|
-
)
|
|
566
|
-
]
|
|
519
|
+
children: cloneIconWithDefaults(iconRight, sizeStyles.iconSize, textColor)
|
|
567
520
|
}
|
|
568
521
|
)
|
|
569
522
|
]
|
|
@@ -575,7 +528,7 @@ Button.displayName = "Button";
|
|
|
575
528
|
// src/IconButton.tsx
|
|
576
529
|
var import_react3 = __toESM(require("react"));
|
|
577
530
|
var import_xui_core2 = require("@xsolla/xui-core");
|
|
578
|
-
var
|
|
531
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
579
532
|
var cloneIconWithDefaults2 = (icon, defaultSize, defaultColor) => {
|
|
580
533
|
if (!import_react3.default.isValidElement(icon)) return icon;
|
|
581
534
|
const iconElement = icon;
|
|
@@ -651,7 +604,7 @@ var IconButton = ({
|
|
|
651
604
|
}
|
|
652
605
|
const borderColor = disabled ? variantStyles.borderDisable || variantStyles.border : variantStyles.border;
|
|
653
606
|
const textColor = disabled ? variantStyles.text?.disable || variantStyles.text?.primary : variantStyles.text?.primary;
|
|
654
|
-
return /* @__PURE__ */ (0,
|
|
607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
655
608
|
Box,
|
|
656
609
|
{
|
|
657
610
|
as: "button",
|
|
@@ -696,7 +649,7 @@ var IconButton = ({
|
|
|
696
649
|
outlineStyle: "solid"
|
|
697
650
|
},
|
|
698
651
|
children: [
|
|
699
|
-
loading && /* @__PURE__ */ (0,
|
|
652
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
700
653
|
Box,
|
|
701
654
|
{
|
|
702
655
|
position: "absolute",
|
|
@@ -707,7 +660,7 @@ var IconButton = ({
|
|
|
707
660
|
alignItems: "center",
|
|
708
661
|
justifyContent: "center",
|
|
709
662
|
zIndex: 1,
|
|
710
|
-
children: /* @__PURE__ */ (0,
|
|
663
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
711
664
|
Spinner,
|
|
712
665
|
{
|
|
713
666
|
color: textColor,
|
|
@@ -717,7 +670,7 @@ var IconButton = ({
|
|
|
717
670
|
)
|
|
718
671
|
}
|
|
719
672
|
),
|
|
720
|
-
/* @__PURE__ */ (0,
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
721
674
|
Box,
|
|
722
675
|
{
|
|
723
676
|
"aria-hidden": true,
|
|
@@ -737,7 +690,7 @@ IconButton.displayName = "IconButton";
|
|
|
737
690
|
// src/FlexButton.tsx
|
|
738
691
|
var import_react4 = require("react");
|
|
739
692
|
var import_xui_core3 = require("@xsolla/xui-core");
|
|
740
|
-
var
|
|
693
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
741
694
|
var ICON_SIZES = {
|
|
742
695
|
xs: 12,
|
|
743
696
|
sm: 14,
|
|
@@ -1032,7 +985,7 @@ var FlexButton = ({
|
|
|
1032
985
|
height: lineHeight
|
|
1033
986
|
};
|
|
1034
987
|
const computedAriaLabel = ariaLabel || (typeof children === "string" ? children : void 0);
|
|
1035
|
-
return /* @__PURE__ */ (0,
|
|
988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1036
989
|
"button",
|
|
1037
990
|
{
|
|
1038
991
|
...buttonProps,
|
|
@@ -1059,10 +1012,10 @@ var FlexButton = ({
|
|
|
1059
1012
|
tabIndex,
|
|
1060
1013
|
style: buttonStyle,
|
|
1061
1014
|
"data-testid": testID || "flex-button",
|
|
1062
|
-
children: /* @__PURE__ */ (0,
|
|
1063
|
-
iconLeft && /* @__PURE__ */ (0,
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1065
|
-
iconRight && /* @__PURE__ */ (0,
|
|
1015
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: contentStyle, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: spinnerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Spinner, { size: spinnerSize, color: spinnerColor }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1016
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: iconSize, color: colors.text, children: iconLeft }),
|
|
1017
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children }),
|
|
1018
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: iconSize, color: colors.text, children: iconRight })
|
|
1066
1019
|
] }) })
|
|
1067
1020
|
}
|
|
1068
1021
|
);
|
|
@@ -1072,7 +1025,7 @@ FlexButton.displayName = "FlexButton";
|
|
|
1072
1025
|
// src/ButtonGroup.tsx
|
|
1073
1026
|
var import_react5 = __toESM(require("react"));
|
|
1074
1027
|
var import_xui_core4 = require("@xsolla/xui-core");
|
|
1075
|
-
var
|
|
1028
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1076
1029
|
var ButtonGroup = ({
|
|
1077
1030
|
orientation = "horizontal",
|
|
1078
1031
|
size = "md",
|
|
@@ -1143,9 +1096,9 @@ var ButtonGroup = ({
|
|
|
1143
1096
|
if (useSpaceBetween) {
|
|
1144
1097
|
const firstChild = processedChildren[0];
|
|
1145
1098
|
const restChildren = processedChildren.slice(1);
|
|
1146
|
-
return /* @__PURE__ */ (0,
|
|
1099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1147
1100
|
firstChild,
|
|
1148
|
-
/* @__PURE__ */ (0,
|
|
1101
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { flexDirection: "row", gap: computedGap, children: restChildren })
|
|
1149
1102
|
] });
|
|
1150
1103
|
}
|
|
1151
1104
|
if (orientation === "vertical") {
|
|
@@ -1153,8 +1106,8 @@ var ButtonGroup = ({
|
|
|
1153
1106
|
}
|
|
1154
1107
|
return children;
|
|
1155
1108
|
};
|
|
1156
|
-
return /* @__PURE__ */ (0,
|
|
1157
|
-
/* @__PURE__ */ (0,
|
|
1109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box, { flexDirection: "column", width: "100%", gap: 8, children: [
|
|
1110
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1158
1111
|
Box,
|
|
1159
1112
|
{
|
|
1160
1113
|
role: "group",
|
|
@@ -1171,7 +1124,7 @@ var ButtonGroup = ({
|
|
|
1171
1124
|
children: renderChildren()
|
|
1172
1125
|
}
|
|
1173
1126
|
),
|
|
1174
|
-
error && /* @__PURE__ */ (0,
|
|
1127
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { marginTop: 4, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1175
1128
|
Text,
|
|
1176
1129
|
{
|
|
1177
1130
|
id: errorId,
|
|
@@ -1184,7 +1137,7 @@ var ButtonGroup = ({
|
|
|
1184
1137
|
children: error
|
|
1185
1138
|
}
|
|
1186
1139
|
) }),
|
|
1187
|
-
description && /* @__PURE__ */ (0,
|
|
1140
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { marginTop: 4, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1188
1141
|
Text,
|
|
1189
1142
|
{
|
|
1190
1143
|
id: descriptionId,
|
package/native/index.js.flow
CHANGED
|
@@ -56,11 +56,6 @@ declare interface ButtonProps {
|
|
|
56
56
|
*/
|
|
57
57
|
iconRight?: React.ReactNode;
|
|
58
58
|
|
|
59
|
-
/**
|
|
60
|
-
* Show/hide vertical divider between icon and content (default: true when icon present)
|
|
61
|
-
*/
|
|
62
|
-
divider?: boolean;
|
|
63
|
-
|
|
64
59
|
/**
|
|
65
60
|
* Secondary text displayed inline with the main label (e.g., price), shown with 40% opacity
|
|
66
61
|
*/
|