import type { Meta, StoryObj } from '@storybook/web-components-vite'; import { html } from 'lit'; import './index.js'; import type { USASiteAlert } from './usa-site-alert.js'; const meta: Meta = { title: 'Feedback/Site Alert', component: 'usa-site-alert', parameters: { layout: 'padded', docs: { description: { component: ` The USA Site Alert component provides prominent site-wide notifications for websites. It supports both informational and emergency alerts with USWDS styling and accessibility features. Perfect for system maintenance notices, policy updates, emergency communications, and important announcements. ## Features - Two alert types: info and emergency - Closable alerts with keyboard support - Slim and no-icon variants - Support for both property and slot content - Light DOM for USWDS CSS compatibility - Consistent styling and accessibility `, }, }, }, argTypes: { type: { control: 'select', options: ['info', 'emergency'], description: 'Type of site alert (info or emergency)', }, heading: { control: 'text', description: 'Alert heading text', }, content: { control: 'text', description: 'HTML content to display (alternative to slot content)', }, slim: { control: 'boolean', description: 'Use slim variant with reduced padding', }, noIcon: { control: 'boolean', description: 'Remove the alert icon', }, closable: { control: 'boolean', description: 'Allow users to close the alert', }, visible: { control: 'boolean', description: 'Control alert visibility', }, closeLabel: { control: 'text', description: 'Accessible label for close button', }, }, }; export default meta; type Story = StoryObj; export const Default: Story = { args: { type: 'info', heading: 'System Maintenance Notice', visible: true, }, render: (args) => html`

The system will be unavailable for routine maintenance on Saturday, March 30 from 11:00 PM to 5:00 AM EST.

Alternative services: Call 1-800-555-0123 for urgent matters during the maintenance window.

`, }; export const AllVariants: Story = { parameters: { controls: { disable: true }, }, render: () => html`

Info Alert (Default)

New cybersecurity requirements are now in effect for all organizations. View implementation guidance.

Emergency Alert

URGENT: Offices are closed due to severe weather conditions. Essential personnel should follow emergency protocols.

Slim Variant

System deadline extended to April 18, 2024. More details.

No Icon Variant

This alert uses the no-icon variant for a cleaner appearance when icons are not needed.

Closable Alert

This alert can be closed by users. Try clicking the close button or pressing Escape when focused.

`, }; export const CustomContent: Story = { parameters: { controls: { disable: true }, docs: { description: { story: 'Demonstrates using the default slot for custom content.', }, }, }, render: () => html`

This is custom slotted content demonstrating flexible content options.

Slots allow you to provide your own HTML content to the component.

  • Full control over content structure
  • Rich HTML formatting support
  • Flexible layout options
`, };