@xsolla/xui-primitives-native 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,19 @@
1
+ import React from 'react';
2
+ import { BoxProps, TextProps, SpinnerProps, IconProps, DividerProps, InputPrimitiveProps, TextAreaPrimitiveProps } from '@xsolla/xui-primitives-core';
3
+ import { TextInput } from 'react-native';
4
+
5
+ declare const Box: React.FC<BoxProps>;
6
+
7
+ declare const Text: React.FC<TextProps>;
8
+
9
+ declare const Spinner: React.FC<SpinnerProps>;
10
+
11
+ declare const Icon: React.FC<IconProps>;
12
+
13
+ declare const Divider: React.FC<DividerProps>;
14
+
15
+ declare const InputPrimitive: React.ForwardRefExoticComponent<InputPrimitiveProps & React.RefAttributes<TextInput>>;
16
+
17
+ declare const TextAreaPrimitive: React.ForwardRefExoticComponent<TextAreaPrimitiveProps & React.RefAttributes<TextInput>>;
18
+
19
+ export { Box, Divider, Icon, InputPrimitive, Spinner, Text, TextAreaPrimitive };
package/index.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { BoxProps, TextProps, SpinnerProps, IconProps, DividerProps, InputPrimitiveProps, TextAreaPrimitiveProps } from '@xsolla/xui-primitives-core';
3
+ import { TextInput } from 'react-native';
4
+
5
+ declare const Box: React.FC<BoxProps>;
6
+
7
+ declare const Text: React.FC<TextProps>;
8
+
9
+ declare const Spinner: React.FC<SpinnerProps>;
10
+
11
+ declare const Icon: React.FC<IconProps>;
12
+
13
+ declare const Divider: React.FC<DividerProps>;
14
+
15
+ declare const InputPrimitive: React.ForwardRefExoticComponent<InputPrimitiveProps & React.RefAttributes<TextInput>>;
16
+
17
+ declare const TextAreaPrimitive: React.ForwardRefExoticComponent<TextAreaPrimitiveProps & React.RefAttributes<TextInput>>;
18
+
19
+ export { Box, Divider, Icon, InputPrimitive, Spinner, Text, TextAreaPrimitive };
package/index.js ADDED
@@ -0,0 +1,550 @@
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_native = require("react-native");
45
+ var import_jsx_runtime = require("react/jsx-runtime");
46
+ var Box = ({
47
+ children,
48
+ onPress,
49
+ onLayout,
50
+ onMoveShouldSetResponder,
51
+ onResponderGrant,
52
+ onResponderMove,
53
+ onResponderRelease,
54
+ onResponderTerminate,
55
+ backgroundColor,
56
+ borderColor,
57
+ borderWidth,
58
+ borderBottomWidth,
59
+ borderBottomColor,
60
+ borderTopWidth,
61
+ borderTopColor,
62
+ borderLeftWidth,
63
+ borderLeftColor,
64
+ borderRightWidth,
65
+ borderRightColor,
66
+ borderRadius,
67
+ borderStyle,
68
+ height,
69
+ padding,
70
+ paddingHorizontal,
71
+ paddingVertical,
72
+ margin,
73
+ marginTop,
74
+ marginBottom,
75
+ marginLeft,
76
+ marginRight,
77
+ flexDirection,
78
+ alignItems,
79
+ justifyContent,
80
+ position,
81
+ top,
82
+ bottom,
83
+ left,
84
+ right,
85
+ width,
86
+ flex,
87
+ overflow,
88
+ zIndex,
89
+ hoverStyle,
90
+ pressStyle,
91
+ style,
92
+ "data-testid": dataTestId,
93
+ testID,
94
+ as,
95
+ src,
96
+ alt,
97
+ ...rest
98
+ }) => {
99
+ const getContainerStyle = (pressed) => ({
100
+ backgroundColor: pressed && pressStyle?.backgroundColor ? pressStyle.backgroundColor : backgroundColor,
101
+ borderColor,
102
+ borderWidth,
103
+ borderBottomWidth,
104
+ borderBottomColor,
105
+ borderTopWidth,
106
+ borderTopColor,
107
+ borderLeftWidth,
108
+ borderLeftColor,
109
+ borderRightWidth,
110
+ borderRightColor,
111
+ borderRadius,
112
+ borderStyle,
113
+ overflow,
114
+ zIndex,
115
+ height,
116
+ width,
117
+ padding,
118
+ paddingHorizontal,
119
+ paddingVertical,
120
+ margin,
121
+ marginTop,
122
+ marginBottom,
123
+ marginLeft,
124
+ marginRight,
125
+ flexDirection,
126
+ alignItems,
127
+ justifyContent,
128
+ position,
129
+ top,
130
+ bottom,
131
+ left,
132
+ right,
133
+ flex,
134
+ ...style
135
+ });
136
+ const finalTestID = dataTestId || testID;
137
+ const {
138
+ role,
139
+ tabIndex,
140
+ onKeyDown,
141
+ onKeyUp,
142
+ "aria-label": _ariaLabel,
143
+ "aria-labelledby": _ariaLabelledBy,
144
+ "aria-current": _ariaCurrent,
145
+ "aria-disabled": _ariaDisabled,
146
+ "aria-live": _ariaLive,
147
+ className,
148
+ "data-testid": _dataTestId,
149
+ ...nativeRest
150
+ } = rest;
151
+ if (as === "img" && src) {
152
+ const imageStyle = {
153
+ width,
154
+ height,
155
+ borderRadius,
156
+ position,
157
+ top,
158
+ bottom,
159
+ left,
160
+ right,
161
+ ...style
162
+ };
163
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
164
+ import_react_native.Image,
165
+ {
166
+ source: { uri: src },
167
+ style: imageStyle,
168
+ testID: finalTestID,
169
+ resizeMode: "cover",
170
+ ...nativeRest
171
+ }
172
+ );
173
+ }
174
+ if (onPress) {
175
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
176
+ import_react_native.Pressable,
177
+ {
178
+ onPress,
179
+ onLayout,
180
+ onMoveShouldSetResponder,
181
+ onResponderGrant,
182
+ onResponderMove,
183
+ onResponderRelease,
184
+ onResponderTerminate,
185
+ style: ({ pressed }) => getContainerStyle(pressed),
186
+ testID: finalTestID,
187
+ ...nativeRest,
188
+ children
189
+ }
190
+ );
191
+ }
192
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
193
+ import_react_native.View,
194
+ {
195
+ style: getContainerStyle(),
196
+ testID: finalTestID,
197
+ onLayout,
198
+ onMoveShouldSetResponder,
199
+ onResponderGrant,
200
+ onResponderMove,
201
+ onResponderRelease,
202
+ onResponderTerminate,
203
+ ...nativeRest,
204
+ children
205
+ }
206
+ );
207
+ };
208
+
209
+ // src/Text.tsx
210
+ var import_react_native2 = require("react-native");
211
+ var import_jsx_runtime2 = require("react/jsx-runtime");
212
+ var roleMap = {
213
+ alert: "alert",
214
+ heading: "header",
215
+ button: "button",
216
+ link: "link",
217
+ text: "text"
218
+ };
219
+ var Text = ({
220
+ children,
221
+ color,
222
+ fontSize,
223
+ fontWeight,
224
+ fontFamily,
225
+ id,
226
+ role,
227
+ ...props
228
+ }) => {
229
+ let resolvedFontFamily = fontFamily ? fontFamily.split(",")[0].replace(/['"]/g, "").trim() : void 0;
230
+ if (resolvedFontFamily === "Pilat Wide Bold") {
231
+ resolvedFontFamily = void 0;
232
+ }
233
+ const style = {
234
+ color,
235
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
236
+ fontWeight,
237
+ fontFamily: resolvedFontFamily,
238
+ textDecorationLine: props.textDecoration
239
+ };
240
+ const accessibilityRole = role ? roleMap[role] : void 0;
241
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.Text, { style, testID: id, accessibilityRole, children });
242
+ };
243
+
244
+ // src/Spinner.tsx
245
+ var import_react_native3 = require("react-native");
246
+ var import_jsx_runtime3 = require("react/jsx-runtime");
247
+ var Spinner = ({
248
+ color,
249
+ size,
250
+ role,
251
+ "aria-label": ariaLabel,
252
+ "aria-live": ariaLive,
253
+ "aria-describedby": ariaDescribedBy,
254
+ testID
255
+ }) => {
256
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
257
+ import_react_native3.View,
258
+ {
259
+ accessible: true,
260
+ accessibilityRole: role === "status" ? "none" : void 0,
261
+ accessibilityLabel: ariaLabel,
262
+ accessibilityLiveRegion: ariaLive === "polite" ? "polite" : ariaLive === "assertive" ? "assertive" : "none",
263
+ testID,
264
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
265
+ import_react_native3.ActivityIndicator,
266
+ {
267
+ color,
268
+ size: typeof size === "number" ? size : "small"
269
+ }
270
+ )
271
+ }
272
+ );
273
+ };
274
+ Spinner.displayName = "Spinner";
275
+
276
+ // src/Icon.tsx
277
+ var import_react = __toESM(require("react"));
278
+ var import_react_native4 = require("react-native");
279
+ var import_jsx_runtime4 = require("react/jsx-runtime");
280
+ var Icon = ({ children, color, size }) => {
281
+ const style = {
282
+ width: typeof size === "number" ? size : void 0,
283
+ height: typeof size === "number" ? size : void 0,
284
+ alignItems: "center",
285
+ justifyContent: "center"
286
+ };
287
+ const childrenWithProps = import_react.default.Children.map(children, (child) => {
288
+ if (import_react.default.isValidElement(child)) {
289
+ return import_react.default.cloneElement(child, {
290
+ color: child.props.color || color,
291
+ // Also pass size if child seems to be an icon that needs it
292
+ size: child.props.size || size
293
+ });
294
+ }
295
+ return child;
296
+ });
297
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.View, { style, children: childrenWithProps });
298
+ };
299
+
300
+ // src/Divider.tsx
301
+ var import_react_native5 = require("react-native");
302
+ var import_jsx_runtime5 = require("react/jsx-runtime");
303
+ var Divider = ({
304
+ color,
305
+ height,
306
+ width,
307
+ vertical,
308
+ dashStroke
309
+ }) => {
310
+ const style = {
311
+ backgroundColor: dashStroke ? "transparent" : color || "rgba(255, 255, 255, 0.15)",
312
+ width: vertical ? typeof width === "number" ? width : 1 : "100%",
313
+ height: vertical ? "100%" : typeof height === "number" ? height : 1,
314
+ ...dashStroke && {
315
+ borderStyle: "dashed",
316
+ borderColor: color || "rgba(255, 255, 255, 0.15)",
317
+ borderWidth: 0,
318
+ ...vertical ? { borderLeftWidth: typeof width === "number" ? width : 1 } : { borderTopWidth: typeof height === "number" ? height : 1 }
319
+ }
320
+ };
321
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native5.View, { style });
322
+ };
323
+
324
+ // src/Input.tsx
325
+ var import_react2 = require("react");
326
+ var import_react_native6 = require("react-native");
327
+ var import_jsx_runtime6 = require("react/jsx-runtime");
328
+ var keyboardTypeMap = {
329
+ text: "default",
330
+ number: "numeric",
331
+ email: "email-address",
332
+ tel: "phone-pad",
333
+ url: "url",
334
+ decimal: "decimal-pad"
335
+ };
336
+ var inputModeToKeyboardType = {
337
+ none: "default",
338
+ text: "default",
339
+ decimal: "decimal-pad",
340
+ numeric: "number-pad",
341
+ tel: "phone-pad",
342
+ search: "default",
343
+ email: "email-address",
344
+ url: "url"
345
+ };
346
+ var autoCompleteToTextContentType = {
347
+ "one-time-code": "oneTimeCode",
348
+ email: "emailAddress",
349
+ username: "username",
350
+ password: "password",
351
+ "new-password": "newPassword",
352
+ tel: "telephoneNumber",
353
+ "postal-code": "postalCode",
354
+ name: "name"
355
+ };
356
+ var InputPrimitive = (0, import_react2.forwardRef)(
357
+ ({
358
+ value,
359
+ placeholder,
360
+ onChange,
361
+ onChangeText,
362
+ onFocus,
363
+ onBlur,
364
+ onKeyDown,
365
+ disabled,
366
+ secureTextEntry,
367
+ style,
368
+ color,
369
+ fontSize,
370
+ placeholderTextColor,
371
+ maxLength,
372
+ name,
373
+ type,
374
+ inputMode,
375
+ autoComplete,
376
+ id,
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
+ }, ref) => {
384
+ const handleChangeText = (text) => {
385
+ onChangeText?.(text);
386
+ if (onChange) {
387
+ const syntheticEvent = {
388
+ target: { value: text },
389
+ currentTarget: { value: text },
390
+ type: "change",
391
+ nativeEvent: { text },
392
+ preventDefault: () => {
393
+ },
394
+ stopPropagation: () => {
395
+ },
396
+ isTrusted: false
397
+ };
398
+ onChange(syntheticEvent);
399
+ }
400
+ };
401
+ const keyboardType = inputMode ? inputModeToKeyboardType[inputMode] || "default" : type ? keyboardTypeMap[type] || "default" : "default";
402
+ const textContentType = autoComplete ? autoCompleteToTextContentType[autoComplete] : void 0;
403
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
404
+ import_react_native6.TextInput,
405
+ {
406
+ ref,
407
+ value,
408
+ placeholder,
409
+ onChangeText: handleChangeText,
410
+ onFocus,
411
+ onBlur,
412
+ onKeyPress: (e) => {
413
+ if (onKeyDown) {
414
+ onKeyDown({
415
+ key: e.nativeEvent.key,
416
+ preventDefault: () => {
417
+ }
418
+ });
419
+ }
420
+ },
421
+ editable: !disabled,
422
+ secureTextEntry: secureTextEntry || type === "password",
423
+ keyboardType,
424
+ textContentType,
425
+ style: [
426
+ {
427
+ color,
428
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
429
+ flex: 1,
430
+ padding: 0,
431
+ textAlign: style?.textAlign || "left"
432
+ },
433
+ style
434
+ ],
435
+ placeholderTextColor,
436
+ maxLength,
437
+ testID: dataTestId || id,
438
+ accessibilityLabel: ariaLabel,
439
+ accessibilityHint: ariaDescribedBy,
440
+ accessibilityState: {
441
+ disabled: disabled || ariaDisabled
442
+ },
443
+ accessible: true
444
+ }
445
+ );
446
+ }
447
+ );
448
+ InputPrimitive.displayName = "InputPrimitive";
449
+
450
+ // src/TextArea.tsx
451
+ var import_react3 = require("react");
452
+ var import_react_native7 = require("react-native");
453
+ var import_jsx_runtime7 = require("react/jsx-runtime");
454
+ var TextAreaPrimitive = (0, import_react3.forwardRef)(
455
+ ({
456
+ value,
457
+ placeholder,
458
+ onChange,
459
+ onChangeText,
460
+ onFocus,
461
+ onBlur,
462
+ onKeyDown,
463
+ disabled,
464
+ style,
465
+ color,
466
+ fontSize,
467
+ placeholderTextColor,
468
+ maxLength,
469
+ rows,
470
+ id,
471
+ "aria-invalid": ariaInvalid,
472
+ "aria-describedby": ariaDescribedBy,
473
+ "aria-labelledby": ariaLabelledBy,
474
+ "aria-label": ariaLabel,
475
+ "aria-disabled": ariaDisabled,
476
+ "data-testid": dataTestId
477
+ }, ref) => {
478
+ const handleChangeText = (text) => {
479
+ onChangeText?.(text);
480
+ if (onChange) {
481
+ const syntheticEvent = {
482
+ target: { value: text },
483
+ currentTarget: { value: text },
484
+ type: "change",
485
+ nativeEvent: { text },
486
+ preventDefault: () => {
487
+ },
488
+ stopPropagation: () => {
489
+ },
490
+ isTrusted: false
491
+ };
492
+ onChange(syntheticEvent);
493
+ }
494
+ };
495
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
496
+ import_react_native7.TextInput,
497
+ {
498
+ ref,
499
+ value,
500
+ placeholder,
501
+ onChangeText: handleChangeText,
502
+ onFocus,
503
+ onBlur,
504
+ onKeyPress: (e) => {
505
+ if (onKeyDown) {
506
+ onKeyDown({
507
+ key: e.nativeEvent.key,
508
+ preventDefault: () => {
509
+ }
510
+ });
511
+ }
512
+ },
513
+ editable: !disabled,
514
+ multiline: true,
515
+ numberOfLines: rows || 4,
516
+ style: [
517
+ {
518
+ color,
519
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
520
+ flex: 1,
521
+ padding: 0,
522
+ textAlignVertical: "top",
523
+ textAlign: style?.textAlign || "left"
524
+ },
525
+ style
526
+ ],
527
+ placeholderTextColor,
528
+ maxLength,
529
+ testID: dataTestId || id,
530
+ accessibilityLabel: ariaLabel,
531
+ accessibilityHint: ariaDescribedBy,
532
+ accessibilityState: {
533
+ disabled: disabled || ariaDisabled
534
+ },
535
+ accessible: true
536
+ }
537
+ );
538
+ }
539
+ );
540
+ TextAreaPrimitive.displayName = "TextAreaPrimitive";
541
+ // Annotate the CommonJS export names for ESM import in node:
542
+ 0 && (module.exports = {
543
+ Box,
544
+ Divider,
545
+ Icon,
546
+ InputPrimitive,
547
+ Spinner,
548
+ Text,
549
+ TextAreaPrimitive
550
+ });
package/index.mjs ADDED
@@ -0,0 +1,511 @@
1
+ // src/Box.tsx
2
+ import {
3
+ View,
4
+ Pressable,
5
+ Image
6
+ } from "react-native";
7
+ import { jsx } from "react/jsx-runtime";
8
+ var Box = ({
9
+ children,
10
+ onPress,
11
+ onLayout,
12
+ onMoveShouldSetResponder,
13
+ onResponderGrant,
14
+ onResponderMove,
15
+ onResponderRelease,
16
+ onResponderTerminate,
17
+ backgroundColor,
18
+ borderColor,
19
+ borderWidth,
20
+ borderBottomWidth,
21
+ borderBottomColor,
22
+ borderTopWidth,
23
+ borderTopColor,
24
+ borderLeftWidth,
25
+ borderLeftColor,
26
+ borderRightWidth,
27
+ borderRightColor,
28
+ borderRadius,
29
+ borderStyle,
30
+ height,
31
+ padding,
32
+ paddingHorizontal,
33
+ paddingVertical,
34
+ margin,
35
+ marginTop,
36
+ marginBottom,
37
+ marginLeft,
38
+ marginRight,
39
+ flexDirection,
40
+ alignItems,
41
+ justifyContent,
42
+ position,
43
+ top,
44
+ bottom,
45
+ left,
46
+ right,
47
+ width,
48
+ flex,
49
+ overflow,
50
+ zIndex,
51
+ hoverStyle,
52
+ pressStyle,
53
+ style,
54
+ "data-testid": dataTestId,
55
+ testID,
56
+ as,
57
+ src,
58
+ alt,
59
+ ...rest
60
+ }) => {
61
+ const getContainerStyle = (pressed) => ({
62
+ backgroundColor: pressed && pressStyle?.backgroundColor ? pressStyle.backgroundColor : backgroundColor,
63
+ borderColor,
64
+ borderWidth,
65
+ borderBottomWidth,
66
+ borderBottomColor,
67
+ borderTopWidth,
68
+ borderTopColor,
69
+ borderLeftWidth,
70
+ borderLeftColor,
71
+ borderRightWidth,
72
+ borderRightColor,
73
+ borderRadius,
74
+ borderStyle,
75
+ overflow,
76
+ zIndex,
77
+ height,
78
+ width,
79
+ padding,
80
+ paddingHorizontal,
81
+ paddingVertical,
82
+ margin,
83
+ marginTop,
84
+ marginBottom,
85
+ marginLeft,
86
+ marginRight,
87
+ flexDirection,
88
+ alignItems,
89
+ justifyContent,
90
+ position,
91
+ top,
92
+ bottom,
93
+ left,
94
+ right,
95
+ flex,
96
+ ...style
97
+ });
98
+ const finalTestID = dataTestId || testID;
99
+ const {
100
+ role,
101
+ tabIndex,
102
+ onKeyDown,
103
+ onKeyUp,
104
+ "aria-label": _ariaLabel,
105
+ "aria-labelledby": _ariaLabelledBy,
106
+ "aria-current": _ariaCurrent,
107
+ "aria-disabled": _ariaDisabled,
108
+ "aria-live": _ariaLive,
109
+ className,
110
+ "data-testid": _dataTestId,
111
+ ...nativeRest
112
+ } = rest;
113
+ if (as === "img" && src) {
114
+ const imageStyle = {
115
+ width,
116
+ height,
117
+ borderRadius,
118
+ position,
119
+ top,
120
+ bottom,
121
+ left,
122
+ right,
123
+ ...style
124
+ };
125
+ return /* @__PURE__ */ jsx(
126
+ Image,
127
+ {
128
+ source: { uri: src },
129
+ style: imageStyle,
130
+ testID: finalTestID,
131
+ resizeMode: "cover",
132
+ ...nativeRest
133
+ }
134
+ );
135
+ }
136
+ if (onPress) {
137
+ return /* @__PURE__ */ jsx(
138
+ Pressable,
139
+ {
140
+ onPress,
141
+ onLayout,
142
+ onMoveShouldSetResponder,
143
+ onResponderGrant,
144
+ onResponderMove,
145
+ onResponderRelease,
146
+ onResponderTerminate,
147
+ style: ({ pressed }) => getContainerStyle(pressed),
148
+ testID: finalTestID,
149
+ ...nativeRest,
150
+ children
151
+ }
152
+ );
153
+ }
154
+ return /* @__PURE__ */ jsx(
155
+ View,
156
+ {
157
+ style: getContainerStyle(),
158
+ testID: finalTestID,
159
+ onLayout,
160
+ onMoveShouldSetResponder,
161
+ onResponderGrant,
162
+ onResponderMove,
163
+ onResponderRelease,
164
+ onResponderTerminate,
165
+ ...nativeRest,
166
+ children
167
+ }
168
+ );
169
+ };
170
+
171
+ // src/Text.tsx
172
+ import { Text as RNText } from "react-native";
173
+ import { jsx as jsx2 } from "react/jsx-runtime";
174
+ var roleMap = {
175
+ alert: "alert",
176
+ heading: "header",
177
+ button: "button",
178
+ link: "link",
179
+ text: "text"
180
+ };
181
+ var Text = ({
182
+ children,
183
+ color,
184
+ fontSize,
185
+ fontWeight,
186
+ fontFamily,
187
+ id,
188
+ role,
189
+ ...props
190
+ }) => {
191
+ let resolvedFontFamily = fontFamily ? fontFamily.split(",")[0].replace(/['"]/g, "").trim() : void 0;
192
+ if (resolvedFontFamily === "Pilat Wide Bold") {
193
+ resolvedFontFamily = void 0;
194
+ }
195
+ const style = {
196
+ color,
197
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
198
+ fontWeight,
199
+ fontFamily: resolvedFontFamily,
200
+ textDecorationLine: props.textDecoration
201
+ };
202
+ const accessibilityRole = role ? roleMap[role] : void 0;
203
+ return /* @__PURE__ */ jsx2(RNText, { style, testID: id, accessibilityRole, children });
204
+ };
205
+
206
+ // src/Spinner.tsx
207
+ import { ActivityIndicator, View as View2 } from "react-native";
208
+ import { jsx as jsx3 } from "react/jsx-runtime";
209
+ var Spinner = ({
210
+ color,
211
+ size,
212
+ role,
213
+ "aria-label": ariaLabel,
214
+ "aria-live": ariaLive,
215
+ "aria-describedby": ariaDescribedBy,
216
+ testID
217
+ }) => {
218
+ return /* @__PURE__ */ jsx3(
219
+ View2,
220
+ {
221
+ accessible: true,
222
+ accessibilityRole: role === "status" ? "none" : void 0,
223
+ accessibilityLabel: ariaLabel,
224
+ accessibilityLiveRegion: ariaLive === "polite" ? "polite" : ariaLive === "assertive" ? "assertive" : "none",
225
+ testID,
226
+ children: /* @__PURE__ */ jsx3(
227
+ ActivityIndicator,
228
+ {
229
+ color,
230
+ size: typeof size === "number" ? size : "small"
231
+ }
232
+ )
233
+ }
234
+ );
235
+ };
236
+ Spinner.displayName = "Spinner";
237
+
238
+ // src/Icon.tsx
239
+ import React from "react";
240
+ import { View as View3 } from "react-native";
241
+ import { jsx as jsx4 } from "react/jsx-runtime";
242
+ var Icon = ({ children, color, size }) => {
243
+ const style = {
244
+ width: typeof size === "number" ? size : void 0,
245
+ height: typeof size === "number" ? size : void 0,
246
+ alignItems: "center",
247
+ justifyContent: "center"
248
+ };
249
+ const childrenWithProps = React.Children.map(children, (child) => {
250
+ if (React.isValidElement(child)) {
251
+ return React.cloneElement(child, {
252
+ color: child.props.color || color,
253
+ // Also pass size if child seems to be an icon that needs it
254
+ size: child.props.size || size
255
+ });
256
+ }
257
+ return child;
258
+ });
259
+ return /* @__PURE__ */ jsx4(View3, { style, children: childrenWithProps });
260
+ };
261
+
262
+ // src/Divider.tsx
263
+ import { View as View4 } from "react-native";
264
+ import { jsx as jsx5 } from "react/jsx-runtime";
265
+ var Divider = ({
266
+ color,
267
+ height,
268
+ width,
269
+ vertical,
270
+ dashStroke
271
+ }) => {
272
+ const style = {
273
+ backgroundColor: dashStroke ? "transparent" : color || "rgba(255, 255, 255, 0.15)",
274
+ width: vertical ? typeof width === "number" ? width : 1 : "100%",
275
+ height: vertical ? "100%" : typeof height === "number" ? height : 1,
276
+ ...dashStroke && {
277
+ borderStyle: "dashed",
278
+ borderColor: color || "rgba(255, 255, 255, 0.15)",
279
+ borderWidth: 0,
280
+ ...vertical ? { borderLeftWidth: typeof width === "number" ? width : 1 } : { borderTopWidth: typeof height === "number" ? height : 1 }
281
+ }
282
+ };
283
+ return /* @__PURE__ */ jsx5(View4, { style });
284
+ };
285
+
286
+ // src/Input.tsx
287
+ import { forwardRef } from "react";
288
+ import { TextInput as RNTextInput } from "react-native";
289
+ import { jsx as jsx6 } from "react/jsx-runtime";
290
+ var keyboardTypeMap = {
291
+ text: "default",
292
+ number: "numeric",
293
+ email: "email-address",
294
+ tel: "phone-pad",
295
+ url: "url",
296
+ decimal: "decimal-pad"
297
+ };
298
+ var inputModeToKeyboardType = {
299
+ none: "default",
300
+ text: "default",
301
+ decimal: "decimal-pad",
302
+ numeric: "number-pad",
303
+ tel: "phone-pad",
304
+ search: "default",
305
+ email: "email-address",
306
+ url: "url"
307
+ };
308
+ var autoCompleteToTextContentType = {
309
+ "one-time-code": "oneTimeCode",
310
+ email: "emailAddress",
311
+ username: "username",
312
+ password: "password",
313
+ "new-password": "newPassword",
314
+ tel: "telephoneNumber",
315
+ "postal-code": "postalCode",
316
+ name: "name"
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
+ }, ref) => {
346
+ const handleChangeText = (text) => {
347
+ onChangeText?.(text);
348
+ if (onChange) {
349
+ const syntheticEvent = {
350
+ target: { value: text },
351
+ currentTarget: { value: text },
352
+ type: "change",
353
+ nativeEvent: { text },
354
+ preventDefault: () => {
355
+ },
356
+ stopPropagation: () => {
357
+ },
358
+ isTrusted: false
359
+ };
360
+ onChange(syntheticEvent);
361
+ }
362
+ };
363
+ const keyboardType = inputMode ? inputModeToKeyboardType[inputMode] || "default" : type ? keyboardTypeMap[type] || "default" : "default";
364
+ const textContentType = autoComplete ? autoCompleteToTextContentType[autoComplete] : void 0;
365
+ return /* @__PURE__ */ jsx6(
366
+ RNTextInput,
367
+ {
368
+ ref,
369
+ value,
370
+ placeholder,
371
+ onChangeText: handleChangeText,
372
+ onFocus,
373
+ onBlur,
374
+ onKeyPress: (e) => {
375
+ if (onKeyDown) {
376
+ onKeyDown({
377
+ key: e.nativeEvent.key,
378
+ preventDefault: () => {
379
+ }
380
+ });
381
+ }
382
+ },
383
+ editable: !disabled,
384
+ secureTextEntry: secureTextEntry || type === "password",
385
+ keyboardType,
386
+ textContentType,
387
+ style: [
388
+ {
389
+ color,
390
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
391
+ flex: 1,
392
+ padding: 0,
393
+ textAlign: style?.textAlign || "left"
394
+ },
395
+ style
396
+ ],
397
+ placeholderTextColor,
398
+ maxLength,
399
+ testID: dataTestId || id,
400
+ accessibilityLabel: ariaLabel,
401
+ accessibilityHint: ariaDescribedBy,
402
+ accessibilityState: {
403
+ disabled: disabled || ariaDisabled
404
+ },
405
+ accessible: true
406
+ }
407
+ );
408
+ }
409
+ );
410
+ InputPrimitive.displayName = "InputPrimitive";
411
+
412
+ // src/TextArea.tsx
413
+ import { forwardRef as forwardRef2 } from "react";
414
+ import { TextInput as RNTextInput2 } from "react-native";
415
+ import { jsx as jsx7 } from "react/jsx-runtime";
416
+ var TextAreaPrimitive = forwardRef2(
417
+ ({
418
+ value,
419
+ placeholder,
420
+ onChange,
421
+ onChangeText,
422
+ onFocus,
423
+ onBlur,
424
+ onKeyDown,
425
+ disabled,
426
+ style,
427
+ color,
428
+ fontSize,
429
+ placeholderTextColor,
430
+ maxLength,
431
+ rows,
432
+ id,
433
+ "aria-invalid": ariaInvalid,
434
+ "aria-describedby": ariaDescribedBy,
435
+ "aria-labelledby": ariaLabelledBy,
436
+ "aria-label": ariaLabel,
437
+ "aria-disabled": ariaDisabled,
438
+ "data-testid": dataTestId
439
+ }, ref) => {
440
+ const handleChangeText = (text) => {
441
+ onChangeText?.(text);
442
+ if (onChange) {
443
+ const syntheticEvent = {
444
+ target: { value: text },
445
+ currentTarget: { value: text },
446
+ type: "change",
447
+ nativeEvent: { text },
448
+ preventDefault: () => {
449
+ },
450
+ stopPropagation: () => {
451
+ },
452
+ isTrusted: false
453
+ };
454
+ onChange(syntheticEvent);
455
+ }
456
+ };
457
+ return /* @__PURE__ */ jsx7(
458
+ RNTextInput2,
459
+ {
460
+ ref,
461
+ value,
462
+ placeholder,
463
+ onChangeText: handleChangeText,
464
+ onFocus,
465
+ onBlur,
466
+ onKeyPress: (e) => {
467
+ if (onKeyDown) {
468
+ onKeyDown({
469
+ key: e.nativeEvent.key,
470
+ preventDefault: () => {
471
+ }
472
+ });
473
+ }
474
+ },
475
+ editable: !disabled,
476
+ multiline: true,
477
+ numberOfLines: rows || 4,
478
+ style: [
479
+ {
480
+ color,
481
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
482
+ flex: 1,
483
+ padding: 0,
484
+ textAlignVertical: "top",
485
+ textAlign: style?.textAlign || "left"
486
+ },
487
+ style
488
+ ],
489
+ placeholderTextColor,
490
+ maxLength,
491
+ testID: dataTestId || id,
492
+ accessibilityLabel: ariaLabel,
493
+ accessibilityHint: ariaDescribedBy,
494
+ accessibilityState: {
495
+ disabled: disabled || ariaDisabled
496
+ },
497
+ accessible: true
498
+ }
499
+ );
500
+ }
501
+ );
502
+ TextAreaPrimitive.displayName = "TextAreaPrimitive";
503
+ export {
504
+ Box,
505
+ Divider,
506
+ Icon,
507
+ InputPrimitive,
508
+ Spinner,
509
+ Text,
510
+ TextAreaPrimitive
511
+ };
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@xsolla/xui-primitives-native",
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-native": "*"
13
+ },
14
+ "dependencies": {
15
+ "@xsolla/xui-primitives-core": "0.64.0-pr56.1768348754",
16
+ "lucide-react-native": "^0.470.0",
17
+ "react-native-svg": "^15.10.1"
18
+ },
19
+ "devDependencies": {
20
+ "@types/react": "^18.0.0",
21
+ "@types/react-native": "^0.73.0",
22
+ "react-native": "^0.73.0",
23
+ "tsup": "^8.0.0"
24
+ },
25
+ "license": "MIT"
26
+ }