import type { Meta, StoryObj } from "@storybook/react-vite" import { Label, RadioGroup, RadioGroupItem } from "@hm-design/ui" import { StateBoard } from "@/components/story-board" import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page" // Current HM Radio Group. ui-viz has no Radio spec, so it was reference only. function Group({ prefix, defaultValue = "a", disabled, disabledItem, invalid, orientation, hoverItem, }: { prefix: string defaultValue?: string disabled?: boolean disabledItem?: string invalid?: boolean orientation?: "horizontal" | "vertical" // Pins :hover on one item with the Storybook-only data-sb-hover attribute (.storybook/pseudo-states.ts). hoverItem?: string }) { return ( {["a", "b", "c"].map((v) => (
))}
) } const meta = { title: "Components/Form/Radio Group", component: RadioGroup, parameters: { layout: "padded", docs: { description: { component: "현재 HM 규격: 18px 원, border 1px(stroke), Checked/Selected는 state-active 테두리 + 8px state-active dot, group gap 12(horizontal 16). Radix RadioGroup의 roving focus, 방향키 선택, ARIA를 유지합니다. ui-viz에는 Radio 규격이 없어 참고만 했습니다.", }, }, }, } satisfies Meta export default meta type Story = StoryObj export const All: Story = { name: "Radio Group", parameters: { layout: "fullscreen", controls: { disable: true } }, render: () => ( }]} /> }]} /> }, { id: "focus", label: "Focus", children: }, { id: "disabled-item", label: "Disabled · 항목", children: }, { id: "disabled-group", label: "Disabled · 그룹", children: }, ]} /> }]} /> ), play: async ({ canvasElement }) => { // preventScroll: the page opens at its header, not at the States section. canvasElement.querySelector('[data-overview-state="focus"] [role="radio"][data-state="checked"]')?.focus({ preventScroll: true }) }, } export const Vertical: Story = { tags: ["verification"], render: () => } export const Horizontal: Story = { tags: ["verification"], render: () => } export const Disabled: Story = { tags: ["verification"], render: () => } export const Error: Story = { tags: ["verification"], render: () => }