{"_id":"@asnewyla/unstyled-tooltip","name":"@asnewyla/unstyled-tooltip","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@asnewyla/unstyled-tooltip","version":"0.2.0","description":"Unstyled tooltip primitive — hover/focus open with delay, Escape to dismiss, accessible aria-describedby wiring","license":"MIT","repository":{"type":"git","url":"git+https://github.com/xavierDelaFuente/xd-components.git","directory":"packages/unstyled-tooltip"},"publishConfig":{"access":"public"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./test-utils":{"types":"./dist/test-utils.d.ts","import":"./dist/test-utils.mjs","require":"./dist/test-utils.js"}},"sideEffects":false,"keywords":["react","tooltip","unstyled","accessible"],"peerDependencies":{"react":"^18.0.0 || ^19.0.0","react-dom":"^18.0.0 || ^19.0.0","@testing-library/react":"^16.0.0","@testing-library/user-event":"^14.5.0"},"peerDependenciesMeta":{"@testing-library/react":{"optional":true},"@testing-library/user-event":{"optional":true}},"devDependencies":{"react":"^18.3.0","react-dom":"^18.3.0","tsup":"^8.1.0","vitest":"^2.0.0","@vitest/coverage-v8":"^2.0.0","@testing-library/react":"^16.0.0","@testing-library/user-event":"^14.5.0","@testing-library/jest-dom":"^6.4.0","jsdom":"^24.0.0","typescript":"^5.5.0"},"scripts":{"build":"tsup","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","type-check":"tsc --noEmit"},"_nodeVersion":"24.19.0","_id":"@asnewyla/unstyled-tooltip@0.2.0","dist":{"integrity":"sha512-PbAXie14+zHei01U7rNiuVOHB//Vx0G50jafp9lxgxkOJ7z+4UFb9604BXq99JYSOlYBUtLJ1VCwFTNFlR526Q==","shasum":"41bdcfb447f251b33cab3e73e84abb495e21aea4","tarball":"https://registry.npmjs.org/@asnewyla/unstyled-tooltip/-/unstyled-tooltip-0.2.0.tgz","fileCount":15,"unpackedSize":42606,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFroigfONmBdR2Ryf+GfgjI3xKarAvGTr9C8p7XoDPlEAiBoZdIyR8F/BIeTuEi0GIeOjMa2+V8vS3X9wiZkHsEJFQ=="}]},"_npmUser":{"name":"asnewyla","email":"asnewyla@gmail.com"},"directories":{},"maintainers":[{"name":"asnewyla","email":"asnewyla@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/unstyled-tooltip_0.2.0_1788128077708_0.011863720417042645"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-30T22:14:37.537Z","0.2.0":"2026-08-30T22:14:37.841Z","modified":"2026-08-30T22:14:38.043Z"},"maintainers":[{"name":"asnewyla","email":"asnewyla@gmail.com"}],"description":"Unstyled tooltip primitive — hover/focus open with delay, Escape to dismiss, accessible aria-describedby wiring","keywords":["react","tooltip","unstyled","accessible"],"repository":{"type":"git","url":"git+https://github.com/xavierDelaFuente/xd-components.git","directory":"packages/unstyled-tooltip"},"license":"MIT","readme":"# @asnewyla/unstyled-tooltip\n\nUnstyled, accessible tooltip primitive. Compound components, hover/focus open\nwith a delay, Escape to dismiss — no visual styling, the base layer under\n`@asnewyla/tooltip`.\n\n## Install\n\n```bash\nnpm install @asnewyla/unstyled-tooltip\n```\n\n## Usage\n\n```tsx\nimport {\n  Tooltip,\n  TooltipTrigger,\n  TooltipContent,\n} from '@asnewyla/unstyled-tooltip';\n\n<Tooltip>\n  <TooltipTrigger>\n    <button type=\"button\">Save</button>\n  </TooltipTrigger>\n  <TooltipContent>Saves your work automatically</TooltipContent>\n</Tooltip>\n\n// Controlled\n<Tooltip open={open} onOpenChange={setOpen}>\n  ...\n</Tooltip>\n```\n\n### Components\n\n| Component | Renders | Notes |\n|---|---|---|\n| `Tooltip` | `<span>` wrapper | Owns open state (`open`/`defaultOpen`/`onOpenChange`), `delay?` (hover open delay, ms, default `700`). The wrapper is `position: relative; display: inline-block` so `TooltipContent` can place itself with plain CSS |\n| `TooltipTrigger` | its single child, cloned | Injects `aria-describedby` (while open) and pointer/focus/blur handlers onto whatever element you pass — a `<button>`, a link, an input. The child must forward `ref` and props |\n| `TooltipContent` | `<span role=\"tooltip\">` | `side?` → `data-side` (`top`/`right`/`bottom`/`left`, default `top`). Rendered only while open |\n\n### Behavior\n\n- Opens on pointer enter after `delay` ms, or immediately on keyboard focus.\n- Closes on pointer leave, blur, `Escape`, or pressing the trigger.\n- `Escape` closing is the one hard WAI-ARIA requirement and works regardless of how the tooltip was opened.\n- `aria-describedby` on the trigger points at the content's id only while the tooltip is open.\n\n### Not yet supported\n\n- **Collision-aware positioning.** `side` is honored as-is; a tooltip near a viewport edge is not flipped or shifted.\n- **Portal rendering.** The content renders inline, so an ancestor with `overflow: hidden` can clip it.\n- **Hoverable content.** Moving the pointer onto the tooltip closes it — it's for display, not interaction.\n\n## License\n\nMIT\n","readmeFilename":"","_rev":"1-84505883335607564880ccfd2c022cba"}