import { useState, type ReactNode } from "react" import type { Meta, StoryObj } from "@storybook/react-vite" import { CalendarIcon, SettingsIcon, UserIcon } from "lucide-react" import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from "@hm-design/ui" import { StateBoard } from "@/components/story-board" import { StoryPage, StoryPageHeader, StorySection } from "@/components/story-page" // The representative "Command" Story shows real, typeable lists; the same specimens also exist as Stories tagged `verification` // (hidden from the sidebar). Filtering is cmdk's. The bordered box is Story composition (Command draws no border of its own). // A selection log shows that Enter / click reach `onSelect`. const box = (node: ReactNode) =>
{node}
// `showValue={false}` hides the value readout on the representative page; the verification Stories keep it. function Basic({ showValue = true }: { showValue?: boolean }) { const [last, setLast] = useState("-") return (
{box( 결과가 없습니다. Next.js SvelteKit Remix Astro )} {showValue ? {`선택: ${last}`} : null}
) } function Grouped() { return box( 결과가 없습니다. 일정 보기 프로필 ⌘P 환경설정 ⌘, 결제 (사용 불가) ) } function Long() { return box( 결과가 없습니다. {Array.from({ length: 30 }, (_, i) => ( {`항목 ${i + 1} — 긴 항목 이름도 줄바꿈 없이 한 줄로 이어질 수 있습니다`} ))} ) } // Same 3-column track as the Form pages (1 column on narrow screens). Each cell is a one-specimen StateBoard so subtitles, dividers and // command boxes line up; sections with fewer specimens leave the remaining tracks empty. const Grid = ({ children }: { children: ReactNode }) => (
{children}
) const Cell = ({ id, label, children }: { id: string; label: string; children: ReactNode }) => (
) const meta = { title: "Components/Search & Date/Command", component: Command, parameters: { layout: "padded" } } satisfies Meta export default meta type Story = StoryObj // Representative Story: the common Story page; the sections group the same specimens. export const All: Story = { name: "Command", parameters: { layout: "fullscreen", controls: { disable: true } }, render: () => ( ), } export const Search: Story = { tags: ["verification"], render: () => } export const GroupedList: Story = { tags: ["verification"], name: "Grouped", render: () => }