2023-08-15 00:42:10 +00:00
import { Canvas, Meta, Story, ArgsTable } from "@storybook/addon-docs";
import {
Examples,
Example,
Note,
Title,
CustomArgsTable,
VariantRow,
VariantsTable,
} from "@calcom/storybook/components";
2022-11-04 15:40:46 +00:00
2023-08-15 00:42:10 +00:00
import { Select, UnstyledSelect } from "../select";
import { InputFieldWithSelect } from "./Input";
import { InputField } from "./Input";
2022-11-04 15:40:46 +00:00
<Meta title="UI/Form/Input Field" component={InputField} />
2023-08-15 00:42:10 +00:00
<Title title="Inputs" suffix="Brief" subtitle="Version 2.0 — Last Update: 22 Aug 2022" />
2022-11-04 15:40:46 +00:00
## Definition
2023-08-15 00:42:10 +00:00
2022-11-04 15:40:46 +00:00
Text fields allow users to input and edit text into the product. Usually appear in forms and modals. Various options can be shown with the field to communicate the input requirements.## Structure
## Structure
2023-08-15 00:42:10 +00:00
<CustomArgsTable of={InputField} />
2022-11-04 15:40:46 +00:00
2023-08-15 00:42:10 +00:00
<Examples
title="Inputs"
footnote={
<ul>
<li>The width is flexible but the height is fixed for both desktop and mobile. </li>
</ul>
}>
2022-11-04 15:40:46 +00:00
<Example title="Default">
2023-08-15 00:42:10 +00:00
<InputField placeholder="Default" />
2022-11-04 15:40:46 +00:00
</Example>
</Examples>
<Examples title="Input Types">
<Example title="Default">
2023-08-15 00:42:10 +00:00
<InputField placeholder="Default" />
2022-11-04 15:40:46 +00:00
</Example>
<Example title="Prefix">
2023-08-15 00:42:10 +00:00
<InputField placeholder="Prefix" addOnLeading={<>Prefix</>} />
2022-11-04 15:40:46 +00:00
</Example>
<Example title="Suffix">
2023-08-15 00:42:10 +00:00
<InputField placeholder="Suffic" addOnSuffix={<>Suffix</>} />
2022-11-04 15:40:46 +00:00
</Example>
2022-11-28 11:20:49 +00:00
<Example title="Suffix With Select">
2023-08-15 00:42:10 +00:00
<InputFieldWithSelect
placeholder="Suffix"
selectProps={{ options: [{ value: "TEXT", label: "Text" }] }}
/>
2022-11-28 11:20:49 +00:00
</Example>
2022-11-04 15:40:46 +00:00
<Example title="Focused">
2023-08-15 00:42:10 +00:00
<InputField placeholder="Focused" className="sb-pseudo--focus" />
2022-11-04 15:40:46 +00:00
</Example>
<Example title="Hovered">
2023-08-15 00:42:10 +00:00
<InputField placeholder="Hovered" className="sb-pseudo--hover" />
2022-11-04 15:40:46 +00:00
</Example>
<Example title="Error">
2023-08-15 00:42:10 +00:00
<InputField placeholder="Error" error="Error" />
2022-11-04 15:40:46 +00:00
</Example>
</Examples>
<Examples title="Input Text">
<Example title="Default">
<InputField />
</Example>
<Example title="Placeholder">
2023-08-15 00:42:10 +00:00
<InputField placeholder="Placeholder" />
2022-11-04 15:40:46 +00:00
</Example>
<Example title="Filled">
2023-08-15 00:42:10 +00:00
<InputField value="Filled" />
2022-11-04 15:40:46 +00:00
</Example>
</Examples>
<Title offset title="Input" suffix="Variants" />
<Canvas>
<Story name="All Variants">
2023-08-15 00:42:10 +00:00
<VariantsTable titles={["Default", "Focused", "Hovered"]} columnMinWidth={150}>
2022-11-04 15:40:46 +00:00
<VariantRow variant="Default">
2023-08-15 00:42:10 +00:00
<InputField placeholder="Default" />
<InputField placeholder="Focused" className="sb-pseudo--focus" />
<InputField placeholder="Hovered" className="sb-pseudo--hover" />
2022-11-04 15:40:46 +00:00
</VariantRow>
<VariantRow variant="Prefixed">
2023-08-15 00:42:10 +00:00
<InputField placeholder="Default" addOnLeading={<>Prefix</>} />
<InputField placeholder="Focused" className="sb-pseudo--focus" addOnLeading={<>Prefix</>} />
<InputField placeholder="Hovered" className="sb-pseudo--hover" addOnLeading={<>Prefix</>} />
2022-11-04 15:40:46 +00:00
</VariantRow>
<VariantRow variant="Suffix">
2023-08-15 00:42:10 +00:00
<InputField placeholder="Default" addOnSuffix={<>Prefix</>} />
<InputField placeholder="Focused" className="sb-pseudo--focus" addOnSuffix={<>Prefix</>} />
<InputField placeholder="Hovered" className="sb-pseudo--hover" addOnSuffix={<>Prefix</>} />
2022-11-04 15:40:46 +00:00
</VariantRow>
</VariantsTable>
</Story>
</Canvas>