@xsolla/xui-button 0.87.0 → 0.89.0-pr137.1770210437
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/web/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-web/src/Box.tsx
|
|
44
44
|
var import_react = __toESM(require("react"));
|
|
@@ -332,176 +332,14 @@ var Divider = (props) => {
|
|
|
332
332
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StyledDivider, { ...props });
|
|
333
333
|
};
|
|
334
334
|
|
|
335
|
-
// ../primitives-web/src/Input.tsx
|
|
336
|
-
var import_react2 = require("react");
|
|
337
|
-
var import_styled_components6 = __toESM(require("styled-components"));
|
|
338
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
339
|
-
var StyledInput = import_styled_components6.default.input`
|
|
340
|
-
background: transparent;
|
|
341
|
-
border: none;
|
|
342
|
-
outline: none;
|
|
343
|
-
width: 100%;
|
|
344
|
-
height: 100%;
|
|
345
|
-
padding: 0;
|
|
346
|
-
margin: 0;
|
|
347
|
-
color: ${(props) => props.color || "inherit"};
|
|
348
|
-
font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
|
|
349
|
-
font-family: inherit;
|
|
350
|
-
text-align: inherit;
|
|
351
|
-
|
|
352
|
-
&::placeholder {
|
|
353
|
-
color: ${(props) => props.placeholderTextColor || "rgba(255, 255, 255, 0.5)"};
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
&:disabled {
|
|
357
|
-
cursor: not-allowed;
|
|
358
|
-
}
|
|
359
|
-
`;
|
|
360
|
-
var InputPrimitive = (0, import_react2.forwardRef)(
|
|
361
|
-
({
|
|
362
|
-
value,
|
|
363
|
-
placeholder,
|
|
364
|
-
onChange,
|
|
365
|
-
onChangeText,
|
|
366
|
-
onFocus,
|
|
367
|
-
onBlur,
|
|
368
|
-
onKeyDown,
|
|
369
|
-
disabled,
|
|
370
|
-
secureTextEntry,
|
|
371
|
-
style,
|
|
372
|
-
color,
|
|
373
|
-
fontSize,
|
|
374
|
-
placeholderTextColor,
|
|
375
|
-
maxLength,
|
|
376
|
-
name,
|
|
377
|
-
type,
|
|
378
|
-
inputMode,
|
|
379
|
-
autoComplete,
|
|
380
|
-
id,
|
|
381
|
-
"aria-invalid": ariaInvalid,
|
|
382
|
-
"aria-describedby": ariaDescribedBy,
|
|
383
|
-
"aria-labelledby": ariaLabelledBy,
|
|
384
|
-
"aria-label": ariaLabel,
|
|
385
|
-
"aria-disabled": ariaDisabled,
|
|
386
|
-
"data-testid": dataTestId,
|
|
387
|
-
...rest
|
|
388
|
-
}, ref) => {
|
|
389
|
-
const handleChange = (e) => {
|
|
390
|
-
if (onChange) {
|
|
391
|
-
onChange(e);
|
|
392
|
-
}
|
|
393
|
-
if (onChangeText) {
|
|
394
|
-
onChangeText(e.target.value);
|
|
395
|
-
}
|
|
396
|
-
};
|
|
397
|
-
const inputValue = value !== void 0 ? value : "";
|
|
398
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
399
|
-
StyledInput,
|
|
400
|
-
{
|
|
401
|
-
ref,
|
|
402
|
-
id,
|
|
403
|
-
value: inputValue,
|
|
404
|
-
name,
|
|
405
|
-
placeholder,
|
|
406
|
-
onChange: handleChange,
|
|
407
|
-
onFocus,
|
|
408
|
-
onBlur,
|
|
409
|
-
onKeyDown,
|
|
410
|
-
disabled,
|
|
411
|
-
type: secureTextEntry ? "password" : type || "text",
|
|
412
|
-
inputMode,
|
|
413
|
-
autoComplete,
|
|
414
|
-
style,
|
|
415
|
-
color,
|
|
416
|
-
fontSize,
|
|
417
|
-
placeholderTextColor,
|
|
418
|
-
maxLength,
|
|
419
|
-
"aria-invalid": ariaInvalid,
|
|
420
|
-
"aria-describedby": ariaDescribedBy,
|
|
421
|
-
"aria-labelledby": ariaLabelledBy,
|
|
422
|
-
"aria-label": ariaLabel,
|
|
423
|
-
"aria-disabled": ariaDisabled,
|
|
424
|
-
"data-testid": dataTestId,
|
|
425
|
-
...rest
|
|
426
|
-
}
|
|
427
|
-
);
|
|
428
|
-
}
|
|
429
|
-
);
|
|
430
|
-
InputPrimitive.displayName = "InputPrimitive";
|
|
431
|
-
|
|
432
|
-
// ../primitives-web/src/TextArea.tsx
|
|
433
|
-
var import_react3 = require("react");
|
|
434
|
-
var import_styled_components7 = __toESM(require("styled-components"));
|
|
435
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
436
|
-
var StyledTextArea = import_styled_components7.default.textarea`
|
|
437
|
-
background: transparent;
|
|
438
|
-
border: none;
|
|
439
|
-
outline: none;
|
|
440
|
-
width: 100%;
|
|
441
|
-
height: 100%;
|
|
442
|
-
padding: 0;
|
|
443
|
-
margin: 0;
|
|
444
|
-
color: ${(props) => props.color || "inherit"};
|
|
445
|
-
font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
|
|
446
|
-
font-family: inherit;
|
|
447
|
-
text-align: inherit;
|
|
448
|
-
resize: none;
|
|
449
|
-
|
|
450
|
-
&::placeholder {
|
|
451
|
-
color: ${(props) => props.placeholderTextColor || "rgba(255, 255, 255, 0.5)"};
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
&:disabled {
|
|
455
|
-
cursor: not-allowed;
|
|
456
|
-
}
|
|
457
|
-
`;
|
|
458
|
-
var TextAreaPrimitive = (0, import_react3.forwardRef)(
|
|
459
|
-
({
|
|
460
|
-
value,
|
|
461
|
-
placeholder,
|
|
462
|
-
onChangeText,
|
|
463
|
-
onFocus,
|
|
464
|
-
onBlur,
|
|
465
|
-
onKeyDown,
|
|
466
|
-
disabled,
|
|
467
|
-
style,
|
|
468
|
-
color,
|
|
469
|
-
fontSize,
|
|
470
|
-
placeholderTextColor,
|
|
471
|
-
maxLength,
|
|
472
|
-
rows
|
|
473
|
-
}, ref) => {
|
|
474
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
475
|
-
StyledTextArea,
|
|
476
|
-
{
|
|
477
|
-
ref,
|
|
478
|
-
value,
|
|
479
|
-
placeholder,
|
|
480
|
-
onChange: (e) => onChangeText?.(e.target.value),
|
|
481
|
-
onFocus,
|
|
482
|
-
onBlur,
|
|
483
|
-
onKeyDown,
|
|
484
|
-
disabled,
|
|
485
|
-
style,
|
|
486
|
-
color,
|
|
487
|
-
fontSize,
|
|
488
|
-
placeholderTextColor,
|
|
489
|
-
maxLength,
|
|
490
|
-
rows
|
|
491
|
-
}
|
|
492
|
-
);
|
|
493
|
-
}
|
|
494
|
-
);
|
|
495
|
-
TextAreaPrimitive.displayName = "TextAreaPrimitive";
|
|
496
|
-
|
|
497
335
|
// src/Button.tsx
|
|
498
336
|
var import_xui_core = require("@xsolla/xui-core");
|
|
499
|
-
var
|
|
337
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
500
338
|
var cloneIconWithDefaults = (icon, defaultSize, defaultColor) => {
|
|
501
|
-
if (!
|
|
339
|
+
if (!import_react2.default.isValidElement(icon)) return icon;
|
|
502
340
|
const iconElement = icon;
|
|
503
341
|
const existingProps = iconElement.props || {};
|
|
504
|
-
return
|
|
342
|
+
return import_react2.default.cloneElement(iconElement, {
|
|
505
343
|
...existingProps,
|
|
506
344
|
// Preserve existing props (including accessibility attributes)
|
|
507
345
|
size: existingProps.size ?? defaultSize,
|
|
@@ -535,7 +373,7 @@ var Button = ({
|
|
|
535
373
|
fullWidth = false
|
|
536
374
|
}) => {
|
|
537
375
|
const { theme } = (0, import_xui_core.useDesignSystem)();
|
|
538
|
-
const [isKeyboardPressed, setIsKeyboardPressed] = (0,
|
|
376
|
+
const [isKeyboardPressed, setIsKeyboardPressed] = (0, import_react2.useState)(false);
|
|
539
377
|
const isDisabled = disabled || loading;
|
|
540
378
|
const sizeStyles = theme.sizing.button(size);
|
|
541
379
|
const controlTone = theme?.colors?.control?.[tone];
|
|
@@ -586,7 +424,7 @@ var Button = ({
|
|
|
586
424
|
const hasIcon = Boolean(iconLeft || iconRight);
|
|
587
425
|
const showDivider = divider !== void 0 ? divider : hasIcon;
|
|
588
426
|
const computedAriaLabel = ariaLabel;
|
|
589
|
-
return /* @__PURE__ */ (0,
|
|
427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
590
428
|
Box,
|
|
591
429
|
{
|
|
592
430
|
as: "button",
|
|
@@ -631,7 +469,7 @@ var Button = ({
|
|
|
631
469
|
outlineStyle: "solid"
|
|
632
470
|
},
|
|
633
471
|
children: [
|
|
634
|
-
loading && /* @__PURE__ */ (0,
|
|
472
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
635
473
|
Box,
|
|
636
474
|
{
|
|
637
475
|
position: "absolute",
|
|
@@ -642,7 +480,7 @@ var Button = ({
|
|
|
642
480
|
alignItems: "center",
|
|
643
481
|
justifyContent: "center",
|
|
644
482
|
zIndex: 1,
|
|
645
|
-
children: /* @__PURE__ */ (0,
|
|
483
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
646
484
|
Spinner,
|
|
647
485
|
{
|
|
648
486
|
color: textColor,
|
|
@@ -652,7 +490,7 @@ var Button = ({
|
|
|
652
490
|
)
|
|
653
491
|
}
|
|
654
492
|
),
|
|
655
|
-
iconLeft && /* @__PURE__ */ (0,
|
|
493
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
656
494
|
Box,
|
|
657
495
|
{
|
|
658
496
|
height: "100%",
|
|
@@ -664,7 +502,7 @@ var Button = ({
|
|
|
664
502
|
pointerEvents: loading ? "none" : "auto"
|
|
665
503
|
},
|
|
666
504
|
children: [
|
|
667
|
-
/* @__PURE__ */ (0,
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
668
506
|
Box,
|
|
669
507
|
{
|
|
670
508
|
width: sizeStyles.iconContainerSize,
|
|
@@ -674,11 +512,11 @@ var Button = ({
|
|
|
674
512
|
children: cloneIconWithDefaults(iconLeft, sizeStyles.iconSize, textColor)
|
|
675
513
|
}
|
|
676
514
|
),
|
|
677
|
-
showDivider && /* @__PURE__ */ (0,
|
|
515
|
+
showDivider && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Divider, { vertical: true, color: dividerLineColor, height: "100%" })
|
|
678
516
|
]
|
|
679
517
|
}
|
|
680
518
|
),
|
|
681
|
-
/* @__PURE__ */ (0,
|
|
519
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
682
520
|
Box,
|
|
683
521
|
{
|
|
684
522
|
flex: fullWidth ? 1 : void 0,
|
|
@@ -694,13 +532,13 @@ var Button = ({
|
|
|
694
532
|
},
|
|
695
533
|
"aria-hidden": loading ? true : void 0,
|
|
696
534
|
children: [
|
|
697
|
-
labelIcon && /* @__PURE__ */ (0,
|
|
535
|
+
labelIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box, { "aria-hidden": true, children: cloneIconWithDefaults(
|
|
698
536
|
labelIcon,
|
|
699
537
|
sizeStyles.labelIconSize,
|
|
700
538
|
textColor
|
|
701
539
|
) }),
|
|
702
|
-
/* @__PURE__ */ (0,
|
|
703
|
-
sublabel && /* @__PURE__ */ (0,
|
|
540
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: textColor, fontSize: sizeStyles.fontSize, fontWeight: "500", children }),
|
|
541
|
+
sublabel && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
704
542
|
Text,
|
|
705
543
|
{
|
|
706
544
|
color: textColor,
|
|
@@ -710,11 +548,11 @@ var Button = ({
|
|
|
710
548
|
children: sublabel
|
|
711
549
|
}
|
|
712
550
|
),
|
|
713
|
-
customContent && /* @__PURE__ */ (0,
|
|
551
|
+
customContent && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box, { "aria-hidden": true, children: customContent })
|
|
714
552
|
]
|
|
715
553
|
}
|
|
716
554
|
),
|
|
717
|
-
iconRight && /* @__PURE__ */ (0,
|
|
555
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
718
556
|
Box,
|
|
719
557
|
{
|
|
720
558
|
height: "100%",
|
|
@@ -726,8 +564,8 @@ var Button = ({
|
|
|
726
564
|
pointerEvents: loading ? "none" : "auto"
|
|
727
565
|
},
|
|
728
566
|
children: [
|
|
729
|
-
showDivider && /* @__PURE__ */ (0,
|
|
730
|
-
/* @__PURE__ */ (0,
|
|
567
|
+
showDivider && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Divider, { vertical: true, color: dividerLineColor, height: "100%" }),
|
|
568
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
731
569
|
Box,
|
|
732
570
|
{
|
|
733
571
|
width: sizeStyles.iconContainerSize,
|
|
@@ -747,14 +585,14 @@ var Button = ({
|
|
|
747
585
|
Button.displayName = "Button";
|
|
748
586
|
|
|
749
587
|
// src/IconButton.tsx
|
|
750
|
-
var
|
|
588
|
+
var import_react3 = __toESM(require("react"));
|
|
751
589
|
var import_xui_core2 = require("@xsolla/xui-core");
|
|
752
|
-
var
|
|
590
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
753
591
|
var cloneIconWithDefaults2 = (icon, defaultSize, defaultColor) => {
|
|
754
|
-
if (!
|
|
592
|
+
if (!import_react3.default.isValidElement(icon)) return icon;
|
|
755
593
|
const iconElement = icon;
|
|
756
594
|
const existingProps = iconElement.props || {};
|
|
757
|
-
return
|
|
595
|
+
return import_react3.default.cloneElement(iconElement, {
|
|
758
596
|
...existingProps,
|
|
759
597
|
// Preserve existing props (including accessibility attributes)
|
|
760
598
|
size: existingProps.size ?? defaultSize,
|
|
@@ -780,7 +618,7 @@ var IconButton = ({
|
|
|
780
618
|
type = "button"
|
|
781
619
|
}) => {
|
|
782
620
|
const { theme } = (0, import_xui_core2.useDesignSystem)();
|
|
783
|
-
const [isKeyboardPressed, setIsKeyboardPressed] = (0,
|
|
621
|
+
const [isKeyboardPressed, setIsKeyboardPressed] = (0, import_react3.useState)(false);
|
|
784
622
|
const isDisabled = disabled || loading;
|
|
785
623
|
const sizeStyles = theme.sizing.button(size);
|
|
786
624
|
const controlTone = theme?.colors?.control?.[tone];
|
|
@@ -825,7 +663,7 @@ var IconButton = ({
|
|
|
825
663
|
}
|
|
826
664
|
const borderColor = disabled ? variantStyles.borderDisable || variantStyles.border : variantStyles.border;
|
|
827
665
|
const textColor = disabled ? variantStyles.text?.disable || variantStyles.text?.primary : variantStyles.text?.primary;
|
|
828
|
-
return /* @__PURE__ */ (0,
|
|
666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
829
667
|
Box,
|
|
830
668
|
{
|
|
831
669
|
as: "button",
|
|
@@ -870,7 +708,7 @@ var IconButton = ({
|
|
|
870
708
|
outlineStyle: "solid"
|
|
871
709
|
},
|
|
872
710
|
children: [
|
|
873
|
-
loading && /* @__PURE__ */ (0,
|
|
711
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
874
712
|
Box,
|
|
875
713
|
{
|
|
876
714
|
position: "absolute",
|
|
@@ -881,7 +719,7 @@ var IconButton = ({
|
|
|
881
719
|
alignItems: "center",
|
|
882
720
|
justifyContent: "center",
|
|
883
721
|
zIndex: 1,
|
|
884
|
-
children: /* @__PURE__ */ (0,
|
|
722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
885
723
|
Spinner,
|
|
886
724
|
{
|
|
887
725
|
color: textColor,
|
|
@@ -891,7 +729,7 @@ var IconButton = ({
|
|
|
891
729
|
)
|
|
892
730
|
}
|
|
893
731
|
),
|
|
894
|
-
/* @__PURE__ */ (0,
|
|
732
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
895
733
|
Box,
|
|
896
734
|
{
|
|
897
735
|
"aria-hidden": true,
|
|
@@ -909,9 +747,9 @@ var IconButton = ({
|
|
|
909
747
|
IconButton.displayName = "IconButton";
|
|
910
748
|
|
|
911
749
|
// src/FlexButton.tsx
|
|
912
|
-
var
|
|
750
|
+
var import_react4 = require("react");
|
|
913
751
|
var import_xui_core3 = require("@xsolla/xui-core");
|
|
914
|
-
var
|
|
752
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
915
753
|
var ICON_SIZES = {
|
|
916
754
|
xs: 12,
|
|
917
755
|
sm: 14,
|
|
@@ -971,9 +809,9 @@ var FlexButton = ({
|
|
|
971
809
|
...buttonProps
|
|
972
810
|
}) => {
|
|
973
811
|
const { theme } = (0, import_xui_core3.useDesignSystem)();
|
|
974
|
-
const [state, setState] = (0,
|
|
975
|
-
const [isFocused, setIsFocused] = (0,
|
|
976
|
-
const isMouseOverRef = (0,
|
|
812
|
+
const [state, setState] = (0, import_react4.useState)("default");
|
|
813
|
+
const [isFocused, setIsFocused] = (0, import_react4.useState)(false);
|
|
814
|
+
const isMouseOverRef = (0, import_react4.useRef)(false);
|
|
977
815
|
const isDisabled = disabled || loading;
|
|
978
816
|
const getVariantColors = (currentState) => {
|
|
979
817
|
if (isDisabled) {
|
|
@@ -1206,7 +1044,7 @@ var FlexButton = ({
|
|
|
1206
1044
|
height: lineHeight
|
|
1207
1045
|
};
|
|
1208
1046
|
const computedAriaLabel = ariaLabel || (typeof children === "string" ? children : void 0);
|
|
1209
|
-
return /* @__PURE__ */ (0,
|
|
1047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1210
1048
|
"button",
|
|
1211
1049
|
{
|
|
1212
1050
|
...buttonProps,
|
|
@@ -1233,10 +1071,10 @@ var FlexButton = ({
|
|
|
1233
1071
|
tabIndex,
|
|
1234
1072
|
style: buttonStyle,
|
|
1235
1073
|
"data-testid": testID || "flex-button",
|
|
1236
|
-
children: /* @__PURE__ */ (0,
|
|
1237
|
-
iconLeft && /* @__PURE__ */ (0,
|
|
1238
|
-
/* @__PURE__ */ (0,
|
|
1239
|
-
iconRight && /* @__PURE__ */ (0,
|
|
1074
|
+
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: [
|
|
1075
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { size: iconSize, color: colors.text, children: iconLeft }),
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children }),
|
|
1077
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { size: iconSize, color: colors.text, children: iconRight })
|
|
1240
1078
|
] }) })
|
|
1241
1079
|
}
|
|
1242
1080
|
);
|
|
@@ -1244,9 +1082,9 @@ var FlexButton = ({
|
|
|
1244
1082
|
FlexButton.displayName = "FlexButton";
|
|
1245
1083
|
|
|
1246
1084
|
// src/ButtonGroup.tsx
|
|
1247
|
-
var
|
|
1085
|
+
var import_react5 = __toESM(require("react"));
|
|
1248
1086
|
var import_xui_core4 = require("@xsolla/xui-core");
|
|
1249
|
-
var
|
|
1087
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1250
1088
|
var ButtonGroup = ({
|
|
1251
1089
|
orientation = "horizontal",
|
|
1252
1090
|
size = "md",
|
|
@@ -1263,8 +1101,8 @@ var ButtonGroup = ({
|
|
|
1263
1101
|
const { theme } = (0, import_xui_core4.useDesignSystem)();
|
|
1264
1102
|
const flattenChildren = (children2) => {
|
|
1265
1103
|
const result = [];
|
|
1266
|
-
|
|
1267
|
-
if (
|
|
1104
|
+
import_react5.default.Children.forEach(children2, (child) => {
|
|
1105
|
+
if (import_react5.default.isValidElement(child) && child.type === import_react5.default.Fragment) {
|
|
1268
1106
|
result.push(...flattenChildren(child.props.children));
|
|
1269
1107
|
} else if (child !== null && child !== void 0) {
|
|
1270
1108
|
result.push(child);
|
|
@@ -1300,8 +1138,8 @@ var ButtonGroup = ({
|
|
|
1300
1138
|
const processChildren = (childrenToProcess) => {
|
|
1301
1139
|
if (orientation === "vertical") {
|
|
1302
1140
|
return childrenToProcess.map((child, index) => {
|
|
1303
|
-
if (
|
|
1304
|
-
return
|
|
1141
|
+
if (import_react5.default.isValidElement(child)) {
|
|
1142
|
+
return import_react5.default.cloneElement(child, {
|
|
1305
1143
|
...child.props,
|
|
1306
1144
|
fullWidth: true,
|
|
1307
1145
|
key: child.key ?? index
|
|
@@ -1317,9 +1155,9 @@ var ButtonGroup = ({
|
|
|
1317
1155
|
if (useSpaceBetween) {
|
|
1318
1156
|
const firstChild = processedChildren[0];
|
|
1319
1157
|
const restChildren = processedChildren.slice(1);
|
|
1320
|
-
return /* @__PURE__ */ (0,
|
|
1158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1321
1159
|
firstChild,
|
|
1322
|
-
/* @__PURE__ */ (0,
|
|
1160
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { flexDirection: "row", gap: computedGap, children: restChildren })
|
|
1323
1161
|
] });
|
|
1324
1162
|
}
|
|
1325
1163
|
if (orientation === "vertical") {
|
|
@@ -1327,8 +1165,8 @@ var ButtonGroup = ({
|
|
|
1327
1165
|
}
|
|
1328
1166
|
return children;
|
|
1329
1167
|
};
|
|
1330
|
-
return /* @__PURE__ */ (0,
|
|
1331
|
-
/* @__PURE__ */ (0,
|
|
1168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box, { flexDirection: "column", width: "100%", gap: 8, children: [
|
|
1169
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1332
1170
|
Box,
|
|
1333
1171
|
{
|
|
1334
1172
|
role: "group",
|
|
@@ -1345,7 +1183,7 @@ var ButtonGroup = ({
|
|
|
1345
1183
|
children: renderChildren()
|
|
1346
1184
|
}
|
|
1347
1185
|
),
|
|
1348
|
-
error && /* @__PURE__ */ (0,
|
|
1186
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { marginTop: 4, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1349
1187
|
Text,
|
|
1350
1188
|
{
|
|
1351
1189
|
id: errorId,
|
|
@@ -1358,7 +1196,7 @@ var ButtonGroup = ({
|
|
|
1358
1196
|
children: error
|
|
1359
1197
|
}
|
|
1360
1198
|
) }),
|
|
1361
|
-
description && /* @__PURE__ */ (0,
|
|
1199
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box, { marginTop: 4, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1362
1200
|
Text,
|
|
1363
1201
|
{
|
|
1364
1202
|
id: descriptionId,
|