Files
frontend-svelte/src/shared/ui/SearchBar/SearchBar.stories.svelte

46 lines
1.2 KiB
Svelte
Raw Normal View History

<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
import SearchBar from './SearchBar.svelte';
const { Story } = defineMeta({
title: 'Shared/SearchBar',
component: SearchBar,
tags: ['autodocs'],
parameters: {
docs: {
description: {
component:
'Search input with popover dropdown for results/suggestions. Features keyboard navigation (ArrowDown/Up/Enter) and auto-focus prevention on popover open. The input field serves as the popover trigger.',
},
story: { inline: false }, // Render stories in iframe for state isolation
},
},
argTypes: {
value: {
control: 'text',
description: 'Current search value (two-way bindable)',
},
placeholder: {
control: 'text',
description: 'Placeholder text for the input',
},
},
});
</script>
<script lang="ts">
let defaultSearchValue = $state('');
</script>
<Story
name="Default"
args={{
value: defaultSearchValue,
placeholder: 'Type here...',
}}
>
{#snippet template(args)}
<SearchBar bind:value={defaultSearchValue} placeholder="Type here..." {...args} />
{/snippet}
</Story>