import { ComponentMeta, ComponentStory } from "@storybook/react"; import React, { useRef } from "react"; import { Input, InputRefType } from "components/Forms/Input/index"; import { Button } from "components/Button"; export default { title: "Components/Forms/Input", component: Input, } as ComponentMeta; const Template: ComponentStory = (args) => ; export const Default = Template.bind({}); Default.args = { defaultValue: "Hello world", label: "Your name", }; export const Success = Template.bind({}); Success.args = { defaultValue: "Hello world", label: "Your name", state: "success", icon: person, text: "This is an optional success message", }; export const Error = Template.bind({}); Error.args = { defaultValue: "Hello world", label: "Your name", state: "error", icon: person, text: "This is an optional error message", }; export const DisabledEmpty = Template.bind({}); DisabledEmpty.args = { label: "Your name", icon: person, disabled: true, }; export const DisabledFilled = Template.bind({}); DisabledFilled.args = { label: "Your name", defaultValue: "John Doe", icon: person, disabled: true, }; export const Empty = Template.bind({}); Empty.args = { label: "Your email", }; export const Icon = Template.bind({}); Icon.args = { label: "Account balance", icon: attach_money, defaultValue: "1000", }; export const IconRight = Template.bind({}); IconRight.args = { label: "Account balance", rightIcon: attach_money, defaultValue: "1000", }; export const IconBoth = Template.bind({}); IconBoth.args = { label: "Not a recommended use", icon: attach_money, rightIcon: attach_money, defaultValue: "Is isn't recommended to use both icons", }; export const OverflowingText = Template.bind({}); OverflowingText.args = { label: "Your name", icon: attach_money, defaultValue: "John Dave Mike Smith Doe Junior Senior Yoda Skywalker", }; export const WithText = Template.bind({}); WithText.args = { defaultValue: "Hello world", label: "Your name", text: "This is a text, you can display anything you want here like warnings, informations or errors.", }; export const WithTextRight = Template.bind({}); WithTextRight.args = { defaultValue: "Hello world", label: "Your name", rightText: "0/300", }; export const WithBothTexts = Template.bind({}); WithBothTexts.args = { defaultValue: "Hello world", label: "Your name", text: "This is a text, you can display anything you want here like warnings, informations or errors.", rightText: "0/300", }; export const FullWidth = Template.bind({}); FullWidth.args = { defaultValue: "Hello world", label: "Your name", fullWidth: true, text: "This is a text, you can display anything you want here like warnings, informations or errors.", rightText: "0/300", }; export const CharCounter = Template.bind({}); CharCounter.args = { defaultValue: "CEO", label: "Job title", text: "This is a text, you can display anything you want here like warnings, informations or errors.", charCounter: true, charCounterMax: 30, }; export const Controlled = () => { const [value, setValue] = React.useState("I am controlled"); return (
Value: {value}
setValue(e.target.value)} />
); }; export const NonControlled = () => { return ; }; export const WithRef = () => { const ref = useRef(null); return (
); }; export const FormExample = () => { return (
apartment} />
location_on} />
map} />
); };