import { Suspense, startTransition, use, useState } from 'react';
import { Tabs, TabList, Tab, TabContent, type TabsMountStrategy } from '../../src';
export default {
component: Tabs,
title: 'Tests behavior',
};
export const KeyboardNavigation = () => (
Tab 1
Tab 2
Tab 3
Content 1
Content 2
Content 3
);
export const Controlled = () => {
const [active, setActive] = useState('tab1');
return (
<>
{active}
setActive(value) }>
Tab 1
Tab 2
Tab 3
Content 1
Content 2
Content 3
>
);
};
export const Disabled = () => (
Tab 1
Tab 2
Tab 3
Content 1
Content 2
Content 3
);
const MountStrategyTabs = ({ mountStrategy, overrides = {} }: {
mountStrategy?: TabsMountStrategy,
overrides?: Partial>,
}) => (
Tab 1
Tab 2
Tab 3
Content 1
Content 3
);
export const MountStrategyKeep = () => ;
export const MountStrategyLazy = () => ;
export const MountStrategyUnmount = () => ;
export const MountStrategyOverride = () => (
);
const neverResolved = new Promise(() => {});
const SuspendedContent = () => {
use(neverResolved);
return Suspended content
;
};
export const MountStrategyLazyAbandonedTransition = () => {
const [value, setValue] = useState('tab1');
const [, setRenderCount] = useState(0);
return (
<>
Loading }>
setValue(value) } value={ value }>
Tab 1
Tab 2
Content 1
>
);
};