import { DemoStory } from '../demo/demo-types'; import { ToggleSwitch, ToggleSwitchIcon, ToggleSwitchIconSize, ToggleSwitchProps, ToggleSwitchSize, } from './toggle-switch'; import { HtmlVar } from 'lupine.components'; export const toggleSwitchDemo: DemoStory = { id: 'toggle-switch-demo', text: 'Toggle Switch Demo', args: { size: ToggleSwitchSize.Medium, disabled: false, checked: false, text: { on: 'ON', off: 'OFF' }, textWidth: '30px', }, argTypes: { size: { control: 'select', options: Object.values(ToggleSwitchSize), description: 'The size of the switch', }, disabled: { control: 'boolean', description: 'Whether the switch is disabled' }, checked: { control: 'boolean', description: 'Whether the switch is turned on' }, textWidth: { control: 'text', description: 'Fixed width for the text to prevent jumping' }, }, render: (args: ToggleSwitchProps) => { // Note: We don't expose 'text' as a simple control because our current demo system // handles primitives. But the user can see how it works with the default args. const ToggleSwitchDemoContent = () => { const msg = new HtmlVar(''); return (
{ msg.value = `Interactive Switch checked: ${c}`; }} />

{ msg.value = `SmallSmall Switch checked: ${c}`; }} />
{ msg.value = `Small Switch checked: ${c}`; }} />
{ msg.value = `Medium Switch checked: ${c}`; }} />
On ), off: ( <> Off ), }} textWidth='50px' checked={true} onClick={(c) => { msg.value = `Large Switch checked: ${c}`; }} />
{ msg.value = `LargeLarge Switch checked: ${c}`; }} />

ToggleSwitchIcon Sizes
), off: ( <> ), }} disabled={args.disabled} checked={args.checked} onClick={(c) => console.log(`SmallSmall ToggleSwitchIcon checked: ${c}`)} /> ), off: ( <> ), }} disabled={args.disabled} checked={args.checked} onClick={(c) => console.log(`Small ToggleSwitchIcon checked: ${c}`)} /> ), off: ( <> ), }} disabled={args.disabled} checked={args.checked} onClick={(c) => console.log(`Medium ToggleSwitchIcon checked: ${c}`)} /> ), off: ( <> ), }} disabled={args.disabled} checked={args.checked} onClick={(c) => console.log(`Large ToggleSwitchIcon checked: ${c}`)} /> ), off: ( <> ), }} disabled={args.disabled} checked={args.checked} onClick={(c) => console.log(`LargeLarge ToggleSwitchIcon checked: ${c}`)} />
{msg.node}
); }; return ; }, code: `import { ToggleSwitch, ToggleSwitchSize } from 'lupine.components/components/toggle-switch'; `, };