feat: add missing storybook files and type template arguments properly

This commit is contained in:
Ilia Mashkov
2026-04-17 18:01:24 +03:00
parent 5eb9584797
commit bb65f1c8d6
31 changed files with 1124 additions and 90 deletions
+56 -10
View File
@@ -37,13 +37,23 @@ const { Story } = defineMeta({
</script>
<script lang="ts">
import type { ComponentProps } from 'svelte';
let value = $state(50);
let valueLow = $state(25);
let valueHigh = $state(75);
</script>
<Story name="Horizontal" args={{ orientation: 'horizontal', min: 0, max: 100, step: 1, value }}>
{#snippet template(args)}
<Story
name="Horizontal"
args={{
orientation: 'horizontal',
min: 0,
max: 100,
step: 1,
value,
}}
>
{#snippet template(args: ComponentProps<typeof Slider>)}
<div class="p-8">
<Slider {...args} />
<p class="mt-4 text-sm text-muted-foreground">Value: {args.value}</p>
@@ -54,8 +64,17 @@ let valueHigh = $state(75);
{/snippet}
</Story>
<Story name="Vertical" args={{ orientation: 'vertical', min: 0, max: 100, step: 1, value }}>
{#snippet template(args)}
<Story
name="Vertical"
args={{
orientation: 'vertical',
min: 0,
max: 100,
step: 1,
value,
}}
>
{#snippet template(args: ComponentProps<typeof Slider>)}
<div class="p-8 flex items-center gap-8 h-72">
<Slider {...args} />
<div>
@@ -66,8 +85,17 @@ let valueHigh = $state(75);
{/snippet}
</Story>
<Story name="With Label" args={{ orientation: 'horizontal', min: 0, max: 100, step: 1, value }}>
{#snippet template(args)}
<Story
name="With Label"
args={{
orientation: 'horizontal',
min: 0,
max: 100,
step: 1,
value,
}}
>
{#snippet template(args: ComponentProps<typeof Slider>)}
<div class="p-8">
<Slider {...args} />
<p class="mt-4 text-sm text-muted-foreground">Slider with inline label</p>
@@ -75,8 +103,17 @@ let valueHigh = $state(75);
{/snippet}
</Story>
<Story name="Interactive States" args={{ orientation: 'horizontal', min: 0, max: 100, step: 1, value: 50 }}>
{#snippet template(args)}
<Story
name="Interactive States"
args={{
orientation: 'horizontal',
min: 0,
max: 100,
step: 1,
value: 50,
}}
>
{#snippet template(args: ComponentProps<typeof Slider>)}
<div class="p-8 space-y-8">
<div>
<p class="text-sm font-medium mb-2">Thumb: 45° rotated square</p>
@@ -103,8 +140,17 @@ let valueHigh = $state(75);
{/snippet}
</Story>
<Story name="Step Sizes" args={{ orientation: 'horizontal', min: 0, max: 100, step: 1, value }}>
{#snippet template(args)}
<Story
name="Step Sizes"
args={{
orientation: 'horizontal',
min: 0,
max: 100,
step: 1,
value,
}}
>
{#snippet template(args: ComponentProps<typeof Slider>)}
<div class="p-8 space-y-6">
<div>
<p class="text-sm font-medium mb-2">Step: 1 (default)</p>