@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/web/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/Button.tsx
2
- import React3, { useState } from "react";
2
+ import React2, { useState } from "react";
3
3
 
4
4
  // ../primitives-web/src/Box.tsx
5
5
  import React from "react";
@@ -293,176 +293,14 @@ var Divider = (props) => {
293
293
  return /* @__PURE__ */ jsx5(StyledDivider, { ...props });
294
294
  };
295
295
 
296
- // ../primitives-web/src/Input.tsx
297
- import { forwardRef } from "react";
298
- import styled6 from "styled-components";
299
- import { jsx as jsx6 } from "react/jsx-runtime";
300
- var StyledInput = styled6.input`
301
- background: transparent;
302
- border: none;
303
- outline: none;
304
- width: 100%;
305
- height: 100%;
306
- padding: 0;
307
- margin: 0;
308
- color: ${(props) => props.color || "inherit"};
309
- font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
310
- font-family: inherit;
311
- text-align: inherit;
312
-
313
- &::placeholder {
314
- color: ${(props) => props.placeholderTextColor || "rgba(255, 255, 255, 0.5)"};
315
- }
316
-
317
- &:disabled {
318
- cursor: not-allowed;
319
- }
320
- `;
321
- var InputPrimitive = forwardRef(
322
- ({
323
- value,
324
- placeholder,
325
- onChange,
326
- onChangeText,
327
- onFocus,
328
- onBlur,
329
- onKeyDown,
330
- disabled,
331
- secureTextEntry,
332
- style,
333
- color,
334
- fontSize,
335
- placeholderTextColor,
336
- maxLength,
337
- name,
338
- type,
339
- inputMode,
340
- autoComplete,
341
- id,
342
- "aria-invalid": ariaInvalid,
343
- "aria-describedby": ariaDescribedBy,
344
- "aria-labelledby": ariaLabelledBy,
345
- "aria-label": ariaLabel,
346
- "aria-disabled": ariaDisabled,
347
- "data-testid": dataTestId,
348
- ...rest
349
- }, ref) => {
350
- const handleChange = (e) => {
351
- if (onChange) {
352
- onChange(e);
353
- }
354
- if (onChangeText) {
355
- onChangeText(e.target.value);
356
- }
357
- };
358
- const inputValue = value !== void 0 ? value : "";
359
- return /* @__PURE__ */ jsx6(
360
- StyledInput,
361
- {
362
- ref,
363
- id,
364
- value: inputValue,
365
- name,
366
- placeholder,
367
- onChange: handleChange,
368
- onFocus,
369
- onBlur,
370
- onKeyDown,
371
- disabled,
372
- type: secureTextEntry ? "password" : type || "text",
373
- inputMode,
374
- autoComplete,
375
- style,
376
- color,
377
- fontSize,
378
- placeholderTextColor,
379
- maxLength,
380
- "aria-invalid": ariaInvalid,
381
- "aria-describedby": ariaDescribedBy,
382
- "aria-labelledby": ariaLabelledBy,
383
- "aria-label": ariaLabel,
384
- "aria-disabled": ariaDisabled,
385
- "data-testid": dataTestId,
386
- ...rest
387
- }
388
- );
389
- }
390
- );
391
- InputPrimitive.displayName = "InputPrimitive";
392
-
393
- // ../primitives-web/src/TextArea.tsx
394
- import { forwardRef as forwardRef2 } from "react";
395
- import styled7 from "styled-components";
396
- import { jsx as jsx7 } from "react/jsx-runtime";
397
- var StyledTextArea = styled7.textarea`
398
- background: transparent;
399
- border: none;
400
- outline: none;
401
- width: 100%;
402
- height: 100%;
403
- padding: 0;
404
- margin: 0;
405
- color: ${(props) => props.color || "inherit"};
406
- font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
407
- font-family: inherit;
408
- text-align: inherit;
409
- resize: none;
410
-
411
- &::placeholder {
412
- color: ${(props) => props.placeholderTextColor || "rgba(255, 255, 255, 0.5)"};
413
- }
414
-
415
- &:disabled {
416
- cursor: not-allowed;
417
- }
418
- `;
419
- var TextAreaPrimitive = forwardRef2(
420
- ({
421
- value,
422
- placeholder,
423
- onChangeText,
424
- onFocus,
425
- onBlur,
426
- onKeyDown,
427
- disabled,
428
- style,
429
- color,
430
- fontSize,
431
- placeholderTextColor,
432
- maxLength,
433
- rows
434
- }, ref) => {
435
- return /* @__PURE__ */ jsx7(
436
- StyledTextArea,
437
- {
438
- ref,
439
- value,
440
- placeholder,
441
- onChange: (e) => onChangeText?.(e.target.value),
442
- onFocus,
443
- onBlur,
444
- onKeyDown,
445
- disabled,
446
- style,
447
- color,
448
- fontSize,
449
- placeholderTextColor,
450
- maxLength,
451
- rows
452
- }
453
- );
454
- }
455
- );
456
- TextAreaPrimitive.displayName = "TextAreaPrimitive";
457
-
458
296
  // src/Button.tsx
