import type { Meta, StoryObj } from '@storybook/react-vite' import { useState } from 'react' import { TabsField } from './TabsField' import type { TabItem } from './TabsField' import { TextField } from '../TextField/TextField' import { ButtonArrayLayout } from '../Button/ButtonArrayLayout' import { HeadingField } from '../Heading/HeadingField' const meta = { title: 'Components/Tabs', component: TabsField, tags: ['autodocs'], parameters: { layout: 'centered' }, argTypes: { variant: { control: 'select', options: ['UNDERLINE', 'PILL'] }, size: { control: 'select', options: ['SMALL', 'STANDARD', 'MEDIUM', 'LARGE'] }, density: { control: 'select', options: ['STANDARD', 'DENSE'] }, color: { control: 'text' }, orientation: { control: 'select', options: ['HORIZONTAL', 'VERTICAL'] }, align: { control: 'select', options: ['START', 'CENTER', 'END'] }, activationMode: { control: 'select', options: ['AUTOMATIC', 'MANUAL'] }, navigationOnly: { control: 'boolean' }, fullWidthSeparator: { control: 'boolean' }, }, } satisfies Meta export default meta type Story = StoryObj const simpleTabs: TabItem[] = [ { value: 'tab1', label: 'Account', content:

Make changes to your account here.

, }, { value: 'tab2', label: 'Password', content:

Change your password here.

, }, { value: 'tab3', label: 'Notifications', content:

Configure your notification preferences.

, }, ] export const Default: Story = { args: { tabs: simpleTabs, defaultValue: 'tab1', size: 'STANDARD', color: 'ACCENT', }, } export const BasicHorizontalWithContent: Story = { args: { tabs: simpleTabs, defaultValue: 'tab1', }, render: () => { const [activeTab, setActiveTab] = useState('account') const [name, setName] = useState('Pedro Duarte') const [username, setUsername] = useState('@peduarte') const tabs: TabItem[] = [ { value: 'account', label: 'Account', content: (

Make changes to your account here. Click save when you're done.

), }, { value: 'password', label: 'Password', content: (

Change your password here. After saving, you'll be logged out.

), }, { value: 'notifications', label: 'Notifications', content: (

Configure your notification preferences.

Email notifications enabled

Push notifications disabled

SMS notifications disabled

), }, ] return (
) }, } export const VerticalOrientation: Story = { args: { tabs: simpleTabs, defaultValue: 'tab1', }, render: () => { const [activeTab, setActiveTab] = useState('profile') const tabs: TabItem[] = [ { value: 'profile', label: 'Profile', content: (

Manage your profile information and preferences.

), }, { value: 'security', label: 'Security', content: (

Configure security settings and two-factor authentication.

), }, { value: 'billing', label: 'Billing', disabled: true, content: (

Manage your billing information and subscription.

), }, ] return (
) }, } export const NavigationOnly: Story = { name: 'Navigation Only (No Content Panels)', args: { tabs: simpleTabs, defaultValue: 'tab1', }, render: () => { const [activeTab, setActiveTab] = useState('dashboard') const navTabs: TabItem[] = [ { value: 'dashboard', label: 'Dashboard' }, { value: 'reports', label: 'Reports' }, { value: 'settings', label: 'Settings' }, { value: 'help', label: 'Help' }, ] return (

Active route: {activeTab}

Content is rendered externally — no content panels in the tab component.

) }, } export const NavigationOnlyVertical: Story = { name: 'Navigation Only — Vertical Sidebar', args: { tabs: simpleTabs, defaultValue: 'tab1', }, render: () => { const [activeTab, setActiveTab] = useState('inbox') const navTabs: TabItem[] = [ { value: 'inbox', label: 'Inbox' }, { value: 'drafts', label: 'Drafts' }, { value: 'sent', label: 'Sent' }, { value: 'archive', label: 'Archive' }, { value: 'trash', label: 'Trash' }, ] return (

Viewing: {activeTab}

) }, } export const DensityComparison: Story = { name: 'Density — STANDARD vs DENSE', args: { tabs: simpleTabs, defaultValue: 'tab1', }, render: () => { const tabs: TabItem[] = [ { value: 'one', label: 'First Tab', content:

Content for first tab.

}, { value: 'two', label: 'Second Tab', content:

Content for second tab.

}, { value: 'three', label: 'Third Tab', content:

Content for third tab.

}, ] return (

Density: STANDARD (default)

Density: DENSE

) }, } export const FullWidthSeparator: Story = { name: 'Full-Width Separator', args: { tabs: simpleTabs, defaultValue: 'tab1', }, render: () => { const tabs: TabItem[] = [ { value: 'overview', label: 'Overview', content:

Overview content here.

}, { value: 'details', label: 'Details', content:

Details content here.

}, { value: 'history', label: 'History', content:

History content here.

}, ] return (
) }, } export const LightBackground: Story = { name: 'Light Background (Non-White)', args: { tabs: simpleTabs, defaultValue: 'tab1', }, render: () => { const tabs: TabItem[] = [ { value: 'overview', label: 'Overview', content:

Overview content on light bg.

}, { value: 'details', label: 'Details', content:

Details content on light bg.

}, { value: 'history', label: 'History', content:

History content on light bg.

}, ] return (
) }, } export const DarkBackground: Story = { name: 'Dark Background (Auto Separator)', args: { tabs: simpleTabs, defaultValue: 'tab1', }, render: () => { const tabs: TabItem[] = [ { value: 'overview', label: 'Overview', content:

Overview content on dark.

}, { value: 'details', label: 'Details', content:

Details content on dark.

}, { value: 'history', label: 'History', content:

History content on dark.

}, ] return (
) }, } export const SizeSmall: Story = { args: { tabs: [ { value: 'tab1', label: 'Tab 1', content:

Small tab content

}, { value: 'tab2', label: 'Tab 2', content:

Small tab content

}, ], defaultValue: 'tab1', size: 'SMALL', }, } export const SizeLarge: Story = { args: { tabs: [ { value: 'tab1', label: 'Tab 1', content:

Large tab content

}, { value: 'tab2', label: 'Tab 2', content:

Large tab content

}, ], defaultValue: 'tab1', size: 'LARGE', }, } export const ColorCustomHex: Story = { args: { tabs: [ { value: 'success', label: 'Success', content:

Success content with custom hex color.

}, { value: 'warning', label: 'Warning', content:

Warning content with custom hex color.

}, { value: 'info', label: 'Info', content:

Info content with custom hex color.

}, ], defaultValue: 'info', color: '#9333EA', }, } export const Pill: Story = { args: { tabs: [ { value: 'summary', label: 'Summary', content:

Summary view content.

}, { value: 'details', label: 'Details', content:

Details view content.

}, { value: 'activity', label: 'Activity', content:

Activity view content.

}, { value: 'documents', label: 'Documents', content:

Documents view content.

}, { value: 'history', label: 'History', content:

History view content.

}, ], defaultValue: 'summary', variant: 'PILL', size: 'SMALL', }, } export const PillCustomColor: Story = { args: { tabs: [ { value: 'tab1', label: 'Tab One', content:

Custom color pill tab.

}, { value: 'tab2', label: 'Tab Two', content:

Custom color pill tab.

}, ], defaultValue: 'tab1', variant: 'PILL', size: 'SMALL', color: '#9333EA', }, }