import { useState } from "react"
import type { Meta, StoryObj } from "@storybook/react-vite"
import { Button, Progress } from "@hm-design/ui"
import { StateBoard } from "@/components/story-board"
import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page"
// Progress follows `value` (0..max). The representative Story shows fixed values plus one interactive value; the same specimens
// also exist as Stories tagged `verification` (hidden from the sidebar). No status colors are defined, so there is one look.
// `showValue={false}` hides the value readout on the representative page; the verification Stories keep it.
function Interactive({ showValue = true }: { showValue?: boolean }) {
const [value, setValue] = useState(30)
return (
{showValue ?
{`value = ${value}`}
: null}
)
}
function CustomMaximum() {
return (
)
}
const sections = [
{ id: "zero", label: "0%", node: },
{ id: "middle", label: "50%", node: },
{ id: "full", label: "100%", node: },
{ id: "custom-maximum", label: "max = 200", node: },
{ id: "interactive", label: "Interactive", node: },
]
const meta = { title: "Components/Data & Display/Progress", component: Progress, parameters: { layout: "padded" } } satisfies Meta
export default meta
type Story = StoryObj
// Representative-page layout (Storybook presentation only): equal columns on PC (iframe width 1000px and up), fewer below that
// (240px minimum). Each specimen sits in its own single-column StateBoard (min larger than any column), so every subtitle and divider
// has the width of its column; a section with fewer specimens than columns leaves the remaining columns empty.
const specimenColumns = {
2: "min-[1000px]:grid-cols-2",
3: "min-[1000px]:grid-cols-3",
4: "min-[1000px]:grid-cols-4",
} as const
function SpecimenGrid({ ids, columns, spans = {} }: { ids: string[]; columns: 2 | 3 | 4; spans?: Record }) {
return (