@xsolla/xui-button 0.64.0-pr56.1768440195

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.js ADDED
@@ -0,0 +1,1227 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.tsx
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ Button: () => Button,
34
+ ButtonGroup: () => ButtonGroup,
35
+ FlexButton: () => FlexButton,
36
+ IconButton: () => IconButton
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+
40
+ // src/Button.tsx
41
+ var import_react4 = require("react");
42
+
43
+ // ../primitives-web/src/Box.tsx
44
+ var import_react = __toESM(require("react"));
45
+ var import_styled_components = __toESM(require("styled-components"));
46
+ var import_jsx_runtime = require("react/jsx-runtime");
47
+ var StyledBox = import_styled_components.default.div`
48
+ display: flex;
49
+ box-sizing: border-box;
50
+ background-color: ${(props) => props.backgroundColor || "transparent"};
51
+ border-color: ${(props) => props.borderColor || "transparent"};
52
+ border-width: ${(props) => typeof props.borderWidth === "number" ? `${props.borderWidth}px` : props.borderWidth || 0};
53
+
54
+ ${(props) => props.borderBottomWidth !== void 0 && `
55
+ border-bottom-width: ${typeof props.borderBottomWidth === "number" ? `${props.borderBottomWidth}px` : props.borderBottomWidth};
56
+ border-bottom-color: ${props.borderBottomColor || props.borderColor || "transparent"};
57
+ border-bottom-style: solid;
58
+ `}
59
+ ${(props) => props.borderTopWidth !== void 0 && `
60
+ border-top-width: ${typeof props.borderTopWidth === "number" ? `${props.borderTopWidth}px` : props.borderTopWidth};
61
+ border-top-color: ${props.borderTopColor || props.borderColor || "transparent"};
62
+ border-top-style: solid;
63
+ `}
64
+ ${(props) => props.borderLeftWidth !== void 0 && `
65
+ border-left-width: ${typeof props.borderLeftWidth === "number" ? `${props.borderLeftWidth}px` : props.borderLeftWidth};
66
+ border-left-color: ${props.borderLeftColor || props.borderColor || "transparent"};
67
+ border-left-style: solid;
68
+ `}
69
+ ${(props) => props.borderRightWidth !== void 0 && `
70
+ border-right-width: ${typeof props.borderRightWidth === "number" ? `${props.borderRightWidth}px` : props.borderRightWidth};
71
+ border-right-color: ${props.borderRightColor || props.borderColor || "transparent"};
72
+ border-right-style: solid;
73
+ `}
74
+
75
+ border-style: ${(props) => props.borderStyle || (props.borderWidth || props.borderBottomWidth || props.borderTopWidth || props.borderLeftWidth || props.borderRightWidth ? "solid" : "none")};
76
+ border-radius: ${(props) => typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius || 0};
77
+ height: ${(props) => typeof props.height === "number" ? `${props.height}px` : props.height || "auto"};
78
+ width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
79
+ min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
80
+ min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
81
+
82
+ padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
83
+ ${(props) => props.paddingHorizontal && `
84
+ padding-left: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
85
+ padding-right: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
86
+ `}
87
+ ${(props) => props.paddingVertical && `
88
+ padding-top: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
89
+ padding-bottom: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
90
+ `}
91
+ ${(props) => props.paddingTop !== void 0 && `padding-top: ${typeof props.paddingTop === "number" ? `${props.paddingTop}px` : props.paddingTop};`}
92
+ ${(props) => props.paddingBottom !== void 0 && `padding-bottom: ${typeof props.paddingBottom === "number" ? `${props.paddingBottom}px` : props.paddingBottom};`}
93
+ ${(props) => props.paddingLeft !== void 0 && `padding-left: ${typeof props.paddingLeft === "number" ? `${props.paddingLeft}px` : props.paddingLeft};`}
94
+ ${(props) => props.paddingRight !== void 0 && `padding-right: ${typeof props.paddingRight === "number" ? `${props.paddingRight}px` : props.paddingRight};`}
95
+
96
+ margin: ${(props) => typeof props.margin === "number" ? `${props.margin}px` : props.margin || 0};
97
+ ${(props) => props.marginTop !== void 0 && `margin-top: ${typeof props.marginTop === "number" ? `${props.marginTop}px` : props.marginTop};`}
98
+ ${(props) => props.marginBottom !== void 0 && `margin-bottom: ${typeof props.marginBottom === "number" ? `${props.marginBottom}px` : props.marginBottom};`}
99
+ ${(props) => props.marginLeft !== void 0 && `margin-left: ${typeof props.marginLeft === "number" ? `${props.marginLeft}px` : props.marginLeft};`}
100
+ ${(props) => props.marginRight !== void 0 && `margin-right: ${typeof props.marginRight === "number" ? `${props.marginRight}px` : props.marginRight};`}
101
+
102
+ flex-direction: ${(props) => props.flexDirection || "column"};
103
+ flex-wrap: ${(props) => props.flexWrap || "nowrap"};
104
+ align-items: ${(props) => props.alignItems || "stretch"};
105
+ justify-content: ${(props) => props.justifyContent || "flex-start"};
106
+ cursor: ${(props) => props.cursor ? props.cursor : props.onClick || props.onPress ? "pointer" : "inherit"};
107
+ position: ${(props) => props.position || "static"};
108
+ top: ${(props) => typeof props.top === "number" ? `${props.top}px` : props.top};
109
+ bottom: ${(props) => typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom};
110
+ left: ${(props) => typeof props.left === "number" ? `${props.left}px` : props.left};
111
+ right: ${(props) => typeof props.right === "number" ? `${props.right}px` : props.right};
112
+ flex: ${(props) => props.flex};
113
+ flex-shrink: ${(props) => props.flexShrink ?? 1};
114
+ gap: ${(props) => typeof props.gap === "number" ? `${props.gap}px` : props.gap || 0};
115
+ align-self: ${(props) => props.alignSelf || "auto"};
116
+ overflow: ${(props) => props.overflow || "visible"};
117
+ overflow-x: ${(props) => props.overflowX || "visible"};
118
+ overflow-y: ${(props) => props.overflowY || "visible"};
119
+ z-index: ${(props) => props.zIndex};
120
+ opacity: ${(props) => props.disabled ? 0.5 : 1};
121
+ pointer-events: ${(props) => props.disabled ? "none" : "auto"};
122
+
123
+ &:hover {
124
+ ${(props) => props.hoverStyle?.backgroundColor && `background-color: ${props.hoverStyle.backgroundColor};`}
125
+ ${(props) => props.hoverStyle?.borderColor && `border-color: ${props.hoverStyle.borderColor};`}
126
+ }
127
+
128
+ &:active {
129
+ ${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
130
+ }
131
+ `;
132
+ var Box = import_react.default.forwardRef(
133
+ ({
134
+ children,
135
+ onPress,
136
+ onKeyDown,
137
+ onKeyUp,
138
+ role,
139
+ "aria-label": ariaLabel,
140
+ "aria-labelledby": ariaLabelledBy,
141
+ "aria-current": ariaCurrent,
142
+ "aria-disabled": ariaDisabled,
143
+ "aria-live": ariaLive,
144
+ "aria-busy": ariaBusy,
145
+ "aria-describedby": ariaDescribedBy,
146
+ "aria-expanded": ariaExpanded,
147
+ "aria-haspopup": ariaHasPopup,
148
+ "aria-pressed": ariaPressed,
149
+ "aria-controls": ariaControls,
150
+ tabIndex,
151
+ as,
152
+ src,
153
+ alt,
154
+ type,
155
+ disabled,
156
+ id,
157
+ ...props
158
+ }, ref) => {
159
+ if (as === "img" && src) {
160
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
161
+ "img",
162
+ {
163
+ src,
164
+ alt: alt || "",
165
+ style: {
166
+ display: "block",
167
+ objectFit: "cover",
168
+ width: typeof props.width === "number" ? `${props.width}px` : props.width,
169
+ height: typeof props.height === "number" ? `${props.height}px` : props.height,
170
+ borderRadius: typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius,
171
+ position: props.position,
172
+ top: typeof props.top === "number" ? `${props.top}px` : props.top,
173
+ left: typeof props.left === "number" ? `${props.left}px` : props.left,
174
+ right: typeof props.right === "number" ? `${props.right}px` : props.right,
175
+ bottom: typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom
176
+ }
177
+ }
178
+ );
179
+ }
180
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
181
+ StyledBox,
182
+ {
183
+ ref,
184
+ as,
185
+ id,
186
+ type: as === "button" ? type || "button" : void 0,
187
+ disabled: as === "button" ? disabled : void 0,
188
+ onClick: onPress,
189
+ onKeyDown,
190
+ onKeyUp,
191
+ role,
192
+ "aria-label": ariaLabel,
193
+ "aria-labelledby": ariaLabelledBy,
194
+ "aria-current": ariaCurrent,
195
+ "aria-disabled": ariaDisabled,
196
+ "aria-busy": ariaBusy,
197
+ "aria-describedby": ariaDescribedBy,
198
+ "aria-expanded": ariaExpanded,
199
+ "aria-haspopup": ariaHasPopup,
200
+ "aria-pressed": ariaPressed,
201
+ "aria-controls": ariaControls,
202
+ "aria-live": ariaLive,
203
+ tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
204
+ ...props,
205
+ children
206
+ }
207
+ );
208
+ }
209
+ );
210
+ Box.displayName = "Box";
211
+
212
+ // ../primitives-web/src/Text.tsx
213
+ var import_styled_components2 = __toESM(require("styled-components"));
214
+ var import_jsx_runtime2 = require("react/jsx-runtime");
215
+ var StyledText = import_styled_components2.default.span`
216
+ color: ${(props) => props.color || "inherit"};
217
+ font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
218
+ font-weight: ${(props) => props.fontWeight || "normal"};
219
+ font-family: ${(props) => props.fontFamily || '"Pilat Wide Bold", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important'};
220
+ line-height: ${(props) => typeof props.lineHeight === "number" ? `${props.lineHeight}px` : props.lineHeight || "inherit"};
221
+ white-space: ${(props) => props.whiteSpace || "normal"};
222
+ text-align: ${(props) => props.textAlign || "inherit"};
223
+ text-decoration: ${(props) => props.textDecoration || "none"};
224
+ `;
225
+ var Text = ({
226
+ style,
227
+ className,
228
+ id,
229
+ role,
230
+ ...props
231
+ }) => {
232
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
233
+ StyledText,
234
+ {
235
+ ...props,
236
+ style,
237
+ className,
238
+ id,
239
+ role
240
+ }
241
+ );
242
+ };
243
+
244
+ // ../primitives-web/src/Spinner.tsx
245
+ var import_styled_components3 = __toESM(require("styled-components"));
246
+ var import_jsx_runtime3 = require("react/jsx-runtime");
247
+ var rotate = import_styled_components3.keyframes`
248
+ from {
249
+ transform: rotate(0deg);
250
+ }
251
+ to {
252
+ transform: rotate(360deg);
253
+ }
254
+ `;
255
+ var StyledSpinner = import_styled_components3.default.div`
256
+ width: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
257
+ height: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
258
+ border: ${(props) => props.strokeWidth || 2}px solid
259
+ ${(props) => props.color || "currentColor"};
260
+ border-bottom-color: transparent;
261
+ border-radius: 50%;
262
+ display: inline-block;
263
+ box-sizing: border-box;
264
+ animation: ${rotate} 1s linear infinite;
265
+ `;
266
+ var Spinner = ({
267
+ role = "status",
268
+ "aria-label": ariaLabel,
269
+ "aria-live": ariaLive = "polite",
270
+ "aria-describedby": ariaDescribedBy,
271
+ testID,
272
+ ...props
273
+ }) => {
274
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
275
+ StyledSpinner,
276
+ {
277
+ role,
278
+ "aria-label": ariaLabel,
279
+ "aria-live": ariaLive,
280
+ "aria-describedby": ariaDescribedBy,
281
+ "data-testid": testID,
282
+ ...props
283
+ }
284
+ );
285
+ };
286
+ Spinner.displayName = "Spinner";
287
+
288
+ // ../primitives-web/src/Icon.tsx
289
+ var import_styled_components4 = __toESM(require("styled-components"));
290
+ var import_jsx_runtime4 = require("react/jsx-runtime");
291
+ var StyledIcon = import_styled_components4.default.div`
292
+ display: flex;
293
+ align-items: center;
294
+ justify-content: center;
295
+ width: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
296
+ height: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
297
+ color: ${(props) => props.color || "currentColor"};
298
+
299
+ svg {
300
+ width: 100%;
301
+ height: 100%;
302
+ fill: none;
303
+ stroke: currentColor;
304
+ }
305
+ `;
306
+ var Icon = ({ children, ...props }) => {
307
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StyledIcon, { ...props, children });
308
+ };
309
+
310
+ // ../primitives-web/src/Divider.tsx
311
+ var import_styled_components5 = __toESM(require("styled-components"));
312
+ var import_jsx_runtime5 = require("react/jsx-runtime");
313
+ var StyledDivider = import_styled_components5.default.div`
314
+ background-color: ${(props) => props.dashStroke ? "transparent" : props.color || "rgba(255, 255, 255, 0.15)"};
315
+ width: ${(props) => props.vertical ? typeof props.width === "number" ? `${props.width}px` : props.width || "1px" : "100%"};
316
+ height: ${(props) => props.vertical ? "100%" : typeof props.height === "number" ? `${props.height}px` : props.height || "1px"};
317
+
318
+ ${(props) => props.dashStroke && `
319
+ border-style: dashed;
320
+ border-color: ${props.color || "rgba(255, 255, 255, 0.15)"};
321
+ border-width: 0;
322
+ ${props.vertical ? `
323
+ border-left-width: ${typeof props.width === "number" ? `${props.width}px` : props.width || "1px"};
324
+ height: 100%;
325
+ ` : `
326
+ border-top-width: ${typeof props.height === "number" ? `${props.height}px` : props.height || "1px"};
327
+ width: 100%;
328
+ `}
329
+ `}
330
+ `;
331
+ var Divider = (props) => {
332
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StyledDivider, { ...props });
333
+ };
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
+ // src/Button.tsx
498
+ var import_xui_core = require("@xsolla/xui-core");
499
+ var import_jsx_runtime8 = require("react/jsx-runtime");
500
+ var Button = ({
501
+ variant = "primary",
502
+ tone = "brand",
503
+ size = "m",
504
+ disabled = false,
505
+ loading = false,
506
+ children,
507
+ onPress,
508
+ iconLeft,
509
+ iconRight,
510
+ "aria-label": ariaLabel,
511
+ "aria-describedby": ariaDescribedBy,
512
+ "aria-expanded": ariaExpanded,
513
+ "aria-haspopup": ariaHasPopup,
514
+ "aria-pressed": ariaPressed,
515
+ "aria-controls": ariaControls,
516
+ testID,
517
+ id,
518
+ type = "button",
519
+ fullWidth = false
520
+ }) => {
521
+ const { theme } = (0, import_xui_core.useDesignSystem)();
522
+ const [isKeyboardPressed, setIsKeyboardPressed] = (0, import_react4.useState)(false);
523
+ const isDisabled = disabled || loading;
524
+ const sizeStyles = theme.sizing.button(size);
525
+ const variantStyles = theme?.colors?.control?.[tone]?.[variant] || theme?.colors?.control?.brand?.primary || {
526
+ bg: "transparent",
527
+ text: { primary: "#000" }
528
+ };
529
+ const handlePress = () => {
530
+ if (!isDisabled && onPress) {
531
+ onPress();
532
+ }
533
+ };
534
+ const handleKeyDown = (e) => {
535
+ if (isDisabled) return;
536
+ if (e.key === "Enter" || e.key === " ") {
537
+ e.preventDefault();
538
+ setIsKeyboardPressed(true);
539
+ }
540
+ };
541
+ const handleKeyUp = (e) => {
542
+ if (isDisabled) return;
543
+ if (e.key === "Enter" || e.key === " ") {
544
+ e.preventDefault();
545
+ setIsKeyboardPressed(false);
546
+ if (onPress) {
547
+ onPress();
548
+ }
549
+ }
550
+ };
551
+ const styles = variantStyles;
552
+ let backgroundColor = styles.bg;
553
+ if (disabled) {
554
+ backgroundColor = styles.bgDisable || styles.bg;
555
+ } else if (isKeyboardPressed) {
556
+ backgroundColor = styles.bgPress || styles.bg;
557
+ }
558
+ const borderColor = disabled ? styles.borderDisable || styles.border : styles.border;
559
+ const textColor = disabled ? styles.text?.disable || styles.text?.primary : styles.text?.primary;
560
+ const isDarkText = textColor === "#000000" || textColor === "black" || textColor.startsWith("rgba(0, 0, 0");
561
+ const dividerColor = isDarkText ? "rgba(0, 0, 0, 0.2)" : "rgba(255, 255, 255, 0.2)";
562
+ const computedAriaLabel = ariaLabel || (typeof children === "string" ? children : void 0);
563
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
564
+ Box,
565
+ {
566
+ as: "button",
567
+ type,
568
+ id,
569
+ onPress: handlePress,
570
+ onKeyDown: handleKeyDown,
571
+ onKeyUp: handleKeyUp,
572
+ disabled: isDisabled,
573
+ "aria-label": computedAriaLabel,
574
+ "aria-disabled": isDisabled || void 0,
575
+ "aria-busy": loading || void 0,
576
+ "aria-describedby": ariaDescribedBy,
577
+ "aria-expanded": ariaExpanded,
578
+ "aria-haspopup": ariaHasPopup,
579
+ "aria-pressed": ariaPressed,
580
+ "aria-controls": ariaControls,
581
+ testID,
582
+ backgroundColor,
583
+ borderColor,
584
+ borderWidth: borderColor !== "transparent" && borderColor !== "rgba(255, 255, 255, 0)" ? 1 : 0,
585
+ borderRadius: theme.radius.button,
586
+ height: sizeStyles.height,
587
+ width: fullWidth ? "100%" : void 0,
588
+ padding: 0,
589
+ flexDirection: "row",
590
+ alignItems: "center",
591
+ justifyContent: "center",
592
+ position: "relative",
593
+ cursor: disabled ? "not-allowed" : loading ? "wait" : "pointer",
594
+ opacity: disabled ? 0.6 : 1,
595
+ hoverStyle: !isDisabled ? {
596
+ backgroundColor: variantStyles?.bgHover
597
+ } : void 0,
598
+ pressStyle: !isDisabled ? {
599
+ backgroundColor: variantStyles?.bgPress
600
+ } : void 0,
601
+ focusStyle: {
602
+ outlineColor: theme.colors.border.brand,
603
+ outlineWidth: 2,
604
+ outlineOffset: 2,
605
+ outlineStyle: "solid"
606
+ },
607
+ children: [
608
+ !loading && iconLeft && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
609
+ Box,
610
+ {
611
+ height: "100%",
612
+ flexDirection: "row",
613
+ alignItems: "center",
614
+ justifyContent: "center",
615
+ "aria-hidden": true,
616
+ children: [
617
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
618
+ Box,
619
+ {
620
+ alignItems: "center",
621
+ justifyContent: "center",
622
+ paddingHorizontal: sizeStyles.iconPadding,
623
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { size: sizeStyles.iconSize, color: textColor, children: iconLeft })
624
+ }
625
+ ),
626
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Divider, { vertical: true, color: dividerColor, height: "100%" })
627
+ ]
628
+ }
629
+ ),
630
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
631
+ Box,
632
+ {
633
+ flex: fullWidth ? 1 : void 0,
634
+ flexDirection: "row",
635
+ alignItems: "center",
636
+ justifyContent: "center",
637
+ paddingHorizontal: loading ? sizeStyles.loadingPadding : sizeStyles.padding,
638
+ height: "100%",
639
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
640
+ Spinner,
641
+ {
642
+ color: textColor,
643
+ size: sizeStyles.spinnerSize,
644
+ "aria-hidden": true
645
+ }
646
+ ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
647
+ Text,
648
+ {
649
+ color: textColor,
650
+ fontSize: sizeStyles.fontSize,
651
+ fontWeight: "500",
652
+ "aria-hidden": computedAriaLabel ? true : void 0,
653
+ children
654
+ }
655
+ )
656
+ }
657
+ ),
658
+ !loading && iconRight && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
659
+ Box,
660
+ {
661
+ height: "100%",
662
+ flexDirection: "row",
663
+ alignItems: "center",
664
+ justifyContent: "center",
665
+ "aria-hidden": true,
666
+ children: [
667
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Divider, { vertical: true, color: dividerColor, height: "100%" }),
668
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
669
+ Box,
670
+ {
671
+ alignItems: "center",
672
+ justifyContent: "center",
673
+ paddingHorizontal: sizeStyles.iconPadding,
674
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { size: sizeStyles.iconSize, color: textColor, children: iconRight })
675
+ }
676
+ )
677
+ ]
678
+ }
679
+ )
680
+ ]
681
+ }
682
+ );
683
+ };
684
+ Button.displayName = "Button";
685
+
686
+ // src/IconButton.tsx
687
+ var import_react5 = require("react");
688
+ var import_xui_core2 = require("@xsolla/xui-core");
689
+ var import_jsx_runtime9 = require("react/jsx-runtime");
690
+ var IconButton = ({
691
+ variant = "primary",
692
+ tone = "brand",
693
+ size = "m",
694
+ disabled = false,
695
+ loading = false,
696
+ icon,
697
+ onPress,
698
+ "aria-label": ariaLabel,
699
+ "aria-describedby": ariaDescribedBy,
700
+ "aria-expanded": ariaExpanded,
701
+ "aria-haspopup": ariaHasPopup,
702
+ "aria-pressed": ariaPressed,
703
+ "aria-controls": ariaControls,
704
+ testID,
705
+ id,
706
+ type = "button"
707
+ }) => {
708
+ const { theme } = (0, import_xui_core2.useDesignSystem)();
709
+ const [isKeyboardPressed, setIsKeyboardPressed] = (0, import_react5.useState)(false);
710
+ const isDisabled = disabled || loading;
711
+ const sizeStyles = theme.sizing.button(size);
712
+ const variantStyles = theme?.colors?.control?.[tone]?.[variant] || theme?.colors?.control?.brand?.primary || {
713
+ bg: "transparent",
714
+ text: { primary: "#000" }
715
+ };
716
+ const handlePress = () => {
717
+ if (!isDisabled && onPress) {
718
+ onPress();
719
+ }
720
+ };
721
+ const handleKeyDown = (e) => {
722
+ if (isDisabled) return;
723
+ if (e.key === "Enter" || e.key === " ") {
724
+ e.preventDefault();
725
+ setIsKeyboardPressed(true);
726
+ }
727
+ };
728
+ const handleKeyUp = (e) => {
729
+ if (isDisabled) return;
730
+ if (e.key === "Enter" || e.key === " ") {
731
+ e.preventDefault();
732
+ setIsKeyboardPressed(false);
733
+ if (onPress) {
734
+ onPress();
735
+ }
736
+ }
737
+ };
738
+ const styles = variantStyles;
739
+ let backgroundColor = styles.bg;
740
+ if (disabled) {
741
+ backgroundColor = styles.bgDisable || styles.bg;
742
+ } else if (isKeyboardPressed) {
743
+ backgroundColor = styles.bgPress || styles.bg;
744
+ }
745
+ const borderColor = disabled ? styles.borderDisable || styles.border : styles.border;
746
+ const textColor = disabled ? styles.text?.disable || styles.text?.primary : styles.text?.primary;
747
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
748
+ Box,
749
+ {
750
+ as: "button",
751
+ type,
752
+ id,
753
+ onPress: handlePress,
754
+ onKeyDown: handleKeyDown,
755
+ onKeyUp: handleKeyUp,
756
+ disabled: isDisabled,
757
+ "aria-label": ariaLabel,
758
+ "aria-disabled": isDisabled || void 0,
759
+ "aria-busy": loading || void 0,
760
+ "aria-describedby": ariaDescribedBy,
761
+ "aria-expanded": ariaExpanded,
762
+ "aria-haspopup": ariaHasPopup,
763
+ "aria-pressed": ariaPressed,
764
+ "aria-controls": ariaControls,
765
+ testID,
766
+ backgroundColor,
767
+ borderColor,
768
+ borderWidth: borderColor !== "transparent" && borderColor !== "rgba(255, 255, 255, 0)" ? 1 : 0,
769
+ borderRadius: theme.radius.button,
770
+ height: sizeStyles.height,
771
+ width: sizeStyles.height,
772
+ padding: 0,
773
+ flexDirection: "row",
774
+ alignItems: "center",
775
+ justifyContent: "center",
776
+ position: "relative",
777
+ cursor: disabled ? "not-allowed" : loading ? "wait" : "pointer",
778
+ opacity: disabled ? 0.6 : 1,
779
+ hoverStyle: !isDisabled ? {
780
+ backgroundColor: styles.bgHover
781
+ } : void 0,
782
+ pressStyle: !isDisabled ? {
783
+ backgroundColor: styles.bgPress
784
+ } : void 0,
785
+ focusStyle: {
786
+ outlineColor: theme.colors.border.brand,
787
+ outlineWidth: 2,
788
+ outlineOffset: 2,
789
+ outlineStyle: "solid"
790
+ },
791
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
792
+ Spinner,
793
+ {
794
+ color: textColor,
795
+ size: sizeStyles.spinnerSize,
796
+ "aria-hidden": true
797
+ }
798
+ ) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { size: sizeStyles.iconSize, color: textColor, "aria-hidden": true, children: icon })
799
+ }
800
+ );
801
+ };
802
+ IconButton.displayName = "IconButton";
803
+
804
+ // src/FlexButton.tsx
805
+ var import_react6 = require("react");
806
+ var import_xui_core3 = require("@xsolla/xui-core");
807
+ var import_jsx_runtime10 = require("react/jsx-runtime");
808
+ var ICON_SIZES = {
809
+ xs: 12,
810
+ s: 14,
811
+ m: 16,
812
+ l: 18,
813
+ xl: 20
814
+ };
815
+ var SPINNER_SIZES = {
816
+ xs: 12,
817
+ s: 14,
818
+ m: 16,
819
+ l: 18,
820
+ xl: 20
821
+ };
822
+ var LINE_HEIGHTS = {
823
+ xs: "14px",
824
+ s: "16px",
825
+ m: "18px",
826
+ l: "20px",
827
+ xl: "22px"
828
+ };
829
+ var FONT_SIZES = {
830
+ xs: 12,
831
+ s: 14,
832
+ m: 14,
833
+ l: 16,
834
+ xl: 18
835
+ };
836
+ var BORDER_RADIUS = {
837
+ xl: 4,
838
+ l: 4,
839
+ m: 2,
840
+ s: 2,
841
+ xs: 2
842
+ };
843
+ var FlexButton = ({
844
+ children,
845
+ variant = "brand",
846
+ size = "m",
847
+ background = false,
848
+ disabled = false,
849
+ loading = false,
850
+ iconLeft,
851
+ iconRight,
852
+ onPress,
853
+ onClick,
854
+ className,
855
+ type = "button",
856
+ "aria-label": ariaLabel,
857
+ "aria-describedby": ariaDescribedBy,
858
+ "aria-expanded": ariaExpanded,
859
+ "aria-haspopup": ariaHasPopup,
860
+ "aria-pressed": ariaPressed,
861
+ "aria-controls": ariaControls,
862
+ testID,
863
+ tabIndex = 0,
864
+ ...buttonProps
865
+ }) => {
866
+ const { theme } = (0, import_xui_core3.useDesignSystem)();
867
+ const [state, setState] = (0, import_react6.useState)("default");
868
+ const [isFocused, setIsFocused] = (0, import_react6.useState)(false);
869
+ const isMouseOverRef = (0, import_react6.useRef)(false);
870
+ const isDisabled = disabled || loading;
871
+ const getVariantColors = (currentState) => {
872
+ if (isDisabled) {
873
+ return {
874
+ bg: background ? theme.colors.overlay.mono : "transparent",
875
+ text: theme.colors.control.text.disable,
876
+ border: void 0
877
+ };
878
+ }
879
+ const effectiveBackground = loading ? false : background;
880
+ switch (variant) {
881
+ case "brand":
882
+ if (effectiveBackground) {
883
+ return {
884
+ bg: currentState === "press" ? theme.colors.control.brand.primary.bgPress : currentState === "hover" ? theme.colors.control.brand.primary.bgHover : theme.colors.background.brand.primary,
885
+ text: theme.colors.content.on.brand,
886
+ border: void 0
887
+ };
888
+ }
889
+ return {
890
+ bg: currentState === "press" ? theme.colors.background.brand.primary : currentState === "hover" ? theme.colors.overlay.brand : "transparent",
891
+ text: currentState === "press" ? theme.colors.content.on.brand : theme.colors.content.brand.primary,
892
+ border: void 0
893
+ };
894
+ case "primary":
895
+ if (effectiveBackground) {
896
+ return {
897
+ bg: theme.colors.background.primary,
898
+ text: theme.colors.content.primary,
899
+ border: currentState === "press" ? theme.colors.border.primary : void 0
900
+ };
901
+ }
902
+ return {
903
+ bg: currentState === "press" || currentState === "hover" ? theme.colors.overlay.mono : "transparent",
904
+ text: theme.colors.content.primary,
905
+ border: currentState === "press" ? theme.colors.border.primary : void 0
906
+ };
907
+ case "secondary":
908
+ if (effectiveBackground) {
909
+ return {
910
+ bg: currentState === "press" ? theme.colors.control.mono.secondary.bgPress : currentState === "hover" ? theme.colors.control.mono.secondary.bgHover : theme.colors.background.secondary,
911
+ text: theme.colors.content.secondary,
912
+ border: void 0
913
+ };
914
+ }
915
+ return {
916
+ bg: currentState === "press" || currentState === "hover" ? theme.colors.overlay.mono : "transparent",
917
+ text: currentState === "press" ? theme.colors.content.primary : currentState === "hover" ? theme.colors.content.secondary : theme.colors.content.secondary,
918
+ border: void 0
919
+ };
920
+ case "tertiary":
921
+ if (effectiveBackground) {
922
+ return {
923
+ bg: currentState === "press" ? theme.colors.control.mono.secondary.bgPress : currentState === "hover" ? theme.colors.control.mono.secondary.bgHover : theme.colors.background.secondary,
924
+ text: theme.colors.content.tertiary,
925
+ border: void 0
926
+ };
927
+ }
928
+ return {
929
+ bg: currentState === "press" || currentState === "hover" ? theme.colors.overlay.mono : "transparent",
930
+ text: currentState === "press" ? theme.colors.content.secondary : currentState === "hover" ? theme.colors.content.tertiary : theme.colors.content.tertiary,
931
+ border: void 0
932
+ };
933
+ case "brandExtra":
934
+ if (effectiveBackground) {
935
+ return {
936
+ bg: currentState === "press" ? theme.colors.control.brandExtra.primary.bgPress : currentState === "hover" ? theme.colors.control.brandExtra.primary.bgHover : theme.colors.background.brandExtra.primary,
937
+ text: theme.colors.content.on.brandExtra,
938
+ border: void 0
939
+ };
940
+ }
941
+ return {
942
+ bg: currentState === "press" ? theme.colors.background.brandExtra.primary : currentState === "hover" ? theme.colors.overlay.brandExtra : "transparent",
943
+ text: currentState === "press" ? theme.colors.content.on.brandExtra : theme.colors.content.brandExtra.secondary,
944
+ border: void 0
945
+ };
946
+ case "inverse":
947
+ if (effectiveBackground) {
948
+ return {
949
+ bg: currentState === "press" ? theme.colors.control.mono.primary.bgPress : currentState === "hover" ? theme.colors.control.mono.primary.bgHover : theme.colors.background.inverse,
950
+ text: theme.colors.content.inverse,
951
+ border: void 0
952
+ };
953
+ }
954
+ return {
955
+ bg: currentState === "press" || currentState === "hover" ? theme.colors.overlay.mono : "transparent",
956
+ text: theme.colors.content.inverse,
957
+ border: void 0
958
+ };
959
+ default:
960
+ return {
961
+ bg: "transparent",
962
+ text: theme.colors.content.primary,
963
+ border: void 0
964
+ };
965
+ }
966
+ };
967
+ const getFocusRingColor = () => {
968
+ switch (variant) {
969
+ case "brand":
970
+ return theme.colors.overlay.brand;
971
+ case "brandExtra":
972
+ return theme.colors.overlay.brandExtra;
973
+ case "inverse":
974
+ return "rgba(255, 255, 255, 0.3)";
975
+ default:
976
+ return theme.colors.overlay.mono;
977
+ }
978
+ };
979
+ const getSpinnerColor = () => {
980
+ switch (variant) {
981
+ case "brand":
982
+ return theme.colors.content.brand.primary;
983
+ case "primary":
984
+ return theme.colors.content.primary;
985
+ case "secondary":
986
+ return theme.colors.content.secondary;
987
+ case "tertiary":
988
+ return theme.colors.content.tertiary;
989
+ case "brandExtra":
990
+ return theme.colors.content.brandExtra.secondary;
991
+ case "inverse":
992
+ return theme.colors.content.inverse;
993
+ default:
994
+ return theme.colors.content.brand.primary;
995
+ }
996
+ };
997
+ const colors = getVariantColors(state);
998
+ const focusRingColor = getFocusRingColor();
999
+ const spinnerColor = getSpinnerColor();
1000
+ const iconSize = ICON_SIZES[size];
1001
+ const spinnerSize = SPINNER_SIZES[size];
1002
+ const fontSize = FONT_SIZES[size];
1003
+ const borderRadius = BORDER_RADIUS[size];
1004
+ const lineHeight = LINE_HEIGHTS[size];
1005
+ const handleMouseEnter = () => {
1006
+ if (!isDisabled) {
1007
+ isMouseOverRef.current = true;
1008
+ setState("hover");
1009
+ }
1010
+ };
1011
+ const handleMouseLeave = () => {
1012
+ if (!isDisabled) {
1013
+ isMouseOverRef.current = false;
1014
+ setState("default");
1015
+ }
1016
+ };
1017
+ const handleMouseDown = () => {
1018
+ if (!isDisabled) {
1019
+ setState("press");
1020
+ }
1021
+ };
1022
+ const handleMouseUp = () => {
1023
+ if (!isDisabled) {
1024
+ setState(isMouseOverRef.current ? "hover" : "default");
1025
+ }
1026
+ };
1027
+ const handleFocus = () => {
1028
+ if (!isDisabled) {
1029
+ setIsFocused(true);
1030
+ }
1031
+ };
1032
+ const handleBlur = () => {
1033
+ setIsFocused(false);
1034
+ };
1035
+ const handleClick = (event) => {
1036
+ if (isDisabled) return;
1037
+ if (onPress) {
1038
+ onPress();
1039
+ }
1040
+ if (onClick) {
1041
+ onClick(event);
1042
+ }
1043
+ };
1044
+ const handleKeyDown = (event) => {
1045
+ if (isDisabled) return;
1046
+ if (event.key === "Enter" || event.key === " ") {
1047
+ event.preventDefault();
1048
+ setState("press");
1049
+ }
1050
+ };
1051
+ const handleKeyUp = (event) => {
1052
+ if (isDisabled) return;
1053
+ if (event.key === "Enter" || event.key === " ") {
1054
+ event.preventDefault();
1055
+ setState(isMouseOverRef.current ? "hover" : "default");
1056
+ if (onPress) {
1057
+ onPress();
1058
+ }
1059
+ }
1060
+ };
1061
+ const borderShadow = colors.border ? `inset 0 0 0 1px ${colors.border}` : void 0;
1062
+ const focusShadow = isFocused && !isDisabled ? `0 0 0 2px ${focusRingColor}` : void 0;
1063
+ const boxShadows = [];
1064
+ if (borderShadow) boxShadows.push(borderShadow);
1065
+ if (focusShadow) boxShadows.push(focusShadow);
1066
+ const combinedBoxShadow = boxShadows.length > 0 ? boxShadows.join(", ") : "none";
1067
+ const buttonStyle = {
1068
+ display: "inline-flex",
1069
+ alignItems: "center",
1070
+ justifyContent: "center",
1071
+ gap: "2px",
1072
+ padding: "4px",
1073
+ backgroundColor: loading ? "transparent" : colors.bg,
1074
+ color: colors.text,
1075
+ border: "none",
1076
+ borderWidth: "0px",
1077
+ borderRadius: `${borderRadius}px`,
1078
+ cursor: isDisabled ? "not-allowed" : "pointer",
1079
+ fontSize: `${fontSize}px`,
1080
+ fontWeight: 500,
1081
+ lineHeight,
1082
+ fontFamily: "inherit",
1083
+ transition: "background-color 100ms ease-in-out, color 100ms ease-in-out, box-shadow 100ms ease-in-out",
1084
+ outline: "none",
1085
+ boxShadow: combinedBoxShadow,
1086
+ opacity: isDisabled && !loading ? 0.6 : 1
1087
+ };
1088
+ const contentStyle = {
1089
+ display: "flex",
1090
+ alignItems: "center",
1091
+ justifyContent: "center",
1092
+ gap: "2px"
1093
+ };
1094
+ const spinnerStyle = {
1095
+ display: "flex",
1096
+ alignItems: "center",
1097
+ justifyContent: "center",
1098
+ backgroundColor: "transparent",
1099
+ height: lineHeight
1100
+ };
1101
+ const computedAriaLabel = ariaLabel || (typeof children === "string" ? children : void 0);
1102
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1103
+ "button",
1104
+ {
1105
+ ...buttonProps,
1106
+ type,
1107
+ className,
1108
+ disabled: isDisabled,
1109
+ onClick: handleClick,
1110
+ onMouseEnter: handleMouseEnter,
1111
+ onMouseLeave: handleMouseLeave,
1112
+ onMouseDown: handleMouseDown,
1113
+ onMouseUp: handleMouseUp,
1114
+ onKeyDown: handleKeyDown,
1115
+ onKeyUp: handleKeyUp,
1116
+ onFocus: handleFocus,
1117
+ onBlur: handleBlur,
1118
+ "aria-label": computedAriaLabel,
1119
+ "aria-busy": loading || void 0,
1120
+ "aria-disabled": isDisabled || void 0,
1121
+ "aria-describedby": ariaDescribedBy,
1122
+ "aria-expanded": ariaExpanded,
1123
+ "aria-haspopup": ariaHasPopup,
1124
+ "aria-pressed": ariaPressed,
1125
+ "aria-controls": ariaControls,
1126
+ tabIndex,
1127
+ style: buttonStyle,
1128
+ "data-testid": testID || "flex-button",
1129
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: contentStyle, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: spinnerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Spinner, { size: spinnerSize, color: spinnerColor }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1130
+ iconLeft && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { size: iconSize, color: colors.text, children: iconLeft }),
1131
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children }),
1132
+ iconRight && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { size: iconSize, color: colors.text, children: iconRight })
1133
+ ] }) })
1134
+ }
1135
+ );
1136
+ };
1137
+ FlexButton.displayName = "FlexButton";
1138
+
1139
+ // src/ButtonGroup.tsx
1140
+ var import_xui_core4 = require("@xsolla/xui-core");
1141
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1142
+ var ButtonGroup = ({
1143
+ orientation = "horizontal",
1144
+ size = "m",
1145
+ children,
1146
+ description,
1147
+ error,
1148
+ gap,
1149
+ "aria-label": ariaLabel,
1150
+ "aria-labelledby": ariaLabelledBy,
1151
+ "aria-describedby": ariaDescribedBy,
1152
+ id,
1153
+ testID
1154
+ }) => {
1155
+ const { theme } = (0, import_xui_core4.useDesignSystem)();
1156
+ const verticalGapMap = {
1157
+ xl: 16,
1158
+ l: 16,
1159
+ m: 12,
1160
+ s: 8,
1161
+ xs: 4
1162
+ };
1163
+ const horizontalGapMap = {
1164
+ xl: 16,
1165
+ l: 16,
1166
+ m: 16,
1167
+ s: 12,
1168
+ xs: 12
1169
+ };
1170
+ const computedGap = gap ?? (orientation === "vertical" ? verticalGapMap[size] : horizontalGapMap[size]);
1171
+ const descriptionId = id ? `${id}-description` : void 0;
1172
+ const errorId = id ? `${id}-error` : void 0;
1173
+ const computedAriaDescribedBy = [
1174
+ ariaDescribedBy,
1175
+ error && errorId ? errorId : void 0,
1176
+ description && !error && descriptionId ? descriptionId : void 0
1177
+ ].filter(Boolean).join(" ") || void 0;
1178
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Box, { flexDirection: "column", width: "100%", gap: 8, children: [
1179
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1180
+ Box,
1181
+ {
1182
+ role: "group",
1183
+ "aria-label": ariaLabel,
1184
+ "aria-labelledby": ariaLabelledBy,
1185
+ "aria-describedby": computedAriaDescribedBy,
1186
+ id,
1187
+ testID,
1188
+ flexDirection: orientation === "horizontal" ? "row" : "column",
1189
+ alignItems: "stretch",
1190
+ gap: computedGap,
1191
+ width: "100%",
1192
+ children
1193
+ }
1194
+ ),
1195
+ error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { marginTop: 4, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1196
+ Text,
1197
+ {
1198
+ id: errorId,
1199
+ role: "alert",
1200
+ "aria-live": "assertive",
1201
+ color: theme.colors.content.alert.primary,
1202
+ fontSize: 14,
1203
+ fontWeight: "400",
1204
+ children: error
1205
+ }
1206
+ ) }),
1207
+ description && !error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Box, { marginTop: 4, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1208
+ Text,
1209
+ {
1210
+ id: descriptionId,
1211
+ color: theme.colors.content.tertiary,
1212
+ fontSize: 14,
1213
+ fontWeight: "400",
1214
+ children: description
1215
+ }
1216
+ ) })
1217
+ ] });
1218
+ };
1219
+ ButtonGroup.displayName = "ButtonGroup";
1220
+ // Annotate the CommonJS export names for ESM import in node:
1221
+ 0 && (module.exports = {
1222
+ Button,
1223
+ ButtonGroup,
1224
+ FlexButton,
1225
+ IconButton
1226
+ });
1227
+ //# sourceMappingURL=index.js.map