diff --git a/.storybook/StoryStage.svelte b/.storybook/StoryStage.svelte new file mode 100644 index 0000000..d0510dc --- /dev/null +++ b/.storybook/StoryStage.svelte @@ -0,0 +1,16 @@ + + +
+
+
+ {@render children()} +
+
+
diff --git a/.storybook/main.ts b/.storybook/main.ts index 8f8d617..78cd878 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -1,4 +1,16 @@ import type { StorybookConfig } from '@storybook/svelte-vite'; +import { + dirname, + resolve, +} from 'path'; +import { fileURLToPath } from 'url'; +import { + loadConfigFromFile, + mergeConfig, +} from 'vite'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); const config: StorybookConfig = { 'stories': [ @@ -18,5 +30,17 @@ const config: StorybookConfig = { '@storybook/addon-docs', ], 'framework': '@storybook/svelte-vite', + async viteFinal(config) { + // This attempts to find your actual vite.config.ts + const { config: userConfig } = await loadConfigFromFile( + { command: 'serve', mode: 'development' }, + resolve(__dirname, '../vite.config.ts'), + ) || {}; + + return mergeConfig(config, { + // Merge only the resolve/alias parts if you want to be safe + resolve: userConfig?.resolve || {}, + }); + }, }; export default config; diff --git a/.storybook/preview.ts b/.storybook/preview.ts index 89f39af..2734a23 100644 --- a/.storybook/preview.ts +++ b/.storybook/preview.ts @@ -1,9 +1,10 @@ import type { Preview } from '@storybook/svelte-vite'; - +import StoryStage from './StoryStage.svelte'; import '../src/app/styles/app.css'; const preview: Preview = { parameters: { + layout: 'fullscreen', controls: { matchers: { color: /(background|color)$/i, @@ -17,7 +18,31 @@ const preview: Preview = { // 'off' - skip a11y checks entirely test: 'todo', }, + + docs: { + story: { + // This sets the default height for the iframe in Autodocs + iframeHeight: '400px', + // Ensure the story isn't forced into a tiny inline box + // inline: true, + }, + }, }, + decorators: [ + (storyFn, { parameters }) => { + const { Component, props } = storyFn(); + return { + Component: StoryStage, + // We pass the actual story component into the Stage via a snippet/slot + // Svelte 5 Storybook handles this mapping internally when you return this structure + props: { + children: Component, + width: parameters.stageWidth || 'max-w-3xl', + ...props, + }, + }; + }, + ], }; export default preview; diff --git a/src/shared/ui/CheckboxFilter/CheckboxFilter.stories.svelte b/src/shared/ui/CheckboxFilter/CheckboxFilter.stories.svelte new file mode 100644 index 0000000..2d0df2f --- /dev/null +++ b/src/shared/ui/CheckboxFilter/CheckboxFilter.stories.svelte @@ -0,0 +1,73 @@ + + + + + + + + + + + diff --git a/src/shared/ui/ComboControl/ComboControl.stories.svelte b/src/shared/ui/ComboControl/ComboControl.stories.svelte new file mode 100644 index 0000000..c697da4 --- /dev/null +++ b/src/shared/ui/ComboControl/ComboControl.stories.svelte @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/shared/ui/ContentEditable/ContentEditable.stories.svelte b/src/shared/ui/ContentEditable/ContentEditable.stories.svelte new file mode 100644 index 0000000..c839f86 --- /dev/null +++ b/src/shared/ui/ContentEditable/ContentEditable.stories.svelte @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/shared/ui/SearchBar/SearchBar.stories.svelte b/src/shared/ui/SearchBar/SearchBar.stories.svelte new file mode 100644 index 0000000..f86dad9 --- /dev/null +++ b/src/shared/ui/SearchBar/SearchBar.stories.svelte @@ -0,0 +1,82 @@ + + + + + + + Here will be the search result +
+ Popover closes only when the user clicks outside the search bar or presses the Escape key. +
+
+ + + +
+

No results found

+
+
+
+ + + +
+ Start typing to see results +
+
+
diff --git a/src/shared/ui/SearchBar/SearchBar.svelte b/src/shared/ui/SearchBar/SearchBar.svelte index 9cb6dac..d1e339f 100644 --- a/src/shared/ui/SearchBar/SearchBar.svelte +++ b/src/shared/ui/SearchBar/SearchBar.svelte @@ -18,7 +18,7 @@ import type { Snippet } from 'svelte'; interface Props { /** Unique identifier for the input element */ - id: string; + id?: string; /** Current search value (bindable) */ value: string; /** Additional CSS classes for the container */ diff --git a/src/shared/ui/VirtualList/VirtualList.stories.svelte b/src/shared/ui/VirtualList/VirtualList.stories.svelte new file mode 100644 index 0000000..1e3064e --- /dev/null +++ b/src/shared/ui/VirtualList/VirtualList.stories.svelte @@ -0,0 +1,70 @@ + + + + + + + {#snippet children({ item })} +
{item}
+ {/snippet} +
+
+ + + + {#snippet children({ item })} +
{item}
+ {/snippet} +
+
+ + + + {#snippet children({ item })} +
{item}
+ {/snippet} +
+