<script module lang="ts">
	import { defineMeta } from "@storybook/addon-svelte-csf";
	import Search from "$icon/search";
	import Mail from "$icon/mail";
	import Input from "./Input.svelte";

	const { Story } = defineMeta({
		title: "UI/Input",
		component: Input,
		tags: ["autodocs"],
		argTypes: {
			error: { control: "boolean" },
			disabled: { control: "boolean" },
			loading: { control: "boolean" },
			placeholder: { control: "text" }
		},
		args: {
			error: false,
			disabled: false,
			loading: false,
			placeholder: "Placeholder"
		}
	});
</script>

<Story name="Default" />
<Story name="Focus" args={{ autofocus: true }} />
<Story name="Filled" args={{ value: "Filled value" }} />
<Story name="Error" args={{ error: true, value: "Invalid value" }} />
<Story name="Disabled" args={{ disabled: true, value: "Can't edit this" }} />
<Story name="Loading" args={{ loading: true, value: "Checking..." }} />
<Story name="With left icon" args={{ iconLeft: Search, placeholder: "Search" }} />
<Story name="With right icon" args={{ iconRight: Mail, placeholder: "you@example.com" }} />
