@xsolla/xui-button 0.100.0 → 0.101.0-pr167.1772008285
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/README.md +0 -6
- 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/web/index.mjs
CHANGED
|
@@ -268,34 +268,9 @@ var Icon = ({ children, ...props }) => {
|
|
|
268
268
|
return /* @__PURE__ */ jsx4(StyledIcon, { ...props, children });
|
|
269
269
|
};
|
|
270
270
|
|
|
271
|
-
// ../primitives-web/src/Divider.tsx
|
|
272
|
-
import styled5 from "styled-components";
|
|
273
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
274
|
-
var StyledDivider = styled5.div`
|
|
275
|
-
background-color: ${(props) => props.dashStroke ? "transparent" : props.color || "rgba(255, 255, 255, 0.15)"};
|
|
276
|
-
width: ${(props) => props.vertical ? typeof props.width === "number" ? `${props.width}px` : props.width || "1px" : "100%"};
|
|
277
|
-
height: ${(props) => props.vertical ? "100%" : typeof props.height === "number" ? `${props.height}px` : props.height || "1px"};
|
|
278
|
-
|
|
279
|
-
${(props) => props.dashStroke && `
|
|
280
|
-
border-style: dashed;
|
|
281
|
-
border-color: ${props.color || "rgba(255, 255, 255, 0.15)"};
|
|
282
|
-
border-width: 0;
|
|
283
|
-
${props.vertical ? `
|
|
284
|
-
border-left-width: ${typeof props.width === "number" ? `${props.width}px` : props.width || "1px"};
|
|
285
|
-
height: 100%;
|
|
286
|
-
` : `
|
|
287
|
-
border-top-width: ${typeof props.height === "number" ? `${props.height}px` : props.height || "1px"};
|
|
288
|
-
width: 100%;
|
|
289
|
-
`}
|
|
290
|
-
`}
|
|
291
|
-
`;
|
|
292
|
-
var Divider = (props) => {
|
|
293
|
-
return /* @__PURE__ */ jsx5(StyledDivider, { ...props });
|
|
294
|
-
};
|
|
295
|
-
|
|
296
271
|
// src/Button.tsx
|
|
297
272
|
import { useDesignSystem } from "@xsolla/xui-core";
|
|
298
|
-
import { jsx as
|
|
273
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
299
274
|
var cloneIconWithDefaults = (icon, defaultSize, defaultColor) => {
|
|
300
275
|
if (!React2.isValidElement(icon)) return icon;
|
|
301
276
|
const iconElement = icon;
|
|
@@ -317,7 +292,6 @@ var Button = ({
|
|
|
317
292
|
onPress,
|
|
318
293
|
iconLeft,
|
|
319
294
|
iconRight,
|
|
320
|
-
divider,
|
|
321
295
|
sublabel,
|
|
322
296
|
labelAlignment = "center",
|
|
323
297
|
labelIcon,
|
|
@@ -346,8 +320,13 @@ var Button = ({
|
|
|
346
320
|
border: "transparent",
|
|
347
321
|
borderHover: "transparent",
|
|
348
322
|
borderPress: "transparent",
|
|
349
|
-
borderDisable: "transparent"
|
|
350
|
-
|
|
323
|
+
borderDisable: "transparent"
|
|
324
|
+
};
|
|
325
|
+
const textStyles = controlTone?.text || theme?.colors?.control?.brand?.text || {
|
|
326
|
+
primary: "#000",
|
|
327
|
+
secondary: "#fff",
|
|
328
|
+
tertiary: "#888",
|
|
329
|
+
disable: "#666"
|
|
351
330
|
};
|
|
352
331
|
const handlePress = () => {
|
|
353
332
|
if (!isDisabled && onPress) {
|
|
@@ -378,12 +357,7 @@ var Button = ({
|
|
|
378
357
|
backgroundColor = variantStyles.bgPress || variantStyles.bg;
|
|
379
358
|
}
|
|
380
359
|
const borderColor = disabled ? variantStyles.borderDisable || variantStyles.border : variantStyles.border;
|
|
381
|
-
const textColor = disabled ?
|
|
382
|
-
const textColorStr = typeof textColor === "string" ? textColor : "";
|
|
383
|
-
const isDarkText = textColorStr === "#000000" || textColorStr === "black" || textColorStr.startsWith("rgba(0, 0, 0");
|
|
384
|
-
const dividerLineColor = isDarkText ? "rgba(0, 0, 0, 0.2)" : "rgba(255, 255, 255, 0.2)";
|
|
385
|
-
const hasIcon = Boolean(iconLeft || iconRight);
|
|
386
|
-
const showDivider = divider !== void 0 ? divider : hasIcon;
|
|
360
|
+
const textColor = disabled ? textStyles.disable : textStyles[variant];
|
|
387
361
|
const computedAriaLabel = ariaLabel;
|
|
388
362
|
return /* @__PURE__ */ jsxs(
|
|
389
363
|
Box,
|
|
@@ -430,7 +404,7 @@ var Button = ({
|
|
|
430
404
|
outlineStyle: "solid"
|
|
431
405
|
},
|
|
432
406
|
children: [
|
|
433
|
-
loading && /* @__PURE__ */
|
|
407
|
+
loading && /* @__PURE__ */ jsx5(
|
|
434
408
|
Box,
|
|
435
409
|
{
|
|
436
410
|
position: "absolute",
|
|
@@ -441,7 +415,7 @@ var Button = ({
|
|
|
441
415
|
alignItems: "center",
|
|
442
416
|
justifyContent: "center",
|
|
443
417
|
zIndex: 1,
|
|
444
|
-
children: /* @__PURE__ */
|
|
418
|
+
children: /* @__PURE__ */ jsx5(
|
|
445
419
|
Spinner,
|
|
446
420
|
{
|
|
447
421
|
color: textColor,
|
|
@@ -451,30 +425,19 @@ var Button = ({
|
|
|
451
425
|
)
|
|
452
426
|
}
|
|
453
427
|
),
|
|
454
|
-
iconLeft && /* @__PURE__ */
|
|
428
|
+
iconLeft && /* @__PURE__ */ jsx5(
|
|
455
429
|
Box,
|
|
456
430
|
{
|
|
457
|
-
|
|
458
|
-
|
|
431
|
+
width: sizeStyles.iconContainerSize,
|
|
432
|
+
height: sizeStyles.iconContainerSize,
|
|
459
433
|
alignItems: "center",
|
|
434
|
+
justifyContent: "center",
|
|
460
435
|
"aria-hidden": true,
|
|
461
436
|
style: {
|
|
462
437
|
opacity: loading ? 0 : 1,
|
|
463
438
|
pointerEvents: loading ? "none" : "auto"
|
|
464
439
|
},
|
|
465
|
-
children:
|
|
466
|
-
/* @__PURE__ */ jsx6(
|
|
467
|
-
Box,
|
|
468
|
-
{
|
|
469
|
-
width: sizeStyles.iconContainerSize,
|
|
470
|
-
height: sizeStyles.iconContainerSize,
|
|
471
|
-
alignItems: "center",
|
|
472
|
-
justifyContent: "center",
|
|
473
|
-
children: cloneIconWithDefaults(iconLeft, sizeStyles.iconSize, textColor)
|
|
474
|
-
}
|
|
475
|
-
),
|
|
476
|
-
showDivider && /* @__PURE__ */ jsx6(Divider, { vertical: true, color: dividerLineColor, height: "100%" })
|
|
477
|
-
]
|
|
440
|
+
children: cloneIconWithDefaults(iconLeft, sizeStyles.iconSize, textColor)
|
|
478
441
|
}
|
|
479
442
|
),
|
|
480
443
|
/* @__PURE__ */ jsxs(
|
|
@@ -493,13 +456,13 @@ var Button = ({
|
|
|
493
456
|
},
|
|
494
457
|
"aria-hidden": loading ? true : void 0,
|
|
495
458
|
children: [
|
|
496
|
-
labelIcon && /* @__PURE__ */
|
|
459
|
+
labelIcon && /* @__PURE__ */ jsx5(Box, { "aria-hidden": true, children: cloneIconWithDefaults(
|
|
497
460
|
labelIcon,
|
|
498
461
|
sizeStyles.labelIconSize,
|
|
499
462
|
textColor
|
|
500
463
|
) }),
|
|
501
|
-
/* @__PURE__ */
|
|
502
|
-
sublabel && /* @__PURE__ */
|
|
464
|
+
/* @__PURE__ */ jsx5(Text, { color: textColor, fontSize: sizeStyles.fontSize, fontWeight: "500", children }),
|
|
465
|
+
sublabel && /* @__PURE__ */ jsx5(
|
|
503
466
|
Text,
|
|
504
467
|
{
|
|
505
468
|
color: textColor,
|
|
@@ -509,34 +472,23 @@ var Button = ({
|
|
|
509
472
|
children: sublabel
|
|
510
473
|
}
|
|
511
474
|
),
|
|
512
|
-
customContent && /* @__PURE__ */
|
|
475
|
+
customContent && /* @__PURE__ */ jsx5(Box, { "aria-hidden": true, children: customContent })
|
|
513
476
|
]
|
|
514
477
|
}
|
|
515
478
|
),
|
|
516
|
-
iconRight && /* @__PURE__ */
|
|
479
|
+
iconRight && /* @__PURE__ */ jsx5(
|
|
517
480
|
Box,
|
|
518
481
|
{
|
|
519
|
-
|
|
520
|
-
|
|
482
|
+
width: sizeStyles.iconContainerSize,
|
|
483
|
+
height: sizeStyles.iconContainerSize,
|
|
521
484
|
alignItems: "center",
|
|
485
|
+
justifyContent: "center",
|
|
522
486
|
"aria-hidden": true,
|
|
523
487
|
style: {
|
|
524
488
|
opacity: loading ? 0 : 1,
|
|
525
489
|
pointerEvents: loading ? "none" : "auto"
|
|
526
490
|
},
|
|
527
|
-
children:
|
|
528
|
-
showDivider && /* @__PURE__ */ jsx6(Divider, { vertical: true, color: dividerLineColor, height: "100%" }),
|
|
529
|
-
/* @__PURE__ */ jsx6(
|
|
530
|
-
Box,
|
|
531
|
-
{
|
|
532
|
-
width: sizeStyles.iconContainerSize,
|
|
533
|
-
height: sizeStyles.iconContainerSize,
|
|
534
|
-
alignItems: "center",
|
|
535
|
-
justifyContent: "center",
|
|
536
|
-
children: cloneIconWithDefaults(iconRight, sizeStyles.iconSize, textColor)
|
|
537
|
-
}
|
|
538
|
-
)
|
|
539
|
-
]
|
|
491
|
+
children: cloneIconWithDefaults(iconRight, sizeStyles.iconSize, textColor)
|
|
540
492
|
}
|
|
541
493
|
)
|
|
542
494
|
]
|
|
@@ -548,7 +500,7 @@ Button.displayName = "Button";
|
|
|
548
500
|
// src/IconButton.tsx
|
|
549
501
|
import React3, { useState as useState2 } from "react";
|
|
550
502
|
import { useDesignSystem as useDesignSystem2 } from "@xsolla/xui-core";
|
|
551
|
-
import { jsx as
|
|
503
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
552
504
|
var cloneIconWithDefaults2 = (icon, defaultSize, defaultColor) => {
|
|
553
505
|
if (!React3.isValidElement(icon)) return icon;
|
|
554
506
|
const iconElement = icon;
|
|
@@ -669,7 +621,7 @@ var IconButton = ({
|
|
|
669
621
|
outlineStyle: "solid"
|
|
670
622
|
},
|
|
671
623
|
children: [
|
|
672
|
-
loading && /* @__PURE__ */
|
|
624
|
+
loading && /* @__PURE__ */ jsx6(
|
|
673
625
|
Box,
|
|
674
626
|
{
|
|
675
627
|
position: "absolute",
|
|
@@ -680,7 +632,7 @@ var IconButton = ({
|
|
|
680
632
|
alignItems: "center",
|
|
681
633
|
justifyContent: "center",
|
|
682
634
|
zIndex: 1,
|
|
683
|
-
children: /* @__PURE__ */
|
|
635
|
+
children: /* @__PURE__ */ jsx6(
|
|
684
636
|
Spinner,
|
|
685
637
|
{
|
|
686
638
|
color: textColor,
|
|
@@ -690,7 +642,7 @@ var IconButton = ({
|
|
|
690
642
|
)
|
|
691
643
|
}
|
|
692
644
|
),
|
|
693
|
-
/* @__PURE__ */
|
|
645
|
+
/* @__PURE__ */ jsx6(
|
|
694
646
|
Box,
|
|
695
647
|
{
|
|
696
648
|
"aria-hidden": true,
|
|
@@ -713,7 +665,7 @@ import {
|
|
|
713
665
|
useState as useState3
|
|
714
666
|
} from "react";
|
|
715
667
|
import { useDesignSystem as useDesignSystem3 } from "@xsolla/xui-core";
|
|
716
|
-
import { Fragment, jsx as
|
|
668
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
717
669
|
var ICON_SIZES = {
|
|
718
670
|
xs: 12,
|
|
719
671
|
sm: 14,
|
|
@@ -1008,7 +960,7 @@ var FlexButton = ({
|
|
|
1008
960
|
height: lineHeight
|
|
1009
961
|
};
|
|
1010
962
|
const computedAriaLabel = ariaLabel || (typeof children === "string" ? children : void 0);
|
|
1011
|
-
return /* @__PURE__ */
|
|
963
|
+
return /* @__PURE__ */ jsx7(
|
|
1012
964
|
"button",
|
|
1013
965
|
{
|
|
1014
966
|
...buttonProps,
|
|
@@ -1035,10 +987,10 @@ var FlexButton = ({
|
|
|
1035
987
|
tabIndex,
|
|
1036
988
|
style: buttonStyle,
|
|
1037
989
|
"data-testid": testID || "flex-button",
|
|
1038
|
-
children: /* @__PURE__ */
|
|
1039
|
-
iconLeft && /* @__PURE__ */
|
|
1040
|
-
/* @__PURE__ */
|
|
1041
|
-
iconRight && /* @__PURE__ */
|
|
990
|
+
children: /* @__PURE__ */ jsx7("span", { style: contentStyle, children: loading ? /* @__PURE__ */ jsx7("span", { style: spinnerStyle, children: /* @__PURE__ */ jsx7(Spinner, { size: spinnerSize, color: spinnerColor }) }) : /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
991
|
+
iconLeft && /* @__PURE__ */ jsx7(Icon, { size: iconSize, color: colors.text, children: iconLeft }),
|
|
992
|
+
/* @__PURE__ */ jsx7("span", { children }),
|
|
993
|
+
iconRight && /* @__PURE__ */ jsx7(Icon, { size: iconSize, color: colors.text, children: iconRight })
|
|
1042
994
|
] }) })
|
|
1043
995
|
}
|
|
1044
996
|
);
|
|
@@ -1048,7 +1000,7 @@ FlexButton.displayName = "FlexButton";
|
|
|
1048
1000
|
// src/ButtonGroup.tsx
|
|
1049
1001
|
import React5 from "react";
|
|
1050
1002
|
import { useDesignSystem as useDesignSystem4 } from "@xsolla/xui-core";
|
|
1051
|
-
import { Fragment as Fragment2, jsx as
|
|
1003
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1052
1004
|
var ButtonGroup = ({
|
|
1053
1005
|
orientation = "horizontal",
|
|
1054
1006
|
size = "md",
|
|
@@ -1121,7 +1073,7 @@ var ButtonGroup = ({
|
|
|
1121
1073
|
const restChildren = processedChildren.slice(1);
|
|
1122
1074
|
return /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1123
1075
|
firstChild,
|
|
1124
|
-
/* @__PURE__ */
|
|
1076
|
+
/* @__PURE__ */ jsx8(Box, { flexDirection: "row", gap: computedGap, children: restChildren })
|
|
1125
1077
|
] });
|
|
1126
1078
|
}
|
|
1127
1079
|
if (orientation === "vertical") {
|
|
@@ -1130,7 +1082,7 @@ var ButtonGroup = ({
|
|
|
1130
1082
|
return children;
|
|
1131
1083
|
};
|
|
1132
1084
|
return /* @__PURE__ */ jsxs4(Box, { flexDirection: "column", width: "100%", gap: 8, children: [
|
|
1133
|
-
/* @__PURE__ */
|
|
1085
|
+
/* @__PURE__ */ jsx8(
|
|
1134
1086
|
Box,
|
|
1135
1087
|
{
|
|
1136
1088
|
role: "group",
|
|
@@ -1147,7 +1099,7 @@ var ButtonGroup = ({
|
|
|
1147
1099
|
children: renderChildren()
|
|
1148
1100
|
}
|
|
1149
1101
|
),
|
|
1150
|
-
error && /* @__PURE__ */
|
|
1102
|
+
error && /* @__PURE__ */ jsx8(Box, { marginTop: 4, children: /* @__PURE__ */ jsx8(
|
|
1151
1103
|
Text,
|
|
1152
1104
|
{
|
|
1153
1105
|
id: errorId,
|
|
@@ -1160,7 +1112,7 @@ var ButtonGroup = ({
|
|
|
1160
1112
|
children: error
|
|
1161
1113
|
}
|
|
1162
1114
|
) }),
|
|
1163
|
-
description && /* @__PURE__ */
|
|
1115
|
+
description && /* @__PURE__ */ jsx8(Box, { marginTop: 4, children: /* @__PURE__ */ jsx8(
|
|
1164
1116
|
Text,
|
|
1165
1117
|
{
|
|
1166
1118
|
id: descriptionId,
|