import { useState } from "react"; import { Button, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from "@ai-ui/ui"; import type { Meta, StoryObj } from "@storybook/react"; const inlineItems = [ { heading: "Navigation", items: [ { label: "Open docs", shortcut: "G D", value: "open-docs" }, { label: "Go to releases", shortcut: "G R", value: "go-releases" } ] }, { heading: "Actions", items: [ { label: "Publish update", shortcut: "P U", value: "publish-update" }, { label: "Invite reviewer", shortcut: "I R", value: "invite-reviewer" } ] } ]; function InlineCommandShowcase() { return ( No matching actions. {inlineItems.map((group, index) => (
{group.items.map((item) => ( {item.label} {item.value === "open-docs" ? "Jump into authoring guidance, slots, and motion references." : item.value === "go-releases" ? "Open the current release desk and recent launch notes." : item.value === "publish-update" ? "Queue the current workspace update for approval." : "Assign the next reviewer without leaving the palette."} {item.shortcut} ))} {index < inlineItems.length - 1 ? : null}
))}
); } function OperationsWorkbenchShowcase() { return (

Tip: press Enter to run the highlighted action.

} label="Operations workbench" loop > No matching actions. Launch review Reopen the last routed launch brief and approvals queue. R Blocked queue Inspect stalled items, owners, and next unblock steps. B Open Storybook docs Review the live component contract and interaction stories. G D Compliance review locked This action unlocks after policy artifacts finish syncing. Locked
); } function DialogCommandShowcase() { const [open, setOpen] = useState(false); return (

Need a new action? Add it to the workspace command registry.

} onOpenChange={setOpen} open={open} title="Workspace command palette" > No commands available. Launch checklist Open the current milestone handoff and owner checklist. Rollout audit Review timing, communications, and incident readiness. Brand theme tokens Jump to the token surface that controls tonal palette shifts. Jordan Lee Product lead for launch sequencing and review coordination. @ Avery Carter Owns release notes, docs framing, and approval summaries. @ ); } function LoadingResultsShowcase() { return (

Cached suggestions stay visible while the workspace search refreshes.

} label="Remote workspace search" loading loadingMessage="Searching remote workspace actions…" > No commands available. Launch checklist Reopen the previous launch checklist while fresh results stream in. Review queue Keep the last known reviewer list visible during the remote refresh.
); } const meta = { title: "Components/Command", component: InlineCommandShowcase, parameters: { docs: { description: { component: "Command is the system surface for in-app palettes and quick action search. The highlighted row should feel adhesive and spatial, with enough motion to clarify focus and loading state without turning the palette into a busy animation surface." } }, layout: "centered" }, tags: ["autodocs"] } satisfies Meta; export default meta; type Story = StoryObj; export const Playground: Story = { render: () => }; export const OperationsWorkbench: Story = { render: () => }; export const DialogPalette: Story = { render: () => }; export const LoadingResults: Story = { parameters: { docs: { description: { story: "Loading should not feel like a hard swap. Keep a soft status band at the top, let cached results dim underneath, and preserve the same highlighted-row motion language." } } }, render: () => };