2026-01-18 20:08:13 +03:00
< script module >
import { createTypographyControl } from '$shared/lib';
import { defineMeta } from '@storybook/addon-svelte-csf';
import ComboControl from './ComboControl.svelte';
const { Story } = defineMeta({
title: 'Shared/ComboControl',
2026-01-18 20:55:36 +03:00
component: ComboControl,
2026-01-18 20:08:13 +03:00
tags: ['autodocs'],
parameters: {
docs: {
2026-01-18 20:55:36 +03:00
description: {
component:
'Provides multiple ways to change a numeric value via decrease/increase buttons, slider, and direct input. All three methods are synchronized, giving users flexibility based on precision needs.',
},
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: {
control: {
control: 'object',
description: 'TypographyControl instance managing the value and bounds',
},
decreaseLabel: {
control: 'text',
description: 'Accessibility label for the decrease button',
},
increaseLabel: {
control: 'text',
description: 'Accessibility label for the increase button',
},
controlLabel: {
control: 'text',
description: 'Accessibility label for the control button (opens popover)',
},
},
2026-01-18 20:08:13 +03:00
});
< / script >
< script lang = "ts" >
const defaultControl = createTypographyControl({ value : 77 , min : 0 , max : 100 , step : 1 } );
const atMinimumControl = createTypographyControl({ value : 0 , min : 0 , max : 100 , step : 1 } );
const atMaximumControl = createTypographyControl({ value : 100 , min : 0 , max : 100 , step : 1 } );
const withFloatControl = createTypographyControl({ value : 77.5 , min : 0 , max : 100 , step : 0.1 } );
2026-01-18 20:55:36 +03:00
const customLabelsControl = createTypographyControl({ value : 50 , min : 0 , max : 100 , step : 1 } );
2026-01-18 20:08:13 +03:00
< / script >
2026-01-18 20:55:36 +03:00
< Story
name="Default"
args={{
control: defaultControl,
}}
>
2026-01-18 20:08:13 +03:00
< ComboControl control = { defaultControl } / >
< / Story >
2026-01-18 20:55:36 +03:00
< Story
name="At Minimum"
args={{
control: atMinimumControl,
}}
>
2026-01-18 20:08:13 +03:00
< ComboControl control = { atMinimumControl } / >
< / Story >
2026-01-18 20:55:36 +03:00
< Story
name="At Maximum"
args={{
control: atMaximumControl,
}}
>
2026-01-18 20:08:13 +03:00
< ComboControl control = { atMaximumControl } / >
< / Story >
2026-01-18 20:55:36 +03:00
< Story
name="With Float"
args={{
control: withFloatControl,
}}
>
2026-01-18 20:08:13 +03:00
< ComboControl control = { withFloatControl } / >
< / Story >
2026-01-18 20:55:36 +03:00
< Story
name="Custom Labels"
args={{
control: customLabelsControl,
decreaseLabel: 'Decrease font size',
increaseLabel: 'Increase font size',
controlLabel: 'Open font size controls',
}}
>
< ComboControl
control={ customLabelsControl }
decreaseLabel="Decrease font size"
increaseLabel="Increase font size"
controlLabel="Open font size controls"
/>
< / Story >