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'] }, color: { control: 'text' }, orientation: { control: 'select', options: ['HORIZONTAL', 'VERTICAL'] }, activationMode: { control: 'select', options: ['AUTOMATIC', 'MANUAL'] }, }, } 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 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 ColorPositive: Story = { args: { tabs: [ { value: 'success', label: 'Success', content:

Success content with positive color scheme.

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

Warning content with negative color scheme.

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

Info content with secondary color scheme.

}, ], defaultValue: 'success', color: 'POSITIVE', }, } export const ColorNegative: Story = { args: { tabs: [ { value: 'success', label: 'Success', content:

Success content with positive color scheme.

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

Warning content with negative color scheme.

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

Info content with secondary color scheme.

}, ], defaultValue: 'warning', color: 'NEGATIVE', }, } 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 ManualActivation: Story = { args: { tabs: [ { value: 'manual1', label: 'Manual 1', content:

Manual activation tab 1

}, { value: 'manual2', label: 'Manual 2', content:

Manual activation tab 2

}, { value: 'manual3', label: 'Manual 3', content:

Manual activation tab 3

}, ], defaultValue: 'manual1', activationMode: 'MANUAL', }, } 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', }, }