<script module lang="ts">
	import { defineMeta } from "@storybook/addon-svelte-csf";
	import Button from "./Button.svelte";

	const { Story } = defineMeta({
		title: "UI/Button",
		component: Button,
		tags: ["autodocs"],
		argTypes: {
			variant: {
				control: { type: "select" },
				options: ["default", "primary", "ghost", "flat", "danger", "success", "warning"]
			},
			size: {
				control: { type: "inline-radio" },
				options: ["sm", "md", "lg"]
			},
			disabled: { control: "boolean" },
			loading: { control: "boolean" }
		},
		args: {
			variant: "default",
			size: "md",
			disabled: false,
			loading: false
		}
	});
</script>

<!-- Button content comes through its `children` snippet, provided here as Story slot content. -->
<Story name="Default">Button</Story>
<Story name="Primary" args={{ variant: "primary" }}>Save</Story>
<Story name="Ghost" args={{ variant: "ghost" }}>Cancel</Story>
<Story name="Danger" args={{ variant: "danger" }}>Delete</Story>
<Story name="Success" args={{ variant: "success" }}>Confirm</Story>
<Story name="Warning" args={{ variant: "warning" }}>Careful</Story>
<Story name="Loading" args={{ variant: "primary", loading: true }}>Saving</Story>
<Story name="Disabled" args={{ disabled: true }}>Button</Story>
<Story name="Link" args={{ href: "/" }}>Go home</Story>

<Story name="Sizes">
	<div class="flex items-center gap-3">
		<Button size="sm">Small</Button>
		<Button size="md">Medium</Button>
		<Button size="lg">Large</Button>
	</div>
</Story>