459
297
  import { useDesignSystem } from "@xsolla/xui-core";
460
- import { jsx as jsx8, jsxs } from "react/jsx-runtime";
298
+ import { jsx as jsx6, jsxs } from "react/jsx-runtime";
461
299
  var cloneIconWithDefaults = (icon, defaultSize, defaultColor) => {
462
- if (!React3.isValidElement(icon)) return icon;
300
+ if (!React2.isValidElement(icon)) return icon;
463
301
  const iconElement = icon;
464
302
  const existingProps = iconElement.props || {};
465
- return React3.cloneElement(iconElement, {
303
+ return React2.cloneElement(iconElement, {
466
304
  ...existingProps,
467
305
  // Preserve existing props (including accessibility attributes)
468
306
  size: existingProps.size ?? defaultSize,
@@ -592,7 +430,7 @@ var Button = ({
592
430
  outlineStyle: "solid"
593
431
  },
594
432
  children: [
595
- loading && /* @__PURE__ */ jsx8(
433
+ loading && /* @__PURE__ */ jsx6(
596
434
  Box,
597
435
  {
598
436
  position: "absolute",
@@ -603,7 +441,7 @@ var Button = ({
603
441
  alignItems: "center",
604
442
  justifyContent: "center",
605
443
  zIndex: 1,
606
- children: /* @__PURE__ */ jsx8(
444
+ children: /* @__PURE__ */ jsx6(
607
445
  Spinner,
608
446
  {
609
447
  color: textColor,
@@ -625,7 +463,7 @@ var Button = ({
625
463
  pointerEvents: loading ? "none" : "auto"
626
464
  },
627
465
  children: [
628
- /* @__PURE__ */ jsx8(
466
+ /* @__PURE__ */ jsx6(
629
467
  Box,
630
468
  {
631
469
  width: sizeStyles.iconContainerSize,
@@ -635,7 +473,7 @@ var Button = ({
635
473
  children: cloneIconWithDefaults(iconLeft, sizeStyles.iconSize, textColor)
636
474
  }
637
475
  ),
638
- showDivider && /* @__PURE__ */ jsx8(Divider, { vertical: true, color: dividerLineColor, height: "100%" })
476
+ showDivider && /* @__PURE__ */ jsx6(Divider, { vertical: true, color: dividerLineColor, height: "100%" })
639
477
  ]
640
478
  }
641
479
  ),
@@ -655,13 +493,13 @@ var Button = ({
655
493
  },
656
494
  "aria-hidden": loading ? true : void 0,
657
495
  children: [
658
- labelIcon && /* @__PURE__ */ jsx8(Box, { "aria-hidden": true, children: cloneIconWithDefaults(
496
+ labelIcon && /* @__PURE__ */ jsx6(Box, { "aria-hidden": true, children: cloneIconWithDefaults(
659
497
  labelIcon,
660
498
  sizeStyles.labelIconSize,
661
499
  textColor
662
500
  ) }),
663
- /* @__PURE__ */ jsx8(Text, { color: textColor, fontSize: sizeStyles.fontSize, fontWeight: "500", children }),
664
- sublabel && /* @__PURE__ */ jsx8(
501
+ /* @__PURE__ */ jsx6(Text, { color: textColor, fontSize: sizeStyles.fontSize, fontWeight: "500", children }),
502
+ sublabel && /* @__PURE__ */ jsx6(
665
503
  Text,
666
504
  {
667
505
  color: textColor,
@@ -671,7 +509,7 @@ var Button = ({
671
509
  children: sublabel
672
510
  }
673
511
  ),
674
- customContent && /* @__PURE__ */ jsx8(Box, { "aria-hidden": true, children: customContent })
512
+ customContent && /* @__PURE__ */ jsx6(Box, { "aria-hidden": true, children: customContent })
675
513
  ]
676
514
  }
677
515
  ),
@@ -687,8 +525,8 @@ var Button = ({
687
525
  pointerEvents: loading ? "none" : "auto"
688
526
  },
689
527
  children: [
690
- showDivider && /* @__PURE__ */ jsx8(Divider, { vertical: true, color: dividerLineColor, height: "100%" }),
691
- /* @__PURE__ */ jsx8(
528
+ showDivider && /* @__PURE__ */ jsx6(Divider, { vertical: true, color: dividerLineColor, height: "100%" }),
529
+ /* @__PURE__ */ jsx6(
692
530
  Box,
693
531
  {
694
532
  width: sizeStyles.iconContainerSize,
@@ -708,14 +546,14 @@ var Button = ({
708
546
  Button.displayName = "Button";
709
547
 
710
548
  // src/IconButton.tsx
711
- import React4, { useState as useState2 } from "react";
549
+ import React3, { useState as useState2 } from "react";
712
550
  import { useDesignSystem as useDesignSystem2 } from "@xsolla/xui-core";
713
- import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
551
+ import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
714
552
  var cloneIconWithDefaults2 = (icon, defaultSize, defaultColor) => {
715
- if (!React4.isValidElement(icon)) return icon;
553
+ if (!React3.isValidElement(icon)) return icon;
716
554
  const iconElement = icon;
717
555
  const existingProps = iconElement.props || {};
718
- return React4.cloneElement(iconElement, {
556
+ return React3.cloneElement(iconElement, {
719
557
  ...existingProps,
720
558
  // Preserve existing props (including accessibility attributes)
721
559
  size: existingProps.size ?? defaultSize,
@@ -831,7 +669,7 @@ var IconButton = ({
831
669
  outlineStyle: "solid"
832
670
  },
833
671
  children: [
834
- loading && /* @__PURE__ */ jsx9(
672
+ loading && /* @__PURE__ */ jsx7(
835
673
  Box,
836
674
  {
837
675
  position: "absolute",
@@ -842,7 +680,7 @@ var IconButton = ({
842
680
  alignItems: "center",
843
681
  justifyContent: "center",
844
682
  zIndex: 1,
845
- children: /* @__PURE__ */ jsx9(
683
+ children: /* @__PURE__ */ jsx7(
846
684
  Spinner,
847
685
  {
848
686
  color: textColor,
@@ -852,7 +690,7 @@ var IconButton = ({
852
690
  )
853
691
  }
854
692
  ),
855
- /* @__PURE__ */ jsx9(
693
+ /* @__PURE__ */ jsx7(
856
694
  Box,
857
695
  {
858
696
  "aria-hidden": true,
@@ -875,7 +713,7 @@ import {
875
713
  useState as useState3
876
714
  } from "react";
877
715
  import { useDesignSystem as useDesignSystem3 } from "@xsolla/xui-core";
878
- import { Fragment, jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
716
+ import { Fragment, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
879
717
  var ICON_SIZES = {
880
718
  xs: 12,
881
719
  sm: 14,
@@ -1170,7 +1008,7 @@ var FlexButton = ({
1170
1008
  height: lineHeight
1171
1009
  };
1172
1010
  const computedAriaLabel = ariaLabel || (typeof children === "string" ? children : void 0);
1173
- return /* @__PURE__ */ jsx10(
1011
+ return /* @__PURE__ */ jsx8(
1174
1012
  "button",
1175
1013
  {
1176
1014
  ...buttonProps,
@@ -1197,10 +1035,10 @@ var FlexButton = ({
1197
1035
  tabIndex,
1198
1036
  style: buttonStyle,
1199
1037
  "data-testid": testID || "flex-button",
1200
- children: /* @__PURE__ */ jsx10("span", { style: contentStyle, children: loading ? /* @__PURE__ */ jsx10("span", { style: spinnerStyle, children: /* @__PURE__ */ jsx10(Spinner, { size: spinnerSize, color: spinnerColor }) }) : /* @__PURE__ */ jsxs3(Fragment, { children: [
1201
- iconLeft && /* @__PURE__ */ jsx10(Icon, { size: iconSize, color: colors.text, children: iconLeft }),
1202
- /* @__PURE__ */ jsx10("span", { children }),
1203
- iconRight && /* @__PURE__ */ jsx10(Icon, { size: iconSize, color: colors.text, children: iconRight })
1038
+ children: /* @__PURE__ */ jsx8("span", { style: contentStyle, children: loading ? /* @__PURE__ */ jsx8("span", { style: spinnerStyle, children: /* @__PURE__ */ jsx8(Spinner, { size: spinnerSize, color: spinnerColor }) }) : /* @__PURE__ */ jsxs3(Fragment, { children: [
1039
+ iconLeft && /* @__PURE__ */ jsx8(Icon, { size: iconSize, color: colors.text, children: iconLeft }),
1040
+ /* @__PURE__ */ jsx8("span", { children }),
1041
+ iconRight && /* @__PURE__ */ jsx8(Icon, { size: iconSize, color: colors.text, children: iconRight })
1204
1042
  ] }) })
1205
1043
  }
1206
1044
  );
@@ -1208,9 +1046,9 @@ var FlexButton = ({
1208
1046
  FlexButton.displayName = "FlexButton";
1209
1047
 
1210
1048
  // src/ButtonGroup.tsx
1211
- import React6 from "react";
1049
+ import React5 from "react";
1212
1050
  import { useDesignSystem as useDesignSystem4 } from "@xsolla/xui-core";
1213
- import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
1051
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1214
1052
  var ButtonGroup = ({
1215
1053
  orientation = "horizontal",
1216
1054
  size = "md",
@@ -1227,8 +1065,8 @@ var ButtonGroup = ({
1227
1065
  const { theme } = useDesignSystem4();
1228
1066
  const flattenChildren = (children2) => {
1229
1067
  const result = [];
1230
- React6.Children.forEach(children2, (child) => {
1231
- if (React6.isValidElement(child) && child.type === React6.Fragment) {
1068
+ React5.Children.forEach(children2, (child) => {
1069
+ if (React5.isValidElement(child) && child.type === React5.Fragment) {
1232
1070
  result.push(...flattenChildren(child.props.children));
1233
1071
  } else if (child !== null && child !== void 0) {
1234
1072
  result.push(child);
@@ -1264,8 +1102,8 @@ var ButtonGroup = ({
1264
1102
  const processChildren = (childrenToProcess) => {
1265
1103
  if (orientation === "vertical") {
1266
1104
  return childrenToProcess.map((child, index) => {
1267
- if (React6.isValidElement(child)) {
1268
- return React6.cloneElement(child, {
1105
+ if (React5.isValidElement(child)) {
1106
+ return React5.cloneElement(child, {
1269
1107
  ...child.props,
1270
1108
  fullWidth: true,
1271
1109
  key: child.key ?? index
@@ -1283,7 +1121,7 @@ var ButtonGroup = ({
1283
1121
  const restChildren = processedChildren.slice(1);
1284
1122
  return /* @__PURE__ */ jsxs4(Fragment2, { children: [
1285
1123
  firstChild,
1286
- /* @__PURE__ */ jsx11(Box, { flexDirection: "row", gap: computedGap, children: restChildren })
1124
+ /* @__PURE__ */ jsx9(Box, { flexDirection: "row", gap: computedGap, children: restChildren })
1287
1125
  ] });
1288
1126
  }
1289
1127
  if (orientation === "vertical") {
@@ -1292,7 +1130,7 @@ var ButtonGroup = ({
1292
1130
  return children;
1293
1131
  };
1294
1132
  return /* @__PURE__ */ jsxs4(Box, { flexDirection: "column", width: "100%", gap: 8, children: [
1295
- /* @__PURE__ */ jsx11(
1133
+ /* @__PURE__ */ jsx9(
1296
1134
  Box,
1297
1135
  {
1298
1136
  role: "group",
@@ -1309,7 +1147,7 @@ var ButtonGroup = ({
1309
1147
  children: renderChildren()
1310
1148
  }
1311
1149
  ),
1312
- error && /* @__PURE__ */ jsx11(Box, { marginTop: 4, children: /* @__PURE__ */ jsx11(
1150
+ error && /* @__PURE__ */ jsx9(Box, { marginTop: 4, children: /* @__PURE__ */ jsx9(
1313
1151
  Text,
1314
1152
  {
1315
1153
  id: errorId,
@@ -1322,7 +1160,7 @@ var ButtonGroup = ({
1322
1160
  children: error
1323
1161
  }
1324
1162
  ) }),
1325
- description && /* @__PURE__ */ jsx11(Box, { marginTop: 4, children: /* @__PURE__ */ jsx11(
1163
+ description && /* @__PURE__ */ jsx9(Box, { marginTop: 4, children: /* @__PURE__ */ jsx9(
1326
1164
  Text,
1327
1165
  {
1328
1166
  id: descriptionId,