import type { Meta, StoryObj } from '@storybook/react-webpack5'; import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator'; import { Width } from '../../common'; import Tabs from '..'; export default { component: Tabs, title: 'Navigation/Tabs/Tests', tags: ['!autodocs', '!manifest'], } satisfies Meta; type Story = StoryObj; /** * The tab list is horizontal: tab order, the active indicator translateX, and * swipe direction all flip between LTR and RTL. The indicator uses a negated * translateX in RTL mode. This diff verifies the layout mirrors correctly. */ export const RTLDiff: Story = { render: () => { const i18n = useRtlDiffI18n(); const defaultTabs = [ { title: i18n.firstTab, disabled: false, content:
{i18n.firstContent}
, }, { title: i18n.secondTab, disabled: false, content:
{i18n.secondContent}
, }, { title: i18n.thirdTab, disabled: false, content:
{i18n.thirdContent}
, }, ]; return (

{i18n.blockFirstSelected}

{}} />

{i18n.blockSecondSelected}

{}} />

{i18n.autoFirstSelected}

{}} />

{i18n.autoSecondSelected}

{}} />
); }, ...withRTLDiff({ fixedRows: { heights: 'auto' }, i18n: { firstTab: { en: 'First tab', ar: 'التبويب الأول' }, secondTab: { en: 'Second tab', ar: 'التبويب الثاني' }, thirdTab: { en: 'Third tab', ar: 'التبويب الثالث' }, firstContent: { en: 'First content', ar: 'المحتوى الأول' }, secondContent: { en: 'Second content', ar: 'المحتوى الثاني' }, thirdContent: { en: 'Third content', ar: 'المحتوى الثالث' }, blockFirstSelected: { en: 'Block width — first tab selected', ar: 'عرض كامل — التبويب الأول محدد', }, blockSecondSelected: { en: 'Block width — second tab selected', ar: 'عرض كامل — التبويب الثاني محدد', }, autoFirstSelected: { en: 'Auto width — first tab selected', ar: 'عرض تلقائي — التبويب الأول محدد', }, autoSecondSelected: { en: 'Auto width — second tab selected', ar: 'عرض تلقائي — التبويب الثاني محدد', }, }, }), };