@xsolla/xui-button 0.89.0 → 0.91.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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/Button.tsx
2
- import React4, { useState } from "react";
2
+ import React2, { useState } from "react";
3
3
 
4
4
  // ../primitives-native/src/Box.tsx
5
5
  import {
@@ -285,227 +285,14 @@ var Divider = ({
285
285
  return /* @__PURE__ */ jsx5(View4, { style });
286
286
  };
287
287
 
288
- // ../primitives-native/src/Input.tsx
289
- import { forwardRef } from "react";
290
- import { TextInput as RNTextInput } from "react-native";
291
- import { jsx as jsx6 } from "react/jsx-runtime";
292
- var keyboardTypeMap = {
293
- text: "default",
294
- number: "numeric",
295
- email: "email-address",
296
- tel: "phone-pad",
297
- url: "url",
298
- decimal: "decimal-pad"
299
- };
300
- var inputModeToKeyboardType = {
301
- none: "default",
302
- text: "default",
303
- decimal: "decimal-pad",
304
- numeric: "number-pad",
305
- tel: "phone-pad",
306
- search: "default",
307
- email: "email-address",
308
- url: "url"
309
- };
310
- var autoCompleteToTextContentType = {
311
- "one-time-code": "oneTimeCode",
312
- email: "emailAddress",
313
- username: "username",
314
- password: "password",
315
- "new-password": "newPassword",
316
- tel: "telephoneNumber",
317
- "postal-code": "postalCode",
318
- name: "name"
319
- };
320
- var InputPrimitive = forwardRef(
321
- ({
322
- value,
323
- placeholder,
324
- onChange,
325
- onChangeText,
326
- onFocus,
327
- onBlur,
328
- onKeyDown,
329
- disabled,
330
- secureTextEntry,
331
- style,
332
- color,
333
- fontSize,
334
- placeholderTextColor,
335
- maxLength,
336
- type,
337
- inputMode,
338
- autoComplete,
339
- id,
340
- "aria-describedby": ariaDescribedBy,
341
- "aria-label": ariaLabel,
342
- "aria-disabled": ariaDisabled,
343
- "data-testid": dataTestId
344
- }, ref) => {
345
- const handleChangeText = (text) => {
346
- onChangeText?.(text);
347
- if (onChange) {
348
- const syntheticEvent = {
349
- target: { value: text },
350
- currentTarget: { value: text },
351
- type: "change",
352
- nativeEvent: { text },
353
- preventDefault: () => {
354
- },
355
- stopPropagation: () => {
356
- },
357
- isTrusted: false
358
- };
359
- onChange(syntheticEvent);
360
- }
361
- };
362
- const keyboardType = inputMode ? inputModeToKeyboardType[inputMode] || "default" : type ? keyboardTypeMap[type] || "default" : "default";
363
- const textContentType = autoComplete ? autoCompleteToTextContentType[autoComplete] : void 0;
364
- return /* @__PURE__ */ jsx6(
365
- RNTextInput,
366
- {
367
- ref,
368
- value,
369
- placeholder,
370
- onChangeText: handleChangeText,
371
- onFocus,
372
- onBlur,
373
- onKeyPress: (e) => {
374
- if (onKeyDown) {
375
- onKeyDown({
376
- key: e.nativeEvent.key,
377
- preventDefault: () => {
378
- }
379
- });
380
- }
381
- },
382
- editable: !disabled,
383
- secureTextEntry: secureTextEntry || type === "password",
384
- keyboardType,
385
- textContentType,
386
- style: [
387
- {
388
- color,
389
- fontSize: typeof fontSize === "number" ? fontSize : void 0,
390
- flex: 1,
391
- padding: 0,
392
- textAlign: style?.textAlign || "left"
393
- },
394
- style
395
- ],
396
- placeholderTextColor,
397
- maxLength,
398
- testID: dataTestId || id,
399
- accessibilityLabel: ariaLabel,
400
- accessibilityHint: ariaDescribedBy,
401
- accessibilityState: {
402
- disabled: disabled || ariaDisabled
403
- },
404
- accessible: true
405
- }
406
- );
407
- }
408
- );
409
- InputPrimitive.displayName = "InputPrimitive";
410
-
411
- // ../primitives-native/src/TextArea.tsx
412
- import { forwardRef as forwardRef2 } from "react";
413
- import { TextInput as RNTextInput2 } from "react-native";
414
- import { jsx as jsx7 } from "react/jsx-runtime";
415
- var TextAreaPrimitive = forwardRef2(
416
- ({
417
- value,
418
- placeholder,
419
- onChange,
420
- onChangeText,
421
- onFocus,
422
- onBlur,
423
- onKeyDown,
424
- disabled,
425
- style,
426
- color,
427
- fontSize,
428
- placeholderTextColor,
429
- maxLength,
430
- rows,
431
- id,
432
- "aria-describedby": ariaDescribedBy,
433
- "aria-label": ariaLabel,
434
- "aria-disabled": ariaDisabled,
435
- "data-testid": dataTestId
436
- }, ref) => {
437
- const handleChangeText = (text) => {
438
- onChangeText?.(text);
439
- if (onChange) {
440
- const syntheticEvent = {
441
- target: { value: text },
442
- currentTarget: { value: text },
443
- type: "change",
444
- nativeEvent: { text },
445
- preventDefault: () => {
446
- },
447
- stopPropagation: () => {
448
- },
449
- isTrusted: false
450
- };
451
- onChange(syntheticEvent);
452
- }
453
- };
454
- return /* @__PURE__ */ jsx7(
455
- RNTextInput2,
456
- {
457
- ref,
458
- value,
459
- placeholder,
460
- onChangeText: handleChangeText,
461
- onFocus,
462
- onBlur,
463
- onKeyPress: (e) => {
464
- if (onKeyDown) {
465
- onKeyDown({
466
- key: e.nativeEvent.key,
467
- preventDefault: () => {
468
- }
469
- });
470
- }
471
- },
472
- editable: !disabled,
473
- multiline: true,
474
- numberOfLines: rows || 4,
475
- style: [
476
- {
477
- color,
478
- fontSize: typeof fontSize === "number" ? fontSize : void 0,
479
- flex: 1,
480
- padding: 0,
481
- textAlignVertical: "top",
482
- textAlign: style?.textAlign || "left"
483
- },
484
- style
485
- ],
486
- placeholderTextColor,
487
- maxLength,
488
- testID: dataTestId || id,
489
- accessibilityLabel: ariaLabel,
490
- accessibilityHint: ariaDescribedBy,
491
- accessibilityState: {
492
- disabled: disabled || ariaDisabled
493
- },
494
- accessible: true
495
- }
496
- );
497
- }
498
- );
499
- TextAreaPrimitive.displayName = "TextAreaPrimitive";
500
-
501
288
  // src/Button.tsx
502
289
  import { useDesignSystem } from "@xsolla/xui-core";
503
- import { jsx as jsx8, jsxs } from "react/jsx-runtime";
290
+ import { jsx as jsx6, jsxs } from "react/jsx-runtime";
504
291
  var cloneIconWithDefaults = (icon, defaultSize, defaultColor) => {
505
- if (!React4.isValidElement(icon)) return icon;
292
+ if (!React2.isValidElement(icon)) return icon;
506
293
  const iconElement = icon;
507
294
  const existingProps = iconElement.props || {};
508
- return React4.cloneElement(iconElement, {
295
+ return React2.cloneElement(iconElement, {
509
296
  ...existingProps,
510
297
  // Preserve existing props (including accessibility attributes)
511
298
  size: existingProps.size ?? defaultSize,
@@ -635,7 +422,7 @@ var Button = ({
635
422
  outlineStyle: "solid"
636
423
  },
637
424
  children: [
638
- loading && /* @__PURE__ */ jsx8(
425
+ loading && /* @__PURE__ */ jsx6(
639
426
  Box,
640
427
  {
641
428
  position: "absolute",
@@ -646,7 +433,7 @@ var Button = ({
646
433
  alignItems: "center",
647
434
  justifyContent: "center",
648
435
  zIndex: 1,
649
- children: /* @__PURE__ */ jsx8(
436
+ children: /* @__PURE__ */ jsx6(
650
437
  Spinner,
651
438
  {
652
439
  color: textColor,
@@ -668,7 +455,7 @@ var Button = ({
668
455
  pointerEvents: loading ? "none" : "auto"
669
456
  },
670
457
  children: [
671
- /* @__PURE__ */ jsx8(
458
+ /* @__PURE__ */ jsx6(
672
459
  Box,
673
460
  {
674
461
  width: sizeStyles.iconContainerSize,
@@ -678,7 +465,7 @@ var Button = ({
678
465
  children: cloneIconWithDefaults(iconLeft, sizeStyles.iconSize, textColor)
679
466
  }
680
467
  ),
681
- showDivider && /* @__PURE__ */ jsx8(Divider, { vertical: true, color: dividerLineColor, height: "100%" })
468
+ showDivider && /* @__PURE__ */ jsx6(Divider, { vertical: true, color: dividerLineColor, height: "100%" })
682
469
  ]
683
470
  }
684
471
  ),
@@ -698,13 +485,13 @@ var Button = ({
698
485
  },
699
486
  "aria-hidden": loading ? true : void 0,
700
487
  children: [
701
- labelIcon && /* @__PURE__ */ jsx8(Box, { "aria-hidden": true, children: cloneIconWithDefaults(
488
+ labelIcon && /* @__PURE__ */ jsx6(Box, { "aria-hidden": true, children: cloneIconWithDefaults(
702
489
  labelIcon,
703
490
  sizeStyles.labelIconSize,
704
491
  textColor
705
492
  ) }),
706
- /* @__PURE__ */ jsx8(Text, { color: textColor, fontSize: sizeStyles.fontSize, fontWeight: "500", children }),
707
- sublabel && /* @__PURE__ */ jsx8(
493
+ /* @__PURE__ */ jsx6(Text, { color: textColor, fontSize: sizeStyles.fontSize, fontWeight: "500", children }),
494
+ sublabel && /* @__PURE__ */ jsx6(
708
495
  Text,
709
496
  {
710
497
  color: textColor,
@@ -714,7 +501,7 @@ var Button = ({
714
501
  children: sublabel
715
502
  }
716
503
  ),
717
- customContent && /* @__PURE__ */ jsx8(Box, { "aria-hidden": true, children: customContent })
504
+ customContent && /* @__PURE__ */ jsx6(Box, { "aria-hidden": true, children: customContent })
718
505
  ]
719
506
  }
720
507
  ),
@@ -730,8 +517,8 @@ var Button = ({
730
517
  pointerEvents: loading ? "none" : "auto"
731
518
  },
732
519
  children: [
733
- showDivider && /* @__PURE__ */ jsx8(Divider, { vertical: true, color: dividerLineColor, height: "100%" }),
734
- /* @__PURE__ */ jsx8(
520
+ showDivider && /* @__PURE__ */ jsx6(Divider, { vertical: true, color: dividerLineColor, height: "100%" }),
521
+ /* @__PURE__ */ jsx6(
735
522
  Box,
736
523
  {
737
524
  width: sizeStyles.iconContainerSize,
@@ -751,14 +538,14 @@ var Button = ({
751
538
  Button.displayName = "Button";
752
539
 
753
540
  // src/IconButton.tsx
754
- import React5, { useState as useState2 } from "react";
541
+ import React3, { useState as useState2 } from "react";
755
542
  import { useDesignSystem as useDesignSystem2 } from "@xsolla/xui-core";
756
- import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
543
+ import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
757
544
  var cloneIconWithDefaults2 = (icon, defaultSize, defaultColor) => {
758
- if (!React5.isValidElement(icon)) return icon;
545
+ if (!React3.isValidElement(icon)) return icon;
759
546
  const iconElement = icon;
760
547
  const existingProps = iconElement.props || {};
761
- return React5.cloneElement(iconElement, {
548
+ return React3.cloneElement(iconElement, {
762
549
  ...existingProps,
763
550
  // Preserve existing props (including accessibility attributes)
764
551
  size: existingProps.size ?? defaultSize,
@@ -874,7 +661,7 @@ var IconButton = ({
874
661
  outlineStyle: "solid"
875
662
  },
876
663
  children: [
877
- loading && /* @__PURE__ */ jsx9(
664
+ loading && /* @__PURE__ */ jsx7(
878
665
  Box,
879
666
  {
880
667
  position: "absolute",
@@ -885,7 +672,7 @@ var IconButton = ({
885
672
  alignItems: "center",
886
673
  justifyContent: "center",
887
674
  zIndex: 1,
888
- children: /* @__PURE__ */ jsx9(
675
+ children: /* @__PURE__ */ jsx7(
889
676
  Spinner,
890
677
  {
891
678
  color: textColor,
@@ -895,7 +682,7 @@ var IconButton = ({
895
682
  )
896
683
  }
897
684
  ),
898
- /* @__PURE__ */ jsx9(
685
+ /* @__PURE__ */ jsx7(
899
686
  Box,
900
687
  {
901
688
  "aria-hidden": true,
@@ -918,7 +705,7 @@ import {
918
705
  useState as useState3
919
706
  } from "react";
920
707
  import { useDesignSystem as useDesignSystem3 } from "@xsolla/xui-core";
921
- import { Fragment, jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
708
+ import { Fragment, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
922
709
  var ICON_SIZES = {
923
710
  xs: 12,
924
711
  sm: 14,
@@ -1213,7 +1000,7 @@ var FlexButton = ({
1213
1000
  height: lineHeight
1214
1001
  };
1215
1002
  const computedAriaLabel = ariaLabel || (typeof children === "string" ? children : void 0);
1216
- return /* @__PURE__ */ jsx10(
1003
+ return /* @__PURE__ */ jsx8(
1217
1004
  "button",
1218
1005
  {
1219
1006
  ...buttonProps,
@@ -1240,10 +1027,10 @@ var FlexButton = ({
1240
1027
  tabIndex,
1241
1028
  style: buttonStyle,
1242
1029
  "data-testid": testID || "flex-button",
1243
- 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: [
1244
- iconLeft && /* @__PURE__ */ jsx10(Icon, { size: iconSize, color: colors.text, children: iconLeft }),
1245
- /* @__PURE__ */ jsx10("span", { children }),
1246
- iconRight && /* @__PURE__ */ jsx10(Icon, { size: iconSize, color: colors.text, children: iconRight })
1030
+ 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: [
1031
+ iconLeft && /* @__PURE__ */ jsx8(Icon, { size: iconSize, color: colors.text, children: iconLeft }),
1032
+ /* @__PURE__ */ jsx8("span", { children }),
1033
+ iconRight && /* @__PURE__ */ jsx8(Icon, { size: iconSize, color: colors.text, children: iconRight })
1247
1034
  ] }) })
1248
1035
  }
1249
1036
  );
@@ -1251,9 +1038,9 @@ var FlexButton = ({
1251
1038
  FlexButton.displayName = "FlexButton";
1252
1039
 
1253
1040
  // src/ButtonGroup.tsx
1254
- import React7 from "react";
1041
+ import React5 from "react";
1255
1042
  import { useDesignSystem as useDesignSystem4 } from "@xsolla/xui-core";
1256
- import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
1043
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1257
1044
  var ButtonGroup = ({
1258
1045
  orientation = "horizontal",
1259
1046
  size = "md",
@@ -1270,8 +1057,8 @@ var ButtonGroup = ({
1270
1057
  const { theme } = useDesignSystem4();
1271
1058
  const flattenChildren = (children2) => {
1272
1059
  const result = [];
1273
- React7.Children.forEach(children2, (child) => {
1274
- if (React7.isValidElement(child) && child.type === React7.Fragment) {
1060
+ React5.Children.forEach(children2, (child) => {
1061
+ if (React5.isValidElement(child) && child.type === React5.Fragment) {
1275
1062
  result.push(...flattenChildren(child.props.children));
1276
1063
  } else if (child !== null && child !== void 0) {
1277
1064
  result.push(child);
@@ -1307,8 +1094,8 @@ var ButtonGroup = ({
1307
1094
  const processChildren = (childrenToProcess) => {
1308
1095
  if (orientation === "vertical") {
1309
1096
  return childrenToProcess.map((child, index) => {
1310
- if (React7.isValidElement(child)) {
1311
- return React7.cloneElement(child, {
1097
+ if (React5.isValidElement(child)) {
1098
+ return React5.cloneElement(child, {
1312
1099
  ...child.props,
1313
1100
  fullWidth: true,
1314
1101
  key: child.key ?? index
@@ -1326,7 +1113,7 @@ var ButtonGroup = ({
1326
1113
  const restChildren = processedChildren.slice(1);
1327
1114
  return /* @__PURE__ */ jsxs4(Fragment2, { children: [
1328
1115
  firstChild,
1329
- /* @__PURE__ */ jsx11(Box, { flexDirection: "row", gap: computedGap, children: restChildren })
1116
+ /* @__PURE__ */ jsx9(Box, { flexDirection: "row", gap: computedGap, children: restChildren })
1330
1117
  ] });
1331
1118
  }
1332
1119
  if (orientation === "vertical") {
@@ -1335,7 +1122,7 @@ var ButtonGroup = ({
1335
1122
  return children;
1336
1123
  };
1337
1124
  return /* @__PURE__ */ jsxs4(Box, { flexDirection: "column", width: "100%", gap: 8, children: [
1338
- /* @__PURE__ */ jsx11(
1125
+ /* @__PURE__ */ jsx9(
1339
1126
  Box,
1340
1127
  {
1341
1128
  role: "group",
@@ -1352,7 +1139,7 @@ var ButtonGroup = ({
1352
1139
  children: renderChildren()
1353
1140
  }
1354
1141
  ),
1355
- error && /* @__PURE__ */ jsx11(Box, { marginTop: 4, children: /* @__PURE__ */ jsx11(
1142
+ error && /* @__PURE__ */ jsx9(Box, { marginTop: 4, children: /* @__PURE__ */ jsx9(
1356
1143
  Text,
1357
1144
  {
1358
1145
  id: errorId,
@@ -1365,7 +1152,7 @@ var ButtonGroup = ({
1365
1152
  children: error
1366
1153
  }
1367
1154
  ) }),
1368
- description && /* @__PURE__ */ jsx11(Box, { marginTop: 4, children: /* @__PURE__ */ jsx11(
1155
+ description && /* @__PURE__ */ jsx9(Box, { marginTop: 4, children: /* @__PURE__ */ jsx9(
1369
1156
  Text,
1370
1157
  {
1371
1158
  id: descriptionId,