import type { Meta, StoryObj } from "@storybook/react-vite"
// Usage: preserved native label fixtures do not define a new-screen exception. Use public Label
// for supported fields (docs/components/label.md §5); copy only actions requested by the screen.
import { Button, Input, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "@hm-design/ui"
import { StateBoard, type BoardState } from "@/components/story-board"
import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page"
// Sheet is a modal Radix overlay (Portal), so the representative Story is a row of triggers that open the real Sheet for each
// side and content case. The same cases start open in the verification Stories. Radix owns focus trap, Escape and focus return.
type Side = "top" | "right" | "bottom" | "left"
const longText = "긴 내용은 Body 영역만 세로로 scroll 하고 Header와 Footer는 그대로 보입니다. "
function Frame({
trigger,
side,
defaultOpen,
title,
description,
children,
}: {
trigger: string
side?: Side
defaultOpen?: boolean
title: string
description?: string
children: React.ReactNode
}) {
return (
{title}
{description ? {description} : null}
{children}
)
}
function SideCase({ side, defaultOpen }: { side: Side; defaultOpen?: boolean }) {
return (
))}
)
}
const meta = { title: "Components/Overlay/Sheet", component: Sheet, parameters: { layout: "centered" } } 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
// (200px 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. The trigger keeps its
// own size (the wrapper div stretches, the inline-flex trigger does not). Overlays open in a portal, so this layout never affects them.
function SpecimenGrid({ states, columns = 4 }: { states: BoardState[]; columns?: 4 | 5 }) {
return (
{states.map((state) => (
{state.children}
}]} />
))}
)
}
// Representative Story: the common Story page. Overview is merged into Variants (Right is its first item).
export const All: Story = {
name: "Sheet",
parameters: { layout: "fullscreen", controls: { disable: true } },
render: () => (
},
{ id: "left", label: "Left", children: },
{ id: "top", label: "Top", children: },
{ id: "bottom", label: "Bottom", children: },
]}
/>
},
{ id: "long-content", label: "Long Content", children: },
]}
/>
),
}
// Verification Stories: the same cases starting open, hidden from the sidebar (tag `verification`).
export const Right: Story = { tags: ["verification"], render: () => }
export const Left: Story = { tags: ["verification"], render: () => }
export const Top: Story = { tags: ["verification"], render: () => }
export const Bottom: Story = { tags: ["verification"], render: () => }
export const Form: Story = { tags: ["verification"], render: () => }
export const LongContent: Story = { tags: ["verification"], name: "Long Content", render: () => }