@xsolla/xui-tab-bar 0.102.0 → 0.104.0

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/native/index.js CHANGED
@@ -225,7 +225,7 @@ var Text = ({
225
225
  ...props
226
226
  }) => {
227
227
  let resolvedFontFamily = fontFamily ? fontFamily.split(",")[0].replace(/['"]/g, "").trim() : void 0;
228
- if (resolvedFontFamily === "Pilat Wide Bold") {
228
+ if (resolvedFontFamily === "Pilat Wide" || resolvedFontFamily === "Pilat Wide Bold" || resolvedFontFamily === "Aktiv Grotesk") {
229
229
  resolvedFontFamily = void 0;
230
230
  }
231
231
  const style = {
@@ -287,7 +287,7 @@ var TabBarItem = ({
287
287
  tabRef
288
288
  }) => {
289
289
  const { theme } = (0, import_xui_core.useDesignSystem)();
290
- const color = focused ? theme.colors.content.brand.primary : theme.colors.content.primary;
290
+ const color = focused ? theme.colors.content.inverse : theme.colors.content.primary;
291
291
  const renderIcon = () => {
292
292
  if (!icon) return null;
293
293
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
@@ -321,8 +321,9 @@ var TabBarItem = ({
321
321
  Text,
322
322
  {
323
323
  color,
324
- fontSize: 12,
325
- fontWeight: focused ? "600" : "400",
324
+ fontSize: 10,
325
+ lineHeight: 10,
326
+ fontWeight: "400",
326
327
  numberOfLines: 1,
327
328
  "aria-hidden": true,
328
329
  children: label
@@ -352,12 +353,15 @@ var TabBarItem = ({
352
353
  paddingVertical: 8,
353
354
  cursor: "pointer",
354
355
  flexDirection: labelPosition === "beside-icon" ? "row" : "column",
355
- gap: labelPosition === "beside-icon" ? 8 : 4,
356
+ gap: labelPosition === "beside-icon" ? 8 : 8,
357
+ position: "relative",
358
+ zIndex: 1,
359
+ borderRadius: 4,
356
360
  onPress,
357
361
  onLongPress,
358
362
  onKeyDown: handleKeyDown,
359
363
  testID,
360
- hoverStyle: {
364
+ hoverStyle: focused ? void 0 : {
361
365
  backgroundColor: theme.colors.overlay.mono
362
366
  },
363
367
  focusStyle: {
@@ -391,7 +395,24 @@ var TabBar = ({
391
395
  }) => {
392
396
  const { theme } = (0, import_xui_core2.useDesignSystem)();
393
397
  const tabRefs = (0, import_react3.useRef)([]);
398
+ const containerRef = (0, import_react3.useRef)(null);
394
399
  const tabCount = state.routes.length;
400
+ const [indicatorStyle, setIndicatorStyle] = (0, import_react3.useState)({ left: 0, width: 0, initialized: false });
401
+ (0, import_react3.useEffect)(() => {
402
+ if (!import_xui_core2.isWeb) return;
403
+ const activeIndex = state.index;
404
+ const activeTabEl = tabRefs.current[activeIndex];
405
+ const containerEl = containerRef.current;
406
+ if (activeTabEl && containerEl) {
407
+ const containerRect = containerEl.getBoundingClientRect();
408
+ const tabRect = activeTabEl.getBoundingClientRect();
409
+ setIndicatorStyle({
410
+ left: tabRect.left - containerRect.left,
411
+ width: tabRect.width,
412
+ initialized: true
413
+ });
414
+ }
415
+ }, [state.index]);
395
416
  const focusTab = (0, import_react3.useCallback)((index) => {
396
417
  const tabElement = tabRefs.current[index];
397
418
  if (tabElement) {
@@ -453,7 +474,7 @@ var TabBar = ({
453
474
  },
454
475
  [tabCount, focusTab, navigateToTab, activateOnFocus]
455
476
  );
456
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
477
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
457
478
  Box,
458
479
  {
459
480
  as: "nav",
@@ -461,71 +482,94 @@ var TabBar = ({
461
482
  "aria-label": ariaLabel || "Tab navigation",
462
483
  "aria-labelledby": ariaLabelledBy,
463
484
  "aria-orientation": "horizontal",
485
+ ref: (el) => {
486
+ containerRef.current = el;
487
+ },
464
488
  flexDirection: "row",
465
489
  backgroundColor: backgroundColor || theme.colors.background.primary,
466
- borderTopWidth: 1,
467
- borderTopColor: theme.colors.border.secondary,
468
- borderStyle: "solid",
469
- height: 60,
490
+ borderRadius: 4,
491
+ height: 56,
470
492
  width: "100%",
493
+ position: "relative",
494
+ overflow: "hidden",
471
495
  testID: testID || "tab-bar-container",
472
496
  id,
473
- children: state.routes.map((route, index) => {
474
- const { options } = descriptors[route.key];
475
- const label = options.tabBarShowLabel === false ? void 0 : options.tabBarLabel !== void 0 ? options.tabBarLabel : options.title !== void 0 ? options.title : route.name;
476
- const isFocused = state.index === index;
477
- const onPress = () => {
478
- const event = navigation.emit({
479
- type: "tabPress",
480
- target: route.key,
481
- canPreventDefault: true
482
- });
483
- if (!isFocused && !event.defaultPrevented) {
484
- navigation.navigate(route.name, route.params);
485
- }
486
- };
487
- const onLongPress = () => {
488
- navigation.emit({
489
- type: "tabLongPress",
490
- target: route.key
491
- });
492
- };
493
- const icon = options.tabBarIcon ? options.tabBarIcon({
494
- focused: isFocused,
495
- color: isFocused ? theme.colors.content.brand.primary : theme.colors.content.primary,
496
- size: 24
497
- }) : void 0;
498
- const badge = options.tabBarBadge;
499
- const resolvedLabel = typeof label === "function" ? label({
500
- focused: isFocused,
501
- color: isFocused ? theme.colors.content.brand.primary : theme.colors.content.primary,
502
- position: labelPosition
503
- }) : label;
504
- const accessibilityLabel = options.tabBarAccessibilityLabel || (typeof resolvedLabel === "string" ? resolvedLabel : route.name);
505
- const tabId = id ? `${id}-tab-${route.key}` : void 0;
506
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
507
- TabBarItem,
497
+ children: [
498
+ import_xui_core2.isWeb && indicatorStyle.initialized && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
499
+ Box,
508
500
  {
509
- id: tabId,
510
- label: resolvedLabel,
511
- icon,
512
- badge,
513
- focused: isFocused,
514
- onPress,
515
- onLongPress,
516
- labelPosition,
517
- accessibilityLabel,
518
- testID: options.tabBarTestID,
519
- index,
520
- tabCount,
521
- onKeyDown: handleKeyDown,
522
- tabRef: (el) => {
523
- tabRefs.current[index] = el;
501
+ position: "absolute",
502
+ zIndex: 0,
503
+ height: "100%",
504
+ backgroundColor: theme.colors.content.primary,
505
+ borderRadius: 4,
506
+ style: {
507
+ left: indicatorStyle.left,
508
+ width: indicatorStyle.width,
509
+ transition: "left 200ms ease-out, width 200ms ease-out",
510
+ pointerEvents: "none"
511
+ },
512
+ "aria-hidden": true
513
+ }
514
+ ),
515
+ state.routes.map((route, index) => {
516
+ const { options } = descriptors[route.key];
517
+ const label = options.tabBarShowLabel === false ? void 0 : options.tabBarLabel !== void 0 ? options.tabBarLabel : options.title !== void 0 ? options.title : route.name;
518
+ const isFocused = state.index === index;
519
+ const onPress = () => {
520
+ const event = navigation.emit({
521
+ type: "tabPress",
522
+ target: route.key,
523
+ canPreventDefault: true
524
+ });
525
+ if (!isFocused && !event.defaultPrevented) {
526
+ navigation.navigate(route.name, route.params);
524
527
  }
525
- },
526
- route.key
527
- );
528
- })
528
+ };
529
+ const onLongPress = () => {
530
+ navigation.emit({
531
+ type: "tabLongPress",
532
+ target: route.key
533
+ });
534
+ };
535
+ const iconColor = isFocused ? theme.colors.content.inverse : theme.colors.content.primary;
536
+ const icon = options.tabBarIcon ? options.tabBarIcon({
537
+ focused: isFocused,
538
+ color: iconColor,
539
+ size: 24
540
+ }) : void 0;
541
+ const badge = options.tabBarBadge;
542
+ const resolvedLabel = typeof label === "function" ? label({
543
+ focused: isFocused,
544
+ color: iconColor,
545
+ position: labelPosition
546
+ }) : label;
547
+ const accessibilityLabel = options.tabBarAccessibilityLabel || (typeof resolvedLabel === "string" ? resolvedLabel : route.name);
548
+ const tabId = id ? `${id}-tab-${route.key}` : void 0;
549
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
550
+ TabBarItem,
551
+ {
552
+ id: tabId,
553
+ label: resolvedLabel,
554
+ icon,
555
+ badge,
556
+ focused: isFocused,
557
+ onPress,
558
+ onLongPress,
559
+ labelPosition,
560
+ accessibilityLabel,
561
+ testID: options.tabBarTestID,
562
+ index,
563
+ tabCount,
564
+ onKeyDown: handleKeyDown,
565
+ tabRef: (el) => {
566
+ tabRefs.current[index] = el;
567
+ }
568
+ },
569
+ route.key
570
+ );
571
+ })
572
+ ]
529
573
  }
530
574
  );
531
575
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.tsx","../../src/TabBar.tsx","../../../primitives-native/src/Box.tsx","../../../primitives-native/src/Text.tsx","../../../primitives-native/src/Icon.tsx","../../src/TabBarItem.tsx"],"sourcesContent":["export * from \"./TabBar\";\nexport * from \"./TabBarItem\";\nexport * from \"./types\";\n","import React, { useRef, useCallback } from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\nimport { TabBarItem } from \"./TabBarItem\";\nimport type { TabBarProps } from \"./types\";\n\n/**\n * TabBar - An accessible tab bar navigation component\n *\n * Implements WAI-ARIA Tabs pattern with proper keyboard navigation:\n * - Arrow Left/Right: Navigate between tabs\n * - Home: Jump to first tab\n * - End: Jump to last tab\n * - Enter/Space: Activate focused tab (when activateOnFocus is false)\n *\n * @example\n * ```tsx\n * <TabBar\n * state={navigationState}\n * descriptors={descriptors}\n * navigation={navigation}\n * aria-label=\"Main navigation\"\n * />\n * ```\n */\nexport const TabBar: React.FC<TabBarProps> = ({\n state,\n descriptors,\n navigation,\n labelPosition = \"below-icon\",\n backgroundColor,\n testID,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n id,\n activateOnFocus = true,\n}) => {\n const { theme } = useDesignSystem();\n const tabRefs = useRef<(HTMLElement | null)[]>([]);\n const tabCount = state.routes.length;\n\n /**\n * Focus a tab by its index\n */\n const focusTab = useCallback((index: number) => {\n const tabElement = tabRefs.current[index];\n if (tabElement) {\n tabElement.focus();\n }\n }, []);\n\n /**\n * Navigate to a tab by index\n */\n const navigateToTab = useCallback(\n (index: number) => {\n const route = state.routes[index];\n if (route) {\n const event = navigation.emit({\n type: \"tabPress\",\n target: route.key,\n canPreventDefault: true,\n });\n\n if (!event.defaultPrevented) {\n navigation.navigate(route.name, route.params);\n }\n }\n },\n [state.routes, navigation]\n );\n\n /**\n * Handle keyboard navigation within the tab bar\n */\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent, currentIndex: number) => {\n let nextIndex: number | null = null;\n\n switch (e.key) {\n case \"ArrowRight\":\n case \"ArrowDown\":\n e.preventDefault();\n nextIndex = currentIndex < tabCount - 1 ? currentIndex + 1 : 0;\n break;\n\n case \"ArrowLeft\":\n case \"ArrowUp\":\n e.preventDefault();\n nextIndex = currentIndex > 0 ? currentIndex - 1 : tabCount - 1;\n break;\n\n case \"Home\":\n e.preventDefault();\n nextIndex = 0;\n break;\n\n case \"End\":\n e.preventDefault();\n nextIndex = tabCount - 1;\n break;\n\n case \"Enter\":\n case \" \":\n e.preventDefault();\n navigateToTab(currentIndex);\n break;\n\n default:\n break;\n }\n\n if (nextIndex !== null) {\n focusTab(nextIndex);\n if (activateOnFocus) {\n navigateToTab(nextIndex);\n }\n }\n },\n [tabCount, focusTab, navigateToTab, activateOnFocus]\n );\n\n return (\n <Box\n as=\"nav\"\n role=\"tablist\"\n aria-label={ariaLabel || \"Tab navigation\"}\n aria-labelledby={ariaLabelledBy}\n aria-orientation=\"horizontal\"\n flexDirection=\"row\"\n backgroundColor={backgroundColor || theme.colors.background.primary}\n borderTopWidth={1}\n borderTopColor={theme.colors.border.secondary}\n borderStyle=\"solid\"\n height={60}\n width=\"100%\"\n testID={testID || \"tab-bar-container\"}\n id={id}\n >\n {state.routes.map((route, index) => {\n const { options } = descriptors[route.key];\n const label =\n options.tabBarShowLabel === false\n ? undefined\n : options.tabBarLabel !== undefined\n ? options.tabBarLabel\n : options.title !== undefined\n ? options.title\n : route.name;\n\n const isFocused = state.index === index;\n\n const onPress = () => {\n const event = navigation.emit({\n type: \"tabPress\",\n target: route.key,\n canPreventDefault: true,\n });\n\n if (!isFocused && !event.defaultPrevented) {\n navigation.navigate(route.name, route.params);\n }\n };\n\n const onLongPress = () => {\n navigation.emit({\n type: \"tabLongPress\",\n target: route.key,\n });\n };\n\n const icon = options.tabBarIcon\n ? options.tabBarIcon({\n focused: isFocused,\n color: isFocused\n ? theme.colors.content.brand.primary\n : theme.colors.content.primary,\n size: 24,\n })\n : undefined;\n\n const badge = options.tabBarBadge;\n\n // Generate accessible label fallback\n const resolvedLabel =\n typeof label === \"function\"\n ? label({\n focused: isFocused,\n color: isFocused\n ? theme.colors.content.brand.primary\n : theme.colors.content.primary,\n position: labelPosition,\n })\n : label;\n\n // Use explicit accessibility label or fall back to text label\n const accessibilityLabel =\n options.tabBarAccessibilityLabel ||\n (typeof resolvedLabel === \"string\" ? resolvedLabel : route.name);\n\n // Generate unique tab ID\n const tabId = id ? `${id}-tab-${route.key}` : undefined;\n\n return (\n <TabBarItem\n key={route.key}\n id={tabId}\n label={resolvedLabel}\n icon={icon}\n badge={badge}\n focused={isFocused}\n onPress={onPress}\n onLongPress={onLongPress}\n labelPosition={labelPosition}\n accessibilityLabel={accessibilityLabel}\n testID={options.tabBarTestID}\n index={index}\n tabCount={tabCount}\n onKeyDown={handleKeyDown}\n tabRef={(el) => {\n tabRefs.current[index] = el;\n }}\n />\n );\n })}\n </Box>\n );\n};\n\nTabBar.displayName = \"TabBar\";\n","import React from \"react\";\nimport {\n View,\n Pressable,\n Image,\n ViewStyle,\n ImageStyle,\n DimensionValue,\n AnimatableNumericValue,\n} from \"react-native\";\nimport { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Box: React.FC<BoxProps> = ({\n children,\n onPress,\n onLayout,\n onMoveShouldSetResponder,\n onResponderGrant,\n onResponderMove,\n onResponderRelease,\n onResponderTerminate,\n backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius,\n borderStyle,\n height,\n padding,\n paddingHorizontal,\n paddingVertical,\n margin,\n marginTop,\n marginBottom,\n marginLeft,\n marginRight,\n flexDirection,\n alignItems,\n justifyContent,\n position,\n top,\n bottom,\n left,\n right,\n width,\n flex,\n overflow,\n zIndex,\n hoverStyle,\n pressStyle,\n style,\n \"data-testid\": dataTestId,\n testID,\n as,\n src,\n alt,\n ...rest\n}) => {\n const getContainerStyle = (pressed?: boolean): ViewStyle => ({\n backgroundColor:\n pressed && pressStyle?.backgroundColor\n ? pressStyle.backgroundColor\n : backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius: borderRadius as AnimatableNumericValue,\n borderStyle: borderStyle as ViewStyle[\"borderStyle\"],\n overflow,\n zIndex,\n height: height as DimensionValue,\n width: width as DimensionValue,\n padding: padding as DimensionValue,\n paddingHorizontal: paddingHorizontal as DimensionValue,\n paddingVertical: paddingVertical as DimensionValue,\n margin: margin as DimensionValue,\n marginTop: marginTop as DimensionValue,\n marginBottom: marginBottom as DimensionValue,\n marginLeft: marginLeft as DimensionValue,\n marginRight: marginRight as DimensionValue,\n flexDirection,\n alignItems,\n justifyContent,\n position: position as ViewStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n flex,\n ...(style as ViewStyle),\n });\n\n const finalTestID = dataTestId || testID;\n\n // Destructure and drop web-only props from rest before passing to RN components\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n role,\n tabIndex,\n onKeyDown,\n onKeyUp,\n \"aria-label\": _ariaLabel,\n \"aria-labelledby\": _ariaLabelledBy,\n \"aria-current\": _ariaCurrent,\n \"aria-disabled\": _ariaDisabled,\n \"aria-live\": _ariaLive,\n className,\n \"data-testid\": _dataTestId,\n ...nativeRest\n } = rest as Record<string, unknown>;\n\n // Handle as=\"img\" for React Native\n if (as === \"img\" && src) {\n const imageStyle: ImageStyle = {\n width: width as DimensionValue,\n height: height as DimensionValue,\n borderRadius: borderRadius as number,\n position: position as ImageStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n ...(style as ImageStyle),\n };\n\n return (\n <Image\n source={{ uri: src }}\n style={imageStyle}\n testID={finalTestID}\n resizeMode=\"cover\"\n {...nativeRest}\n />\n );\n }\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n style={({ pressed }) => getContainerStyle(pressed)}\n testID={finalTestID}\n {...nativeRest}\n >\n {children}\n </Pressable>\n );\n }\n\n return (\n <View\n style={getContainerStyle()}\n testID={finalTestID}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n {...nativeRest}\n >\n {children}\n </View>\n );\n};\n","import React from \"react\";\nimport { Text as RNText, TextStyle, AccessibilityRole } from \"react-native\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\n// Map web roles to React Native accessibility roles\nconst roleMap: Record<string, AccessibilityRole> = {\n alert: \"alert\",\n heading: \"header\",\n button: \"button\",\n link: \"link\",\n text: \"text\",\n};\n\nexport const Text: React.FC<TextProps> = ({\n children,\n color,\n fontSize,\n fontWeight,\n fontFamily,\n id,\n role,\n ...props\n}) => {\n // Extract the first font name from a comma-separated list (e.g. for web-style font stacks)\n let resolvedFontFamily = fontFamily\n ? fontFamily.split(\",\")[0].replace(/['\"]/g, \"\").trim()\n : undefined;\n\n // On native, if we don't have the custom font loaded, it's better to use the system font\n // to avoid rendering issues or missing text.\n if (resolvedFontFamily === \"Pilat Wide Bold\") {\n resolvedFontFamily = undefined;\n }\n\n const style: TextStyle = {\n color,\n fontSize: typeof fontSize === \"number\" ? fontSize : undefined,\n fontWeight: fontWeight as TextStyle[\"fontWeight\"],\n fontFamily: resolvedFontFamily,\n textDecorationLine: props.textDecoration as TextStyle[\"textDecorationLine\"],\n };\n\n // Map role to React Native accessibilityRole\n const accessibilityRole = role ? roleMap[role] : undefined;\n\n return (\n <RNText style={style} testID={id} accessibilityRole={accessibilityRole}>\n {children}\n </RNText>\n );\n};\n","import React from \"react\";\nimport { View, ViewStyle } from \"react-native\";\nimport { IconProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Icon: React.FC<IconProps> = ({ children, color, size }) => {\n const style: ViewStyle = {\n width: typeof size === \"number\" ? size : undefined,\n height: typeof size === \"number\" ? size : undefined,\n alignItems: \"center\",\n justifyContent: \"center\",\n };\n\n // On native, we try to pass the color down to children (like Text primitives)\n // to mimic the CSS inheritance behavior of the web version.\n const childrenWithProps = React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n return React.cloneElement(child, {\n color: child.props.color || color,\n // Also pass size if child seems to be an icon that needs it\n size: child.props.size || size,\n });\n }\n return child;\n });\n\n return <View style={style}>{childrenWithProps}</View>;\n};\n","import React, { cloneElement, isValidElement, type ReactNode } from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box, Text, Icon } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\nimport { Badge } from \"@xsolla/xui-badge\";\nimport type { TabBarItemProps } from \"./types\";\n\n/**\n * TabBarItem - An accessible tab item component\n *\n * Implements WAI-ARIA tab role with proper semantics:\n * - role=\"tab\" for tab semantics\n * - aria-selected to indicate active state\n * - tabIndex management for roving tabindex pattern\n * - Keyboard navigation support\n */\nexport const TabBarItem: React.FC<TabBarItemProps> = ({\n label,\n icon,\n badge,\n focused,\n onPress,\n onLongPress,\n labelPosition,\n accessibilityLabel,\n testID,\n id,\n index,\n onKeyDown,\n tabRef,\n}) => {\n const { theme } = useDesignSystem();\n\n const color = focused\n ? theme.colors.content.brand.primary\n : theme.colors.content.primary;\n\n const renderIcon = () => {\n if (!icon) return null;\n\n return (\n <Box\n position=\"relative\"\n alignItems=\"center\"\n justifyContent=\"center\"\n aria-hidden={true}\n >\n <Icon size={24} color={color}>\n {isValidElement(icon)\n ? cloneElement(icon as React.ReactElement<any>, {\n size: 24,\n color: color,\n stroke: color,\n })\n : icon}\n </Icon>\n {badge !== undefined && badge !== null && (\n <Box position=\"absolute\" top={-5} right={-10} zIndex={1}>\n <Badge\n size=\"sm\"\n aria-label={\n typeof badge === \"number\"\n ? `${badge} notifications`\n : String(badge)\n }\n >\n {badge}\n </Badge>\n </Box>\n )}\n </Box>\n );\n };\n\n const renderLabel = () => {\n if (typeof label === \"string\") {\n return (\n <Text\n color={color}\n fontSize={12}\n fontWeight={focused ? \"600\" : \"400\"}\n numberOfLines={1}\n aria-hidden={true}\n >\n {label}\n </Text>\n );\n }\n return label as ReactNode;\n };\n\n /**\n * Handle keyboard events for this tab\n */\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (onKeyDown) {\n onKeyDown(e, index);\n }\n };\n\n return (\n <Box\n as=\"button\"\n role=\"tab\"\n id={id}\n aria-selected={focused}\n aria-label={accessibilityLabel}\n tabIndex={focused ? 0 : -1}\n ref={tabRef}\n flex={1}\n alignItems=\"center\"\n justifyContent=\"center\"\n paddingVertical={8}\n cursor=\"pointer\"\n flexDirection={labelPosition === \"beside-icon\" ? \"row\" : \"column\"}\n gap={labelPosition === \"beside-icon\" ? 8 : 4}\n onPress={onPress}\n onLongPress={onLongPress}\n onKeyDown={handleKeyDown}\n testID={testID}\n hoverStyle={{\n backgroundColor: theme.colors.overlay.mono,\n }}\n focusStyle={{\n outlineColor: theme.colors.border.brand,\n outlineWidth: 2,\n outlineOffset: -2,\n outlineStyle: \"solid\",\n }}\n >\n {renderIcon()}\n {renderLabel()}\n </Box>\n );\n};\n\nTabBarItem.displayName = \"TabBarItem\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAA2C;;;ACC3C,0BA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ACd,sBAAQ,QAAQ,KAAK,IAAI;AAAA,YAC3B;AAAA;AAAA,UAhBK,MAAM;AAAA,QAiBb;AAAA,MAEJ,CAAC;AAAA;AAAA,EACH;AAEJ;AAEA,OAAO,cAAc;","names":["import_react","import_react_native","import_jsx_runtime","RNText","import_react_native","import_jsx_runtime","React","import_xui_core","import_react","import_jsx_runtime","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../src/index.tsx","../../src/TabBar.tsx","../../../primitives-native/src/Box.tsx","../../../primitives-native/src/Text.tsx","../../../primitives-native/src/Icon.tsx","../../src/TabBarItem.tsx"],"sourcesContent":["export * from \"./TabBar\";\nexport * from \"./TabBarItem\";\nexport * from \"./types\";\n","import React, { useRef, useCallback, useState, useEffect } from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem, isWeb } from \"@xsolla/xui-core\";\nimport { TabBarItem } from \"./TabBarItem\";\nimport type { TabBarProps } from \"./types\";\n\n/**\n * TabBar - An accessible tab bar navigation component\n *\n * Implements WAI-ARIA Tabs pattern with proper keyboard navigation:\n * - Arrow Left/Right: Navigate between tabs\n * - Home: Jump to first tab\n * - End: Jump to last tab\n * - Enter/Space: Activate focused tab (when activateOnFocus is false)\n *\n * @example\n * ```tsx\n * <TabBar\n * state={navigationState}\n * descriptors={descriptors}\n * navigation={navigation}\n * aria-label=\"Main navigation\"\n * />\n * ```\n */\nexport const TabBar: React.FC<TabBarProps> = ({\n state,\n descriptors,\n navigation,\n labelPosition = \"below-icon\",\n backgroundColor,\n testID,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n id,\n activateOnFocus = true,\n}) => {\n const { theme } = useDesignSystem();\n const tabRefs = useRef<(HTMLElement | null)[]>([]);\n const containerRef = useRef<HTMLElement | null>(null);\n const tabCount = state.routes.length;\n\n // Indicator position for sliding selection animation\n const [indicatorStyle, setIndicatorStyle] = useState<{\n left: number;\n width: number;\n initialized: boolean;\n }>({ left: 0, width: 0, initialized: false });\n\n // Update indicator position when active tab changes (web only)\n useEffect(() => {\n if (!isWeb) return;\n\n const activeIndex = state.index;\n const activeTabEl = tabRefs.current[activeIndex];\n const containerEl = containerRef.current;\n\n if (activeTabEl && containerEl) {\n const containerRect = containerEl.getBoundingClientRect();\n const tabRect = activeTabEl.getBoundingClientRect();\n\n setIndicatorStyle({\n left: tabRect.left - containerRect.left,\n width: tabRect.width,\n initialized: true,\n });\n }\n }, [state.index]);\n\n /**\n * Focus a tab by its index\n */\n const focusTab = useCallback((index: number) => {\n const tabElement = tabRefs.current[index];\n if (tabElement) {\n tabElement.focus();\n }\n }, []);\n\n /**\n * Navigate to a tab by index\n */\n const navigateToTab = useCallback(\n (index: number) => {\n const route = state.routes[index];\n if (route) {\n const event = navigation.emit({\n type: \"tabPress\",\n target: route.key,\n canPreventDefault: true,\n });\n\n if (!event.defaultPrevented) {\n navigation.navigate(route.name, route.params);\n }\n }\n },\n [state.routes, navigation]\n );\n\n /**\n * Handle keyboard navigation within the tab bar\n */\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent, currentIndex: number) => {\n let nextIndex: number | null = null;\n\n switch (e.key) {\n case \"ArrowRight\":\n case \"ArrowDown\":\n e.preventDefault();\n nextIndex = currentIndex < tabCount - 1 ? currentIndex + 1 : 0;\n break;\n\n case \"ArrowLeft\":\n case \"ArrowUp\":\n e.preventDefault();\n nextIndex = currentIndex > 0 ? currentIndex - 1 : tabCount - 1;\n break;\n\n case \"Home\":\n e.preventDefault();\n nextIndex = 0;\n break;\n\n case \"End\":\n e.preventDefault();\n nextIndex = tabCount - 1;\n break;\n\n case \"Enter\":\n case \" \":\n e.preventDefault();\n navigateToTab(currentIndex);\n break;\n\n default:\n break;\n }\n\n if (nextIndex !== null) {\n focusTab(nextIndex);\n if (activateOnFocus) {\n navigateToTab(nextIndex);\n }\n }\n },\n [tabCount, focusTab, navigateToTab, activateOnFocus]\n );\n\n return (\n <Box\n as=\"nav\"\n role=\"tablist\"\n aria-label={ariaLabel || \"Tab navigation\"}\n aria-labelledby={ariaLabelledBy}\n aria-orientation=\"horizontal\"\n ref={(el: HTMLElement | null) => {\n containerRef.current = el;\n }}\n flexDirection=\"row\"\n backgroundColor={backgroundColor || theme.colors.background.primary}\n borderRadius={4}\n height={56}\n width=\"100%\"\n position=\"relative\"\n overflow=\"hidden\"\n testID={testID || \"tab-bar-container\"}\n id={id}\n >\n {/* Sliding selection indicator (web only) */}\n {isWeb && indicatorStyle.initialized && (\n <Box\n position=\"absolute\"\n zIndex={0}\n height=\"100%\"\n backgroundColor={theme.colors.content.primary}\n borderRadius={4}\n style={{\n left: indicatorStyle.left,\n width: indicatorStyle.width,\n transition: \"left 200ms ease-out, width 200ms ease-out\",\n pointerEvents: \"none\",\n }}\n aria-hidden\n />\n )}\n {state.routes.map((route, index) => {\n const { options } = descriptors[route.key];\n const label =\n options.tabBarShowLabel === false\n ? undefined\n : options.tabBarLabel !== undefined\n ? options.tabBarLabel\n : options.title !== undefined\n ? options.title\n : route.name;\n\n const isFocused = state.index === index;\n\n const onPress = () => {\n const event = navigation.emit({\n type: \"tabPress\",\n target: route.key,\n canPreventDefault: true,\n });\n\n if (!isFocused && !event.defaultPrevented) {\n navigation.navigate(route.name, route.params);\n }\n };\n\n const onLongPress = () => {\n navigation.emit({\n type: \"tabLongPress\",\n target: route.key,\n });\n };\n\n // Use inverse color (white) when selected for floating design\n const iconColor = isFocused\n ? theme.colors.content.inverse\n : theme.colors.content.primary;\n\n const icon = options.tabBarIcon\n ? options.tabBarIcon({\n focused: isFocused,\n color: iconColor,\n size: 24,\n })\n : undefined;\n\n const badge = options.tabBarBadge;\n\n // Generate accessible label fallback\n const resolvedLabel =\n typeof label === \"function\"\n ? label({\n focused: isFocused,\n color: iconColor,\n position: labelPosition,\n })\n : label;\n\n // Use explicit accessibility label or fall back to text label\n const accessibilityLabel =\n options.tabBarAccessibilityLabel ||\n (typeof resolvedLabel === \"string\" ? resolvedLabel : route.name);\n\n // Generate unique tab ID\n const tabId = id ? `${id}-tab-${route.key}` : undefined;\n\n return (\n <TabBarItem\n key={route.key}\n id={tabId}\n label={resolvedLabel}\n icon={icon}\n badge={badge}\n focused={isFocused}\n onPress={onPress}\n onLongPress={onLongPress}\n labelPosition={labelPosition}\n accessibilityLabel={accessibilityLabel}\n testID={options.tabBarTestID}\n index={index}\n tabCount={tabCount}\n onKeyDown={handleKeyDown}\n tabRef={(el) => {\n tabRefs.current[index] = el;\n }}\n />\n );\n })}\n </Box>\n );\n};\n\nTabBar.displayName = \"TabBar\";\n","import React from \"react\";\nimport {\n View,\n Pressable,\n Image,\n ViewStyle,\n ImageStyle,\n DimensionValue,\n AnimatableNumericValue,\n} from \"react-native\";\nimport { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Box: React.FC<BoxProps> = ({\n children,\n onPress,\n onLayout,\n onMoveShouldSetResponder,\n onResponderGrant,\n onResponderMove,\n onResponderRelease,\n onResponderTerminate,\n backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius,\n borderStyle,\n height,\n padding,\n paddingHorizontal,\n paddingVertical,\n margin,\n marginTop,\n marginBottom,\n marginLeft,\n marginRight,\n flexDirection,\n alignItems,\n justifyContent,\n position,\n top,\n bottom,\n left,\n right,\n width,\n flex,\n overflow,\n zIndex,\n hoverStyle,\n pressStyle,\n style,\n \"data-testid\": dataTestId,\n testID,\n as,\n src,\n alt,\n ...rest\n}) => {\n const getContainerStyle = (pressed?: boolean): ViewStyle => ({\n backgroundColor:\n pressed && pressStyle?.backgroundColor\n ? pressStyle.backgroundColor\n : backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius: borderRadius as AnimatableNumericValue,\n borderStyle: borderStyle as ViewStyle[\"borderStyle\"],\n overflow,\n zIndex,\n height: height as DimensionValue,\n width: width as DimensionValue,\n padding: padding as DimensionValue,\n paddingHorizontal: paddingHorizontal as DimensionValue,\n paddingVertical: paddingVertical as DimensionValue,\n margin: margin as DimensionValue,\n marginTop: marginTop as DimensionValue,\n marginBottom: marginBottom as DimensionValue,\n marginLeft: marginLeft as DimensionValue,\n marginRight: marginRight as DimensionValue,\n flexDirection,\n alignItems,\n justifyContent,\n position: position as ViewStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n flex,\n ...(style as ViewStyle),\n });\n\n const finalTestID = dataTestId || testID;\n\n // Destructure and drop web-only props from rest before passing to RN components\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n role,\n tabIndex,\n onKeyDown,\n onKeyUp,\n \"aria-label\": _ariaLabel,\n \"aria-labelledby\": _ariaLabelledBy,\n \"aria-current\": _ariaCurrent,\n \"aria-disabled\": _ariaDisabled,\n \"aria-live\": _ariaLive,\n className,\n \"data-testid\": _dataTestId,\n ...nativeRest\n } = rest as Record<string, unknown>;\n\n // Handle as=\"img\" for React Native\n if (as === \"img\" && src) {\n const imageStyle: ImageStyle = {\n width: width as DimensionValue,\n height: height as DimensionValue,\n borderRadius: borderRadius as number,\n position: position as ImageStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n ...(style as ImageStyle),\n };\n\n return (\n <Image\n source={{ uri: src }}\n style={imageStyle}\n testID={finalTestID}\n resizeMode=\"cover\"\n {...nativeRest}\n />\n );\n }\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n style={({ pressed }) => getContainerStyle(pressed)}\n testID={finalTestID}\n {...nativeRest}\n >\n {children}\n </Pressable>\n );\n }\n\n return (\n <View\n style={getContainerStyle()}\n testID={finalTestID}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n {...nativeRest}\n >\n {children}\n </View>\n );\n};\n","import React from \"react\";\nimport { Text as RNText, TextStyle, AccessibilityRole } from \"react-native\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\n// Map web roles to React Native accessibility roles\nconst roleMap: Record<string, AccessibilityRole> = {\n alert: \"alert\",\n heading: \"header\",\n button: \"button\",\n link: \"link\",\n text: \"text\",\n};\n\nexport const Text: React.FC<TextProps> = ({\n children,\n color,\n fontSize,\n fontWeight,\n fontFamily,\n id,\n role,\n ...props\n}) => {\n // Extract the first font name from a comma-separated list (e.g. for web-style font stacks)\n let resolvedFontFamily = fontFamily\n ? fontFamily.split(\",\")[0].replace(/['\"]/g, \"\").trim()\n : undefined;\n\n // On native, if we don't have the custom font loaded, fall back to the system font\n if (\n resolvedFontFamily === \"Pilat Wide\" ||\n resolvedFontFamily === \"Pilat Wide Bold\" ||\n resolvedFontFamily === \"Aktiv Grotesk\"\n ) {\n resolvedFontFamily = undefined;\n }\n\n const style: TextStyle = {\n color,\n fontSize: typeof fontSize === \"number\" ? fontSize : undefined,\n fontWeight: fontWeight as TextStyle[\"fontWeight\"],\n fontFamily: resolvedFontFamily,\n textDecorationLine: props.textDecoration as TextStyle[\"textDecorationLine\"],\n };\n\n // Map role to React Native accessibilityRole\n const accessibilityRole = role ? roleMap[role] : undefined;\n\n return (\n <RNText style={style} testID={id} accessibilityRole={accessibilityRole}>\n {children}\n </RNText>\n );\n};\n","import React from \"react\";\nimport { View, ViewStyle } from \"react-native\";\nimport { IconProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Icon: React.FC<IconProps> = ({ children, color, size }) => {\n const style: ViewStyle = {\n width: typeof size === \"number\" ? size : undefined,\n height: typeof size === \"number\" ? size : undefined,\n alignItems: \"center\",\n justifyContent: \"center\",\n };\n\n // On native, we try to pass the color down to children (like Text primitives)\n // to mimic the CSS inheritance behavior of the web version.\n const childrenWithProps = React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n return React.cloneElement(child, {\n color: child.props.color || color,\n // Also pass size if child seems to be an icon that needs it\n size: child.props.size || size,\n });\n }\n return child;\n });\n\n return <View style={style}>{childrenWithProps}</View>;\n};\n","import React, { cloneElement, isValidElement, type ReactNode } from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box, Text, Icon } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\nimport { Badge } from \"@xsolla/xui-badge\";\nimport type { TabBarItemProps } from \"./types\";\n\n/**\n * TabBarItem - An accessible tab item component\n *\n * Implements WAI-ARIA tab role with proper semantics:\n * - role=\"tab\" for tab semantics\n * - aria-selected to indicate active state\n * - tabIndex management for roving tabindex pattern\n * - Keyboard navigation support\n */\nexport const TabBarItem: React.FC<TabBarItemProps> = ({\n label,\n icon,\n badge,\n focused,\n onPress,\n onLongPress,\n labelPosition,\n accessibilityLabel,\n testID,\n id,\n index,\n onKeyDown,\n tabRef,\n}) => {\n const { theme } = useDesignSystem();\n\n // Use inverse color (white) when focused for floating design\n const color = focused\n ? theme.colors.content.inverse\n : theme.colors.content.primary;\n\n const renderIcon = () => {\n if (!icon) return null;\n\n return (\n <Box\n position=\"relative\"\n alignItems=\"center\"\n justifyContent=\"center\"\n aria-hidden={true}\n >\n <Icon size={24} color={color}>\n {isValidElement(icon)\n ? cloneElement(icon as React.ReactElement<any>, {\n size: 24,\n color: color,\n stroke: color,\n })\n : icon}\n </Icon>\n {badge !== undefined && badge !== null && (\n <Box position=\"absolute\" top={-5} right={-10} zIndex={1}>\n <Badge\n size=\"sm\"\n aria-label={\n typeof badge === \"number\"\n ? `${badge} notifications`\n : String(badge)\n }\n >\n {badge}\n </Badge>\n </Box>\n )}\n </Box>\n );\n };\n\n const renderLabel = () => {\n if (typeof label === \"string\") {\n return (\n <Text\n color={color}\n fontSize={10}\n lineHeight={10}\n fontWeight=\"400\"\n numberOfLines={1}\n aria-hidden={true}\n >\n {label}\n </Text>\n );\n }\n return label as ReactNode;\n };\n\n /**\n * Handle keyboard events for this tab\n */\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (onKeyDown) {\n onKeyDown(e, index);\n }\n };\n\n return (\n <Box\n as=\"button\"\n role=\"tab\"\n id={id}\n aria-selected={focused}\n aria-label={accessibilityLabel}\n tabIndex={focused ? 0 : -1}\n ref={tabRef}\n flex={1}\n alignItems=\"center\"\n justifyContent=\"center\"\n paddingVertical={8}\n cursor=\"pointer\"\n flexDirection={labelPosition === \"beside-icon\" ? \"row\" : \"column\"}\n gap={labelPosition === \"beside-icon\" ? 8 : 8}\n position=\"relative\"\n zIndex={1}\n borderRadius={4}\n onPress={onPress}\n onLongPress={onLongPress}\n onKeyDown={handleKeyDown}\n testID={testID}\n hoverStyle={\n focused\n ? undefined\n : {\n backgroundColor: theme.colors.overlay.mono,\n }\n }\n focusStyle={{\n outlineColor: theme.colors.border.brand,\n outlineWidth: 2,\n outlineOffset: -2,\n outlineStyle: \"solid\",\n }}\n >\n {renderIcon()}\n {renderLabel()}\n </Box>\n );\n};\n\nTabBarItem.displayName = \"TabBarItem\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAgE;;;ACChE,0BAQO;AAmID;AAhIC,IAAM,MAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,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,YAAY,YACd,MAAM,OAAO,QAAQ,UACrB,MAAM,OAAO,QAAQ;AAEzB,gBAAM,OAAO,QAAQ,aACjB,QAAQ,WAAW;AAAA,YACjB,SAAS;AAAA,YACT,OAAO;AAAA,YACP,MAAM;AAAA,UACR,CAAC,IACD;AAEJ,gBAAM,QAAQ,QAAQ;AAGtB,gBAAM,gBACJ,OAAO,UAAU,aACb,MAAM;AAAA,YACJ,SAAS;AAAA,YACT,OAAO;AAAA,YACP,UAAU;AAAA,UACZ,CAAC,IACD;AAGN,gBAAM,qBACJ,QAAQ,6BACP,OAAO,kBAAkB,WAAW,gBAAgB,MAAM;AAG7D,gBAAM,QAAQ,KAAK,GAAG,EAAE,QAAQ,MAAM,GAAG,KAAK;AAE9C,iBACE;AAAA,YAAC;AAAA;AAAA,cAEC,IAAI;AAAA,cACJ,OAAO;AAAA,cACP;AAAA,cACA;AAAA,cACA,SAAS;AAAA,cACT;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA,QAAQ,QAAQ;AAAA,cAChB;AAAA,cACA;AAAA,cACA,WAAW;AAAA,cACX,QAAQ,CAAC,OAAO;AACd,wBAAQ,QAAQ,KAAK,IAAI;AAAA,cAC3B;AAAA;AAAA,YAhBK,MAAM;AAAA,UAiBb;AAAA,QAEJ,CAAC;AAAA;AAAA;AAAA,EACH;AAEJ;AAEA,OAAO,cAAc;","names":["import_react","import_react_native","import_jsx_runtime","RNText","import_react_native","import_jsx_runtime","React","import_xui_core","import_react","import_jsx_runtime","import_jsx_runtime"]}
package/native/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/TabBar.tsx
2
- import { useRef, useCallback } from "react";
2
+ import { useRef, useCallback, useState, useEffect } from "react";
3
3
 
4
4
  // ../primitives-native/src/Box.tsx
5
5
  import {
@@ -192,7 +192,7 @@ var Text = ({
192
192
  ...props
193
193
  }) => {
194
194
  let resolvedFontFamily = fontFamily ? fontFamily.split(",")[0].replace(/['"]/g, "").trim() : void 0;
195
- if (resolvedFontFamily === "Pilat Wide Bold") {
195
+ if (resolvedFontFamily === "Pilat Wide" || resolvedFontFamily === "Pilat Wide Bold" || resolvedFontFamily === "Aktiv Grotesk") {
196
196
  resolvedFontFamily = void 0;
197
197
  }
198
198
  const style = {
@@ -231,7 +231,7 @@ var Icon = ({ children, color, size }) => {
231
231
  };
232
232
 
233
233
  // src/TabBar.tsx
234
- import { useDesignSystem as useDesignSystem2 } from "@xsolla/xui-core";
234
+ import { useDesignSystem as useDesignSystem2, isWeb } from "@xsolla/xui-core";
235
235
 
236
236
  // src/TabBarItem.tsx
237
237
  import { cloneElement, isValidElement } from "react";
@@ -254,7 +254,7 @@ var TabBarItem = ({
254
254
  tabRef
255
255
  }) => {
256
256
  const { theme } = useDesignSystem();
257
- const color = focused ? theme.colors.content.brand.primary : theme.colors.content.primary;
257
+ const color = focused ? theme.colors.content.inverse : theme.colors.content.primary;
258
258
  const renderIcon = () => {
259
259
  if (!icon) return null;
260
260
  return /* @__PURE__ */ jsxs(
@@ -288,8 +288,9 @@ var TabBarItem = ({
288
288
  Text,
289
289
  {
290
290
  color,
291
- fontSize: 12,
292
- fontWeight: focused ? "600" : "400",
291
+ fontSize: 10,
292
+ lineHeight: 10,
293
+ fontWeight: "400",
293
294
  numberOfLines: 1,
294
295
  "aria-hidden": true,
295
296
  children: label
@@ -319,12 +320,15 @@ var TabBarItem = ({
319
320
  paddingVertical: 8,
320
321
  cursor: "pointer",
321
322
  flexDirection: labelPosition === "beside-icon" ? "row" : "column",
322
- gap: labelPosition === "beside-icon" ? 8 : 4,
323
+ gap: labelPosition === "beside-icon" ? 8 : 8,
324
+ position: "relative",
325
+ zIndex: 1,
326
+ borderRadius: 4,
323
327
  onPress,
324
328
  onLongPress,
325
329
  onKeyDown: handleKeyDown,
326
330
  testID,
327
- hoverStyle: {
331
+ hoverStyle: focused ? void 0 : {
328
332
  backgroundColor: theme.colors.overlay.mono
329
333
  },
330
334
  focusStyle: {
@@ -343,7 +347,7 @@ var TabBarItem = ({
343
347
  TabBarItem.displayName = "TabBarItem";
344
348
 
345
349
  // src/TabBar.tsx
346
- import { jsx as jsx5 } from "react/jsx-runtime";
350
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
347
351
  var TabBar = ({
348
352
  state,
349
353
  descriptors,
@@ -358,7 +362,24 @@ var TabBar = ({
358
362
  }) => {
359
363
  const { theme } = useDesignSystem2();
360
364
  const tabRefs = useRef([]);
365
+ const containerRef = useRef(null);
361
366
  const tabCount = state.routes.length;
367
+ const [indicatorStyle, setIndicatorStyle] = useState({ left: 0, width: 0, initialized: false });
368
+ useEffect(() => {
369
+ if (!isWeb) return;
370
+ const activeIndex = state.index;
371
+ const activeTabEl = tabRefs.current[activeIndex];
372
+ const containerEl = containerRef.current;
373
+ if (activeTabEl && containerEl) {
374
+ const containerRect = containerEl.getBoundingClientRect();
375
+ const tabRect = activeTabEl.getBoundingClientRect();
376
+ setIndicatorStyle({
377
+ left: tabRect.left - containerRect.left,
378
+ width: tabRect.width,
379
+ initialized: true
380
+ });
381
+ }
382
+ }, [state.index]);
362
383
  const focusTab = useCallback((index) => {
363
384
  const tabElement = tabRefs.current[index];
364
385
  if (tabElement) {
@@ -420,7 +441,7 @@ var TabBar = ({
420
441
  },
421
442
  [tabCount, focusTab, navigateToTab, activateOnFocus]
422
443
  );
423
- return /* @__PURE__ */ jsx5(
444
+ return /* @__PURE__ */ jsxs2(
424
445
  Box,
425
446
  {
426
447
  as: "nav",
@@ -428,71 +449,94 @@ var TabBar = ({
428
449
  "aria-label": ariaLabel || "Tab navigation",
429
450
  "aria-labelledby": ariaLabelledBy,
430
451
  "aria-orientation": "horizontal",
452
+ ref: (el) => {
453
+ containerRef.current = el;
454
+ },
431
455
  flexDirection: "row",
432
456
  backgroundColor: backgroundColor || theme.colors.background.primary,
433
- borderTopWidth: 1,
434
- borderTopColor: theme.colors.border.secondary,
435
- borderStyle: "solid",
436
- height: 60,
457
+ borderRadius: 4,
458
+ height: 56,
437
459
  width: "100%",
460
+ position: "relative",
461
+ overflow: "hidden",
438
462
  testID: testID || "tab-bar-container",
439
463
  id,
440
- children: state.routes.map((route, index) => {
441
- const { options } = descriptors[route.key];
442
- const label = options.tabBarShowLabel === false ? void 0 : options.tabBarLabel !== void 0 ? options.tabBarLabel : options.title !== void 0 ? options.title : route.name;
443
- const isFocused = state.index === index;
444
- const onPress = () => {
445
- const event = navigation.emit({
446
- type: "tabPress",
447
- target: route.key,
448
- canPreventDefault: true
449
- });
450
- if (!isFocused && !event.defaultPrevented) {
451
- navigation.navigate(route.name, route.params);
452
- }
453
- };
454
- const onLongPress = () => {
455
- navigation.emit({
456
- type: "tabLongPress",
457
- target: route.key
458
- });
459
- };
460
- const icon = options.tabBarIcon ? options.tabBarIcon({
461
- focused: isFocused,
462
- color: isFocused ? theme.colors.content.brand.primary : theme.colors.content.primary,
463
- size: 24
464
- }) : void 0;
465
- const badge = options.tabBarBadge;
466
- const resolvedLabel = typeof label === "function" ? label({
467
- focused: isFocused,
468
- color: isFocused ? theme.colors.content.brand.primary : theme.colors.content.primary,
469
- position: labelPosition
470
- }) : label;
471
- const accessibilityLabel = options.tabBarAccessibilityLabel || (typeof resolvedLabel === "string" ? resolvedLabel : route.name);
472
- const tabId = id ? `${id}-tab-${route.key}` : void 0;
473
- return /* @__PURE__ */ jsx5(
474
- TabBarItem,
464
+ children: [
465
+ isWeb && indicatorStyle.initialized && /* @__PURE__ */ jsx5(
466
+ Box,
475
467
  {
476
- id: tabId,
477
- label: resolvedLabel,
478
- icon,
479
- badge,
480
- focused: isFocused,
481
- onPress,
482
- onLongPress,
483
- labelPosition,
484
- accessibilityLabel,
485
- testID: options.tabBarTestID,
486
- index,
487
- tabCount,
488
- onKeyDown: handleKeyDown,
489
- tabRef: (el) => {
490
- tabRefs.current[index] = el;
468
+ position: "absolute",
469
+ zIndex: 0,
470
+ height: "100%",
471
+ backgroundColor: theme.colors.content.primary,
472
+ borderRadius: 4,
473
+ style: {
474
+ left: indicatorStyle.left,
475
+ width: indicatorStyle.width,
476
+ transition: "left 200ms ease-out, width 200ms ease-out",
477
+ pointerEvents: "none"
478
+ },
479
+ "aria-hidden": true
480
+ }
481
+ ),
482
+ state.routes.map((route, index) => {
483
+ const { options } = descriptors[route.key];
484
+ const label = options.tabBarShowLabel === false ? void 0 : options.tabBarLabel !== void 0 ? options.tabBarLabel : options.title !== void 0 ? options.title : route.name;
485
+ const isFocused = state.index === index;
486
+ const onPress = () => {
487
+ const event = navigation.emit({
488
+ type: "tabPress",
489
+ target: route.key,
490
+ canPreventDefault: true
491
+ });
492
+ if (!isFocused && !event.defaultPrevented) {
493
+ navigation.navigate(route.name, route.params);
491
494
  }
492
- },
493
- route.key
494
- );
495
- })
495
+ };
496
+ const onLongPress = () => {
497
+ navigation.emit({
498
+ type: "tabLongPress",
499
+ target: route.key
500
+ });
501
+ };
502
+ const iconColor = isFocused ? theme.colors.content.inverse : theme.colors.content.primary;
503
+ const icon = options.tabBarIcon ? options.tabBarIcon({
504
+ focused: isFocused,
505
+ color: iconColor,
506
+ size: 24
507
+ }) : void 0;
508
+ const badge = options.tabBarBadge;
509
+ const resolvedLabel = typeof label === "function" ? label({
510
+ focused: isFocused,
511
+ color: iconColor,
512
+ position: labelPosition
513
+ }) : label;
514
+ const accessibilityLabel = options.tabBarAccessibilityLabel || (typeof resolvedLabel === "string" ? resolvedLabel : route.name);
515
+ const tabId = id ? `${id}-tab-${route.key}` : void 0;
516
+ return /* @__PURE__ */ jsx5(
517
+ TabBarItem,
518
+ {
519
+ id: tabId,
520
+ label: resolvedLabel,
521
+ icon,
522
+ badge,
523
+ focused: isFocused,
524
+ onPress,
525
+ onLongPress,
526
+ labelPosition,
527
+ accessibilityLabel,
528
+ testID: options.tabBarTestID,
529
+ index,
530
+ tabCount,
531
+ onKeyDown: handleKeyDown,
532
+ tabRef: (el) => {
533
+ tabRefs.current[index] = el;
534
+ }
535
+ },
536
+ route.key
537
+ );
538
+ })
539
+ ]
496
540
  }
497
541
  );
498
542
  };