import type { Meta, StoryObj } from '@storybook/vue3-vite'; import { ref } from 'vue'; import Button from '@/components/button/button.vue'; import Combobox from '@/components/combobox/combobox.vue'; import TextInputAffix from '../text-input-affix.vue'; import TextInputButton from '../text-input-button.vue'; import TextInput from '../text-input.vue'; const meta: Meta = { title: 'Components/Input/Text Input', component: TextInput, }; export default meta; type Story = StoryObj; export const Default: Story = { args: { placeholder: 'Placeholder text...', }, render: args => ({ components: { TextInput, TextInputAffix, TextInputButton }, setup() { return { args }; }, template: `
`, }), }; export const Icon: Story = { args: { placeholder: 'Placeholder text...', }, render: args => ({ components: { TextInput, TextInputAffix, TextInputButton }, setup() { return { args }; }, template: `
`, }), }; export const Size: Story = { args: { placeholder: 'Placeholder text...', }, render: args => ({ components: { TextInput, TextInputAffix, TextInputButton }, setup() { return { args }; }, template: `
`, }), }; export const Affix: Story = { args: { }, render: args => ({ components: { TextInput, TextInputAffix, TextInputButton }, setup() { return { args }; }, template: `
`, }), }; export const InlineAffix: Story = { args: { }, render: args => ({ components: { TextInput, TextInputAffix, TextInputButton }, setup() { return { args }; }, template: `
`, }), }; export const WithKbd: Story = { args: { placeholder: 'Search...', }, render: args => ({ components: { TextInput, TextInputAffix, TextInputButton }, setup() { return { args }; }, template: `
`, }), }; export const Disabled: Story = { args: { disabled: true, placeholder: 'Placeholder text...', }, render: args => ({ components: { TextInput, TextInputAffix, TextInputButton }, setup() { return { args }; }, template: `
`, }), }; export const HasError: Story = { args: { hasError: true, placeholder: 'Placeholder text...', }, render: args => ({ components: { TextInput, TextInputAffix, TextInputButton }, setup() { return { args }; }, template: `
`, }), }; export const WithButton: Story = { args: { placeholder: 'www.facebook.com', }, render: args => ({ components: { TextInput, TextInputAffix, TextInputButton, Button }, setup() { return { args }; }, template: `
`, }), }; export const WithInlineButton: Story = { args: { type: 'password', placeholder: '••••••••••', }, render: args => ({ components: { TextInput, TextInputAffix, TextInputButton }, setup() { return { args }; }, template: `
`, }), }; const OPTIONS = [ { value: { id: 1 }, label: 'MAD', icon: 'i-celeste-bank-card-2-line' }, { value: { id: 2 }, label: 'EUR', icon: 'i-celeste-bank-card-2-line' }, { value: { id: 3 }, label: 'USD', icon: 'i-celeste-bank-card-2-line' }, ]; export const WithLeadingCombobox: Story = { args: { placeholder: 'Search...', }, render: args => ({ components: { TextInput, TextInputAffix, TextInputButton, Combobox }, setup() { const model = ref(); return { args, OPTIONS, model }; }, template: `
`, }), }; export const WithTrailingCombobox: Story = { args: { placeholder: 'Search...', }, render: args => ({ components: { TextInput, TextInputAffix, TextInputButton, Combobox }, setup() { const model = ref(); return { args, OPTIONS, model }; }, template: `
`, }), };