Owner round 2026-09-25, over 09c0f6e. The wave's tooltips read as distracting; this round makes them quiet: - Delay: TOOLTIP_DELAY_MS = 500 in the primitive — tooltips appear when you pause on a control, never in passing (Radix focus-opens stay instant by design; keyboard users don't wait). - Vanish on leave: disableHoverableContent — the chip is un-hoverable, so the instant the cursor leaves the trigger it's gone, even mid-move onto the chip's own pixels. - Look: bg-accent (#2a2a2a, the hover-chip tone) instead of the white bg-foreground slab; 11px; px-2 py-1; arrow culled (nothing purely decorative); text-foreground/85. - Suffix: parentheses, not em-dash — "Dictate (⌘D)"; the registry source unchanged (still override-aware). - Drops (owner-selected): send square, start square, stats summary — the icons/numbers describe themselves. - Home logo kept but to the RIGHT with its real shortcut "Home (⌘G)" (jump-graph routes to /, the same destination). - Trims: "Model selector (⌘K)", "Thinking level", "Graph costs — click for details", "How much of this session isn't mapped yet". - Added: Import Notes gets "Import notes into the graph" — the one button whose destination wasn't obvious. Pins: TOOLTIP_DELAY_MS=500; hintText parens expectations updated. Live-verified on :3001 — 508ms hover delay measured, close within 10ms of pointerout, chip styles probed (rgb(42,42,42), 11px, 4px/8px), arrow gone, all new labels + sides confirmed, drops carry no tooltip and no aria-describedby.
76 lines
2.3 KiB
TypeScript
76 lines
2.3 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
import { Tooltip as TooltipPrimitive } from "radix-ui"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
|
|
/**
|
|
* The styled tooltip (tooltip wave → subtlety round, owner 2026-09-25):
|
|
* a quiet dark chip, not a white slab — accent tone (the hover-chip color),
|
|
* 11px, minimal padding, no arrow (nothing purely decorative). Opens after
|
|
* a 500ms rest, so tooltips appear when you pause on a control, never in
|
|
* passing; disableHoverableContent means the chip is un-hoverable — the
|
|
* instant the cursor leaves the trigger it's gone, even mid-move onto the
|
|
* chip's own pixels.
|
|
*/
|
|
|
|
/** The rest delay (ms): shared by hover and focus opens. */
|
|
export const TOOLTIP_DELAY_MS = 500
|
|
|
|
function TooltipProvider({
|
|
delayDuration = TOOLTIP_DELAY_MS,
|
|
...props
|
|
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
return (
|
|
<TooltipPrimitive.Provider
|
|
data-slot="tooltip-provider"
|
|
delayDuration={delayDuration}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function Tooltip({
|
|
disableHoverableContent = true,
|
|
...props
|
|
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
return (
|
|
<TooltipPrimitive.Root
|
|
data-slot="tooltip"
|
|
disableHoverableContent={disableHoverableContent}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function TooltipTrigger({
|
|
...props
|
|
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
|
}
|
|
|
|
function TooltipContent({
|
|
className,
|
|
sideOffset = 6,
|
|
children,
|
|
...props
|
|
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
return (
|
|
<TooltipPrimitive.Portal>
|
|
<TooltipPrimitive.Content
|
|
data-slot="tooltip-content"
|
|
sideOffset={sideOffset}
|
|
className={cn(
|
|
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-accent px-2 py-1 text-[11px] text-foreground/85 text-balance fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</TooltipPrimitive.Content>
|
|
</TooltipPrimitive.Portal>
|
|
)
|
|
}
|
|
|
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } |