import type { Meta, StoryObj } from '@storybook/react-vite' import { IconArchive, IconPin, IconTrash } from '@tabler/icons-react' import { Button } from './Button' import { IconButton } from './IconButton' import { Tooltip, WithTooltip } from './Tooltip' import { Toolbar, ToolbarButton } from './Toolbar' const meta = { title: 'Primitives/Tooltip', component: Tooltip, args: { label: 'Add to starred' }, } satisfies Meta export default meta type Story = StoryObj /** The static tooltip surface. */ export const Default: Story = {} /** With a key hint — drawn as the `Kbd` chip after the label. */ export const WithShortcut: Story = { args: { label: 'Bold', shortcut: 'Cmd+B' } } /** With and without, so the difference is one glance. */ export const ShortcutComparison: Story = { parameters: { controls: { disable: true } }, render: () => (
), } /** A label longer than 320px wraps onto more lines, rather than running off the screen. A short one stays one line at 30px. */ export const LongLabel: Story = { parameters: { controls: { disable: true } }, render: () => (
), } /** `inline`: a tooltip on a word inside a sentence. The wrapper is a span, so the paragraph stays valid HTML. Hover the word. */ export const InsideText: Story = { parameters: { controls: { disable: true } }, render: () => (

The plan is in{' '} Item one , and the rest follows.

), } /** Hover the button — WithTooltip portals the tooltip above the trigger. */ export const OnHoverTop: Story = { parameters: { controls: { disable: true } }, render: () => ( ), } /** Bottom placement. */ export const OnHoverBottom: Story = { parameters: { controls: { disable: true } }, render: () => ( ), } /** The reason a disabled control gives — wrap the control, not the form around it. */ export const OnADisabledControl: Story = { parameters: { controls: { disable: true } }, render: () => ( ), } /** * A row of controls, which is where the shared delay shows itself: the first * tooltip waits 300ms, and while the group stays warm the neighbours open as * the pointer arrives — and the pill moves between them without re-animating. * An app gets this by mounting one `TooltipProvider` at its root. */ export const InAToolbar: Story = { parameters: { controls: { disable: true } }, render: () => ( ), }