import { useState } from "react"; import type { Meta, StoryObj } from "@storybook/react-vite"; import { ToggleSwitch } from "@shared/components/ToggleSwitch"; const meta: Meta = { title: "Primitives/ToggleSwitch", component: ToggleSwitch, tags: ["autodocs"], parameters: { layout: "centered" }, args: { checked: true, label: "Encryption at rest", size: "md", disabled: false, }, argTypes: { size: { control: "inline-radio", options: ["sm", "md"] }, disabled: { control: "boolean" }, checked: { control: "boolean" }, }, render: (args) => { function Bound() { const [on, setOn] = useState(args.checked); return ; } return ; }, }; export default meta; type Story = StoryObj; /** Flip size / checked / disabled / label / description in controls. */ export const Playground: Story = {}; export const WithDescription: Story = { args: { label: "Auto-promote on golden set pass", description: "When the eval set passes, the new version is promoted automatically.", }, }; export const InContext_SettingsRows: Story = { parameters: { layout: "padded" }, render: () => { function Bound() { const [a, setA] = useState(true); const [b, setB] = useState(true); const [c, setC] = useState(false); const [d, setD] = useState(false); return (
); } return ; }, };