import { Input } from "./index"; import { DocsPage } from "@shared/stories/DocsTemplate"; import type { Meta, StoryObj } from "@storybook/react"; const meta: Meta = { title: "Components/Input", component: Input, tags: ["autodocs"], parameters: { layout: "centered", docs: { page: DocsPage, description: { component: "A comprehensive input component with support for labels, error states, icons, loading states, and multiple sizes.", }, }, }, argTypes: { placeholder: { control: { type: "text" }, description: "Placeholder text", }, label: { control: { type: "text" }, description: "Label text", }, size: { control: { type: "select" }, options: ["slim", "medium", "large"], description: "Input size", }, state: { control: { type: "select" }, options: ["default", "focus", "active", "hover", "filled", "error"], description: "Visual state", }, hasError: { control: { type: "boolean" }, description: "Show error state", }, errorText: { control: { type: "text" }, description: "Error message text", }, disabled: { control: { type: "boolean" }, description: "Disable the input", }, loading: { control: { type: "boolean" }, description: "Show loading state", }, required: { control: { type: "boolean" }, description: "Mark input as required", }, type: { control: { type: "select" }, options: ["text", "email", "password", "number", "tel"], description: "Input type", }, prefixIconName: { control: { type: "select" }, options: ["location_on", "search"], description: "Prefix icon name", }, suffixIconName: { control: { type: "select" }, options: ["visibility", "visibility_off", "lock"], description: "Suffix icon name", }, }, args: { placeholder: "Enter text...", size: "medium", }, }; export default meta; type Story = StoryObj; // Default input export const Default: Story = { args: {}, }; // With label export const WithLabel: Story = { args: { label: "Email Address", placeholder: "Enter your email", }, }; // Required input export const Required: Story = { args: { label: "Required Field", placeholder: "This field is required", required: true, }, }; // Error state export const Error: Story = { args: { label: "Email Address", placeholder: "Enter your email", hasError: true, errorText: "Please enter a valid email address", }, }; // Different sizes export const Sizes: Story = { render: () => (
), parameters: { docs: { description: { story: "All available input sizes: slim, medium, and large.", }, }, }, }; // With prefix icon export const WithPrefixIcon: Story = { args: { label: "Search", placeholder: "Search...", prefixIconName: "search", prefixIconSize: 24, }, }; // With suffix icon export const WithSuffixIcon: Story = { args: { label: "Password", placeholder: "Enter password", type: "password", suffixIconName: "visibility", suffixIconSize: 24, }, }; // Password input export const Password: Story = { args: { label: "Password", placeholder: "Enter your password", type: "password", suffixIconName: "visibility", }, }; // Loading state export const Loading: Story = { args: { label: "Loading Input", placeholder: "Loading...", loading: true, }, }; // Disabled state export const Disabled: Story = { args: { label: "Disabled Input", placeholder: "This input is disabled", disabled: true, }, }; // Different states export const States: Story = { render: () => (
), parameters: { docs: { description: { story: "Different visual states of the input component.", }, }, }, }; // Email input export const Email: Story = { args: { label: "Email", placeholder: "example@email.com", type: "email", }, }; // Phone input export const Phone: Story = { args: { label: "Phone Number", placeholder: "(555) 123-4567", type: "tel", }, }; // Form example export const FormExample: Story = { render: () => (
), parameters: { docs: { description: { story: "Example of multiple inputs used together in a form.", }, }, }, }; // All variants showcase export const AllVariants: Story = { render: () => (

Sizes

With Icons

States

), parameters: { docs: { description: { story: "Complete showcase of all input variants, sizes, and states.", }, }, }, };