- Button page shows Toggle; new Selection Controls page compares Checkbox, Radio Group and Switch states (specimens moved to *-examples.tsx) - Date Picker page includes Calendar; Combobox, Input and Slider layouts (Korean slider labels) tidied - Absorbed representative Stories keep their IDs as verification Stories - Component docs updated to the new representative pages
48 lines
2.2 KiB
TypeScript
48 lines
2.2 KiB
TypeScript
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
import { RadioGroup } from "@hm-design/ui"
|
|
import { StoryPage, StoryPageHeader } from "@/components/story-page"
|
|
import { Group, RadioGroupSections } from "./radio-group-examples"
|
|
|
|
// Current HM Radio Group. The specimens live in ./radio-group-examples and are also shown on the Selection Controls
|
|
// representative page ("선택 컨트롤", Checkbox / Radio Group / Switch), the single sidebar item for the three. Every Story here
|
|
// keeps its ID and direct URL but is hidden from the sidebar (tag `verification`).
|
|
|
|
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<typeof RadioGroup>
|
|
export default meta
|
|
type Story = StoryObj<typeof meta>
|
|
|
|
// Former representative Story: kept for its ID and direct URL; hidden from the sidebar (tag `verification`) since the Selection
|
|
// Controls page shows the same sections.
|
|
export const All: Story = {
|
|
tags: ["verification"],
|
|
name: "Radio Group",
|
|
parameters: { layout: "fullscreen", controls: { disable: true } },
|
|
render: () => (
|
|
<StoryPage>
|
|
<StoryPageHeader title="Radio Group" />
|
|
<RadioGroupSections />
|
|
</StoryPage>
|
|
),
|
|
play: async ({ canvasElement }) => {
|
|
// preventScroll: the page opens at its header, not at the States section.
|
|
canvasElement.querySelector<HTMLButtonElement>('[data-overview-state="focus"] [role="radio"][data-state="checked"]')?.focus({ preventScroll: true })
|
|
},
|
|
}
|
|
|
|
export const Vertical: Story = { tags: ["verification"], render: () => <Group prefix="sv" /> }
|
|
export const Horizontal: Story = { tags: ["verification"], render: () => <Group prefix="sh" orientation="horizontal" /> }
|
|
export const Disabled: Story = { tags: ["verification"], render: () => <Group prefix="sd" disabled /> }
|
|
export const Error: Story = { tags: ["verification"], render: () => <Group prefix="se" invalid /> }
|