import { playgroundParameters } from "@charcuterie/storybook-config/story-parameters" import type { Meta, StoryObj } from "@storybook/react" import { controlSizeArgType } from "../argTypes.storyHelpers.ts" import { StoryCell, StoryGrid, StorySection, } from "../board.storyHelpers.tsx" import { FieldGroup } from "../Field/FieldGroup.tsx" import { Checkbox } from "./Checkbox.tsx" const meta = { title: "Components/Controls/Checkbox", component: Checkbox, parameters: { layout: "padded" }, argTypes: { size: controlSizeArgType }, // The component's own defaults, restated — Storybook does not seed // `args` from docgen, so an unstated default shows in the props // table with nothing selected in its control. args: { isChecked: false, isDisabled: false, isReadOnly: false, size: "md", }, } satisfies Meta export default meta type Story = StoryObj export const Playground: Story = { parameters: playgroundParameters, args: { label: "Delete originals after import" }, } export const AllVariants: Story = { args: { label: "Delete originals after import" }, render: (controlProps) => ( {(["sm", "md", "lg"] as const).map((size) => ( ))} ), } /** * `isChecked` seeds the first paint and nothing after — the `` * owns its state from then on, so a disabled-and-checked box is a * saved preference the user cannot currently change, not a bug. */ export const AllStates: Story = { args: { label: "Delete originals after import" }, render: (controlProps) => ( ), } /** * The whole keyboard path is the browser's: Tab reaches the box, * Space toggles it. A `