2024-08-20 13:57:58 +00:00
|
|
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
|
|
import { fn } from "@storybook/test";
|
2024-08-21 15:14:40 +00:00
|
|
|
import { Input } from "../src/components/Input/Input";
|
2024-08-20 13:57:58 +00:00
|
|
|
import { InputIcon } from "./InputIcon";
|
|
|
|
|
|
|
|
const meta = {
|
|
|
|
title: "Forms/Input",
|
|
|
|
component: Input,
|
|
|
|
parameters: {
|
|
|
|
layout: "centered",
|
|
|
|
},
|
|
|
|
tags: ["autodocs"],
|
|
|
|
argTypes: {},
|
2024-08-22 18:04:24 +00:00
|
|
|
args: {
|
|
|
|
onFocus: fn(),
|
|
|
|
onBlur: fn(),
|
|
|
|
onMouseEnter: fn(),
|
|
|
|
onMouseLeave: fn(),
|
|
|
|
onChange: fn(),
|
|
|
|
},
|
2024-08-20 13:57:58 +00:00
|
|
|
} satisfies Meta<typeof Input>;
|
|
|
|
|
|
|
|
export default meta;
|
|
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
|
|
|
|
export const Default: Story = {
|
|
|
|
args: {
|
|
|
|
id: "input",
|
|
|
|
label: "Input",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const Helper: Story = {
|
|
|
|
args: {
|
|
|
|
id: "helper",
|
|
|
|
label: "Input",
|
|
|
|
helper: "Helper text to give some indication.",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const Icon: Story = {
|
|
|
|
args: {
|
|
|
|
id: "icon",
|
|
|
|
label: "Icon",
|
|
|
|
Icon: InputIcon,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const Disabled: Story = {
|
|
|
|
args: {
|
|
|
|
id: "disabled",
|
|
|
|
label: "Disabled",
|
|
|
|
disabled: true,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2024-10-14 18:36:12 +00:00
|
|
|
export const AutoInvalid: Story = {
|
2024-08-20 13:57:58 +00:00
|
|
|
args: {
|
2024-10-14 18:36:12 +00:00
|
|
|
id: "autoinvalid",
|
|
|
|
label: "Auto invalid",
|
|
|
|
pattern: "a",
|
|
|
|
mode: "auto"
|
2024-08-20 13:57:58 +00:00
|
|
|
},
|
|
|
|
};
|
2024-10-14 18:36:12 +00:00
|
|
|
|
|
|
|
export const IsInvalid: Story = {
|
|
|
|
args: {
|
|
|
|
id: "autoinvalid",
|
|
|
|
label: "Auto invalid",
|
|
|
|
isInvalid: true
|
|
|
|
},
|
|
|
|
};
|