@xsolla/xui-primitives-web 0.64.0-pr56.1768348754

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/index.d.mts ADDED
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { BoxProps, TextProps, SpinnerProps, IconProps, DividerProps, InputPrimitiveProps, TextAreaPrimitiveProps } from '@xsolla/xui-primitives-core';
3
+
4
+ declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLButtonElement | HTMLDivElement>>;
5
+
6
+ declare const Text: React.FC<TextProps>;
7
+
8
+ declare const Spinner: React.FC<SpinnerProps>;
9
+
10
+ declare const Icon: React.FC<IconProps>;
11
+
12
+ declare const Divider: React.FC<DividerProps>;
13
+
14
+ declare const InputPrimitive: React.ForwardRefExoticComponent<InputPrimitiveProps & React.RefAttributes<HTMLInputElement>>;
15
+
16
+ declare const TextAreaPrimitive: React.ForwardRefExoticComponent<TextAreaPrimitiveProps & React.RefAttributes<HTMLTextAreaElement>>;
17
+
18
+ export { Box, Divider, Icon, InputPrimitive, Spinner, Text, TextAreaPrimitive };
package/index.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { BoxProps, TextProps, SpinnerProps, IconProps, DividerProps, InputPrimitiveProps, TextAreaPrimitiveProps } from '@xsolla/xui-primitives-core';
3
+
4
+ declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLButtonElement | HTMLDivElement>>;
5
+
6
+ declare const Text: React.FC<TextProps>;
7
+
8
+ declare const Spinner: React.FC<SpinnerProps>;
9
+
10
+ declare const Icon: React.FC<IconProps>;
11
+
12
+ declare const Divider: React.FC<DividerProps>;
13
+
14
+ declare const InputPrimitive: React.ForwardRefExoticComponent<InputPrimitiveProps & React.RefAttributes<HTMLInputElement>>;
15
+
16
+ declare const TextAreaPrimitive: React.ForwardRefExoticComponent<TextAreaPrimitiveProps & React.RefAttributes<HTMLTextAreaElement>>;
17
+
18
+ export { Box, Divider, Icon, InputPrimitive, Spinner, Text, TextAreaPrimitive };
package/index.js ADDED
@@ -0,0 +1,505 @@
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
+ Box: () => Box,
34
+ Divider: () => Divider,
35
+ Icon: () => Icon,
36
+ InputPrimitive: () => InputPrimitive,
37
+ Spinner: () => Spinner,
38
+ Text: () => Text,
39
+ TextAreaPrimitive: () => TextAreaPrimitive
40
+ });
41
+ module.exports = __toCommonJS(index_exports);
42
+
43
+ // 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
+ // 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
+ // 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
+ // 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
+ // 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
+ // 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
+ // 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
+ // Annotate the CommonJS export names for ESM import in node:
497
+ 0 && (module.exports = {
498
+ Box,
499
+ Divider,
500
+ Icon,
501
+ InputPrimitive,
502
+ Spinner,
503
+ Text,
504
+ TextAreaPrimitive
505
+ });
package/index.mjs ADDED
@@ -0,0 +1,462 @@
1
+ // src/Box.tsx
2
+ import React from "react";
3
+ import styled from "styled-components";
4
+ import { jsx } from "react/jsx-runtime";
5
+ var StyledBox = styled.div`
6
+ display: flex;
7
+ box-sizing: border-box;
8
+ background-color: ${(props) => props.backgroundColor || "transparent"};
9
+ border-color: ${(props) => props.borderColor || "transparent"};
10
+ border-width: ${(props) => typeof props.borderWidth === "number" ? `${props.borderWidth}px` : props.borderWidth || 0};
11
+
12
+ ${(props) => props.borderBottomWidth !== void 0 && `
13
+ border-bottom-width: ${typeof props.borderBottomWidth === "number" ? `${props.borderBottomWidth}px` : props.borderBottomWidth};
14
+ border-bottom-color: ${props.borderBottomColor || props.borderColor || "transparent"};
15
+ border-bottom-style: solid;
16
+ `}
17
+ ${(props) => props.borderTopWidth !== void 0 && `
18
+ border-top-width: ${typeof props.borderTopWidth === "number" ? `${props.borderTopWidth}px` : props.borderTopWidth};
19
+ border-top-color: ${props.borderTopColor || props.borderColor || "transparent"};
20
+ border-top-style: solid;
21
+ `}
22
+ ${(props) => props.borderLeftWidth !== void 0 && `
23
+ border-left-width: ${typeof props.borderLeftWidth === "number" ? `${props.borderLeftWidth}px` : props.borderLeftWidth};
24
+ border-left-color: ${props.borderLeftColor || props.borderColor || "transparent"};
25
+ border-left-style: solid;
26
+ `}
27
+ ${(props) => props.borderRightWidth !== void 0 && `
28
+ border-right-width: ${typeof props.borderRightWidth === "number" ? `${props.borderRightWidth}px` : props.borderRightWidth};
29
+ border-right-color: ${props.borderRightColor || props.borderColor || "transparent"};
30
+ border-right-style: solid;
31
+ `}
32
+
33
+ border-style: ${(props) => props.borderStyle || (props.borderWidth || props.borderBottomWidth || props.borderTopWidth || props.borderLeftWidth || props.borderRightWidth ? "solid" : "none")};
34
+ border-radius: ${(props) => typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius || 0};
35
+ height: ${(props) => typeof props.height === "number" ? `${props.height}px` : props.height || "auto"};
36
+ width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
37
+ min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
38
+ min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
39
+
40
+ padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
41
+ ${(props) => props.paddingHorizontal && `
42
+ padding-left: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
43
+ padding-right: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
44
+ `}
45
+ ${(props) => props.paddingVertical && `
46
+ padding-top: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
47
+ padding-bottom: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
48
+ `}
49
+ ${(props) => props.paddingTop !== void 0 && `padding-top: ${typeof props.paddingTop === "number" ? `${props.paddingTop}px` : props.paddingTop};`}
50
+ ${(props) => props.paddingBottom !== void 0 && `padding-bottom: ${typeof props.paddingBottom === "number" ? `${props.paddingBottom}px` : props.paddingBottom};`}
51
+ ${(props) => props.paddingLeft !== void 0 && `padding-left: ${typeof props.paddingLeft === "number" ? `${props.paddingLeft}px` : props.paddingLeft};`}
52
+ ${(props) => props.paddingRight !== void 0 && `padding-right: ${typeof props.paddingRight === "number" ? `${props.paddingRight}px` : props.paddingRight};`}
53
+
54
+ margin: ${(props) => typeof props.margin === "number" ? `${props.margin}px` : props.margin || 0};
55
+ ${(props) => props.marginTop !== void 0 && `margin-top: ${typeof props.marginTop === "number" ? `${props.marginTop}px` : props.marginTop};`}
56
+ ${(props) => props.marginBottom !== void 0 && `margin-bottom: ${typeof props.marginBottom === "number" ? `${props.marginBottom}px` : props.marginBottom};`}
57
+ ${(props) => props.marginLeft !== void 0 && `margin-left: ${typeof props.marginLeft === "number" ? `${props.marginLeft}px` : props.marginLeft};`}
58
+ ${(props) => props.marginRight !== void 0 && `margin-right: ${typeof props.marginRight === "number" ? `${props.marginRight}px` : props.marginRight};`}
59
+
60
+ flex-direction: ${(props) => props.flexDirection || "column"};
61
+ flex-wrap: ${(props) => props.flexWrap || "nowrap"};
62
+ align-items: ${(props) => props.alignItems || "stretch"};
63
+ justify-content: ${(props) => props.justifyContent || "flex-start"};
64
+ cursor: ${(props) => props.cursor ? props.cursor : props.onClick || props.onPress ? "pointer" : "inherit"};
65
+ position: ${(props) => props.position || "static"};
66
+ top: ${(props) => typeof props.top === "number" ? `${props.top}px` : props.top};
67
+ bottom: ${(props) => typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom};
68
+ left: ${(props) => typeof props.left === "number" ? `${props.left}px` : props.left};
69
+ right: ${(props) => typeof props.right === "number" ? `${props.right}px` : props.right};
70
+ flex: ${(props) => props.flex};
71
+ flex-shrink: ${(props) => props.flexShrink ?? 1};
72
+ gap: ${(props) => typeof props.gap === "number" ? `${props.gap}px` : props.gap || 0};
73
+ align-self: ${(props) => props.alignSelf || "auto"};
74
+ overflow: ${(props) => props.overflow || "visible"};
75
+ overflow-x: ${(props) => props.overflowX || "visible"};
76
+ overflow-y: ${(props) => props.overflowY || "visible"};
77
+ z-index: ${(props) => props.zIndex};
78
+ opacity: ${(props) => props.disabled ? 0.5 : 1};
79
+ pointer-events: ${(props) => props.disabled ? "none" : "auto"};
80
+
81
+ &:hover {
82
+ ${(props) => props.hoverStyle?.backgroundColor && `background-color: ${props.hoverStyle.backgroundColor};`}
83
+ ${(props) => props.hoverStyle?.borderColor && `border-color: ${props.hoverStyle.borderColor};`}
84
+ }
85
+
86
+ &:active {
87
+ ${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
88
+ }
89
+ `;
90
+ var Box = React.forwardRef(
91
+ ({
92
+ children,
93
+ onPress,
94
+ onKeyDown,
95
+ onKeyUp,
96
+ role,
97
+ "aria-label": ariaLabel,
98
+ "aria-labelledby": ariaLabelledBy,
99
+ "aria-current": ariaCurrent,
100
+ "aria-disabled": ariaDisabled,
101
+ "aria-live": ariaLive,
102
+ "aria-busy": ariaBusy,
103
+ "aria-describedby": ariaDescribedBy,
104
+ "aria-expanded": ariaExpanded,
105
+ "aria-haspopup": ariaHasPopup,
106
+ "aria-pressed": ariaPressed,
107
+ "aria-controls": ariaControls,
108
+ tabIndex,
109
+ as,
110
+ src,
111
+ alt,
112
+ type,
113
+ disabled,
114
+ id,
115
+ ...props
116
+ }, ref) => {
117
+ if (as === "img" && src) {
118
+ return /* @__PURE__ */ jsx(
119
+ "img",
120
+ {
121
+ src,
122
+ alt: alt || "",
123
+ style: {
124
+ display: "block",
125
+ objectFit: "cover",
126
+ width: typeof props.width === "number" ? `${props.width}px` : props.width,
127
+ height: typeof props.height === "number" ? `${props.height}px` : props.height,
128
+ borderRadius: typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius,
129
+ position: props.position,
130
+ top: typeof props.top === "number" ? `${props.top}px` : props.top,
131
+ left: typeof props.left === "number" ? `${props.left}px` : props.left,
132
+ right: typeof props.right === "number" ? `${props.right}px` : props.right,
133
+ bottom: typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom
134
+ }
135
+ }
136
+ );
137
+ }
138
+ return /* @__PURE__ */ jsx(
139
+ StyledBox,
140
+ {
141
+ ref,
142
+ as,
143
+ id,
144
+ type: as === "button" ? type || "button" : void 0,
145
+ disabled: as === "button" ? disabled : void 0,
146
+ onClick: onPress,
147
+ onKeyDown,
148
+ onKeyUp,
149
+ role,
150
+ "aria-label": ariaLabel,
151
+ "aria-labelledby": ariaLabelledBy,
152
+ "aria-current": ariaCurrent,
153
+ "aria-disabled": ariaDisabled,
154
+ "aria-busy": ariaBusy,
155
+ "aria-describedby": ariaDescribedBy,
156
+ "aria-expanded": ariaExpanded,
157
+ "aria-haspopup": ariaHasPopup,
158
+ "aria-pressed": ariaPressed,
159
+ "aria-controls": ariaControls,
160
+ "aria-live": ariaLive,
161
+ tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
162
+ ...props,
163
+ children
164
+ }
165
+ );
166
+ }
167
+ );
168
+ Box.displayName = "Box";
169
+
170
+ // src/Text.tsx
171
+ import styled2 from "styled-components";
172
+ import { jsx as jsx2 } from "react/jsx-runtime";
173
+ var StyledText = styled2.span`
174
+ color: ${(props) => props.color || "inherit"};
175
+ font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
176
+ font-weight: ${(props) => props.fontWeight || "normal"};
177
+ font-family: ${(props) => props.fontFamily || '"Pilat Wide Bold", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important'};
178
+ line-height: ${(props) => typeof props.lineHeight === "number" ? `${props.lineHeight}px` : props.lineHeight || "inherit"};
179
+ white-space: ${(props) => props.whiteSpace || "normal"};
180
+ text-align: ${(props) => props.textAlign || "inherit"};
181
+ text-decoration: ${(props) => props.textDecoration || "none"};
182
+ `;
183
+ var Text = ({
184
+ style,
185
+ className,
186
+ id,
187
+ role,
188
+ ...props
189
+ }) => {
190
+ return /* @__PURE__ */ jsx2(
191
+ StyledText,
192
+ {
193
+ ...props,
194
+ style,
195
+ className,
196
+ id,
197
+ role
198
+ }
199
+ );
200
+ };
201
+
202
+ // src/Spinner.tsx
203
+ import styled3, { keyframes } from "styled-components";
204
+ import { jsx as jsx3 } from "react/jsx-runtime";
205
+ var rotate = keyframes`
206
+ from {
207
+ transform: rotate(0deg);
208
+ }
209
+ to {
210
+ transform: rotate(360deg);
211
+ }
212
+ `;
213
+ var StyledSpinner = styled3.div`
214
+ width: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
215
+ height: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
216
+ border: ${(props) => props.strokeWidth || 2}px solid
217
+ ${(props) => props.color || "currentColor"};
218
+ border-bottom-color: transparent;
219
+ border-radius: 50%;
220
+ display: inline-block;
221
+ box-sizing: border-box;
222
+ animation: ${rotate} 1s linear infinite;
223
+ `;
224
+ var Spinner = ({
225
+ role = "status",
226
+ "aria-label": ariaLabel,
227
+ "aria-live": ariaLive = "polite",
228
+ "aria-describedby": ariaDescribedBy,
229
+ testID,
230
+ ...props
231
+ }) => {
232
+ return /* @__PURE__ */ jsx3(
233
+ StyledSpinner,
234
+ {
235
+ role,
236
+ "aria-label": ariaLabel,
237
+ "aria-live": ariaLive,
238
+ "aria-describedby": ariaDescribedBy,
239
+ "data-testid": testID,
240
+ ...props
241
+ }
242
+ );
243
+ };
244
+ Spinner.displayName = "Spinner";
245
+
246
+ // src/Icon.tsx
247
+ import styled4 from "styled-components";
248
+ import { jsx as jsx4 } from "react/jsx-runtime";
249
+ var StyledIcon = styled4.div`
250
+ display: flex;
251
+ align-items: center;
252
+ justify-content: center;
253
+ width: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
254
+ height: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
255
+ color: ${(props) => props.color || "currentColor"};
256
+
257
+ svg {
258
+ width: 100%;
259
+ height: 100%;
260
+ fill: none;
261
+ stroke: currentColor;
262
+ }
263
+ `;
264
+ var Icon = ({ children, ...props }) => {
265
+ return /* @__PURE__ */ jsx4(StyledIcon, { ...props, children });
266
+ };
267
+
268
+ // src/Divider.tsx
269
+ import styled5 from "styled-components";
270
+ import { jsx as jsx5 } from "react/jsx-runtime";
271
+ var StyledDivider = styled5.div`
272
+ background-color: ${(props) => props.dashStroke ? "transparent" : props.color || "rgba(255, 255, 255, 0.15)"};
273
+ width: ${(props) => props.vertical ? typeof props.width === "number" ? `${props.width}px` : props.width || "1px" : "100%"};
274
+ height: ${(props) => props.vertical ? "100%" : typeof props.height === "number" ? `${props.height}px` : props.height || "1px"};
275
+
276
+ ${(props) => props.dashStroke && `
277
+ border-style: dashed;
278
+ border-color: ${props.color || "rgba(255, 255, 255, 0.15)"};
279
+ border-width: 0;
280
+ ${props.vertical ? `
281
+ border-left-width: ${typeof props.width === "number" ? `${props.width}px` : props.width || "1px"};
282
+ height: 100%;
283
+ ` : `
284
+ border-top-width: ${typeof props.height === "number" ? `${props.height}px` : props.height || "1px"};
285
+ width: 100%;
286
+ `}
287
+ `}
288
+ `;
289
+ var Divider = (props) => {
290
+ return /* @__PURE__ */ jsx5(StyledDivider, { ...props });
291
+ };
292
+
293
+ // src/Input.tsx
294
+ import { forwardRef } from "react";
295
+ import styled6 from "styled-components";
296
+ import { jsx as jsx6 } from "react/jsx-runtime";
297
+ var StyledInput = styled6.input`
298
+ background: transparent;
299
+ border: none;
300
+ outline: none;
301
+ width: 100%;
302
+ height: 100%;
303
+ padding: 0;
304
+ margin: 0;
305
+ color: ${(props) => props.color || "inherit"};
306
+ font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
307
+ font-family: inherit;
308
+ text-align: inherit;
309
+
310
+ &::placeholder {
311
+ color: ${(props) => props.placeholderTextColor || "rgba(255, 255, 255, 0.5)"};
312
+ }
313
+
314
+ &:disabled {
315
+ cursor: not-allowed;
316
+ }
317
+ `;
318
+ var InputPrimitive = forwardRef(
319
+ ({
320
+ value,
321
+ placeholder,
322
+ onChange,
323
+ onChangeText,
324
+ onFocus,
325
+ onBlur,
326
+ onKeyDown,
327
+ disabled,
328
+ secureTextEntry,
329
+ style,
330
+ color,
331
+ fontSize,
332
+ placeholderTextColor,
333
+ maxLength,
334
+ name,
335
+ type,
336
+ inputMode,
337
+ autoComplete,
338
+ id,
339
+ "aria-invalid": ariaInvalid,
340
+ "aria-describedby": ariaDescribedBy,
341
+ "aria-labelledby": ariaLabelledBy,
342
+ "aria-label": ariaLabel,
343
+ "aria-disabled": ariaDisabled,
344
+ "data-testid": dataTestId,
345
+ ...rest
346
+ }, ref) => {
347
+ const handleChange = (e) => {
348
+ if (onChange) {
349
+ onChange(e);
350
+ }
351
+ if (onChangeText) {
352
+ onChangeText(e.target.value);
353
+ }
354
+ };
355
+ const inputValue = value !== void 0 ? value : "";
356
+ return /* @__PURE__ */ jsx6(
357
+ StyledInput,
358
+ {
359
+ ref,
360
+ id,
361
+ value: inputValue,
362
+ name,
363
+ placeholder,
364
+ onChange: handleChange,
365
+ onFocus,
366
+ onBlur,
367
+ onKeyDown,
368
+ disabled,
369
+ type: secureTextEntry ? "password" : type || "text",
370
+ inputMode,
371
+ autoComplete,
372
+ style,
373
+ color,
374
+ fontSize,
375
+ placeholderTextColor,
376
+ maxLength,
377
+ "aria-invalid": ariaInvalid,
378
+ "aria-describedby": ariaDescribedBy,
379
+ "aria-labelledby": ariaLabelledBy,
380
+ "aria-label": ariaLabel,
381
+ "aria-disabled": ariaDisabled,
382
+ "data-testid": dataTestId,
383
+ ...rest
384
+ }
385
+ );
386
+ }
387
+ );
388
+ InputPrimitive.displayName = "InputPrimitive";
389
+
390
+ // src/TextArea.tsx
391
+ import { forwardRef as forwardRef2 } from "react";
392
+ import styled7 from "styled-components";
393
+ import { jsx as jsx7 } from "react/jsx-runtime";
394
+ var StyledTextArea = styled7.textarea`
395
+ background: transparent;
396
+ border: none;
397
+ outline: none;
398
+ width: 100%;
399
+ height: 100%;
400
+ padding: 0;
401
+ margin: 0;
402
+ color: ${(props) => props.color || "inherit"};
403
+ font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
404
+ font-family: inherit;
405
+ text-align: inherit;
406
+ resize: none;
407
+
408
+ &::placeholder {
409
+ color: ${(props) => props.placeholderTextColor || "rgba(255, 255, 255, 0.5)"};
410
+ }
411
+
412
+ &:disabled {
413
+ cursor: not-allowed;
414
+ }
415
+ `;
416
+ var TextAreaPrimitive = forwardRef2(
417
+ ({
418
+ value,
419
+ placeholder,
420
+ onChangeText,
421
+ onFocus,
422
+ onBlur,
423
+ onKeyDown,
424
+ disabled,
425
+ style,
426
+ color,
427
+ fontSize,
428
+ placeholderTextColor,
429
+ maxLength,
430
+ rows
431
+ }, ref) => {
432
+ return /* @__PURE__ */ jsx7(
433
+ StyledTextArea,
434
+ {
435
+ ref,
436
+ value,
437
+ placeholder,
438
+ onChange: (e) => onChangeText?.(e.target.value),
439
+ onFocus,
440
+ onBlur,
441
+ onKeyDown,
442
+ disabled,
443
+ style,
444
+ color,
445
+ fontSize,
446
+ placeholderTextColor,
447
+ maxLength,
448
+ rows
449
+ }
450
+ );
451
+ }
452
+ );
453
+ TextAreaPrimitive.displayName = "TextAreaPrimitive";
454
+ export {
455
+ Box,
456
+ Divider,
457
+ Icon,
458
+ InputPrimitive,
459
+ Spinner,
460
+ Text,
461
+ TextAreaPrimitive
462
+ };
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@xsolla/xui-primitives-web",
3
+ "version": "0.64.0-pr56.1768348754",
4
+ "main": "./index.js",
5
+ "module": "./index.mjs",
6
+ "types": "./index.d.ts",
7
+ "scripts": {
8
+ "build": "tsup src/index.tsx --format esm,cjs --dts --clean"
9
+ },
10
+ "peerDependencies": {
11
+ "react": "^16.8.0",
12
+ "react-dom": "^16.8.0",
13
+ "styled-components": "^4.0.0"
14
+ },
15
+ "dependencies": {
16
+ "@xsolla/xui-primitives-core": "0.64.0-pr56.1768348754",
17
+ "lucide-react": "^0.470.0"
18
+ },
19
+ "devDependencies": {
20
+ "@types/react": "^18.0.0",
21
+ "@types/react-dom": "^18.0.0",
22
+ "react": "^18.0.0",
23
+ "react-dom": "^18.0.0",
24
+ "tsup": "^8.0.0"
25
+ },
26
+ "license": "MIT"
27
+ }