{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tool-tip",
  "type": "registry:item",
  "title": "Tool Tip",
  "description": "A short description shown when its trigger is hovered or focused: the trigger is the slotted element, and the tip describes it (aria-describedby), so a screen reader reads it with the trigger's name. It shows after `delay` milliseconds, stays while the pointer is over it, and Escape hides it without moving focus (WCAG 1.4.13). It sits in the top layer (`popover`), placed above the trigger by CSS anchor positioning, or by script where that isn't supported.",
  "dependencies": [
    "@zubra/runtime@^5.13.1"
  ],
  "categories": [
    "widget"
  ],
  "registryDependencies": [
    "https://zubra-js.github.io/zubra-ui/r/theme.json"
  ],
  "files": [
    {
      "path": "components/tool-tip.js",
      "type": "registry:file",
      "target": "~/src/components/zubra/tool-tip.js",
      "content": "// Generated by zubra from tool-tip.zb. Do not edit.\nimport { $define, $r, $t } from \"@zubra/runtime\";\nimport { id, onMount } from '@zubra/runtime';\nimport { state as __zubraState, computed as __zubraComputed } from \"@zubra/runtime\";\n\nexport const tag = \"tool-tip\";\n\nexport default $define(tag, {\n  props: {\n    \"text\": { attribute: \"text\", default: \"\", required: false },\n    \"delay\": { attribute: \"delay\", default: 300, required: false },\n  },\n  abi: 3,\n  shadow: false,\n  form: false,\n  slots: [\"content\", \"default\"],\n  events: [],\n  styled: true,\n  styles: \"@layer theme, base, components, utilities;\\n@layer components {\\n@scope (tool-tip) to ([data-zb-slotted=\\\"tool-tip\\\"]) {\\n  :scope { display: inline-block; }\\n  .trigger { display: contents; }\\n  [popover] { position: fixed; inset: auto; margin: 0; padding: 0.3rem 0.55rem; border: 0; border-radius: calc(var(--radius, 0.625rem) * 0.64); background: var(--foreground, #1d2130); color: var(--card, #fff); font-size: 0.85rem; line-height: 1.3; max-width: 18rem; pointer-events: auto; }\\n  [popover] { opacity: 0; scale: 0.96; translate: 0 0.2rem; transition: opacity var(--duration-fast, 150ms) var(--ease-out, ease-out), scale var(--duration-fast, 150ms) var(--ease-out, ease-out), translate var(--duration-fast, 150ms) var(--ease-out, ease-out), overlay var(--duration-fast, 150ms) allow-discrete, display var(--duration-fast, 150ms) allow-discrete; }\\n  [popover]:popover-open { opacity: 1; scale: 1; translate: 0; }\\n  @starting-style { [popover]:popover-open { opacity: 0; scale: 0.96; translate: 0 0.2rem; } }\\n  @media (prefers-reduced-motion: reduce) { *, *::before, *::after, ::backdrop { transition-duration: 0s !important; animation-duration: 0s !important; } }\\n  @supports (position-area: top) {\\n    [popover] { position-area: top; position-try-fallbacks: flip-block; margin-bottom: 6px; }\\n  }\\n}\\n}\\n\",\n  template: \"\\n  <span class=\\\"trigger\\\">\\n    <!--[--><!--]-->\\n    <span popover=\\\"manual\\\" role=\\\"tooltip\\\"><!--[--><!--]--></span>\\n  </span>\\n\",\n  setup($p, $emit) {\nfunction __zubraAssign(signal, value) { signal.set(value); return value }\nfunction __zubraUpdate(signal, delta, prefix) { const old = signal.get(); signal.set(old + delta); return prefix ? old + delta : old }\n                                              \n\n  const tipId = id()\n  const anchored = typeof CSS !== \"undefined\" && CSS.supports(\"position-area: top\")\n  const wrap = __zubraState(null)\n  const tip = __zubraState(null)\n  const timer = __zubraState(null)\n\n  function show() {\n    clearTimeout(timer.get())\n    __zubraAssign(timer, setTimeout(() => {\n      if (!tip.get() || tip.get().matches(\":popover-open\")) return\n      tip.get().showPopover()\n      if (!anchored) place()\n    }, $p.delay))\n  }\n  function close() {\n    clearTimeout(timer.get())\n    if (tip.get()?.matches(\":popover-open\")) tip.get().hidePopover()\n  }\n  // A moment's grace, so the pointer can cross the gap into the tip (pointerenter on the tip,\n  // inside the trigger's wrapper, cancels it).\n  function hide() {\n    clearTimeout(timer.get())\n    __zubraAssign(timer, setTimeout(close, 150))\n  }\n  // Without anchor positioning: centred above the trigger, or below it if there's no room.\n  function place() {\n    const trigger = wrap.get().firstElementChild.getBoundingClientRect()\n    const own = tip.get().getBoundingClientRect()\n    const top = trigger.top - own.height - 6 >= 0 ? trigger.top - own.height - 6 : trigger.bottom + 6\n    const left = Math.min(Math.max(4, trigger.left + (trigger.width - own.width) / 2), innerWidth - own.width - 4)\n    tip.get().style.top = `${top}px`\n    tip.get().style.left = `${left}px`\n  }\n\n  onMount(() => {\n    const trigger = wrap.get().firstElementChild\n    if (!trigger) return\n    const described = (trigger.getAttribute(\"aria-describedby\") ?? \"\").split(\" \").filter(Boolean)\n    if (!described.includes(tipId)) trigger.setAttribute(\"aria-describedby\", [...described, tipId].join(\" \"))\n    trigger.style.setProperty(\"anchor-name\", `--${tipId}`)\n    const escape = (event) => { if (event.key === \"Escape\") close() }\n    document.addEventListener(\"keydown\", escape)\n    return () => {\n      close()\n      document.removeEventListener(\"keydown\", escape)\n    }\n  })\n    return [\n      { path: [0], ref: () => (($el) => (__zubraAssign(wrap, $el))) },\n      { path: [0], on: \"pointerenter\", handler: () => $r(show) },\n      { path: [0], on: \"pointerleave\", handler: () => $r(hide) },\n      { path: [0], on: \"focusin\", handler: () => $r(show) },\n      { path: [0], on: \"focusout\", handler: () => $r(close) },\n      { path: [0, 0], slot: \"default\", fallback: null },\n      { path: [0, 1], attribute: \"id\", value: () => $r(tipId) },\n      { path: [0, 1], ref: () => (($el) => (__zubraAssign(tip, $el))) },\n      { path: [0, 1], style: \"position-anchor\", value: () => (`--${tipId}`) },\n      { path: [0, 1, 0], slot: \"content\", fallback: { template: \"<!---->\", parts: () => [{ path: [0], anchor: () => $t($p.text) }] } },\n    ];\n  },\n});\n"
    }
  ]
}
