import { useState } from "react" import type { Meta, StoryObj } from "@storybook/react-vite" import { Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, } from "@hm-design/ui" import { STORY_KICKER, StoryPage, StoryPageHeader, StorySection } from "@/components/story-page" // Menubar is a desktop menu bar (Left / Right between top menus). The representative Story is the real bar and opens the real // menus; Radix owns the keyboard model and focus. Hidden verification Stories isolate trigger focus and open + focus. function Specimen() { const [grid, setGrid] = useState(true) const [ruler, setRuler] = useState(false) const [zoom, setZoom] = useState("100") return ( 파일 새로 만들기 ⌘N 열기 ⌘O 저장 (사용 불가) 내보내기 PDF 이미지 종료 편집 실행 취소 ⌘Z 다시 실행 ⇧⌘Z 보기 표시 격자 눈금자 확대 75% 100% 125% ) } const meta = { title: "Components/Navigation/Menubar", component: Menubar, parameters: { layout: "padded" } } satisfies Meta export default meta type Story = StoryObj // Representative Story: File (item, shortcut, disabled, separator, sub menu, destructive), Edit, View (label, checkbox, radio). export const All: Story = { name: "Menubar", parameters: { layout: "fullscreen", controls: { disable: true } }, render: () => (
), } function FocusSpecimen({ open = false }: { open?: boolean }) { return (
파일 새로 만들기 저장 (사용 불가) 사용 불가
) } export const TriggerFocus: Story = { tags: ["verification"], render: () => , play: async ({ canvasElement }) => { canvasElement.querySelector('[data-slot="menubar-trigger"]')?.focus() }, } export const OpenFocus: Story = { tags: ["verification"], render: () => , play: async ({ canvasElement }) => { // Verification only: actual trigger focus while its real menu is open. // Production keyboard opening still moves focus into the menu (Radix default). canvasElement.querySelector('[data-slot="menubar-trigger"]')?.focus() }, }