import type { Meta, StoryObj } from '@storybook/react';
import { Input } from './input';
import { Label } from './label';
import { Button } from './button';
/**
* Input component for WHOOSH UI
*
* A versatile input component for forms and user input throughout the WHOOSH application.
* Supports various input types with consistent styling and behavior.
*/
const meta = {
title: 'UI Components/Input',
component: Input,
parameters: {
layout: 'centered',
docs: {
description: {
component: `
The Input component provides consistent styling and behavior for form inputs across the WHOOSH application.
It supports all standard HTML input types with enhanced styling and focus states.
## Features
- Consistent styling across all input types
- Built-in focus and disabled states
- File upload support with custom styling
- Form validation integration
- Responsive design
- Accessibility support
## Usage
\`\`\`tsx
import { Input } from '@/components/ui/input';
setAgentName(e.target.value)}
required
/>
\`\`\`
## Input Types
- **text**: General text input
- **email**: Email address input with validation
- **password**: Password input with hidden text
- **number**: Numeric input with step controls
- **search**: Search input with enhanced styling
- **url**: URL input with validation
- **tel**: Telephone number input
- **file**: File upload input
`,
},
},
},
tags: ['autodocs'],
argTypes: {
type: {
control: 'select',
options: ['text', 'email', 'password', 'number', 'search', 'url', 'tel', 'file'],
description: 'HTML input type',
},
placeholder: {
control: 'text',
description: 'Placeholder text',
},
value: {
control: 'text',
description: 'Input value',
},
disabled: {
control: 'boolean',
description: 'Whether the input is disabled',
},
required: {
control: 'boolean',
description: 'Whether the input is required',
},
className: {
control: 'text',
description: 'Additional CSS classes',
},
onChange: {
action: 'changed',
description: 'Change event handler',
},
},
args: {
onChange: (e: any) => console.log('Input changed:', e.target.value),
},
} satisfies Meta;
export default meta;
type Story = StoryObj;
/**
* Default text input
*/
export const Default: Story = {
args: {
type: 'text',
placeholder: 'Enter text...',
},
};
/**
* Email input with validation
*/
export const Email: Story = {
args: {
type: 'email',
placeholder: 'Enter email address',
},
};
/**
* Password input
*/
export const Password: Story = {
args: {
type: 'password',
placeholder: 'Enter password',
},
};
/**
* Number input
*/
export const Number: Story = {
args: {
type: 'number',
placeholder: 'Enter number',
},
};
/**
* Search input
*/
export const Search: Story = {
args: {
type: 'search',
placeholder: 'Search agents...',
},
};
/**
* File input
*/
export const File: Story = {
args: {
type: 'file',
},
};
/**
* Disabled state
*/
export const Disabled: Story = {
args: {
type: 'text',
placeholder: 'Disabled input',
disabled: true,
value: 'Cannot edit this value',
},
};
/**
* Required input
*/
export const Required: Story = {
args: {
type: 'text',
placeholder: 'Required field',
required: true,
},
};
/**
* Input with label (form example)
*/
export const WithLabel: Story = {
render: () => (
),
parameters: {
docs: {
description: {
story: 'Input component used with a label in a form context',
},
},
},
};
/**
* Form example with multiple inputs
*/
export const FormExample: Story = {
render: () => (
),
parameters: {
docs: {
description: {
story: 'Complete form example showing agent registration with multiple input types',
},
},
},
};
/**
* Search and filter inputs
*/
export const SearchAndFilter: Story = {
render: () => (
),
parameters: {
docs: {
description: {
story: 'Input components used for search and filtering functionality',
},
},
},
};
/**
* All input types showcase
*/
export const AllTypes: Story = {
render: () => (
),
parameters: {
docs: {
description: {
story: 'Showcase of all supported input types',
},
},
},
};
/**
* Validation states example
*/
export const ValidationStates: Story = {
render: () => (
✓ Agent name is available
✗ Agent name contains invalid characters
⚠ Similar agent name already exists
),
parameters: {
docs: {
description: {
story: 'Examples of input validation states with custom styling',
},
},
},
};