import type { Meta, StoryObj } from '@storybook/vue3-vite' import VvInputText from '@/components/VvInputText/VvInputText.vue' import { argTypes, defaultArgs } from './InputText.settings' import { Default } from './InputText.stories' const meta: Meta = { title: 'Components/InputText/Suggestions', component: VvInputText, args: defaultArgs, argTypes, } export default meta type Story = StoryObj export const StorageSuggestions: Story = { ...Default, args: { ...Default.args, type: 'text', label: 'Input with Storage Suggestions', placeholder: 'Start typing to see stored suggestions', storageKey: 'example-input-storage', maxSuggestions: 5, }, render: args => ({ components: { VvInputText }, setup() { return { args } }, data: () => ({ inputValue: undefined }), template: /* html */ `

Storage suggestions are saved when you blur the input and can be removed by clicking the trash button in the dropdown.

Value: {{ inputValue }}
`, }), } export const ExternalSuggestions: Story = { ...Default, args: { ...Default.args, type: 'text', label: 'Input with External Suggestions', placeholder: 'Type to filter suggestions', suggestions: ['Apple', 'Apricot', 'Avocado', 'Banana', 'Blueberry'], }, render: args => ({ components: { VvInputText }, setup() { return { args } }, data: () => ({ inputValue: undefined }), template: /* html */ `

External suggestions cannot be removed. They're always available for selection.

Value: {{ inputValue }}
`, }), } export const BothSuggestions: Story = { ...Default, args: { ...Default.args, type: 'text', label: 'Input with Storage + External Suggestions', placeholder: 'Type to see all suggestions', storageKey: 'combined-suggestions-example', suggestions: ['Apple', 'Apricot', 'Avocado'], maxSuggestions: 5, }, render: args => ({ components: { VvInputText }, setup() { return { args } }, data: () => ({ inputValue: undefined }), template: /* html */ `

External suggestions: Apple, Apricot, Avocado (cannot be removed)
Storage suggestions: Saved values from previous inputs (can be removed with trash button)

Value: {{ inputValue }}
`, }), }