import type { Meta, StoryObj } from 'storybook-solidjs-vite'; import { HoverCard } from './hover-card'; import { Button } from './button'; import { componentDescription } from '../stories/docs/element-controls'; const meta = { title: 'Solid (Advanced)/Primitives/HoverCard', component: HoverCard, tags: ['autodocs'], parameters: { layout: 'padded', docs: { description: componentDescription([ 'A floating card that opens when its trigger is hovered or focused, built on the kit\'s DIY overlay core (positioning + dismiss + presence — no third-party dependency). Portals into the active shadow root so it never clips, and a transparent "safe bridge" keeps it open while the pointer travels from trigger to card.', '**When to use:** to reveal supplementary, non-essential context on hover — a user/profile preview, a link or citation preview, an attachment summary. For an actionable menu use `Dropdown`; for a one-line label use `Tooltip`.', '**How to use:** pass the trigger element as `trigger` and the card body as `children`. Tune `openDelay` / `closeDelay` (ms) to taste.', ]), }, }, argTypes: { trigger: { control: false, description: 'The element that opens the card on hover/focus.' }, children: { control: false, description: 'The card contents.' }, openDelay: { control: 'number', description: 'Delay (ms) before the card opens. Default 0.' }, closeDelay: { control: 'number', description: 'Delay (ms) before the card closes after the pointer leaves. Default 300.' }, class: { control: 'text', description: 'Extra classes applied to the card body.' }, }, args: { trigger: , children: (
AL

Ada Lovelace

Wrote the first algorithm intended for a machine. Joined in 1843.

), }, render: (args) => , } satisfies Meta; export default meta; type Story = StoryObj; const IMPORT = `import { HoverCard } from '@kitn.ai/chat';`; const src = (code: string) => ({ parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } }, }); /** Hover (or focus) the trigger to reveal a profile preview card. */ export const Playground: Story = { ...src(`@ada}> `), }; /** A link-preview card, the way it might appear inline in an assistant message. */ export const LinkPreview: Story = { render: () => (

See the{' '} MDN reference} >

Custom elements — MDN

developer.mozilla.org

Define your own HTML elements with the CustomElementRegistry.

{' '} for the full custom-elements API.

), ...src(`MDN reference}> `), };