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