import React from "react"; import TextInput from "../../app/components/controls/TextInput"; import { INPUT_STATE_OPTIONS, TEXT_INPUT_SIZE_OPTIONS, } from "../../lib/propNormalization"; export default { title: "Components/Controls/TextInput", component: TextInput, parameters: { layout: "centered", }, argTypes: { inputSize: { control: { type: "select" }, options: [...TEXT_INPUT_SIZE_OPTIONS], }, state: { control: { type: "select" }, options: [...INPUT_STATE_OPTIONS], }, disabled: { control: { type: "boolean" }, }, error: { control: { type: "boolean" }, }, label: { control: { type: "text" }, }, placeholder: { control: { type: "text" }, }, value: { control: { type: "text" }, }, }, }; const Template = (args) => ; // Default story export const Default = { args: { label: "Default Text Input", placeholder: "Enter text...", inputSize: "medium", state: "default", }, render: Template, }; // Size variants export const Small = { args: { label: "Small Text Input", placeholder: "Small size", inputSize: "small", state: "default", }, render: Template, }; export const Medium = { args: { label: "Medium Text Input", placeholder: "Medium size", inputSize: "medium", state: "default", }, render: Template, }; // States export const Active = { args: { label: "Active State", placeholder: "Active input", inputSize: "medium", state: "active", }, render: Template, }; export const Hover = { args: { label: "Hover State", placeholder: "Hover input", inputSize: "medium", state: "hover", }, render: Template, }; export const Focus = { args: { label: "Focus State", placeholder: "Focused input", inputSize: "medium", state: "focus", }, render: Template, }; export const Error = { args: { label: "Error State", placeholder: "Error input", inputSize: "medium", state: "default", error: true, }, render: Template, }; export const Disabled = { args: { label: "Disabled State", placeholder: "Disabled input", inputSize: "medium", state: "default", disabled: true, }, render: Template, }; // Interactive example export const Interactive = (args) => { const [value, setValue] = React.useState(""); return (
setValue(e.target.value)} />

Current value: "{value}"

); }; Interactive.args = { label: "Interactive Text Input", placeholder: "Type something...", inputSize: "medium", state: "default", }; // All sizes comparison export const AllSizes = () => (

Small Size

Medium Size

); // All states comparison export const AllStates = () => (

Text Input States

);