import type { Meta, StoryObj } from '@storybook/nextjs-vite'; import { useState } from 'react'; import { AuthShell, type AuthSsoProvider, CreateOrganizationForm, type CreateOrganizationFormProps, } from '../../components/features/auth'; import { TabSelector } from '../../components/ui/tab-selector'; const meta = { title: 'Auth/Create Organization', component: CreateOrganizationForm, parameters: { layout: 'fullscreen', docs: { description: { component: 'Sign Up → Create Organization form from the auth redesign. Presentational + controlled. Shown inside the full responsive AuthShell (desktop two-column, tablet/mobile stacked). Use the viewport toolbar to check breakpoints.', }, }, }, tags: ['autodocs'], } satisfies Meta; export default meta; type Story = StoryObj; /** Full page: Sign Up / Login tabs + Create Organization form + marketing panel. */ function CreateOrganizationPage(initial: Partial) { const [tab, setTab] = useState('signup'); const [email, setEmail] = useState(initial.email ?? ''); const [organizationName, setOrganizationName] = useState(initial.organizationName ?? ''); const [domain, setDomain] = useState(initial.domain ?? ''); const [agreedToTerms, setAgreedToTerms] = useState(initial.agreedToTerms ?? false); const isValid = !!email.trim() && !!organizationName.trim() && !!domain.trim() && agreedToTerms; const tabs = ( ); return ( {tab === 'signup' ? ( {}} /> ) : (
Login — coming in the next step
)}
); } /** Empty fields, terms unchecked, submit disabled. */ export const Empty: Story = { render: () => , }; /** Valid input, terms accepted, submit enabled. */ export const Filled: Story = { render: () => ( ), }; /** * Error state: long messages under the fields wrap up to two lines. * Validation is deferred — messages appear after a 1.5s typing pause or on blur. */ export const ErrorState: Story = { render: () => ( ), }; const SSO_PROVIDERS: AuthSsoProvider[] = ['openframe', 'google', 'microsoft']; /** SSO configured: fields disabled, submit replaced by provider buttons. */ export const SSO: Story = { render: () => ( ), };