import { playgroundParameters } from "@charcuterie/storybook-config/story-parameters" import type { Meta, StoryObj } from "@storybook/react" import { Badge } from "../Badge/Badge.tsx" import { StoryCell, StoryGrid, } from "../board.storyHelpers.tsx" import type { AccordionItem } from "./Accordion.tsx" import { Accordion } from "./Accordion.tsx" const JOB_SECTIONS: AccordionItem[] = [ { content: (

Blade Runner (1982) · 9 titles · MakeMKV 1.17.8

), key: "disc", label: "Disc", }, { content: (

14:02:11 AACS handshake complete, reading…

), key: "log", label: "Log", }, { content: (
1 retry AACS
), key: "flags", label: "Flags", }, ] const STATE_SECTIONS: AccordionItem[] = [ ...JOB_SECTIONS, { content:

Unreachable — no verdict yet.

, isDisabled: true, key: "verdict", label: "Verdict", }, ] const meta = { title: "Components/Layout/Accordion", component: Accordion, parameters: { layout: "padded" }, args: { headingLevel: 3, isMultiple: false, items: JOB_SECTIONS, }, } satisfies Meta export default meta type Story = StoryObj export const Playground: Story = { parameters: playgroundParameters, args: { expandedKeys: ["disc"], items: JOB_SECTIONS }, } /** * Exclusive is `VisibilityGroup`; `isMultiple` is * `MultiplePicker`. Both hooks are created and one is consulted, * because hooks cannot be conditional — two empty stores and no DOM, * which is cheaper than reimplementing exclusivity on top of the * multiple kind. */ export const AllVariants: Story = { args: { items: JOB_SECTIONS }, render: () => ( {/* Its own item set, with names that appear nowhere else on the board. Four accordions sharing three labels means `getByRole("heading", { name: "Log" })` matches four elements, and `expectAgentDrivable` treats ambiguity as a failure — correctly, since an agent would be picking one at random. */} 4 of 9 titles complete.

, key: "steps", label: "Steps", }, { content:

No errors.

, key: "errors", label: "Errors", }, ]} />
), } /** * A disabled section is **not a member of the group**. Registration * is membership, so nothing can expand it — including a consumer * passing its key in `expandedKeys`. That is the behaviour a * `` cannot have at all, which is one of the two reasons * this is not built on `
`. */ export const AllStates: Story = { args: { expandedKeys: ["verdict"], items: STATE_SECTIONS, }, }