2026-01-18 20:08:13 +03:00
< script module >
import { defineMeta } from '@storybook/addon-svelte-csf';
import SearchBar from './SearchBar.svelte';
const { Story } = defineMeta({
title: 'Shared/SearchBar',
2026-01-18 20:55:36 +03:00
component: SearchBar,
2026-01-18 20:08:13 +03:00
tags: ['autodocs'],
parameters: {
docs: {
2026-01-18 20:55:36 +03:00
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.',
},
2026-01-18 20:08:13 +03:00
story: { inline : false } , // Render stories in iframe for state isolation
},
},
2026-01-18 20:55:36 +03:00
argTypes: {
value: {
control: 'text',
description: 'Current search value (two-way bindable)',
},
placeholder: {
control: 'text',
description: 'Placeholder text for the input',
},
},
2026-01-18 20:08:13 +03:00
});
< / script >
< script lang = "ts" >
2026-01-18 20:55:36 +03:00
let defaultSearchValue = $state('');
2026-01-18 20:08:13 +03:00
< / script >
2026-01-18 20:55:36 +03:00
< Story
name="Default"
args={{
value: defaultSearchValue,
placeholder: 'Type here...',
}}
>
2026-02-22 11:25:02 +03:00
{ # snippet template ( args )}
< SearchBar bind:value = { defaultSearchValue } placeholder="Type here ..." {... args } />
{ /snippet }
2026-01-18 20:55:36 +03:00
< / Story >