import type { Meta, StoryObj } from '@storybook/web-components-vite';
import { html } from 'lit';
import './usa-create-account-template.js';
const meta: Meta = {
title: 'Templates/Create Account',
component: 'usa-create-account-template',
tags: ['autodocs'],
parameters: {
layout: 'fullscreen',
docs: {
description: {
component: `
The create account template provides a registration form following USWDS patterns.
## Features
- Name fields (optional)
- Email and password fields
- Password confirmation with validation
- Terms of service checkbox
- Sign-in link for existing users
- Government banner and identifier
## USWDS Reference
https://designsystem.digital.gov/templates/create-account-page/
`,
},
},
},
argTypes: {
heading: {
control: 'text',
description: 'Page heading',
},
showNameFields: {
control: 'boolean',
description: 'Show first and last name fields',
},
showPasswordRequirements: {
control: 'boolean',
description: 'Show password requirements text',
},
showTerms: {
control: 'boolean',
description: 'Show terms checkbox',
},
termsUrl: {
control: 'text',
description: 'Terms of service URL',
},
privacyUrl: {
control: 'text',
description: 'Privacy policy URL',
},
submitText: {
control: 'text',
description: 'Submit button text',
},
showSignInLink: {
control: 'boolean',
description: 'Show sign-in link',
},
signInUrl: {
control: 'text',
description: 'Sign-in page URL',
},
showBanner: {
control: 'boolean',
description: 'Show government banner',
},
showIdentifier: {
control: 'boolean',
description: 'Show identifier',
},
},
};
export default meta;
type Story = StoryObj;
export const Default: Story = {
args: {
heading: 'Create account',
showNameFields: true,
showPasswordRequirements: true,
showTerms: true,
termsUrl: '/terms',
privacyUrl: '/privacy',
submitText: 'Create account',
showSignInLink: true,
signInUrl: '/sign-in',
showBanner: true,
showIdentifier: true,
},
render: (args) => html`
console.log('Account created:', e.detail)}"
>
`,
};
export const EmailOnly: Story = {
args: {
heading: 'Create account',
showNameFields: false,
showPasswordRequirements: true,
showTerms: true,
showBanner: true,
showIdentifier: true,
},
render: (args) => html`
`,
};
export const WithoutTerms: Story = {
args: {
heading: 'Register',
submitText: 'Register',
showNameFields: true,
showPasswordRequirements: true,
showTerms: false,
showBanner: true,
showIdentifier: true,
},
render: (args) => html`
`,
};
export const CustomPasswordRequirements: Story = {
args: {
heading: 'Create account',
passwordRequirementsText:
'Password must be at least 12 characters long and include uppercase, lowercase, numbers, and symbols.',
showBanner: true,
showIdentifier: true,
},
render: (args) => html`
`,
};
export const CustomLinks: Story = {
args: {
heading: 'Join our agency',
signInLabel: 'Already a member?',
signInText: 'Log in here',
signInUrl: '/login',
termsUrl: '/legal/terms',
privacyUrl: '/legal/privacy',
showBanner: true,
showIdentifier: true,
},
render: (args) => html`
`,
};
export const WithAdditionalFields: Story = {
args: {
heading: 'Create account',
showBanner: true,
showIdentifier: true,
},
render: (args) => html`
`,
};
export const MinimalForm: Story = {
args: {
heading: 'Quick Sign Up',
submitText: 'Sign Up',
showNameFields: false,
showPasswordRequirements: false,
showTerms: false,
showSignInLink: false,
showBanner: false,
showIdentifier: false,
},
render: (args) => html`
`,
};