import type { Meta, StoryObj } from "@storybook/react-vite" import { Input, Label, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from "@hm-design/ui" import { StateBoard, type BoardState } from "@/components/story-board" import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page" // Label has no standalone ui_viz spec. Its typography and color are the Field Label role owned by Input / Textarea // (14/20/500, color.fg.secondary). Required star and messages are composed here as a consumer would (not part of Label). // Story-only Label color. The shared Label sets `color: var(--hm-label-text)` from an unlayered theme rule, so a utility like // `text-foreground` loses to it; overriding the Label's own token on the element works. The Disabled example keeps the // shared secondary color (at 0.5 through `peer-disabled`). State titles are untouched. const fieldLabel = "[--hm-label-text:var(--foreground)]" // Representative-page layout (Storybook presentation only): 3 equal columns on PC (iframe width 1000px and up), shrinking to // fit below that (240px minimum). Each specimen sits in its own single-column StateBoard (min larger than any column), so // StateBoard's auto-fill grid cannot leave an empty or stretched track. A section with fewer than 3 specimens keeps the // same column width and leaves the remaining tracks empty. function SpecimenGrid({ states }: { states: BoardState[] }) { return (
{states.map((state) => ( ))}
) } const meta = { title: "Components/Form/Label", component: Label, parameters: { layout: "padded", docs: { description: { component: "Field Label 14/20/500, 색 color.fg.secondary (ui_viz input.md §9, §10). Radix Label의 htmlFor·클릭 시 컨트롤 focus 동작을 유지합니다. Required 별표·문구는 Label이 아닌 소비 조합입니다.", }, }, }, } satisfies Meta export default meta type Story = StoryObj export const All: Story = { name: "Label", parameters: { layout: "fullscreen", controls: { disable: true } }, render: () => ( ), }, { id: "disabled", label: "Disabled", children: (
), }, ]} />
), }, { id: "required", label: "Required", children: (
), }, { id: "long", label: "Long Label", children: (
), }, ]} />
), }