@xsolla/xui-tabs-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.js ADDED
@@ -0,0 +1,743 @@
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
+ TabPanel: () => TabPanel,
34
+ Tabs: () => Tabs
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+
38
+ // src/Tabs.tsx
39
+ var import_react4 = require("react");
40
+
41
+ // ../primitives-native/src/Box.tsx
42
+ var import_react_native = require("react-native");
43
+ var import_jsx_runtime = require("react/jsx-runtime");
44
+ var Box = ({
45
+ children,
46
+ onPress,
47
+ onLayout,
48
+ onMoveShouldSetResponder,
49
+ onResponderGrant,
50
+ onResponderMove,
51
+ onResponderRelease,
52
+ onResponderTerminate,
53
+ backgroundColor,
54
+ borderColor,
55
+ borderWidth,
56
+ borderBottomWidth,
57
+ borderBottomColor,
58
+ borderTopWidth,
59
+ borderTopColor,
60
+ borderLeftWidth,
61
+ borderLeftColor,
62
+ borderRightWidth,
63
+ borderRightColor,
64
+ borderRadius,
65
+ borderStyle,
66
+ height,
67
+ padding,
68
+ paddingHorizontal,
69
+ paddingVertical,
70
+ margin,
71
+ marginTop,
72
+ marginBottom,
73
+ marginLeft,
74
+ marginRight,
75
+ flexDirection,
76
+ alignItems,
77
+ justifyContent,
78
+ position,
79
+ top,
80
+ bottom,
81
+ left,
82
+ right,
83
+ width,
84
+ flex,
85
+ overflow,
86
+ zIndex,
87
+ hoverStyle,
88
+ pressStyle,
89
+ style,
90
+ "data-testid": dataTestId,
91
+ testID,
92
+ as,
93
+ src,
94
+ alt,
95
+ ...rest
96
+ }) => {
97
+ const getContainerStyle = (pressed) => ({
98
+ backgroundColor: pressed && pressStyle?.backgroundColor ? pressStyle.backgroundColor : backgroundColor,
99
+ borderColor,
100
+ borderWidth,
101
+ borderBottomWidth,
102
+ borderBottomColor,
103
+ borderTopWidth,
104
+ borderTopColor,
105
+ borderLeftWidth,
106
+ borderLeftColor,
107
+ borderRightWidth,
108
+ borderRightColor,
109
+ borderRadius,
110
+ borderStyle,
111
+ overflow,
112
+ zIndex,
113
+ height,
114
+ width,
115
+ padding,
116
+ paddingHorizontal,
117
+ paddingVertical,
118
+ margin,
119
+ marginTop,
120
+ marginBottom,
121
+ marginLeft,
122
+ marginRight,
123
+ flexDirection,
124
+ alignItems,
125
+ justifyContent,
126
+ position,
127
+ top,
128
+ bottom,
129
+ left,
130
+ right,
131
+ flex,
132
+ ...style
133
+ });
134
+ const finalTestID = dataTestId || testID;
135
+ const {
136
+ role,
137
+ tabIndex,
138
+ onKeyDown,
139
+ onKeyUp,
140
+ "aria-label": _ariaLabel,
141
+ "aria-labelledby": _ariaLabelledBy,
142
+ "aria-current": _ariaCurrent,
143
+ "aria-disabled": _ariaDisabled,
144
+ "aria-live": _ariaLive,
145
+ className,
146
+ "data-testid": _dataTestId,
147
+ ...nativeRest
148
+ } = rest;
149
+ if (as === "img" && src) {
150
+ const imageStyle = {
151
+ width,
152
+ height,
153
+ borderRadius,
154
+ position,
155
+ top,
156
+ bottom,
157
+ left,
158
+ right,
159
+ ...style
160
+ };
161
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
162
+ import_react_native.Image,
163
+ {
164
+ source: { uri: src },
165
+ style: imageStyle,
166
+ testID: finalTestID,
167
+ resizeMode: "cover",
168
+ ...nativeRest
169
+ }
170
+ );
171
+ }
172
+ if (onPress) {
173
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
174
+ import_react_native.Pressable,
175
+ {
176
+ onPress,
177
+ onLayout,
178
+ onMoveShouldSetResponder,
179
+ onResponderGrant,
180
+ onResponderMove,
181
+ onResponderRelease,
182
+ onResponderTerminate,
183
+ style: ({ pressed }) => getContainerStyle(pressed),
184
+ testID: finalTestID,
185
+ ...nativeRest,
186
+ children
187
+ }
188
+ );
189
+ }
190
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
191
+ import_react_native.View,
192
+ {
193
+ style: getContainerStyle(),
194
+ testID: finalTestID,
195
+ onLayout,
196
+ onMoveShouldSetResponder,
197
+ onResponderGrant,
198
+ onResponderMove,
199
+ onResponderRelease,
200
+ onResponderTerminate,
201
+ ...nativeRest,
202
+ children
203
+ }
204
+ );
205
+ };
206
+
207
+ // ../primitives-native/src/Text.tsx
208
+ var import_react_native2 = require("react-native");
209
+ var import_jsx_runtime2 = require("react/jsx-runtime");
210
+ var roleMap = {
211
+ alert: "alert",
212
+ heading: "header",
213
+ button: "button",
214
+ link: "link",
215
+ text: "text"
216
+ };
217
+ var Text = ({
218
+ children,
219
+ color,
220
+ fontSize,
221
+ fontWeight,
222
+ fontFamily,
223
+ id,
224
+ role,
225
+ ...props
226
+ }) => {
227
+ let resolvedFontFamily = fontFamily ? fontFamily.split(",")[0].replace(/['"]/g, "").trim() : void 0;
228
+ if (resolvedFontFamily === "Pilat Wide Bold") {
229
+ resolvedFontFamily = void 0;
230
+ }
231
+ const style = {
232
+ color,
233
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
234
+ fontWeight,
235
+ fontFamily: resolvedFontFamily,
236
+ textDecorationLine: props.textDecoration
237
+ };
238
+ const accessibilityRole = role ? roleMap[role] : void 0;
239
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.Text, { style, testID: id, accessibilityRole, children });
240
+ };
241
+
242
+ // ../primitives-native/src/Spinner.tsx
243
+ var import_react_native3 = require("react-native");
244
+ var import_jsx_runtime3 = require("react/jsx-runtime");
245
+ var Spinner = ({
246
+ color,
247
+ size,
248
+ role,
249
+ "aria-label": ariaLabel,
250
+ "aria-live": ariaLive,
251
+ "aria-describedby": ariaDescribedBy,
252
+ testID
253
+ }) => {
254
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
255
+ import_react_native3.View,
256
+ {
257
+ accessible: true,
258
+ accessibilityRole: role === "status" ? "none" : void 0,
259
+ accessibilityLabel: ariaLabel,
260
+ accessibilityLiveRegion: ariaLive === "polite" ? "polite" : ariaLive === "assertive" ? "assertive" : "none",
261
+ testID,
262
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
263
+ import_react_native3.ActivityIndicator,
264
+ {
265
+ color,
266
+ size: typeof size === "number" ? size : "small"
267
+ }
268
+ )
269
+ }
270
+ );
271
+ };
272
+ Spinner.displayName = "Spinner";
273
+
274
+ // ../primitives-native/src/Icon.tsx
275
+ var import_react = __toESM(require("react"));
276
+ var import_react_native4 = require("react-native");
277
+ var import_jsx_runtime4 = require("react/jsx-runtime");
278
+ var Icon = ({ children, color, size }) => {
279
+ const style = {
280
+ width: typeof size === "number" ? size : void 0,
281
+ height: typeof size === "number" ? size : void 0,
282
+ alignItems: "center",
283
+ justifyContent: "center"
284
+ };
285
+ const childrenWithProps = import_react.default.Children.map(children, (child) => {
286
+ if (import_react.default.isValidElement(child)) {
287
+ return import_react.default.cloneElement(child, {
288
+ color: child.props.color || color,
289
+ // Also pass size if child seems to be an icon that needs it
290
+ size: child.props.size || size
291
+ });
292
+ }
293
+ return child;
294
+ });
295
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.View, { style, children: childrenWithProps });
296
+ };
297
+
298
+ // ../primitives-native/src/Divider.tsx
299
+ var import_react_native5 = require("react-native");
300
+ var import_jsx_runtime5 = require("react/jsx-runtime");
301
+
302
+ // ../primitives-native/src/Input.tsx
303
+ var import_react2 = require("react");
304
+ var import_react_native6 = require("react-native");
305
+ var import_jsx_runtime6 = require("react/jsx-runtime");
306
+ var keyboardTypeMap = {
307
+ text: "default",
308
+ number: "numeric",
309
+ email: "email-address",
310
+ tel: "phone-pad",
311
+ url: "url",
312
+ decimal: "decimal-pad"
313
+ };
314
+ var inputModeToKeyboardType = {
315
+ none: "default",
316
+ text: "default",
317
+ decimal: "decimal-pad",
318
+ numeric: "number-pad",
319
+ tel: "phone-pad",
320
+ search: "default",
321
+ email: "email-address",
322
+ url: "url"
323
+ };
324
+ var autoCompleteToTextContentType = {
325
+ "one-time-code": "oneTimeCode",
326
+ email: "emailAddress",
327
+ username: "username",
328
+ password: "password",
329
+ "new-password": "newPassword",
330
+ tel: "telephoneNumber",
331
+ "postal-code": "postalCode",
332
+ name: "name"
333
+ };
334
+ var InputPrimitive = (0, import_react2.forwardRef)(
335
+ ({
336
+ value,
337
+ placeholder,
338
+ onChange,
339
+ onChangeText,
340
+ onFocus,
341
+ onBlur,
342
+ onKeyDown,
343
+ disabled,
344
+ secureTextEntry,
345
+ style,
346
+ color,
347
+ fontSize,
348
+ placeholderTextColor,
349
+ maxLength,
350
+ name,
351
+ type,
352
+ inputMode,
353
+ autoComplete,
354
+ id,
355
+ "aria-invalid": ariaInvalid,
356
+ "aria-describedby": ariaDescribedBy,
357
+ "aria-labelledby": ariaLabelledBy,
358
+ "aria-label": ariaLabel,
359
+ "aria-disabled": ariaDisabled,
360
+ "data-testid": dataTestId
361
+ }, ref) => {
362
+ const handleChangeText = (text) => {
363
+ onChangeText?.(text);
364
+ if (onChange) {
365
+ const syntheticEvent = {
366
+ target: { value: text },
367
+ currentTarget: { value: text },
368
+ type: "change",
369
+ nativeEvent: { text },
370
+ preventDefault: () => {
371
+ },
372
+ stopPropagation: () => {
373
+ },
374
+ isTrusted: false
375
+ };
376
+ onChange(syntheticEvent);
377
+ }
378
+ };
379
+ const keyboardType = inputMode ? inputModeToKeyboardType[inputMode] || "default" : type ? keyboardTypeMap[type] || "default" : "default";
380
+ const textContentType = autoComplete ? autoCompleteToTextContentType[autoComplete] : void 0;
381
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
382
+ import_react_native6.TextInput,
383
+ {
384
+ ref,
385
+ value,
386
+ placeholder,
387
+ onChangeText: handleChangeText,
388
+ onFocus,
389
+ onBlur,
390
+ onKeyPress: (e) => {
391
+ if (onKeyDown) {
392
+ onKeyDown({
393
+ key: e.nativeEvent.key,
394
+ preventDefault: () => {
395
+ }
396
+ });
397
+ }
398
+ },
399
+ editable: !disabled,
400
+ secureTextEntry: secureTextEntry || type === "password",
401
+ keyboardType,
402
+ textContentType,
403
+ style: [
404
+ {
405
+ color,
406
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
407
+ flex: 1,
408
+ padding: 0,
409
+ textAlign: style?.textAlign || "left"
410
+ },
411
+ style
412
+ ],
413
+ placeholderTextColor,
414
+ maxLength,
415
+ testID: dataTestId || id,
416
+ accessibilityLabel: ariaLabel,
417
+ accessibilityHint: ariaDescribedBy,
418
+ accessibilityState: {
419
+ disabled: disabled || ariaDisabled
420
+ },
421
+ accessible: true
422
+ }
423
+ );
424
+ }
425
+ );
426
+ InputPrimitive.displayName = "InputPrimitive";
427
+
428
+ // ../primitives-native/src/TextArea.tsx
429
+ var import_react3 = require("react");
430
+ var import_react_native7 = require("react-native");
431
+ var import_jsx_runtime7 = require("react/jsx-runtime");
432
+ var TextAreaPrimitive = (0, import_react3.forwardRef)(
433
+ ({
434
+ value,
435
+ placeholder,
436
+ onChange,
437
+ onChangeText,
438
+ onFocus,
439
+ onBlur,
440
+ onKeyDown,
441
+ disabled,
442
+ style,
443
+ color,
444
+ fontSize,
445
+ placeholderTextColor,
446
+ maxLength,
447
+ rows,
448
+ id,
449
+ "aria-invalid": ariaInvalid,
450
+ "aria-describedby": ariaDescribedBy,
451
+ "aria-labelledby": ariaLabelledBy,
452
+ "aria-label": ariaLabel,
453
+ "aria-disabled": ariaDisabled,
454
+ "data-testid": dataTestId
455
+ }, ref) => {
456
+ const handleChangeText = (text) => {
457
+ onChangeText?.(text);
458
+ if (onChange) {
459
+ const syntheticEvent = {
460
+ target: { value: text },
461
+ currentTarget: { value: text },
462
+ type: "change",
463
+ nativeEvent: { text },
464
+ preventDefault: () => {
465
+ },
466
+ stopPropagation: () => {
467
+ },
468
+ isTrusted: false
469
+ };
470
+ onChange(syntheticEvent);
471
+ }
472
+ };
473
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
474
+ import_react_native7.TextInput,
475
+ {
476
+ ref,
477
+ value,
478
+ placeholder,
479
+ onChangeText: handleChangeText,
480
+ onFocus,
481
+ onBlur,
482
+ onKeyPress: (e) => {
483
+ if (onKeyDown) {
484
+ onKeyDown({
485
+ key: e.nativeEvent.key,
486
+ preventDefault: () => {
487
+ }
488
+ });
489
+ }
490
+ },
491
+ editable: !disabled,
492
+ multiline: true,
493
+ numberOfLines: rows || 4,
494
+ style: [
495
+ {
496
+ color,
497
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
498
+ flex: 1,
499
+ padding: 0,
500
+ textAlignVertical: "top",
501
+ textAlign: style?.textAlign || "left"
502
+ },
503
+ style
504
+ ],
505
+ placeholderTextColor,
506
+ maxLength,
507
+ testID: dataTestId || id,
508
+ accessibilityLabel: ariaLabel,
509
+ accessibilityHint: ariaDescribedBy,
510
+ accessibilityState: {
511
+ disabled: disabled || ariaDisabled
512
+ },
513
+ accessible: true
514
+ }
515
+ );
516
+ }
517
+ );
518
+ TextAreaPrimitive.displayName = "TextAreaPrimitive";
519
+
520
+ // src/Tabs.tsx
521
+ var import_xui_core = require("@xsolla/xui-core");
522
+ var import_xui_badge = require("@xsolla/xui-badge");
523
+ var import_jsx_runtime8 = require("react/jsx-runtime");
524
+ var Tabs = ({
525
+ tabs,
526
+ activeTabId,
527
+ onChange,
528
+ size = "m",
529
+ alignLeft = true,
530
+ "aria-label": ariaLabel,
531
+ "aria-labelledby": ariaLabelledBy,
532
+ activateOnFocus = true,
533
+ id,
534
+ testID
535
+ }) => {
536
+ const { theme } = (0, import_xui_core.useDesignSystem)();
537
+ const sizeStyles = theme.sizing.tabs(size);
538
+ const tabListId = id ? `${id}-tablist` : void 0;
539
+ const [_focusedIndex, setFocusedIndex] = (0, import_react4.useState)(-1);
540
+ const tabRefs = (0, import_react4.useRef)([]);
541
+ const enabledIndices = tabs.map((tab, index) => !tab.disabled ? index : -1).filter((i) => i !== -1);
542
+ const focusTab = (0, import_react4.useCallback)((index) => {
543
+ const tabElement = tabRefs.current[index];
544
+ if (tabElement) {
545
+ tabElement.focus();
546
+ setFocusedIndex(index);
547
+ }
548
+ }, []);
549
+ const handleKeyDown = (0, import_react4.useCallback)(
550
+ (e, currentIndex) => {
551
+ const currentEnabledIndex = enabledIndices.indexOf(currentIndex);
552
+ switch (e.key) {
553
+ case "ArrowRight":
554
+ case "ArrowDown":
555
+ e.preventDefault();
556
+ {
557
+ const nextEnabledIndex = currentEnabledIndex < enabledIndices.length - 1 ? enabledIndices[currentEnabledIndex + 1] : enabledIndices[0];
558
+ focusTab(nextEnabledIndex);
559
+ if (activateOnFocus && onChange) {
560
+ onChange(tabs[nextEnabledIndex].id);
561
+ }
562
+ }
563
+ break;
564
+ case "ArrowLeft":
565
+ case "ArrowUp":
566
+ e.preventDefault();
567
+ {
568
+ const prevEnabledIndex = currentEnabledIndex > 0 ? enabledIndices[currentEnabledIndex - 1] : enabledIndices[enabledIndices.length - 1];
569
+ focusTab(prevEnabledIndex);
570
+ if (activateOnFocus && onChange) {
571
+ onChange(tabs[prevEnabledIndex].id);
572
+ }
573
+ }
574
+ break;
575
+ case "Home":
576
+ e.preventDefault();
577
+ {
578
+ const firstEnabledIndex = enabledIndices[0];
579
+ focusTab(firstEnabledIndex);
580
+ if (activateOnFocus && onChange) {
581
+ onChange(tabs[firstEnabledIndex].id);
582
+ }
583
+ }
584
+ break;
585
+ case "End":
586
+ e.preventDefault();
587
+ {
588
+ const lastEnabledIndex = enabledIndices[enabledIndices.length - 1];
589
+ focusTab(lastEnabledIndex);
590
+ if (activateOnFocus && onChange) {
591
+ onChange(tabs[lastEnabledIndex].id);
592
+ }
593
+ }
594
+ break;
595
+ case "Enter":
596
+ case " ":
597
+ e.preventDefault();
598
+ if (!activateOnFocus && onChange) {
599
+ onChange(tabs[currentIndex].id);
600
+ }
601
+ break;
602
+ default:
603
+ break;
604
+ }
605
+ },
606
+ [enabledIndices, focusTab, activateOnFocus, onChange, tabs]
607
+ );
608
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
609
+ Box,
610
+ {
611
+ as: "nav",
612
+ role: "tablist",
613
+ id: tabListId,
614
+ "aria-label": ariaLabel,
615
+ "aria-labelledby": ariaLabelledBy,
616
+ "aria-orientation": "horizontal",
617
+ testID,
618
+ flexDirection: "row",
619
+ alignItems: "flex-end",
620
+ justifyContent: alignLeft ? "flex-start" : "center",
621
+ width: "100%",
622
+ height: sizeStyles.height,
623
+ borderBottomWidth: 1,
624
+ borderBottomColor: theme.colors.border.secondary,
625
+ borderStyle: "solid",
626
+ children: tabs.map((tab, index) => {
627
+ const isActive = tab.id === activeTabId;
628
+ const isDisabled = tab.disabled;
629
+ const tabId = `${id}-tab-${tab.id}`;
630
+ const tabPanelId = `${id}-tabpanel-${tab.id}`;
631
+ const handlePress = () => {
632
+ if (!isDisabled && onChange) {
633
+ onChange(tab.id);
634
+ }
635
+ };
636
+ const handleFocus = () => {
637
+ setFocusedIndex(index);
638
+ };
639
+ const textColor = isDisabled ? theme.colors.content.tertiary : isActive ? theme.colors.content.primary : theme.colors.content.tertiary;
640
+ const borderBottomColor = isActive ? theme.colors.border.primary : "transparent";
641
+ const borderBottomWidth = isActive ? 2 : 0;
642
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
643
+ Box,
644
+ {
645
+ as: "button",
646
+ role: "tab",
647
+ id: tabId,
648
+ "aria-selected": isActive,
649
+ "aria-disabled": isDisabled,
650
+ "aria-controls": tabPanelId,
651
+ "aria-label": tab["aria-label"],
652
+ tabIndex: isActive ? 0 : -1,
653
+ disabled: isDisabled,
654
+ ref: (el) => {
655
+ tabRefs.current[index] = el;
656
+ },
657
+ onPress: handlePress,
658
+ onFocus: handleFocus,
659
+ onKeyDown: (e) => handleKeyDown(e, index),
660
+ height: sizeStyles.height,
661
+ paddingHorizontal: sizeStyles.paddingHorizontal,
662
+ flexDirection: "row",
663
+ alignItems: "center",
664
+ justifyContent: "center",
665
+ gap: sizeStyles.gap,
666
+ position: "relative",
667
+ borderBottomWidth,
668
+ borderBottomColor,
669
+ borderStyle: isActive ? "solid" : "none",
670
+ marginBottom: -1,
671
+ cursor: isDisabled ? "not-allowed" : "pointer",
672
+ hoverStyle: !isDisabled && !isActive ? {
673
+ backgroundColor: theme.colors.overlay.mono
674
+ } : void 0,
675
+ focusStyle: {
676
+ outlineColor: theme.colors.border.brand,
677
+ outlineWidth: 2,
678
+ outlineOffset: -2
679
+ },
680
+ children: [
681
+ tab.icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { size: sizeStyles.iconSize, color: textColor, "aria-hidden": true, children: tab.icon }),
682
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
683
+ Text,
684
+ {
685
+ color: textColor,
686
+ fontSize: sizeStyles.fontSize,
687
+ fontWeight: isActive ? "600" : "500",
688
+ children: tab.label
689
+ }
690
+ ),
691
+ tab.counter !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { marginLeft: 2, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
692
+ Text,
693
+ {
694
+ color: theme.colors.content.brand.primary,
695
+ fontSize: sizeStyles.fontSize,
696
+ fontWeight: "500",
697
+ "aria-label": `${tab.counter} items`,
698
+ children: tab.counter
699
+ }
700
+ ) }),
701
+ tab.badge && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { marginLeft: 2, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_xui_badge.Badge, { size: "s", children: typeof tab.badge === "string" || typeof tab.badge === "number" ? tab.badge : void 0 }) })
702
+ ]
703
+ },
704
+ tab.id
705
+ );
706
+ })
707
+ }
708
+ );
709
+ };
710
+ Tabs.displayName = "Tabs";
711
+ var TabPanel = ({
712
+ id,
713
+ tabsId,
714
+ hidden = false,
715
+ children,
716
+ "aria-label": ariaLabel,
717
+ testID
718
+ }) => {
719
+ const panelId = `${tabsId}-tabpanel-${id}`;
720
+ const tabId = `${tabsId}-tab-${id}`;
721
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
722
+ Box,
723
+ {
724
+ as: "section",
725
+ role: "tabpanel",
726
+ id: panelId,
727
+ "aria-labelledby": tabId,
728
+ "aria-label": ariaLabel,
729
+ "aria-hidden": hidden,
730
+ tabIndex: hidden ? -1 : 0,
731
+ testID,
732
+ style: { display: hidden ? "none" : void 0 },
733
+ children
734
+ }
735
+ );
736
+ };
737
+ TabPanel.displayName = "TabPanel";
738
+ // Annotate the CommonJS export names for ESM import in node:
739
+ 0 && (module.exports = {
740
+ TabPanel,
741
+ Tabs
742
+ });
743
+ //# sourceMappingURL=index.js.map