@kumix/ui 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +3 -2
  2. package/dist/components/agents/ai-sidebar/resource-row.js +1 -1
  3. package/dist/components/agents/ai-sidebar.js +1 -1
  4. package/dist/components/agents/approval-card.js +1 -1
  5. package/dist/components/agents/code-block.js +1 -1
  6. package/dist/components/agents/context-meter.js +1 -1
  7. package/dist/components/agents/file-diff.js +1 -1
  8. package/dist/components/agents/message-scroller.js +1 -1
  9. package/dist/components/agents/prompt-input.js +1 -1
  10. package/dist/components/agents/streaming-response.js +1 -1
  11. package/dist/components/agents/tool-result.js +1 -1
  12. package/dist/components/agents/voice-note.js +1 -1
  13. package/dist/components/charts/bar-chart/context.d.ts +3 -3
  14. package/dist/components/charts/bar-chart/tooltip.js +1 -1
  15. package/dist/components/charts/bump-chart/context.d.ts +1 -1
  16. package/dist/components/charts/bump-chart/point.js +1 -1
  17. package/dist/components/charts/bump-chart/series.d.ts +1 -1
  18. package/dist/components/charts/bump-chart.d.ts +1 -1
  19. package/dist/components/charts/candlestick-chart/context.d.ts +3 -3
  20. package/dist/components/charts/composition-chart/context.d.ts +1 -1
  21. package/dist/components/charts/composition-chart/plot.js +1 -1
  22. package/dist/components/charts/composition-chart.d.ts +1 -1
  23. package/dist/components/charts/funnel-chart.js +1 -1
  24. package/dist/components/charts/heat-calendar/tooltip.d.ts +1 -1
  25. package/dist/components/charts/heat-calendar/tooltip.js +1 -1
  26. package/dist/components/charts/heat-calendar.d.ts +1 -1
  27. package/dist/components/charts/liquidity-heatmap.js +1 -1
  28. package/dist/components/charts/order-book.d.ts +1 -1
  29. package/dist/components/charts/price-target-fan/tooltip.js +1 -1
  30. package/dist/components/charts/returns-calendar/tooltip.js +1 -1
  31. package/dist/components/charts/sankey-chart/tooltip.js +1 -1
  32. package/dist/components/charts/status-bar/tooltip.d.ts +1 -1
  33. package/dist/components/charts/status-bar/tooltip.js +1 -1
  34. package/dist/components/charts/status-bar.d.ts +1 -1
  35. package/dist/components/charts/treemap/tooltip.js +1 -1
  36. package/dist/components/charts/treemap.d.ts +1 -1
  37. package/dist/components/charts/volume-profile/tooltip.js +1 -1
  38. package/dist/components/charts/volume-profile.d.ts +1 -1
  39. package/dist/components/motion/animated-toast-stack/toast-body.js +1 -1
  40. package/dist/components/motion/attachment-upload/image-thumbnail.js +1 -1
  41. package/dist/components/motion/attachment-upload/row-action.js +1 -1
  42. package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
  43. package/dist/components/motion/availability-scheduler/day-row.js +2 -2
  44. package/dist/components/motion/availability-scheduler.js +1 -1
  45. package/dist/components/motion/avatar-group.js +1 -1
  46. package/dist/components/motion/casino/game-parts.js +1 -1
  47. package/dist/components/motion/center-morph-modal.js +1 -1
  48. package/dist/components/motion/combobox/trigger.d.ts.map +1 -1
  49. package/dist/components/motion/combobox/trigger.js +7 -2
  50. package/dist/components/motion/combobox/trigger.js.map +1 -1
  51. package/dist/components/motion/date-range-picker/header.js +1 -1
  52. package/dist/components/motion/file-upload.js +1 -1
  53. package/dist/components/motion/knockout-bracket.js +1 -1
  54. package/dist/components/motion/knockout-wheel.js +1 -1
  55. package/dist/components/motion/mines.js +1 -1
  56. package/dist/components/motion/plinko.js +1 -1
  57. package/dist/components/motion/prediction-market-card.js +1 -1
  58. package/dist/components/motion/qr-code.d.ts +42 -0
  59. package/dist/components/motion/qr-code.d.ts.map +1 -0
  60. package/dist/components/motion/qr-code.js +443 -0
  61. package/dist/components/motion/qr-code.js.map +1 -0
  62. package/dist/components/motion/swap/controls.js +1 -1
  63. package/dist/components/motion/tooltip.d.ts +2 -2
  64. package/dist/components/motion/tooltip.d.ts.map +1 -1
  65. package/dist/components/motion/tooltip.js +1 -1
  66. package/dist/components/reui/alert.d.ts +1 -1
  67. package/dist/components/reui/badge.d.ts +1 -1
  68. package/dist/components/reui/icon-tile.d.ts +1 -1
  69. package/dist/components/ui/attachment.d.ts +2 -2
  70. package/dist/components/ui/button-group.d.ts +1 -1
  71. package/dist/components/ui/button.d.ts +1 -1
  72. package/dist/components/ui/empty.d.ts +1 -1
  73. package/dist/components/ui/field.d.ts +1 -1
  74. package/dist/components/ui/item.d.ts +1 -1
  75. package/dist/{context-DMIy-rFm.d.ts → context-Cyjsttyl.d.ts} +4 -4
  76. package/dist/{context-DMIy-rFm.d.ts.map → context-Cyjsttyl.d.ts.map} +1 -1
  77. package/dist/{context-jX-r_7EP.d.ts → context-D7eAawR3.d.ts} +4 -4
  78. package/dist/{context-jX-r_7EP.d.ts.map → context-D7eAawR3.d.ts.map} +1 -1
  79. package/dist/{copy-menu-Bgoo5oWq.js → copy-menu-Di77fZ9p.js} +2 -2
  80. package/dist/{copy-menu-Bgoo5oWq.js.map → copy-menu-Di77fZ9p.js.map} +1 -1
  81. package/dist/hooks/use-dismiss.d.ts +9 -1
  82. package/dist/hooks/use-dismiss.d.ts.map +1 -1
  83. package/dist/hooks/use-dismiss.js +6 -3
  84. package/dist/hooks/use-dismiss.js.map +1 -1
  85. package/dist/lib/layers.d.ts +1 -1
  86. package/dist/lib/layers.js.map +1 -1
  87. package/dist/{resource-row-PkgPS9Hk.js → resource-row-DByzjie0.js} +2 -2
  88. package/dist/{resource-row-PkgPS9Hk.js.map → resource-row-DByzjie0.js.map} +1 -1
  89. package/dist/{tooltip-X7sMXf98.d.ts → tooltip-CwsBzl7m.d.ts} +2 -2
  90. package/dist/{tooltip-X7sMXf98.d.ts.map → tooltip-CwsBzl7m.d.ts.map} +1 -1
  91. package/dist/{tooltip-gKOUHp_1.d.ts → tooltip-TdY1OH4j.d.ts} +2 -2
  92. package/dist/{tooltip-gKOUHp_1.d.ts.map → tooltip-TdY1OH4j.d.ts.map} +1 -1
  93. package/dist/{tooltip-gHv-6eOs.js → tooltip-eecPhLtC.js} +54 -7
  94. package/dist/tooltip-eecPhLtC.js.map +1 -0
  95. package/package.json +11 -6
  96. package/dist/tooltip-gHv-6eOs.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"resource-row-PkgPS9Hk.js","names":[],"sources":["../src/components/agents/ai-sidebar/tree.ts","../src/components/agents/ai-sidebar/resource-row.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n FlatResource,\n SidebarResource,\n SidebarResourceDropPosition,\n SidebarResourceMove,\n} from \"./types\";\n\nexport function canContain(item: SidebarResource) {\n return item.kind === \"folder\" || item.kind === \"project\";\n}\n\nexport function flattenResources(\n items: SidebarResource[],\n expanded: Set<string>,\n depth = 0,\n parentId: string | null = null,\n): FlatResource[] {\n return items.flatMap((item) => {\n const row = { item, depth, parentId };\n if (!item.children?.length || !expanded.has(item.id)) return [row];\n return [row, ...flattenResources(item.children, expanded, depth + 1, item.id)];\n });\n}\n\nexport function findResource(items: SidebarResource[], id: string): SidebarResource | undefined {\n for (const item of items) {\n if (item.id === id) return item;\n const child = item.children ? findResource(item.children, id) : undefined;\n if (child) return child;\n }\n}\n\nexport function containsResource(item: SidebarResource, id: string): boolean {\n return item.id === id || item.children?.some((child) => containsResource(child, id)) === true;\n}\n\nfunction removeResource(\n items: SidebarResource[],\n id: string,\n): { items: SidebarResource[]; removed?: SidebarResource } {\n let removed: SidebarResource | undefined;\n const next: SidebarResource[] = [];\n\n for (const item of items) {\n if (item.id === id) {\n removed = item;\n continue;\n }\n\n if (item.children?.length) {\n const childResult = removeResource(item.children, id);\n if (childResult.removed) {\n removed = childResult.removed;\n next.push({ ...item, children: childResult.items });\n continue;\n }\n }\n\n next.push(item);\n }\n\n return { items: next, removed };\n}\n\nfunction insertResource(\n items: SidebarResource[],\n resource: SidebarResource,\n targetId: string | null,\n position: SidebarResourceDropPosition,\n): SidebarResource[] {\n if (targetId === null) return [...items, resource];\n\n const next: SidebarResource[] = [];\n for (const item of items) {\n if (item.id === targetId) {\n if (position === \"before\") next.push(resource, item);\n else if (position === \"after\") next.push(item, resource);\n else next.push({ ...item, children: [...(item.children ?? []), resource] });\n continue;\n }\n\n if (item.children?.length) {\n next.push({\n ...item,\n children: insertResource(item.children, resource, targetId, position),\n });\n } else {\n next.push(item);\n }\n }\n return next;\n}\n\nexport function moveResource(\n items: SidebarResource[],\n move: SidebarResourceMove,\n): SidebarResource[] | null {\n const source = findResource(items, move.itemId);\n if (!source || source.disabled) return null;\n if (move.targetId && containsResource(source, move.targetId)) return null;\n\n const target = move.targetId ? findResource(items, move.targetId) : undefined;\n if (move.position === \"inside\" && (!target || target.disabled || !canContain(target)))\n return null;\n\n const removed = removeResource(items, move.itemId);\n if (!removed.removed) return null;\n return insertResource(removed.items, removed.removed, move.targetId, move.position);\n}\n\nexport function renameResource(\n items: SidebarResource[],\n id: string,\n label: string,\n): SidebarResource[] {\n return items.map((item) => ({\n ...item,\n label: item.id === id ? label : item.label,\n children: item.children ? renameResource(item.children, id, label) : undefined,\n }));\n}\n","\"use client\";\n\nimport {\n type ComponentProps,\n type DragEvent,\n type KeyboardEvent,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport {\n ArrowDown,\n ArrowUp,\n Bookmark,\n FileText,\n Folder,\n FolderInput,\n FolderOpen,\n MoreHorizontal,\n Pencil,\n Undo2,\n} from \"lucide-react\";\nimport { motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useTouchCapable } from \"../../../hooks/use-touch-capable\";\nimport { SPRING_LAYOUT } from \"../../../lib/ease\";\nimport { MorphPopover, MorphPopoverContent, MorphPopoverTrigger } from \"../../motion/popover-morph\";\nimport { Tooltip } from \"../../motion/tooltip\";\nimport { MarqueeLabel } from \"./marquee-label\";\nimport type { Translate } from \"./messages\";\nimport { ResourceMenuAction } from \"./resource-menu-action\";\nimport { canContain } from \"./tree\";\nimport type {\n AISidebarProps,\n DropTarget,\n FlatResource,\n SidebarResource,\n SidebarResourceMoveCommands,\n} from \"./types\";\n\nfunction defaultIcon(item: SidebarResource, expanded: boolean) {\n const Icon =\n item.kind === \"folder\" || item.kind === \"project\"\n ? expanded\n ? FolderOpen\n : Folder\n : item.kind === \"bookmark\"\n ? Bookmark\n : FileText;\n return <Icon className=\"size-4\" />;\n}\n\ninterface ResourceRowProps {\n row: FlatResource;\n active: boolean;\n expanded: boolean;\n focused: boolean;\n draggingId: string | null;\n dropTarget: DropTarget | null;\n menuOpen: boolean;\n moves: SidebarResourceMoveCommands;\n renaming: boolean;\n onDragEnd: () => void;\n onDragOver: (event: DragEvent<HTMLDivElement>, row: FlatResource) => void;\n onDragStart: (event: DragEvent<HTMLDivElement>, id: string) => void;\n onDrop: (event: DragEvent<HTMLDivElement>) => void;\n onFocus: () => void;\n onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;\n onMenuOpenChange: (open: boolean) => void;\n onRenameCancel: () => void;\n onRenameCommit: (label: string) => void;\n onRenameStart: () => void;\n onSelect: () => void;\n onToggle: () => void;\n renderIcon?: (item: SidebarResource) => ReactNode;\n renderMenu?: AISidebarProps[\"renderMenu\"];\n setRef: (node: HTMLDivElement | null) => void;\n t: Translate;\n}\n\nexport function ResourceRow({\n row,\n active,\n expanded,\n focused,\n draggingId,\n dropTarget,\n menuOpen,\n moves,\n renaming,\n onDragEnd,\n onDragOver,\n onDragStart,\n onDrop,\n onFocus,\n onKeyDown,\n onMenuOpenChange,\n onRenameCancel,\n onRenameCommit,\n onRenameStart,\n onSelect,\n onToggle,\n renderIcon,\n renderMenu,\n setRef,\n t,\n}: ResourceRowProps) {\n const reduce = useReducedMotion() ?? false;\n const canTouch = useTouchCapable();\n const [hovered, setHovered] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const skipRenameBlurRef = useRef(false);\n const draggedRef = useRef(false);\n const [draft, setDraft] = useState(row.item.label);\n const acceptsChildren = canContain(row.item);\n const isDragging = draggingId === row.item.id;\n const dropPosition = dropTarget?.id === row.item.id ? dropTarget.position : null;\n\n useEffect(() => {\n if (!renaming) return;\n skipRenameBlurRef.current = false;\n setDraft(row.item.label);\n requestAnimationFrame(() => {\n inputRef.current?.focus();\n inputRef.current?.select();\n });\n }, [renaming, row.item.label]);\n\n const runFromMenu = (action: () => void) => () => {\n onMenuOpenChange(false);\n action();\n };\n\n const menu = renderMenu?.(row.item, {\n close: () => onMenuOpenChange(false),\n rename: () => {\n onMenuOpenChange(false);\n onRenameStart();\n },\n moves,\n }) ?? (\n <>\n <ResourceMenuAction icon={Pencil} onSelect={runFromMenu(onRenameStart)}>\n {t(\"rename\")}\n </ResourceMenuAction>\n {moves.up || moves.down || moves.into || moves.out ? (\n <div aria-hidden=\"true\" className=\"bg-border my-1 h-px\" />\n ) : null}\n {moves.up ? (\n <ResourceMenuAction icon={ArrowUp} onSelect={runFromMenu(moves.up)}>\n {t(\"moveUp\")}\n </ResourceMenuAction>\n ) : null}\n {moves.down ? (\n <ResourceMenuAction icon={ArrowDown} onSelect={runFromMenu(moves.down)}>\n {t(\"moveDown\")}\n </ResourceMenuAction>\n ) : null}\n {moves.into ? (\n <ResourceMenuAction icon={FolderInput} onSelect={runFromMenu(moves.into.run)}>\n {t(\"moveInto\", { target: moves.into.label })}\n </ResourceMenuAction>\n ) : null}\n {moves.out ? (\n <ResourceMenuAction icon={Undo2} onSelect={runFromMenu(moves.out)}>\n {t(\"moveOut\")}\n </ResourceMenuAction>\n ) : null}\n </>\n );\n\n return (\n <motion.div\n ref={setRef}\n layout=\"position\"\n transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n role=\"treeitem\"\n aria-level={row.depth + 1}\n aria-selected={acceptsChildren ? undefined : active}\n aria-expanded={acceptsChildren ? expanded : undefined}\n aria-disabled={row.item.disabled || undefined}\n tabIndex={focused ? 0 : -1}\n draggable={!row.item.disabled && !renaming}\n data-menu-open={menuOpen || undefined}\n data-drop={dropPosition ?? undefined}\n data-dragging={isDragging || undefined}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n onClick={(event) => {\n if (event.defaultPrevented || draggedRef.current || renaming || row.item.disabled) return;\n if (acceptsChildren) onToggle();\n else onSelect();\n }}\n onDoubleClick={(event) => {\n if (acceptsChildren || row.item.disabled) return;\n event.preventDefault();\n onRenameStart();\n }}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onDragStartCapture={(event) => {\n draggedRef.current = true;\n onDragStart(event, row.item.id);\n }}\n onDragEndCapture={() => {\n onDragEnd();\n requestAnimationFrame(() => {\n draggedRef.current = false;\n });\n }}\n onDragOver={(event) => onDragOver(event, row)}\n onDrop={onDrop}\n className={cn(\n \"group/resource relative flex min-h-9 min-w-0 cursor-pointer items-center gap-2.5 rounded-xl pr-3 text-sm outline-none\",\n \"text-muted-foreground hover:bg-muted hover:text-foreground transition-colors\",\n \"focus-visible:bg-muted/70 focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-inset\",\n \"data-[menu-open=true]:bg-muted data-[menu-open=true]:text-foreground\",\n \"data-[dragging=true]:opacity-40\",\n \"data-[drop=inside]:bg-muted data-[drop=inside]:ring-primary/45 data-[drop=inside]:ring-1\",\n \"data-[drop=before]:before:bg-primary data-[drop=before]:before:absolute data-[drop=before]:before:-top-0.5 data-[drop=before]:before:right-2 data-[drop=before]:before:left-2 data-[drop=before]:before:h-0.5 data-[drop=before]:before:rounded-full\",\n \"data-[drop=after]:after:bg-primary data-[drop=after]:after:absolute data-[drop=after]:after:right-2 data-[drop=after]:after:-bottom-0.5 data-[drop=after]:after:left-2 data-[drop=after]:after:h-0.5 data-[drop=after]:after:rounded-full\",\n !acceptsChildren && active && \"bg-muted text-foreground\",\n row.item.disabled && \"cursor-not-allowed opacity-45\",\n )}\n style={{ paddingLeft: `${12 + row.depth * 16}px` }}\n >\n <span aria-hidden=\"true\" className=\"grid size-5 shrink-0 place-items-center\">\n {renderIcon?.(row.item) ?? defaultIcon(row.item, expanded)}\n </span>\n\n {renaming ? (\n <input\n ref={inputRef}\n value={draft}\n aria-label={t(\"renameItem\", { item: row.item.label })}\n onChange={(event) => setDraft(event.target.value)}\n draggable={false}\n onClick={(event) => event.stopPropagation()}\n onDoubleClick={(event) => event.stopPropagation()}\n onBlur={() => {\n if (!skipRenameBlurRef.current) onRenameCommit(draft);\n }}\n onKeyDown={(event) => {\n event.stopPropagation();\n if (event.key === \"Enter\") {\n skipRenameBlurRef.current = true;\n onRenameCommit(draft);\n }\n if (event.key === \"Escape\") {\n skipRenameBlurRef.current = true;\n onRenameCancel();\n }\n }}\n className=\"border-border bg-background text-foreground focus-visible:ring-ring mx-1 h-7 min-w-0 flex-1 rounded-full border px-3 text-sm outline-none focus-visible:ring-2\"\n />\n ) : (\n <MarqueeLabel active={hovered || menuOpen}>{row.item.label}</MarqueeLabel>\n )}\n\n {!renaming && !row.item.disabled ? (\n <MorphPopover open={menuOpen} onOpenChange={onMenuOpenChange}>\n <Tooltip content={menuOpen ? null : t(\"actions\", { item: row.item.label })} side=\"top\">\n <ActionsTrigger\n aria-label={t(\"actions\", { item: row.item.label })}\n className={cn(\n // A finger never hovers, and this menu is the only path to\n // rename and move without a drag - keep it on screen there.\n canTouch ? \"opacity-100\" : \"opacity-0\",\n )}\n />\n </Tooltip>\n <MorphPopoverContent side=\"bottom\" align=\"end\" sideOffset={8} className=\"w-40 p-2\">\n <div data-sidebar-resource-menu={row.item.id}>{menu}</div>\n </MorphPopoverContent>\n </MorphPopover>\n ) : null}\n </motion.div>\n );\n}\n\n/**\n * The row's \"…\" button. Its own component so the tooltip around it and the\n * popover trigger inside both reach the button.\n */\nfunction ActionsTrigger({ className, ...props }: ComponentProps<\"button\">) {\n return (\n <MorphPopoverTrigger>\n <button\n type=\"button\"\n draggable={false}\n tabIndex={-1}\n {...props}\n onClick={(event) => {\n props.onClick?.(event);\n event.stopPropagation();\n }}\n className={cn(\n \"hover:bg-foreground/5 focus-visible:ring-ring grid size-7 shrink-0 place-items-center rounded-full transition-opacity outline-none group-hover/resource:opacity-100 group-data-[menu-open=true]/resource:opacity-100 focus-visible:opacity-100 focus-visible:ring-2\",\n className,\n )}\n >\n <MoreHorizontal aria-hidden=\"true\" className=\"size-4\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c;IAA5C,UAAA,CACE,oBAAC,SAAD;KAAS,SAAS,WAAW,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,KAAK,MAAM,CAAC;KAAG,MAAK;KAC/E,UAAA,oBAAC,gBAAD;MACE,cAAY,EAAE,WAAW,EAAE,MAAM,IAAI,KAAK,MAAM,CAAC;MACjD,WAAW,GAGT,WAAW,gBAAgB,WAC7B;KACD,CAAA;IACM,CAAA,GACT,oBAAC,qBAAD;KAAqB,MAAK;KAAS,OAAM;KAAM,YAAY;KAAG,WAAU;KACtE,UAAA,oBAAC,OAAD;MAAK,8BAA4B,IAAI,KAAK;MAAK,UAAA;KAAU,CAAA;IACtC,CAAA,CACT;GACZ,CAAA,IAAA;EACM;;AAEhB;;;;;AAMA,SAAS,eAAe,EAAE,WAAW,GAAG,SAAmC;CACzE,OACE,oBAAC,qBAAD,EAAA,UACE,oBAAC,UAAD;EACE,MAAK;EACL,WAAW;EACX,UAAU;EACV,GAAI;EACJ,UAAU,UAAU;GAClB,MAAM,UAAU,KAAK;GACrB,MAAM,gBAAgB;EACxB;EACA,WAAW,GACT,uQACA,SACF;EAEA,UAAA,oBAAC,gBAAD;GAAgB,eAAY;GAAO,WAAU;EAAU,CAAA;CACjD,CAAA,EACW,CAAA;AAEzB"}
1
+ {"version":3,"file":"resource-row-DByzjie0.js","names":[],"sources":["../src/components/agents/ai-sidebar/tree.ts","../src/components/agents/ai-sidebar/resource-row.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n FlatResource,\n SidebarResource,\n SidebarResourceDropPosition,\n SidebarResourceMove,\n} from \"./types\";\n\nexport function canContain(item: SidebarResource) {\n return item.kind === \"folder\" || item.kind === \"project\";\n}\n\nexport function flattenResources(\n items: SidebarResource[],\n expanded: Set<string>,\n depth = 0,\n parentId: string | null = null,\n): FlatResource[] {\n return items.flatMap((item) => {\n const row = { item, depth, parentId };\n if (!item.children?.length || !expanded.has(item.id)) return [row];\n return [row, ...flattenResources(item.children, expanded, depth + 1, item.id)];\n });\n}\n\nexport function findResource(items: SidebarResource[], id: string): SidebarResource | undefined {\n for (const item of items) {\n if (item.id === id) return item;\n const child = item.children ? findResource(item.children, id) : undefined;\n if (child) return child;\n }\n}\n\nexport function containsResource(item: SidebarResource, id: string): boolean {\n return item.id === id || item.children?.some((child) => containsResource(child, id)) === true;\n}\n\nfunction removeResource(\n items: SidebarResource[],\n id: string,\n): { items: SidebarResource[]; removed?: SidebarResource } {\n let removed: SidebarResource | undefined;\n const next: SidebarResource[] = [];\n\n for (const item of items) {\n if (item.id === id) {\n removed = item;\n continue;\n }\n\n if (item.children?.length) {\n const childResult = removeResource(item.children, id);\n if (childResult.removed) {\n removed = childResult.removed;\n next.push({ ...item, children: childResult.items });\n continue;\n }\n }\n\n next.push(item);\n }\n\n return { items: next, removed };\n}\n\nfunction insertResource(\n items: SidebarResource[],\n resource: SidebarResource,\n targetId: string | null,\n position: SidebarResourceDropPosition,\n): SidebarResource[] {\n if (targetId === null) return [...items, resource];\n\n const next: SidebarResource[] = [];\n for (const item of items) {\n if (item.id === targetId) {\n if (position === \"before\") next.push(resource, item);\n else if (position === \"after\") next.push(item, resource);\n else next.push({ ...item, children: [...(item.children ?? []), resource] });\n continue;\n }\n\n if (item.children?.length) {\n next.push({\n ...item,\n children: insertResource(item.children, resource, targetId, position),\n });\n } else {\n next.push(item);\n }\n }\n return next;\n}\n\nexport function moveResource(\n items: SidebarResource[],\n move: SidebarResourceMove,\n): SidebarResource[] | null {\n const source = findResource(items, move.itemId);\n if (!source || source.disabled) return null;\n if (move.targetId && containsResource(source, move.targetId)) return null;\n\n const target = move.targetId ? findResource(items, move.targetId) : undefined;\n if (move.position === \"inside\" && (!target || target.disabled || !canContain(target)))\n return null;\n\n const removed = removeResource(items, move.itemId);\n if (!removed.removed) return null;\n return insertResource(removed.items, removed.removed, move.targetId, move.position);\n}\n\nexport function renameResource(\n items: SidebarResource[],\n id: string,\n label: string,\n): SidebarResource[] {\n return items.map((item) => ({\n ...item,\n label: item.id === id ? label : item.label,\n children: item.children ? renameResource(item.children, id, label) : undefined,\n }));\n}\n","\"use client\";\n\nimport {\n type ComponentProps,\n type DragEvent,\n type KeyboardEvent,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport {\n ArrowDown,\n ArrowUp,\n Bookmark,\n FileText,\n Folder,\n FolderInput,\n FolderOpen,\n MoreHorizontal,\n Pencil,\n Undo2,\n} from \"lucide-react\";\nimport { motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useTouchCapable } from \"../../../hooks/use-touch-capable\";\nimport { SPRING_LAYOUT } from \"../../../lib/ease\";\nimport { MorphPopover, MorphPopoverContent, MorphPopoverTrigger } from \"../../motion/popover-morph\";\nimport { Tooltip } from \"../../motion/tooltip\";\nimport { MarqueeLabel } from \"./marquee-label\";\nimport type { Translate } from \"./messages\";\nimport { ResourceMenuAction } from \"./resource-menu-action\";\nimport { canContain } from \"./tree\";\nimport type {\n AISidebarProps,\n DropTarget,\n FlatResource,\n SidebarResource,\n SidebarResourceMoveCommands,\n} from \"./types\";\n\nfunction defaultIcon(item: SidebarResource, expanded: boolean) {\n const Icon =\n item.kind === \"folder\" || item.kind === \"project\"\n ? expanded\n ? FolderOpen\n : Folder\n : item.kind === \"bookmark\"\n ? Bookmark\n : FileText;\n return <Icon className=\"size-4\" />;\n}\n\ninterface ResourceRowProps {\n row: FlatResource;\n active: boolean;\n expanded: boolean;\n focused: boolean;\n draggingId: string | null;\n dropTarget: DropTarget | null;\n menuOpen: boolean;\n moves: SidebarResourceMoveCommands;\n renaming: boolean;\n onDragEnd: () => void;\n onDragOver: (event: DragEvent<HTMLDivElement>, row: FlatResource) => void;\n onDragStart: (event: DragEvent<HTMLDivElement>, id: string) => void;\n onDrop: (event: DragEvent<HTMLDivElement>) => void;\n onFocus: () => void;\n onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;\n onMenuOpenChange: (open: boolean) => void;\n onRenameCancel: () => void;\n onRenameCommit: (label: string) => void;\n onRenameStart: () => void;\n onSelect: () => void;\n onToggle: () => void;\n renderIcon?: (item: SidebarResource) => ReactNode;\n renderMenu?: AISidebarProps[\"renderMenu\"];\n setRef: (node: HTMLDivElement | null) => void;\n t: Translate;\n}\n\nexport function ResourceRow({\n row,\n active,\n expanded,\n focused,\n draggingId,\n dropTarget,\n menuOpen,\n moves,\n renaming,\n onDragEnd,\n onDragOver,\n onDragStart,\n onDrop,\n onFocus,\n onKeyDown,\n onMenuOpenChange,\n onRenameCancel,\n onRenameCommit,\n onRenameStart,\n onSelect,\n onToggle,\n renderIcon,\n renderMenu,\n setRef,\n t,\n}: ResourceRowProps) {\n const reduce = useReducedMotion() ?? false;\n const canTouch = useTouchCapable();\n const [hovered, setHovered] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const skipRenameBlurRef = useRef(false);\n const draggedRef = useRef(false);\n const [draft, setDraft] = useState(row.item.label);\n const acceptsChildren = canContain(row.item);\n const isDragging = draggingId === row.item.id;\n const dropPosition = dropTarget?.id === row.item.id ? dropTarget.position : null;\n\n useEffect(() => {\n if (!renaming) return;\n skipRenameBlurRef.current = false;\n setDraft(row.item.label);\n requestAnimationFrame(() => {\n inputRef.current?.focus();\n inputRef.current?.select();\n });\n }, [renaming, row.item.label]);\n\n const runFromMenu = (action: () => void) => () => {\n onMenuOpenChange(false);\n action();\n };\n\n const menu = renderMenu?.(row.item, {\n close: () => onMenuOpenChange(false),\n rename: () => {\n onMenuOpenChange(false);\n onRenameStart();\n },\n moves,\n }) ?? (\n <>\n <ResourceMenuAction icon={Pencil} onSelect={runFromMenu(onRenameStart)}>\n {t(\"rename\")}\n </ResourceMenuAction>\n {moves.up || moves.down || moves.into || moves.out ? (\n <div aria-hidden=\"true\" className=\"bg-border my-1 h-px\" />\n ) : null}\n {moves.up ? (\n <ResourceMenuAction icon={ArrowUp} onSelect={runFromMenu(moves.up)}>\n {t(\"moveUp\")}\n </ResourceMenuAction>\n ) : null}\n {moves.down ? (\n <ResourceMenuAction icon={ArrowDown} onSelect={runFromMenu(moves.down)}>\n {t(\"moveDown\")}\n </ResourceMenuAction>\n ) : null}\n {moves.into ? (\n <ResourceMenuAction icon={FolderInput} onSelect={runFromMenu(moves.into.run)}>\n {t(\"moveInto\", { target: moves.into.label })}\n </ResourceMenuAction>\n ) : null}\n {moves.out ? (\n <ResourceMenuAction icon={Undo2} onSelect={runFromMenu(moves.out)}>\n {t(\"moveOut\")}\n </ResourceMenuAction>\n ) : null}\n </>\n );\n\n return (\n <motion.div\n ref={setRef}\n layout=\"position\"\n transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n role=\"treeitem\"\n aria-level={row.depth + 1}\n aria-selected={acceptsChildren ? undefined : active}\n aria-expanded={acceptsChildren ? expanded : undefined}\n aria-disabled={row.item.disabled || undefined}\n tabIndex={focused ? 0 : -1}\n draggable={!row.item.disabled && !renaming}\n data-menu-open={menuOpen || undefined}\n data-drop={dropPosition ?? undefined}\n data-dragging={isDragging || undefined}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n onClick={(event) => {\n if (event.defaultPrevented || draggedRef.current || renaming || row.item.disabled) return;\n if (acceptsChildren) onToggle();\n else onSelect();\n }}\n onDoubleClick={(event) => {\n if (acceptsChildren || row.item.disabled) return;\n event.preventDefault();\n onRenameStart();\n }}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onDragStartCapture={(event) => {\n draggedRef.current = true;\n onDragStart(event, row.item.id);\n }}\n onDragEndCapture={() => {\n onDragEnd();\n requestAnimationFrame(() => {\n draggedRef.current = false;\n });\n }}\n onDragOver={(event) => onDragOver(event, row)}\n onDrop={onDrop}\n className={cn(\n \"group/resource relative flex min-h-9 min-w-0 cursor-pointer items-center gap-2.5 rounded-xl pr-3 text-sm outline-none\",\n \"text-muted-foreground hover:bg-muted hover:text-foreground transition-colors\",\n \"focus-visible:bg-muted/70 focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-inset\",\n \"data-[menu-open=true]:bg-muted data-[menu-open=true]:text-foreground\",\n \"data-[dragging=true]:opacity-40\",\n \"data-[drop=inside]:bg-muted data-[drop=inside]:ring-primary/45 data-[drop=inside]:ring-1\",\n \"data-[drop=before]:before:bg-primary data-[drop=before]:before:absolute data-[drop=before]:before:-top-0.5 data-[drop=before]:before:right-2 data-[drop=before]:before:left-2 data-[drop=before]:before:h-0.5 data-[drop=before]:before:rounded-full\",\n \"data-[drop=after]:after:bg-primary data-[drop=after]:after:absolute data-[drop=after]:after:right-2 data-[drop=after]:after:-bottom-0.5 data-[drop=after]:after:left-2 data-[drop=after]:after:h-0.5 data-[drop=after]:after:rounded-full\",\n !acceptsChildren && active && \"bg-muted text-foreground\",\n row.item.disabled && \"cursor-not-allowed opacity-45\",\n )}\n style={{ paddingLeft: `${12 + row.depth * 16}px` }}\n >\n <span aria-hidden=\"true\" className=\"grid size-5 shrink-0 place-items-center\">\n {renderIcon?.(row.item) ?? defaultIcon(row.item, expanded)}\n </span>\n\n {renaming ? (\n <input\n ref={inputRef}\n value={draft}\n aria-label={t(\"renameItem\", { item: row.item.label })}\n onChange={(event) => setDraft(event.target.value)}\n draggable={false}\n onClick={(event) => event.stopPropagation()}\n onDoubleClick={(event) => event.stopPropagation()}\n onBlur={() => {\n if (!skipRenameBlurRef.current) onRenameCommit(draft);\n }}\n onKeyDown={(event) => {\n event.stopPropagation();\n if (event.key === \"Enter\") {\n skipRenameBlurRef.current = true;\n onRenameCommit(draft);\n }\n if (event.key === \"Escape\") {\n skipRenameBlurRef.current = true;\n onRenameCancel();\n }\n }}\n className=\"border-border bg-background text-foreground focus-visible:ring-ring mx-1 h-7 min-w-0 flex-1 rounded-full border px-3 text-sm outline-none focus-visible:ring-2\"\n />\n ) : (\n <MarqueeLabel active={hovered || menuOpen}>{row.item.label}</MarqueeLabel>\n )}\n\n {!renaming && !row.item.disabled ? (\n <MorphPopover open={menuOpen} onOpenChange={onMenuOpenChange}>\n <Tooltip content={menuOpen ? null : t(\"actions\", { item: row.item.label })} side=\"top\">\n <ActionsTrigger\n aria-label={t(\"actions\", { item: row.item.label })}\n className={cn(\n // A finger never hovers, and this menu is the only path to\n // rename and move without a drag - keep it on screen there.\n canTouch ? \"opacity-100\" : \"opacity-0\",\n )}\n />\n </Tooltip>\n <MorphPopoverContent side=\"bottom\" align=\"end\" sideOffset={8} className=\"w-40 p-2\">\n <div data-sidebar-resource-menu={row.item.id}>{menu}</div>\n </MorphPopoverContent>\n </MorphPopover>\n ) : null}\n </motion.div>\n );\n}\n\n/**\n * The row's \"…\" button. Its own component so the tooltip around it and the\n * popover trigger inside both reach the button.\n */\nfunction ActionsTrigger({ className, ...props }: ComponentProps<\"button\">) {\n return (\n <MorphPopoverTrigger>\n <button\n type=\"button\"\n draggable={false}\n tabIndex={-1}\n {...props}\n onClick={(event) => {\n props.onClick?.(event);\n event.stopPropagation();\n }}\n className={cn(\n \"hover:bg-foreground/5 focus-visible:ring-ring grid size-7 shrink-0 place-items-center rounded-full transition-opacity outline-none group-hover/resource:opacity-100 group-data-[menu-open=true]/resource:opacity-100 focus-visible:opacity-100 focus-visible:ring-2\",\n className,\n )}\n >\n <MoreHorizontal aria-hidden=\"true\" className=\"size-4\" />\n </button>\n </MorphPopoverTrigger>\n );\n}\n"],"mappings":";;;;;;;;;;;;AASA,SAAgB,WAAW,MAAuB;CAChD,OAAO,KAAK,SAAS,YAAY,KAAK,SAAS;AACjD;AAEA,SAAgB,iBACd,OACA,UACA,QAAQ,GACR,WAA0B,MACV;CAChB,OAAO,MAAM,SAAS,SAAS;EAC7B,MAAM,MAAM;GAAE;GAAM;GAAO;EAAS;EACpC,IAAI,CAAC,KAAK,UAAU,UAAU,CAAC,SAAS,IAAI,KAAK,EAAE,GAAG,OAAO,CAAC,GAAG;EACjE,OAAO,CAAC,KAAK,GAAG,iBAAiB,KAAK,UAAU,UAAU,QAAQ,GAAG,KAAK,EAAE,CAAC;CAC/E,CAAC;AACH;AAEA,SAAgB,aAAa,OAA0B,I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AAE,WAAW,GAAG,SAAmC;CACzE,OACE,oBAAC,qBAAD,EAAA,UACE,oBAAC,UAAD;EACE,MAAK;EACL,WAAW;EACX,UAAU;EACV,GAAI;EACJ,UAAU,UAAU;GAClB,MAAM,UAAU,KAAK;GACrB,MAAM,gBAAgB;EACxB;EACA,WAAW,GACT,uQACA,SACF;EAEA,UAAA,oBAAC,gBAAD;GAAgB,eAAY;GAAO,WAAU;EAAU,CAAA;CACjD,CAAA,EACW,CAAA;AAEzB"}
@@ -57,7 +57,7 @@ declare function useStatusBar(): {
57
57
  }[];
58
58
  statuses: readonly StatusBarStatus[];
59
59
  label: string;
60
- t: (key: "details" | "label" | "legend" | "status" | "empty" | "inspect" | "tableCaption" | "period" | "operational" | "degraded" | "outage" | "maintenance" | "unknown", values?: Record<string, string | number>) => string;
60
+ t: (key: "label" | "details" | "legend" | "status" | "empty" | "inspect" | "tableCaption" | "period" | "operational" | "degraded" | "outage" | "maintenance" | "unknown", values?: Record<string, string | number>) => string;
61
61
  active: {
62
62
  datum: StatusBarDatum;
63
63
  status: StatusBarStatus;
@@ -85,4 +85,4 @@ interface StatusBarTooltipProps {
85
85
  }
86
86
  declare function StatusBarTooltip({ children, className, side }: StatusBarTooltipProps): import("react").JSX.Element;
87
87
  export { StatusBarDatum as a, useStatusBar as c, STATUS_BAR_STATUSES as i, StatusBarMessages as l, StatusBarTooltipData as n, StatusBarProps as o, StatusBarTooltipProps as r, StatusBarStatus as s, StatusBarTooltip as t, statusBarMessages as u };
88
- //# sourceMappingURL=tooltip-X7sMXf98.d.ts.map
88
+ //# sourceMappingURL=tooltip-CwsBzl7m.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip-X7sMXf98.d.ts","names":[],"sources":["../src/components/charts/status-bar/messages.ts","../src/components/charts/status-bar/context.ts","../src/components/charts/status-bar/tooltip.tsx"],"mappings":";cAEa;;;;;;;;;;;;;;;KAgBD,2BAA2B;UCRtB;;EAEf;;EAEA;;EAEA;;EAEA;;UAGe;;EAEf;;EAEA;;EAEA;;cAGW,8BAA8B;UAQ1B,uBAAuB;;EAEtC,eAAe;;EAEf,oBAAoB;;EAEpB;;EAEA;;EAEA;;EAEA,kBAAkB;;EAElB,SAAS,QAAQ;;iBAyEH;;;;;;;;;;;;;;;;;;;;;UCrHC;EACf,OAAO;EACP,QAAQ;EACR;;UAGe;EACf,WAAW,cAAc,MAAM,yBAAyB;;EAExD;;EAEA;;iBAGc,mBAAmB,UAAU,WAAW,QAAgB,wCAAqB,IAAA"}
1
+ {"version":3,"file":"tooltip-CwsBzl7m.d.ts","names":[],"sources":["../src/components/charts/status-bar/messages.ts","../src/components/charts/status-bar/context.ts","../src/components/charts/status-bar/tooltip.tsx"],"mappings":";cAEa;;;;;;;;;;;;;;;KAgBD,2BAA2B;UCRtB;;EAEf;;EAEA;;EAEA;;EAEA;;UAGe;;EAEf;;EAEA;;EAEA;;cAGW,8BAA8B;UAQ1B,uBAAuB;;EAEtC,eAAe;;EAEf,oBAAoB;;EAEpB;;EAEA;;EAEA;;EAEA,kBAAkB;;EAElB,SAAS,QAAQ;;iBAyEH;;;;;;;;;;;;;;;;;;;;;UCrHC;EACf,OAAO;EACP,QAAQ;EACR;;UAGe;EACf,WAAW,cAAc,MAAM,yBAAyB;;EAExD;;EAEA;;iBAGc,mBAAmB,UAAU,WAAW,QAAgB,wCAAqB,IAAA"}
@@ -50,7 +50,7 @@ interface HeatCalendarProps {
50
50
  /** Read the shared data and selection from any descendant of HeatCalendar. */
51
51
  declare function useHeatCalendar(): {
52
52
  unit: string;
53
- t: (key: "cell" | "unit" | "range" | "days" | "more" | "less" | "cellUndated" | "level", values?: Record<string, string | number>) => string;
53
+ t: (key: "range" | "cell" | "unit" | "days" | "more" | "less" | "cellUndated" | "level", values?: Record<string, string | number>) => string;
54
54
  formats: {
55
55
  day: Intl.DateTimeFormat;
56
56
  month: Intl.DateTimeFormat;
@@ -111,4 +111,4 @@ declare function HeatCalendarTooltip({ children, className }: {
111
111
  className?: string;
112
112
  }): import("react").JSX.Element;
113
113
  export { HeatCalendarSelection as a, HeatCalendarProps as i, useHeatCalendar as n, HeatCalendarMessages as o, HeatCalendarCell as r, heatCalendarMessages as s, HeatCalendarTooltip as t };
114
- //# sourceMappingURL=tooltip-gKOUHp_1.d.ts.map
114
+ //# sourceMappingURL=tooltip-TdY1OH4j.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip-gKOUHp_1.d.ts","names":[],"sources":["../src/components/charts/heat-calendar/messages.ts","../src/components/charts/heat-calendar/types.ts","../src/components/charts/heat-calendar/context.ts","../src/components/charts/heat-calendar/tooltip.tsx"],"mappings":";cAEa;;;;;;;;;;KAUD,8BAA8B;KCN9B;;EAEV;;EAEA;;UAGe;;EAEf,OAAO;;EAEP,MAAM;;UAGS;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA,UAAU;;EAEV;;EAEA;EACA,WAAW;;EAEX,YAAY;;EAEZ,mBAAmB;;EAEnB,qBAAqB,WAAW;;EAEhC,SAAS,QAAQ;;;iBCsLH;;;;;;;;;;;;;;;;;;;EAjJI,QAAA,WAAM;EACL,SAAA;EACF,OAAA;EAEC,QAAA;EACC,SAAA,WAAM,cAAW;EACjB,SAAA,WAAM;;;;;;;;;;;;;EA6DH,SAAA,MAAA;;;;;;;;;;;;;;;;;;;;;iBC1IR,sBACd,UACA;EAEA,WACI,cACE,MAAM,YAAY,kBAAkB,iCAAiC;EAC3E;oBACD,IAAA"}
1
+ {"version":3,"file":"tooltip-TdY1OH4j.d.ts","names":[],"sources":["../src/components/charts/heat-calendar/messages.ts","../src/components/charts/heat-calendar/types.ts","../src/components/charts/heat-calendar/context.ts","../src/components/charts/heat-calendar/tooltip.tsx"],"mappings":";cAEa;;;;;;;;;;KAUD,8BAA8B;KCN9B;;EAEV;;EAEA;;UAGe;;EAEf,OAAO;;EAEP,MAAM;;UAGS;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA,UAAU;;EAEV;;EAEA;EACA,WAAW;;EAEX,YAAY;;EAEZ,mBAAmB;;EAEnB,qBAAqB,WAAW;;EAEhC,SAAS,QAAQ;;;iBCsLH;;;;;;;;;;;;;;;;;;;EAjJI,QAAA,WAAM;EACL,SAAA;EACF,OAAA;EAEC,QAAA;EACC,SAAA,WAAM,cAAW;EACjB,SAAA,WAAM;;;;;;;;;;;;;EA6DH,SAAA,MAAA;;;;;;;;;;;;;;;;;;;;;iBC1IR,sBACd,UACA;EAEA,WACI,cACE,MAAM,YAAY,kBAAkB,iCAAiC;EAC3E;oBACD,IAAA"}
@@ -141,7 +141,9 @@ function TooltipRoot({ children, open: controlledOpen, defaultOpen = false, onOp
141
141
  const delay = delayProp ?? timing.delay;
142
142
  const closeDelay = closeDelayProp ?? timing.closeDelay;
143
143
  const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
144
- const open = controlledOpen ?? uncontrolledOpen;
144
+ const requestedOpen = controlledOpen ?? uncontrolledOpen;
145
+ const [anchorInert, setAnchorInert] = useState(false);
146
+ const open = requestedOpen && !anchorInert;
145
147
  const [instant, setInstant] = useState(false);
146
148
  const [empty, setEmpty] = useState(initialEmpty);
147
149
  const [trigger, setTrigger] = useState(null);
@@ -159,7 +161,7 @@ function TooltipRoot({ children, open: controlledOpen, defaultOpen = false, onOp
159
161
  if (element !== external) setExternal(element);
160
162
  });
161
163
  const latest = useRef({
162
- open,
164
+ open: requestedOpen,
163
165
  delay,
164
166
  closeDelay,
165
167
  disabled,
@@ -170,7 +172,7 @@ function TooltipRoot({ children, open: controlledOpen, defaultOpen = false, onOp
170
172
  useLayoutEffect(() => {
171
173
  anchorObject.current = anchor;
172
174
  latest.current = {
173
- open,
175
+ open: requestedOpen,
174
176
  delay,
175
177
  closeDelay,
176
178
  disabled,
@@ -201,7 +203,7 @@ function TooltipRoot({ children, open: controlledOpen, defaultOpen = false, onOp
201
203
  const openNow = useCallback((now = false) => {
202
204
  clearTimers();
203
205
  stopGrace();
204
- if (latest.current.disabled || latest.current.empty) return;
206
+ if (latest.current.disabled || latest.current.empty || anchorObject.current?.closest("[inert]")) return;
205
207
  if (current && current !== self.current) current.close();
206
208
  current = self.current;
207
209
  setInstant(now);
@@ -227,9 +229,50 @@ function TooltipRoot({ children, open: controlledOpen, defaultOpen = false, onOp
227
229
  useLayoutEffect(() => {
228
230
  self.current.close = () => finish(true);
229
231
  }, [finish]);
232
+ useLayoutEffect(() => {
233
+ if (!requestedOpen || !anchor) {
234
+ setAnchorInert(false);
235
+ return;
236
+ }
237
+ let wasInert;
238
+ const check = () => {
239
+ const isInert = Boolean(anchor.closest("[inert]"));
240
+ if (isInert === wasInert) return;
241
+ wasInert = isInert;
242
+ setAnchorInert(isInert);
243
+ if (isInert) finish(true);
244
+ };
245
+ const observer = new MutationObserver((records) => {
246
+ if (records.some((record) => record.type === "childList")) observeAncestors();
247
+ check();
248
+ });
249
+ const observeAncestors = () => {
250
+ observer.disconnect();
251
+ observer.observe(anchor, {
252
+ attributes: true,
253
+ attributeFilter: ["inert"]
254
+ });
255
+ for (let parent = anchor.parentElement; parent; parent = parent.parentElement) observer.observe(parent, {
256
+ attributes: true,
257
+ attributeFilter: ["inert"],
258
+ childList: true
259
+ });
260
+ if (!anchor.isConnected) observer.observe(anchor.ownerDocument, {
261
+ childList: true,
262
+ subtree: true
263
+ });
264
+ };
265
+ observeAncestors();
266
+ check();
267
+ return () => observer.disconnect();
268
+ }, [
269
+ anchor,
270
+ requestedOpen,
271
+ finish
272
+ ]);
230
273
  const requestOpen = useCallback(() => {
231
274
  clearTimers();
232
- if (latest.current.open || latest.current.disabled || latest.current.empty) return;
275
+ if (latest.current.open || latest.current.disabled || latest.current.empty || anchorObject.current?.closest("[inert]")) return;
233
276
  if (current !== null && current !== self.current || Date.now() - lastClosedAt < timing.skipDelay) openNow(true);
234
277
  else if (latest.current.delay <= 0) openNow();
235
278
  else openTimer.current = setTimeout(() => openNow(), latest.current.delay);
@@ -310,6 +353,7 @@ function TooltipRoot({ children, open: controlledOpen, defaultOpen = false, onOp
310
353
  if (trigger.contains(event.relatedTarget)) return;
311
354
  const fromKeyboard = keyboardFocus;
312
355
  keyboardFocus = false;
356
+ if (trigger.closest("[inert]")) return;
313
357
  finish(fromKeyboard);
314
358
  };
315
359
  const el = trigger;
@@ -381,7 +425,10 @@ function TooltipRoot({ children, open: controlledOpen, defaultOpen = false, onOp
381
425
  }, [clearTimers, stopGrace]);
382
426
  const insideTooltip = useCallback((target) => Boolean(floatingRef.current?.contains(target)), []);
383
427
  const dismiss = useCallback((reason) => finish(reason === "escape"), [finish]);
384
- useDismiss(open, dismiss, anchorObject, { ignore: insideTooltip });
428
+ useDismiss(open, dismiss, anchorObject, {
429
+ ignore: insideTooltip,
430
+ layerRef: floatingRef
431
+ });
385
432
  const onContentEnter = useCallback(() => {
386
433
  stopGrace();
387
434
  clearTimers();
@@ -541,4 +588,4 @@ function Tooltip(props) {
541
588
  }
542
589
  export { TooltipTrigger as i, TooltipContent as n, TooltipProvider as r, Tooltip as t };
543
590
 
544
- //# sourceMappingURL=tooltip-gHv-6eOs.js.map
591
+ //# sourceMappingURL=tooltip-eecPhLtC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip-eecPhLtC.js","names":[],"sources":["../src/components/motion/tooltip/grace.ts","../src/components/motion/tooltip.tsx"],"sourcesContent":["\"use client\";\n\ntype Point = { x: number; y: number };\ntype Box = { left: number; top: number; right: number; bottom: number };\n\n/**\n * The corridor a pointer may cross between the trigger and the open tooltip\n * without closing it: the convex hull of where it left and the box it is\n * heading for. A fixed timeout either cuts a slow diagonal move short or keeps\n * the label alive after the pointer has plainly gone elsewhere; this follows\n * the path itself.\n */\nexport function graceArea(exit: Point, target: Box): Point[] {\n // A few pixels either side of the exit point give the corridor some width at\n // its narrow end, so a hand that drifts sideways while it moves stays inside.\n const pad = 5;\n return hull([\n { x: exit.x - pad, y: exit.y - pad },\n { x: exit.x + pad, y: exit.y - pad },\n { x: exit.x - pad, y: exit.y + pad },\n { x: exit.x + pad, y: exit.y + pad },\n { x: target.left, y: target.top },\n { x: target.right, y: target.top },\n { x: target.right, y: target.bottom },\n { x: target.left, y: target.bottom },\n ]);\n}\n\nexport function inBox(point: Point, box: Box) {\n return point.x >= box.left && point.x <= box.right && point.y >= box.top && point.y <= box.bottom;\n}\n\nexport function inPolygon(point: Point, polygon: Point[]) {\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const a = polygon[i];\n const b = polygon[j];\n if (\n a.y > point.y !== b.y > point.y &&\n point.x < ((b.x - a.x) * (point.y - a.y)) / (b.y - a.y) + a.x\n ) {\n inside = !inside;\n }\n }\n return inside;\n}\n\n// Monotone chain; the corridor is always convex, so a hull is all it needs.\nfunction hull(points: Point[]) {\n const sorted = [...points].sort((a, b) => a.x - b.x || a.y - b.y);\n const cross = (o: Point, a: Point, b: Point) =>\n (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);\n const lower: Point[] = [];\n for (const p of sorted) {\n while (lower.length >= 2 && cross(lower[lower.length - 2], lower[lower.length - 1], p) <= 0) {\n lower.pop();\n }\n lower.push(p);\n }\n const upper: Point[] = [];\n for (let i = sorted.length - 1; i >= 0; i--) {\n const p = sorted[i];\n while (upper.length >= 2 && cross(upper[upper.length - 2], upper[upper.length - 1], p) <= 0) {\n upper.pop();\n }\n upper.push(p);\n }\n lower.pop();\n upper.pop();\n return lower.concat(upper);\n}\n\n/**\n * How the user last reached for the page. A focus that a mouse press caused is\n * not a request to read the label: the pointer is already on the control and\n * hovering showed it. A focus that followed a key - Tab, or a roving arrow key\n * moving focus in script - is the only way a keyboard user sees it at all.\n */\nlet modality: \"keyboard\" | \"pointer\" = \"keyboard\";\nlet listening = false;\n\nexport function watchModality() {\n if (listening || typeof window === \"undefined\") return;\n listening = true;\n window.addEventListener(\"keydown\", () => (modality = \"keyboard\"), true);\n window.addEventListener(\"pointerdown\", () => (modality = \"pointer\"), true);\n}\n\nexport function focusFromKeyboard() {\n return modality === \"keyboard\";\n}\n","\"use client\";\n\nimport {\n type ComponentProps,\n cloneElement,\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n type PointerEvent as ReactPointerEvent,\n type Ref,\n type RefObject,\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { AnimatePresence } from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { type DismissReason, useDismiss } from \"../../hooks/use-dismiss\";\nimport { useHoverGesture } from \"../../hooks/use-hover-gesture\";\nimport { useTapGesture } from \"../../hooks/use-tap-gesture\";\nimport { assignRef } from \"../../lib/merge-refs\";\nimport { focusFromKeyboard, graceArea, inBox, inPolygon, watchModality } from \"./tooltip/grace\";\nimport { TooltipArrow, TooltipPositioner } from \"./tooltip/positioner\";\nimport {\n type TooltipAlign,\n type TooltipAnchor,\n type TooltipPoint,\n type TooltipSide,\n useTooltipPointer,\n} from \"./tooltip/use-position\";\nimport { TooltipSurface } from \"./tooltip-surface\";\n\nexport type { TooltipAlign, TooltipSide };\n\n/* -------------------------------------------------------------------------- */\n/* Provider */\n/* -------------------------------------------------------------------------- */\n\ninterface TooltipTiming {\n /** Delay before a hover opens a tooltip (ms). */\n delay: number;\n /** Delay before a tooltip closes once the pointer has left it (ms). */\n closeDelay: number;\n /** After one tooltip closes, others open instantly for this long (ms). */\n skipDelay: number;\n}\n\nconst TimingContext = createContext<TooltipTiming>({ delay: 120, closeDelay: 0, skipDelay: 300 });\n\nexport interface TooltipProviderProps extends Partial<TooltipTiming> {\n children: ReactNode;\n}\n\n/** Shared timing for every tooltip inside it. Optional: tooltips work without one. */\nexport function TooltipProvider({ children, ...timing }: TooltipProviderProps) {\n const parent = useContext(TimingContext);\n const {\n delay = parent.delay,\n closeDelay = parent.closeDelay,\n skipDelay = parent.skipDelay,\n } = timing;\n const value = useMemo(() => ({ delay, closeDelay, skipDelay }), [delay, closeDelay, skipDelay]);\n return <TimingContext.Provider value={value}>{children}</TimingContext.Provider>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Root */\n/* -------------------------------------------------------------------------- */\n\n// Moving along a toolbar should feel instant after the first label, and only\n// one label may show at a time: a keyboard-focused control and a hovered one\n// would otherwise both claim the screen.\nlet lastClosedAt = 0;\nlet current: { close: () => void } | null = null;\n\nfunction isEmpty(content: ReactNode) {\n return content == null || content === false || content === \"\";\n}\n\ninterface TooltipContextValue {\n open: boolean;\n /** Show and hide without animating (keyboard focus, a warm toolbar, a replaced label). */\n instant: boolean;\n contentId: string;\n labelId: string;\n asLabel: boolean;\n empty: boolean;\n followCursor: boolean;\n anchor: TooltipAnchor | null;\n /** True when a TooltipTrigger owns the anchor; false for an external `anchorRef`. */\n triggered: boolean;\n floatingRef: RefObject<HTMLSpanElement | null>;\n pointer: ReturnType<typeof useTooltipPointer>;\n setTrigger: (element: TooltipAnchor | null) => void;\n setEmpty: (empty: boolean) => void;\n close: () => void;\n onContentEnter: () => void;\n onContentLeave: (event: ReactPointerEvent) => void;\n}\n\nconst TooltipContext = createContext<TooltipContextValue | null>(null);\n\nfunction useTooltipContext(part: string) {\n const context = useContext(TooltipContext);\n if (!context) throw new Error(`${part} must be used inside <Tooltip>`);\n return context;\n}\n\nexport interface TooltipRootProps {\n children?: ReactNode;\n /** Whether to show the tooltip in controlled use. An inert anchor keeps it hidden. */\n open?: boolean;\n /** Whether the tooltip starts shown when uncontrolled. Default: false */\n defaultOpen?: boolean;\n /** Called when the tooltip requests to show or hide, including when its anchor becomes inert. */\n onOpenChange?: (open: boolean) => void;\n /** Delay before showing on hover (ms). Keyboard focus shows immediately. */\n delay?: number;\n /** Delay before hiding once the pointer has left (ms). */\n closeDelay?: number;\n /** Never show, e.g. while the label it carries is already visible. */\n disabled?: boolean;\n /**\n * Use the tooltip as the trigger's accessible name rather than its\n * description. For icon-only controls whose only label is the tooltip.\n */\n asLabel?: boolean;\n /** Follow real pointer coordinates; keyboard focus still uses the anchor. */\n followCursor?: boolean;\n /** Existing anchor for controlled integrations such as chart cells. */\n anchorRef?: RefObject<TooltipAnchor | null>;\n /** Id of the tooltip surface, for anchors that reference it themselves. */\n id?: string;\n}\n\nfunction TooltipRoot({\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n delay: delayProp,\n closeDelay: closeDelayProp,\n disabled = false,\n asLabel = false,\n followCursor = false,\n anchorRef,\n id,\n initialEmpty = false,\n}: TooltipRootProps & { initialEmpty?: boolean }) {\n const timing = useContext(TimingContext);\n const delay = delayProp ?? timing.delay;\n const closeDelay = closeDelayProp ?? timing.closeDelay;\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const requestedOpen = controlledOpen ?? uncontrolledOpen;\n const [anchorInert, setAnchorInert] = useState(false);\n const open = requestedOpen && !anchorInert;\n // Keyboard focus and a warm toolbar show the label at once; animating\n // something seen this often only makes it feel slow.\n const [instant, setInstant] = useState(false);\n const [empty, setEmpty] = useState(initialEmpty);\n const [trigger, setTrigger] = useState<TooltipAnchor | null>(null);\n const [external, setExternal] = useState<TooltipAnchor | null>(null);\n const anchor = anchorRef ? external : trigger;\n const generatedId = useId();\n const contentId = id ?? `${generatedId}-content`;\n const labelId = `${generatedId}-label`;\n const floatingRef = useRef<HTMLSpanElement | null>(null);\n const anchorObject = useRef<TooltipAnchor | null>(null);\n const pointer = useTooltipPointer(anchor, followCursor);\n\n // An external ref can attach after this component renders; read it once it has.\n useLayoutEffect(() => {\n if (!anchorRef) return;\n const element = anchorRef.current ?? null;\n if (element !== external) setExternal(element);\n });\n\n // Everything the event listeners read, current without re-binding them.\n const latest = useRef({\n open: requestedOpen,\n delay,\n closeDelay,\n disabled,\n empty,\n onOpenChange,\n controlled: false,\n });\n useLayoutEffect(() => {\n anchorObject.current = anchor;\n latest.current = {\n open: requestedOpen,\n delay,\n closeDelay,\n disabled,\n empty,\n onOpenChange,\n controlled: controlledOpen !== undefined,\n };\n });\n\n const openTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const grace = useRef<(() => void) | null>(null);\n const self = useRef<{ close: () => void }>({ close: () => {} });\n\n const clearTimers = useCallback(() => {\n if (openTimer.current) clearTimeout(openTimer.current);\n if (closeTimer.current) clearTimeout(closeTimer.current);\n openTimer.current = null;\n closeTimer.current = null;\n }, []);\n\n const stopGrace = useCallback(() => {\n grace.current?.();\n grace.current = null;\n }, []);\n\n // Only a real change reaches the consumer: a pointer leaving a closed\n // tooltip is not news.\n const commit = useCallback((next: boolean) => {\n if (latest.current.open === next) return;\n if (!latest.current.controlled) setUncontrolledOpen(next);\n latest.current.onOpenChange?.(next);\n }, []);\n\n const openNow = useCallback(\n (now = false) => {\n clearTimers();\n stopGrace();\n if (\n latest.current.disabled ||\n latest.current.empty ||\n anchorObject.current?.closest(\"[inert]\")\n )\n return;\n // The label being replaced leaves at once, so two never show together.\n if (current && current !== self.current) current.close();\n current = self.current;\n setInstant(now);\n commit(true);\n },\n [clearTimers, stopGrace, commit],\n );\n\n const finish = useCallback(\n (now: boolean) => {\n clearTimers();\n stopGrace();\n if (latest.current.open) lastClosedAt = Date.now();\n if (current === self.current) current = null;\n if (latest.current.open) setInstant(now);\n commit(false);\n },\n [clearTimers, stopGrace, commit],\n );\n // Also a listener (window blur, outside press), so it takes no arguments.\n const close = useCallback(() => finish(false), [finish]);\n useLayoutEffect(() => {\n self.current.close = () => finish(true);\n }, [finish]);\n\n useLayoutEffect(() => {\n if (!requestedOpen || !anchor) {\n setAnchorInert(false);\n return;\n }\n // Inerting the anchor need not move the pointer. Close even if a pointer\n // corridor or close delay would otherwise keep the portaled label visible.\n let wasInert: boolean | undefined;\n const check = () => {\n const isInert = Boolean(anchor.closest(\"[inert]\"));\n if (isInert === wasInert) return;\n wasInert = isInert;\n setAnchorInert(isInert);\n if (isInert) finish(true);\n };\n const observer = new MutationObserver((records) => {\n if (records.some((record) => record.type === \"childList\")) observeAncestors();\n check();\n });\n const observeAncestors = () => {\n observer.disconnect();\n observer.observe(anchor, { attributes: true, attributeFilter: [\"inert\"] });\n for (let parent = anchor.parentElement; parent; parent = parent.parentElement) {\n observer.observe(parent, { attributes: true, attributeFilter: [\"inert\"], childList: true });\n }\n // A detached external anchor can reattach outside its old ancestry.\n if (!anchor.isConnected) {\n observer.observe(anchor.ownerDocument, { childList: true, subtree: true });\n }\n };\n observeAncestors();\n check();\n return () => observer.disconnect();\n }, [anchor, requestedOpen, finish]);\n\n const requestOpen = useCallback(() => {\n clearTimers();\n if (\n latest.current.open ||\n latest.current.disabled ||\n latest.current.empty ||\n anchorObject.current?.closest(\"[inert]\")\n )\n return;\n // Warm: another label is still showing (the pointer is crossing to this\n // one), or one closed a moment ago. Either way, skip the delay and the fade.\n const warm =\n (current !== null && current !== self.current) ||\n Date.now() - lastClosedAt < timing.skipDelay;\n if (warm) openNow(true);\n else if (latest.current.delay <= 0) openNow();\n else openTimer.current = setTimeout(() => openNow(), latest.current.delay);\n }, [clearTimers, openNow, timing.skipDelay]);\n\n const requestClose = useCallback(() => {\n clearTimers();\n if (latest.current.closeDelay > 0) {\n closeTimer.current = setTimeout(close, latest.current.closeDelay);\n } else close();\n }, [clearTimers, close]);\n\n // Hold the label open while the pointer crosses from one box toward the other.\n const startGrace = useCallback(\n (exit: TooltipPoint, from: Element, to: Element | null) => {\n stopGrace();\n if (!to) return requestClose();\n const target = to.getBoundingClientRect();\n const origin = from.getBoundingClientRect();\n const corridor = graceArea(exit, target);\n const onMove = (event: PointerEvent) => {\n const point = { x: event.clientX, y: event.clientY };\n if (inBox(point, target) || inBox(point, origin)) return;\n if (!inPolygon(point, corridor)) requestClose();\n };\n document.addEventListener(\"pointermove\", onMove);\n grace.current = () => document.removeEventListener(\"pointermove\", onMove);\n },\n [stopGrace, requestClose],\n );\n\n const hover = useHoverGesture();\n const tap = useTapGesture<boolean>();\n\n // Listeners go on the trigger itself rather than on cloned props, so a\n // component that owns its own handlers keeps them, and no wrapper element\n // sits between the control and its layout.\n useEffect(() => {\n if (anchorRef || !trigger) return;\n watchModality();\n // A mouse press dismisses the label and keeps it away until the pointer\n // leaves; hovering a control you just clicked should not bring it back.\n let suppressed = false;\n // Focus that came from the keyboard holds the label open on its own.\n let keyboardFocus = false;\n\n const onEnter = (event: PointerEvent) => {\n if (!hover.enter(event)) return;\n stopGrace();\n if (closeTimer.current) clearTimeout(closeTimer.current);\n if (!suppressed) requestOpen();\n };\n const onLeave = (event: PointerEvent) => {\n if (!hover.leave(event)) return;\n suppressed = false;\n if (keyboardFocus) return;\n if (openTimer.current) {\n clearTimers();\n return;\n }\n if (latest.current.open && !followCursor) {\n startGrace({ x: event.clientX, y: event.clientY }, trigger, floatingRef.current);\n } else requestClose();\n };\n const onDown = (event: PointerEvent) => {\n tap.start(event, latest.current.open);\n if (event.pointerType === \"mouse\") {\n suppressed = true;\n close();\n }\n };\n // A finger never hovers, and Safari does not focus a button on tap either,\n // so the label is only reachable if the tap itself toggles it. The click\n // carries no pointerType; the pointerdown before it says whether it was a\n // tap, and keyboard activation has none at all.\n const onClick = () => {\n const gesture = tap.take();\n if (!gesture || gesture.pointerType === \"mouse\") return;\n if (gesture.state) close();\n else openNow();\n };\n const onKey = () => tap.drop();\n const onFocusIn = () => {\n if (!focusFromKeyboard()) return;\n keyboardFocus = true;\n openNow(true);\n };\n const onFocusOut = (event: FocusEvent) => {\n if (trigger.contains(event.relatedTarget as Node | null)) return;\n const fromKeyboard = keyboardFocus;\n keyboardFocus = false;\n // The inert observer owns this close, even when focus moves first.\n if (trigger.closest(\"[inert]\")) return;\n finish(fromKeyboard);\n };\n\n // Both element kinds dispatch the same events; one type keeps the listeners typed.\n const el = trigger as HTMLElement;\n el.addEventListener(\"pointerenter\", onEnter);\n el.addEventListener(\"pointerleave\", onLeave);\n el.addEventListener(\"pointerdown\", onDown);\n el.addEventListener(\"pointercancel\", tap.drop);\n el.addEventListener(\"click\", onClick);\n el.addEventListener(\"keydown\", onKey);\n el.addEventListener(\"focusin\", onFocusIn);\n el.addEventListener(\"focusout\", onFocusOut);\n return () => {\n el.removeEventListener(\"pointerenter\", onEnter);\n el.removeEventListener(\"pointerleave\", onLeave);\n el.removeEventListener(\"pointerdown\", onDown);\n el.removeEventListener(\"pointercancel\", tap.drop);\n el.removeEventListener(\"click\", onClick);\n el.removeEventListener(\"keydown\", onKey);\n el.removeEventListener(\"focusin\", onFocusIn);\n el.removeEventListener(\"focusout\", onFocusOut);\n };\n }, [\n anchorRef,\n trigger,\n followCursor,\n hover,\n tap,\n requestOpen,\n requestClose,\n openNow,\n close,\n finish,\n clearTimers,\n stopGrace,\n startGrace,\n ]);\n\n // While open, a trigger that turns disabled loses focus without a blur event,\n // and a window that loses focus never reports the pointer leaving.\n useEffect(() => {\n if (!open || anchorRef || !trigger) return;\n const observer = new MutationObserver(() => {\n if (trigger.matches(\":disabled, [aria-disabled='true']\")) close();\n });\n observer.observe(trigger, { attributes: true, attributeFilter: [\"disabled\", \"aria-disabled\"] });\n window.addEventListener(\"blur\", close);\n return () => {\n observer.disconnect();\n window.removeEventListener(\"blur\", close);\n };\n }, [open, anchorRef, trigger, close]);\n\n // A chart drives its own open state and swaps content as it goes; only a\n // trigger-owned label closes itself for having nothing to say.\n useEffect(() => {\n if (disabled || (empty && !anchorRef)) close();\n }, [disabled, empty, anchorRef, close]);\n\n useEffect(\n () => () => {\n clearTimers();\n stopGrace();\n if (current === self.current) current = null;\n },\n [clearTimers, stopGrace],\n );\n\n const insideTooltip = useCallback(\n (target: Element) => Boolean(floatingRef.current?.contains(target)),\n [],\n );\n // ...and closed by the next tap that lands somewhere else, or Escape. The\n // label covers nothing interactive, so that tap passes through to what it hit.\n // Escape is a key press, so the label goes at once.\n const dismiss = useCallback((reason: DismissReason) => finish(reason === \"escape\"), [finish]);\n // Let other overlays handle presses and Tab on the anchor. The tooltip\n // still leaves anchor presses to the trigger, which records open on touch.\n useDismiss(open, dismiss, anchorObject, { ignore: insideTooltip, layerRef: floatingRef });\n\n const onContentEnter = useCallback(() => {\n stopGrace();\n clearTimers();\n }, [stopGrace, clearTimers]);\n\n const onContentLeave = useCallback(\n (event: ReactPointerEvent) => {\n const floating = floatingRef.current;\n if (!floating) return;\n if (anchorRef) {\n // Bridge the small gap back onto a chart; it reopens on its own terms.\n clearTimers();\n closeTimer.current = setTimeout(close, 100);\n return;\n }\n startGrace({ x: event.clientX, y: event.clientY }, floating, anchorObject.current);\n },\n [anchorRef, clearTimers, close, startGrace],\n );\n\n const value = useMemo<TooltipContextValue>(\n () => ({\n open,\n instant,\n contentId,\n labelId,\n asLabel,\n empty,\n followCursor,\n anchor,\n triggered: !anchorRef,\n floatingRef,\n pointer,\n setTrigger,\n setEmpty,\n close,\n onContentEnter,\n onContentLeave,\n }),\n [\n open,\n instant,\n contentId,\n labelId,\n asLabel,\n empty,\n followCursor,\n anchor,\n anchorRef,\n pointer,\n close,\n onContentEnter,\n onContentLeave,\n ],\n );\n\n return <TooltipContext.Provider value={value}>{children}</TooltipContext.Provider>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Trigger */\n/* -------------------------------------------------------------------------- */\n\nfunction mergeIds(...ids: unknown[]) {\n return ids.filter((value) => typeof value === \"string\" && value).join(\" \") || undefined;\n}\n\nexport interface TooltipTriggerProps extends ComponentProps<\"button\"> {\n /** Use the single child element as the trigger instead of rendering a button. */\n asChild?: boolean;\n}\n\nexport function TooltipTrigger({ asChild = false, children, ref, ...props }: TooltipTriggerProps) {\n const { open, contentId, labelId, asLabel, empty, setTrigger } =\n useTooltipContext(\"TooltipTrigger\");\n const child = asChild && isValidElement(children) ? children : null;\n const childProps = (child?.props ?? props) as Record<string, unknown>;\n const childRef = child ? (childProps.ref as Ref<TooltipAnchor> | undefined) : undefined;\n const attached = useRef<TooltipAnchor | null>(null);\n\n const setRef = useCallback(\n (element: TooltipAnchor | null) => {\n attached.current = element;\n setTrigger(element);\n assignRef(childRef ?? (ref as Ref<TooltipAnchor> | undefined), element);\n },\n [setTrigger, childRef, ref],\n );\n\n useEffect(() => {\n if (process.env.NODE_ENV !== \"production\" && child && !attached.current) {\n console.warn(\n \"TooltipTrigger: the child did not attach a ref, so the tooltip has nothing to listen to. Render a DOM element or a component that passes `ref` through.\",\n );\n }\n }, [child]);\n\n const aria = asLabel\n ? {\n \"aria-labelledby\": empty ? (childProps[\"aria-labelledby\"] as string | undefined) : labelId,\n }\n : {\n \"aria-describedby\": mergeIds(\n childProps[\"aria-describedby\"],\n open && !empty ? contentId : undefined,\n ),\n };\n\n if (asChild) {\n if (!child) return children;\n return cloneElement(child as ReactElement<Record<string, unknown>>, { ref: setRef, ...aria });\n }\n\n return (\n <button\n type=\"button\"\n data-state={open ? \"open\" : \"closed\"}\n {...props}\n ref={setRef as Ref<HTMLButtonElement>}\n {...aria}\n >\n {children}\n </button>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Content */\n/* -------------------------------------------------------------------------- */\n\nexport interface TooltipContentProps {\n children?: ReactNode;\n /** Preferred side of the anchor. Flips when there is no room. Default: \"top\" */\n side?: TooltipSide;\n /** Alignment along the chosen side. Default: \"center\" */\n align?: TooltipAlign;\n /** Gap between anchor and tooltip (px). */\n sideOffset?: number;\n /** Draw an arrow pointing at the anchor. */\n arrow?: boolean;\n /** Point within the anchor, as fractions of its rendered width and height. */\n anchorPoint?: TooltipPoint;\n /** Classes merged onto the tooltip surface. */\n className?: string;\n}\n\nexport function TooltipContent({\n children,\n side = \"top\",\n align = \"center\",\n sideOffset,\n arrow = false,\n anchorPoint,\n className,\n}: TooltipContentProps) {\n const {\n open,\n instant,\n contentId,\n labelId,\n asLabel,\n followCursor,\n anchor,\n floatingRef,\n pointer,\n setEmpty,\n close,\n onContentEnter,\n onContentLeave,\n } = useTooltipContext(\"TooltipContent\");\n const empty = isEmpty(children);\n const arrowRef = useRef<SVGSVGElement | null>(null);\n\n useLayoutEffect(() => {\n setEmpty(empty);\n }, [empty, setEmpty]);\n\n if (typeof document === \"undefined\") return null;\n\n return createPortal(\n <>\n {/* The name has to exist while the label is closed, so it lives apart from the surface. */}\n {asLabel && !empty ? (\n <span id={labelId} hidden>\n {children}\n </span>\n ) : null}\n {/* `custom` reaches a surface that is already exiting, so a label closed\n from the keyboard or replaced by a neighbour leaves without animating. */}\n <AnimatePresence custom={instant}>\n {open && !empty ? (\n <TooltipPositioner\n key=\"tooltip\"\n anchor={anchor}\n floatingRef={floatingRef}\n arrowRef={arrow ? arrowRef : undefined}\n anchorPoint={anchorPoint}\n followCursor={followCursor}\n side={side}\n align={align}\n sideOffset={sideOffset}\n onDismiss={close}\n pointer={pointer}\n >\n {(positioned, isPresent, placedSide) => (\n <TooltipSurface\n id={asLabel ? undefined : contentId}\n aria-hidden={asLabel || undefined}\n ready={positioned}\n instant={instant}\n onPointerEnter={onContentEnter}\n onPointerLeave={onContentLeave}\n style={{ pointerEvents: isPresent && !followCursor ? \"auto\" : \"none\" }}\n className={cn(\n \"max-w-[min(20rem,calc(100vw-16px))] wrap-break-word whitespace-normal\",\n arrow && \"relative\",\n className,\n )}\n >\n {children}\n {arrow ? <TooltipArrow ref={arrowRef} side={placedSide} /> : null}\n </TooltipSurface>\n )}\n </TooltipPositioner>\n ) : null}\n </AnimatePresence>\n </>,\n document.body,\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Tooltip (root, or one-line shorthand when given `content`) */\n/* -------------------------------------------------------------------------- */\n\nexport interface TooltipProps\n extends TooltipRootProps,\n Omit<TooltipContentProps, \"children\" | \"className\"> {\n /**\n * Shorthand: the tooltip's content. With it, `children` is the trigger\n * element; without it, compose `TooltipTrigger` and `TooltipContent`.\n */\n content?: ReactNode;\n /** Shorthand only: classes for the tooltip surface. */\n className?: string;\n}\n\nexport function Tooltip(props: TooltipProps) {\n if (!(\"content\" in props)) return <TooltipRoot {...props} />;\n const { content, children, side, align, sideOffset, arrow, anchorPoint, className, ...root } =\n props;\n if (!root.anchorRef && !isValidElement(children)) return children ?? null;\n return (\n <TooltipRoot {...root} initialEmpty={isEmpty(content)}>\n {isValidElement(children) ? <TooltipTrigger>{children}</TooltipTrigger> : null}\n <TooltipContent\n side={side}\n align={align}\n sideOffset={sideOffset}\n arrow={arrow}\n anchorPoint={anchorPoint}\n className={className}\n >\n {content}\n </TooltipContent>\n </TooltipRoot>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAYA,SAAgB,UAAU,MAAa,QAAsB;CAG3D,MAAM,MAAM;CACZ,OAAO,KAAK;EACV;GAAE,GAAG,KAAK,IAAI;GAAK,GAAG,KAAK,IAAI;EAAI;EACnC;GAAE,GAAG,KAAK,IAAI;GAAK,GAAG,KAAK,IAAI;EAAI;EACnC;GAAE,GAAG,KAAK,IAAI;GAAK,GAAG,KAAK,IAAI;EAAI;EACnC;GAAE,GAAG,KAAK,IAAI;GAAK,GAAG,KAAK,IAAI;EAAI;EACnC;GAAE,GAAG,OAAO;GAAM,GAAG,OAAO;EAAI;EAChC;GAAE,GAAG,OAAO;GAAO,GAAG,OAAO;EAAI;EACjC;GAAE,GAAG,OAAO;GAAO,GAAG,OAAO;EAAO;EACpC;GAAE,GAAG,OAAO;GAAM,GAAG,OAAO;EAAO;CACrC,CAAC;AACH;AAEA,SAAgB,MAAM,OAAc,KAAU;CAC5C,OAAO,MAAM,KAAK,IAAI,QAAQ,MAAM,KAAK,IAAI,SAAS,MAAM,KAAK,IAAI,OAAO,MAAM,KAAK,IAAI;AAC7F;AAEA,SAAgB,UAAU,OAAc,SAAkB;CACxD,IAAI,SAAS;CACb,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,SAAS,GAAG,IAAI,QAAQ,QAAQ,IAAI,KAAK;EACnE,MAAM,IAAI,QAAQ;EAClB,MAAM,IAAI,QAAQ;EAClB,IACE,EAAE,IAAI,MAAM,MAAM,EAAE,IAAI,MAAM,KAC9B,MAAM,KAAM,EAAE,IAAI,EAAE,MAAM,MAAM,IAAI,EAAE,MAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAE5D,SAAS,CAAC;CAEd;CACA,OAAO;AACT;AAG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B,OAAO;IACE;IACT,gBAAgB;IAChB,gBAAgB;IAChB,OAAO,EAAE,eAAe,aAAa,CAAC,eAAe,SAAS,OAAO;IACrE,WAAW,GACT,yEACA,SAAS,YACT,SACF;IAZF,UAAA,CAcG,UACA,QAAQ,oBAAC,cAAD;KAAc,KAAK;KAAU,MAAM;IAAa,CAAA,IAAI,IAC/C;;EAED,GA/Bb,SA+Ba,IACjB;CACW,CAAA,CACjB,EAAA,CAAA,GACF,SAAS,IACX;AACF;AAkBA,SAAgB,QAAQ,OAAqB;CAC3C,IAAI,EAAE,aAAa,QAAQ,OAAO,oBAAC,aAAD,EAAa,GAAI,MAAQ,CAAA;CAC3D,MAAM,EAAE,SAAS,UAAU,MAAM,OAAO,YAAY,OAAO,aAAa,WAAW,GAAG,SACpF;CACF,IAAI,CAAC,KAAK,aAAa,CAAC,eAAe,QAAQ,GAAG,OAAO,YAAY;CACrE,OACE,qBAAC,aAAD;EAAa,GAAI;EAAM,cAAc,QAAQ,OAAO;EAApD,UAAA,CACG,eAAe,QAAQ,IAAI,oBAAC,gBAAD,EAAiB,SAAyB,CAAA,IAAI,MAC1E,oBAAC,gBAAD;GACQ;GACC;GACK;GACL;GACM;GACF;GAEV,UAAA;EACa,CAAA,CACL;;AAEjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumix/ui",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Kumix React UI kit: shadcn/ui (Base UI, base-nova) + ReUI components, Tailwind tokens, and hooks. Per-file ESM exports.",
5
5
  "author": "Kumix Labs <hai@kumix.io>",
6
6
  "license": "MIT",
@@ -79,7 +79,7 @@
79
79
  "@paper-design/shaders-react": "^0.0.82",
80
80
  "@shadcn/react": "^0.3.1",
81
81
  "@tanstack/react-table": "^9.3.1",
82
- "@tanstack/react-virtual": "^3.14.30",
82
+ "@tanstack/react-virtual": "^3.14.31",
83
83
  "@types/react": "^19.3.3",
84
84
  "class-variance-authority": "^0.7.1",
85
85
  "clsx": "^2.1.1",
@@ -88,7 +88,7 @@
88
88
  "embla-carousel-react": "^8.6.0",
89
89
  "input-otp": "^1.5.0",
90
90
  "lenis": "^1.3.29",
91
- "lucide-react": "^1.84.0",
91
+ "lucide-react": "^1.85.0",
92
92
  "motion": "^14.14.0",
93
93
  "next-themes": "^0.4.6",
94
94
  "react": "^19.3.1",
@@ -97,9 +97,10 @@
97
97
  "react-resizable-panels": "^4.27.0",
98
98
  "recharts": "3.11.3",
99
99
  "shiki": "^4.6.0",
100
- "tailwind-merge": "^3.7.1",
100
+ "tailwind-merge": "^3.7.2",
101
101
  "tsdown": "^0.23.7",
102
- "typescript": "6.0.3"
102
+ "typescript": "6.0.3",
103
+ "uqr": "^0.1.3"
103
104
  },
104
105
  "peerDependencies": {
105
106
  "@base-ui/react": ">=1.9.0",
@@ -129,7 +130,8 @@
129
130
  "react-phone-number-input": ">=3.4.0",
130
131
  "react-resizable-panels": ">=4.20.0",
131
132
  "recharts": ">=3.10.0",
132
- "shiki": ">=4.5.0"
133
+ "shiki": ">=4.5.0",
134
+ "uqr": ">=0.1.3"
133
135
  },
134
136
  "peerDependenciesMeta": {
135
137
  "@date-fns/tz": {
@@ -197,6 +199,9 @@
197
199
  },
198
200
  "shiki": {
199
201
  "optional": true
202
+ },
203
+ "uqr": {
204
+ "optional": true
200
205
  }
201
206
  },
202
207
  "publishConfig": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"tooltip-gHv-6eOs.js","names":[],"sources":["../src/components/motion/tooltip/grace.ts","../src/components/motion/tooltip.tsx"],"sourcesContent":["\"use client\";\n\ntype Point = { x: number; y: number };\ntype Box = { left: number; top: number; right: number; bottom: number };\n\n/**\n * The corridor a pointer may cross between the trigger and the open tooltip\n * without closing it: the convex hull of where it left and the box it is\n * heading for. A fixed timeout either cuts a slow diagonal move short or keeps\n * the label alive after the pointer has plainly gone elsewhere; this follows\n * the path itself.\n */\nexport function graceArea(exit: Point, target: Box): Point[] {\n // A few pixels either side of the exit point give the corridor some width at\n // its narrow end, so a hand that drifts sideways while it moves stays inside.\n const pad = 5;\n return hull([\n { x: exit.x - pad, y: exit.y - pad },\n { x: exit.x + pad, y: exit.y - pad },\n { x: exit.x - pad, y: exit.y + pad },\n { x: exit.x + pad, y: exit.y + pad },\n { x: target.left, y: target.top },\n { x: target.right, y: target.top },\n { x: target.right, y: target.bottom },\n { x: target.left, y: target.bottom },\n ]);\n}\n\nexport function inBox(point: Point, box: Box) {\n return point.x >= box.left && point.x <= box.right && point.y >= box.top && point.y <= box.bottom;\n}\n\nexport function inPolygon(point: Point, polygon: Point[]) {\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const a = polygon[i];\n const b = polygon[j];\n if (\n a.y > point.y !== b.y > point.y &&\n point.x < ((b.x - a.x) * (point.y - a.y)) / (b.y - a.y) + a.x\n ) {\n inside = !inside;\n }\n }\n return inside;\n}\n\n// Monotone chain; the corridor is always convex, so a hull is all it needs.\nfunction hull(points: Point[]) {\n const sorted = [...points].sort((a, b) => a.x - b.x || a.y - b.y);\n const cross = (o: Point, a: Point, b: Point) =>\n (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);\n const lower: Point[] = [];\n for (const p of sorted) {\n while (lower.length >= 2 && cross(lower[lower.length - 2], lower[lower.length - 1], p) <= 0) {\n lower.pop();\n }\n lower.push(p);\n }\n const upper: Point[] = [];\n for (let i = sorted.length - 1; i >= 0; i--) {\n const p = sorted[i];\n while (upper.length >= 2 && cross(upper[upper.length - 2], upper[upper.length - 1], p) <= 0) {\n upper.pop();\n }\n upper.push(p);\n }\n lower.pop();\n upper.pop();\n return lower.concat(upper);\n}\n\n/**\n * How the user last reached for the page. A focus that a mouse press caused is\n * not a request to read the label: the pointer is already on the control and\n * hovering showed it. A focus that followed a key - Tab, or a roving arrow key\n * moving focus in script - is the only way a keyboard user sees it at all.\n */\nlet modality: \"keyboard\" | \"pointer\" = \"keyboard\";\nlet listening = false;\n\nexport function watchModality() {\n if (listening || typeof window === \"undefined\") return;\n listening = true;\n window.addEventListener(\"keydown\", () => (modality = \"keyboard\"), true);\n window.addEventListener(\"pointerdown\", () => (modality = \"pointer\"), true);\n}\n\nexport function focusFromKeyboard() {\n return modality === \"keyboard\";\n}\n","\"use client\";\n\nimport {\n type ComponentProps,\n cloneElement,\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n type PointerEvent as ReactPointerEvent,\n type Ref,\n type RefObject,\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { AnimatePresence } from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { type DismissReason, useDismiss } from \"../../hooks/use-dismiss\";\nimport { useHoverGesture } from \"../../hooks/use-hover-gesture\";\nimport { useTapGesture } from \"../../hooks/use-tap-gesture\";\nimport { assignRef } from \"../../lib/merge-refs\";\nimport { focusFromKeyboard, graceArea, inBox, inPolygon, watchModality } from \"./tooltip/grace\";\nimport { TooltipArrow, TooltipPositioner } from \"./tooltip/positioner\";\nimport {\n type TooltipAlign,\n type TooltipAnchor,\n type TooltipPoint,\n type TooltipSide,\n useTooltipPointer,\n} from \"./tooltip/use-position\";\nimport { TooltipSurface } from \"./tooltip-surface\";\n\nexport type { TooltipAlign, TooltipSide };\n\n/* -------------------------------------------------------------------------- */\n/* Provider */\n/* -------------------------------------------------------------------------- */\n\ninterface TooltipTiming {\n /** Delay before a hover opens a tooltip (ms). */\n delay: number;\n /** Delay before a tooltip closes once the pointer has left it (ms). */\n closeDelay: number;\n /** After one tooltip closes, others open instantly for this long (ms). */\n skipDelay: number;\n}\n\nconst TimingContext = createContext<TooltipTiming>({ delay: 120, closeDelay: 0, skipDelay: 300 });\n\nexport interface TooltipProviderProps extends Partial<TooltipTiming> {\n children: ReactNode;\n}\n\n/** Shared timing for every tooltip inside it. Optional: tooltips work without one. */\nexport function TooltipProvider({ children, ...timing }: TooltipProviderProps) {\n const parent = useContext(TimingContext);\n const {\n delay = parent.delay,\n closeDelay = parent.closeDelay,\n skipDelay = parent.skipDelay,\n } = timing;\n const value = useMemo(() => ({ delay, closeDelay, skipDelay }), [delay, closeDelay, skipDelay]);\n return <TimingContext.Provider value={value}>{children}</TimingContext.Provider>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Root */\n/* -------------------------------------------------------------------------- */\n\n// Moving along a toolbar should feel instant after the first label, and only\n// one label may show at a time: a keyboard-focused control and a hovered one\n// would otherwise both claim the screen.\nlet lastClosedAt = 0;\nlet current: { close: () => void } | null = null;\n\nfunction isEmpty(content: ReactNode) {\n return content == null || content === false || content === \"\";\n}\n\ninterface TooltipContextValue {\n open: boolean;\n /** Show and hide without animating (keyboard focus, a warm toolbar, a replaced label). */\n instant: boolean;\n contentId: string;\n labelId: string;\n asLabel: boolean;\n empty: boolean;\n followCursor: boolean;\n anchor: TooltipAnchor | null;\n /** True when a TooltipTrigger owns the anchor; false for an external `anchorRef`. */\n triggered: boolean;\n floatingRef: RefObject<HTMLSpanElement | null>;\n pointer: ReturnType<typeof useTooltipPointer>;\n setTrigger: (element: TooltipAnchor | null) => void;\n setEmpty: (empty: boolean) => void;\n close: () => void;\n onContentEnter: () => void;\n onContentLeave: (event: ReactPointerEvent) => void;\n}\n\nconst TooltipContext = createContext<TooltipContextValue | null>(null);\n\nfunction useTooltipContext(part: string) {\n const context = useContext(TooltipContext);\n if (!context) throw new Error(`${part} must be used inside <Tooltip>`);\n return context;\n}\n\nexport interface TooltipRootProps {\n children?: ReactNode;\n /** Whether the tooltip is shown, for controlled use. */\n open?: boolean;\n /** Whether the tooltip starts shown when uncontrolled. Default: false */\n defaultOpen?: boolean;\n /** Called with the new state when the tooltip shows or hides. */\n onOpenChange?: (open: boolean) => void;\n /** Delay before showing on hover (ms). Keyboard focus shows immediately. */\n delay?: number;\n /** Delay before hiding once the pointer has left (ms). */\n closeDelay?: number;\n /** Never show, e.g. while the label it carries is already visible. */\n disabled?: boolean;\n /**\n * Use the tooltip as the trigger's accessible name rather than its\n * description. For icon-only controls whose only label is the tooltip.\n */\n asLabel?: boolean;\n /** Follow real pointer coordinates; keyboard focus still uses the anchor. */\n followCursor?: boolean;\n /** Existing anchor for controlled integrations such as chart cells. */\n anchorRef?: RefObject<TooltipAnchor | null>;\n /** Id of the tooltip surface, for anchors that reference it themselves. */\n id?: string;\n}\n\nfunction TooltipRoot({\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n delay: delayProp,\n closeDelay: closeDelayProp,\n disabled = false,\n asLabel = false,\n followCursor = false,\n anchorRef,\n id,\n initialEmpty = false,\n}: TooltipRootProps & { initialEmpty?: boolean }) {\n const timing = useContext(TimingContext);\n const delay = delayProp ?? timing.delay;\n const closeDelay = closeDelayProp ?? timing.closeDelay;\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const open = controlledOpen ?? uncontrolledOpen;\n // Keyboard focus and a warm toolbar show the label at once; animating\n // something seen this often only makes it feel slow.\n const [instant, setInstant] = useState(false);\n const [empty, setEmpty] = useState(initialEmpty);\n const [trigger, setTrigger] = useState<TooltipAnchor | null>(null);\n const [external, setExternal] = useState<TooltipAnchor | null>(null);\n const anchor = anchorRef ? external : trigger;\n const generatedId = useId();\n const contentId = id ?? `${generatedId}-content`;\n const labelId = `${generatedId}-label`;\n const floatingRef = useRef<HTMLSpanElement | null>(null);\n const anchorObject = useRef<TooltipAnchor | null>(null);\n const pointer = useTooltipPointer(anchor, followCursor);\n\n // An external ref can attach after this component renders; read it once it has.\n useLayoutEffect(() => {\n if (!anchorRef) return;\n const element = anchorRef.current ?? null;\n if (element !== external) setExternal(element);\n });\n\n // Everything the event listeners read, current without re-binding them.\n const latest = useRef({\n open,\n delay,\n closeDelay,\n disabled,\n empty,\n onOpenChange,\n controlled: false,\n });\n useLayoutEffect(() => {\n anchorObject.current = anchor;\n latest.current = {\n open,\n delay,\n closeDelay,\n disabled,\n empty,\n onOpenChange,\n controlled: controlledOpen !== undefined,\n };\n });\n\n const openTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const grace = useRef<(() => void) | null>(null);\n const self = useRef<{ close: () => void }>({ close: () => {} });\n\n const clearTimers = useCallback(() => {\n if (openTimer.current) clearTimeout(openTimer.current);\n if (closeTimer.current) clearTimeout(closeTimer.current);\n openTimer.current = null;\n closeTimer.current = null;\n }, []);\n\n const stopGrace = useCallback(() => {\n grace.current?.();\n grace.current = null;\n }, []);\n\n // Only a real change reaches the consumer: a pointer leaving a closed\n // tooltip is not news.\n const commit = useCallback((next: boolean) => {\n if (latest.current.open === next) return;\n if (!latest.current.controlled) setUncontrolledOpen(next);\n latest.current.onOpenChange?.(next);\n }, []);\n\n const openNow = useCallback(\n (now = false) => {\n clearTimers();\n stopGrace();\n if (latest.current.disabled || latest.current.empty) return;\n // The label being replaced leaves at once, so two never show together.\n if (current && current !== self.current) current.close();\n current = self.current;\n setInstant(now);\n commit(true);\n },\n [clearTimers, stopGrace, commit],\n );\n\n const finish = useCallback(\n (now: boolean) => {\n clearTimers();\n stopGrace();\n if (latest.current.open) lastClosedAt = Date.now();\n if (current === self.current) current = null;\n if (latest.current.open) setInstant(now);\n commit(false);\n },\n [clearTimers, stopGrace, commit],\n );\n // Also a listener (window blur, outside press), so it takes no arguments.\n const close = useCallback(() => finish(false), [finish]);\n useLayoutEffect(() => {\n self.current.close = () => finish(true);\n }, [finish]);\n\n const requestOpen = useCallback(() => {\n clearTimers();\n if (latest.current.open || latest.current.disabled || latest.current.empty) return;\n // Warm: another label is still showing (the pointer is crossing to this\n // one), or one closed a moment ago. Either way, skip the delay and the fade.\n const warm =\n (current !== null && current !== self.current) ||\n Date.now() - lastClosedAt < timing.skipDelay;\n if (warm) openNow(true);\n else if (latest.current.delay <= 0) openNow();\n else openTimer.current = setTimeout(() => openNow(), latest.current.delay);\n }, [clearTimers, openNow, timing.skipDelay]);\n\n const requestClose = useCallback(() => {\n clearTimers();\n if (latest.current.closeDelay > 0) {\n closeTimer.current = setTimeout(close, latest.current.closeDelay);\n } else close();\n }, [clearTimers, close]);\n\n // Hold the label open while the pointer crosses from one box toward the other.\n const startGrace = useCallback(\n (exit: TooltipPoint, from: Element, to: Element | null) => {\n stopGrace();\n if (!to) return requestClose();\n const target = to.getBoundingClientRect();\n const origin = from.getBoundingClientRect();\n const corridor = graceArea(exit, target);\n const onMove = (event: PointerEvent) => {\n const point = { x: event.clientX, y: event.clientY };\n if (inBox(point, target) || inBox(point, origin)) return;\n if (!inPolygon(point, corridor)) requestClose();\n };\n document.addEventListener(\"pointermove\", onMove);\n grace.current = () => document.removeEventListener(\"pointermove\", onMove);\n },\n [stopGrace, requestClose],\n );\n\n const hover = useHoverGesture();\n const tap = useTapGesture<boolean>();\n\n // Listeners go on the trigger itself rather than on cloned props, so a\n // component that owns its own handlers keeps them, and no wrapper element\n // sits between the control and its layout.\n useEffect(() => {\n if (anchorRef || !trigger) return;\n watchModality();\n // A mouse press dismisses the label and keeps it away until the pointer\n // leaves; hovering a control you just clicked should not bring it back.\n let suppressed = false;\n // Focus that came from the keyboard holds the label open on its own.\n let keyboardFocus = false;\n\n const onEnter = (event: PointerEvent) => {\n if (!hover.enter(event)) return;\n stopGrace();\n if (closeTimer.current) clearTimeout(closeTimer.current);\n if (!suppressed) requestOpen();\n };\n const onLeave = (event: PointerEvent) => {\n if (!hover.leave(event)) return;\n suppressed = false;\n if (keyboardFocus) return;\n if (openTimer.current) {\n clearTimers();\n return;\n }\n if (latest.current.open && !followCursor) {\n startGrace({ x: event.clientX, y: event.clientY }, trigger, floatingRef.current);\n } else requestClose();\n };\n const onDown = (event: PointerEvent) => {\n tap.start(event, latest.current.open);\n if (event.pointerType === \"mouse\") {\n suppressed = true;\n close();\n }\n };\n // A finger never hovers, and Safari does not focus a button on tap either,\n // so the label is only reachable if the tap itself toggles it. The click\n // carries no pointerType; the pointerdown before it says whether it was a\n // tap, and keyboard activation has none at all.\n const onClick = () => {\n const gesture = tap.take();\n if (!gesture || gesture.pointerType === \"mouse\") return;\n if (gesture.state) close();\n else openNow();\n };\n const onKey = () => tap.drop();\n const onFocusIn = () => {\n if (!focusFromKeyboard()) return;\n keyboardFocus = true;\n openNow(true);\n };\n const onFocusOut = (event: FocusEvent) => {\n if (trigger.contains(event.relatedTarget as Node | null)) return;\n const fromKeyboard = keyboardFocus;\n keyboardFocus = false;\n finish(fromKeyboard);\n };\n\n // Both element kinds dispatch the same events; one type keeps the listeners typed.\n const el = trigger as HTMLElement;\n el.addEventListener(\"pointerenter\", onEnter);\n el.addEventListener(\"pointerleave\", onLeave);\n el.addEventListener(\"pointerdown\", onDown);\n el.addEventListener(\"pointercancel\", tap.drop);\n el.addEventListener(\"click\", onClick);\n el.addEventListener(\"keydown\", onKey);\n el.addEventListener(\"focusin\", onFocusIn);\n el.addEventListener(\"focusout\", onFocusOut);\n return () => {\n el.removeEventListener(\"pointerenter\", onEnter);\n el.removeEventListener(\"pointerleave\", onLeave);\n el.removeEventListener(\"pointerdown\", onDown);\n el.removeEventListener(\"pointercancel\", tap.drop);\n el.removeEventListener(\"click\", onClick);\n el.removeEventListener(\"keydown\", onKey);\n el.removeEventListener(\"focusin\", onFocusIn);\n el.removeEventListener(\"focusout\", onFocusOut);\n };\n }, [\n anchorRef,\n trigger,\n followCursor,\n hover,\n tap,\n requestOpen,\n requestClose,\n openNow,\n close,\n finish,\n clearTimers,\n stopGrace,\n startGrace,\n ]);\n\n // While open, a trigger that turns disabled loses focus without a blur event,\n // and a window that loses focus never reports the pointer leaving.\n useEffect(() => {\n if (!open || anchorRef || !trigger) return;\n const observer = new MutationObserver(() => {\n if (trigger.matches(\":disabled, [aria-disabled='true']\")) close();\n });\n observer.observe(trigger, { attributes: true, attributeFilter: [\"disabled\", \"aria-disabled\"] });\n window.addEventListener(\"blur\", close);\n return () => {\n observer.disconnect();\n window.removeEventListener(\"blur\", close);\n };\n }, [open, anchorRef, trigger, close]);\n\n // A chart drives its own open state and swaps content as it goes; only a\n // trigger-owned label closes itself for having nothing to say.\n useEffect(() => {\n if (disabled || (empty && !anchorRef)) close();\n }, [disabled, empty, anchorRef, close]);\n\n useEffect(\n () => () => {\n clearTimers();\n stopGrace();\n if (current === self.current) current = null;\n },\n [clearTimers, stopGrace],\n );\n\n const insideTooltip = useCallback(\n (target: Element) => Boolean(floatingRef.current?.contains(target)),\n [],\n );\n // ...and closed by the next tap that lands somewhere else, or Escape. The\n // label covers nothing interactive, so that tap passes through to what it hit.\n // Escape is a key press, so the label goes at once.\n const dismiss = useCallback((reason: DismissReason) => finish(reason === \"escape\"), [finish]);\n useDismiss(open, dismiss, anchorObject, { ignore: insideTooltip });\n\n const onContentEnter = useCallback(() => {\n stopGrace();\n clearTimers();\n }, [stopGrace, clearTimers]);\n\n const onContentLeave = useCallback(\n (event: ReactPointerEvent) => {\n const floating = floatingRef.current;\n if (!floating) return;\n if (anchorRef) {\n // Bridge the small gap back onto a chart; it reopens on its own terms.\n clearTimers();\n closeTimer.current = setTimeout(close, 100);\n return;\n }\n startGrace({ x: event.clientX, y: event.clientY }, floating, anchorObject.current);\n },\n [anchorRef, clearTimers, close, startGrace],\n );\n\n const value = useMemo<TooltipContextValue>(\n () => ({\n open,\n instant,\n contentId,\n labelId,\n asLabel,\n empty,\n followCursor,\n anchor,\n triggered: !anchorRef,\n floatingRef,\n pointer,\n setTrigger,\n setEmpty,\n close,\n onContentEnter,\n onContentLeave,\n }),\n [\n open,\n instant,\n contentId,\n labelId,\n asLabel,\n empty,\n followCursor,\n anchor,\n anchorRef,\n pointer,\n close,\n onContentEnter,\n onContentLeave,\n ],\n );\n\n return <TooltipContext.Provider value={value}>{children}</TooltipContext.Provider>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Trigger */\n/* -------------------------------------------------------------------------- */\n\nfunction mergeIds(...ids: unknown[]) {\n return ids.filter((value) => typeof value === \"string\" && value).join(\" \") || undefined;\n}\n\nexport interface TooltipTriggerProps extends ComponentProps<\"button\"> {\n /** Use the single child element as the trigger instead of rendering a button. */\n asChild?: boolean;\n}\n\nexport function TooltipTrigger({ asChild = false, children, ref, ...props }: TooltipTriggerProps) {\n const { open, contentId, labelId, asLabel, empty, setTrigger } =\n useTooltipContext(\"TooltipTrigger\");\n const child = asChild && isValidElement(children) ? children : null;\n const childProps = (child?.props ?? props) as Record<string, unknown>;\n const childRef = child ? (childProps.ref as Ref<TooltipAnchor> | undefined) : undefined;\n const attached = useRef<TooltipAnchor | null>(null);\n\n const setRef = useCallback(\n (element: TooltipAnchor | null) => {\n attached.current = element;\n setTrigger(element);\n assignRef(childRef ?? (ref as Ref<TooltipAnchor> | undefined), element);\n },\n [setTrigger, childRef, ref],\n );\n\n useEffect(() => {\n if (process.env.NODE_ENV !== \"production\" && child && !attached.current) {\n console.warn(\n \"TooltipTrigger: the child did not attach a ref, so the tooltip has nothing to listen to. Render a DOM element or a component that passes `ref` through.\",\n );\n }\n }, [child]);\n\n const aria = asLabel\n ? {\n \"aria-labelledby\": empty ? (childProps[\"aria-labelledby\"] as string | undefined) : labelId,\n }\n : {\n \"aria-describedby\": mergeIds(\n childProps[\"aria-describedby\"],\n open && !empty ? contentId : undefined,\n ),\n };\n\n if (asChild) {\n if (!child) return children;\n return cloneElement(child as ReactElement<Record<string, unknown>>, { ref: setRef, ...aria });\n }\n\n return (\n <button\n type=\"button\"\n data-state={open ? \"open\" : \"closed\"}\n {...props}\n ref={setRef as Ref<HTMLButtonElement>}\n {...aria}\n >\n {children}\n </button>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Content */\n/* -------------------------------------------------------------------------- */\n\nexport interface TooltipContentProps {\n children?: ReactNode;\n /** Preferred side of the anchor. Flips when there is no room. Default: \"top\" */\n side?: TooltipSide;\n /** Alignment along the chosen side. Default: \"center\" */\n align?: TooltipAlign;\n /** Gap between anchor and tooltip (px). */\n sideOffset?: number;\n /** Draw an arrow pointing at the anchor. */\n arrow?: boolean;\n /** Point within the anchor, as fractions of its rendered width and height. */\n anchorPoint?: TooltipPoint;\n /** Classes merged onto the tooltip surface. */\n className?: string;\n}\n\nexport function TooltipContent({\n children,\n side = \"top\",\n align = \"center\",\n sideOffset,\n arrow = false,\n anchorPoint,\n className,\n}: TooltipContentProps) {\n const {\n open,\n instant,\n contentId,\n labelId,\n asLabel,\n followCursor,\n anchor,\n floatingRef,\n pointer,\n setEmpty,\n close,\n onContentEnter,\n onContentLeave,\n } = useTooltipContext(\"TooltipContent\");\n const empty = isEmpty(children);\n const arrowRef = useRef<SVGSVGElement | null>(null);\n\n useLayoutEffect(() => {\n setEmpty(empty);\n }, [empty, setEmpty]);\n\n if (typeof document === \"undefined\") return null;\n\n return createPortal(\n <>\n {/* The name has to exist while the label is closed, so it lives apart from the surface. */}\n {asLabel && !empty ? (\n <span id={labelId} hidden>\n {children}\n </span>\n ) : null}\n {/* `custom` reaches a surface that is already exiting, so a label closed\n from the keyboard or replaced by a neighbour leaves without animating. */}\n <AnimatePresence custom={instant}>\n {open && !empty ? (\n <TooltipPositioner\n key=\"tooltip\"\n anchor={anchor}\n floatingRef={floatingRef}\n arrowRef={arrow ? arrowRef : undefined}\n anchorPoint={anchorPoint}\n followCursor={followCursor}\n side={side}\n align={align}\n sideOffset={sideOffset}\n onDismiss={close}\n pointer={pointer}\n >\n {(positioned, isPresent, placedSide) => (\n <TooltipSurface\n id={asLabel ? undefined : contentId}\n aria-hidden={asLabel || undefined}\n ready={positioned}\n instant={instant}\n onPointerEnter={onContentEnter}\n onPointerLeave={onContentLeave}\n style={{ pointerEvents: isPresent && !followCursor ? \"auto\" : \"none\" }}\n className={cn(\n \"max-w-[min(20rem,calc(100vw-16px))] wrap-break-word whitespace-normal\",\n arrow && \"relative\",\n className,\n )}\n >\n {children}\n {arrow ? <TooltipArrow ref={arrowRef} side={placedSide} /> : null}\n </TooltipSurface>\n )}\n </TooltipPositioner>\n ) : null}\n </AnimatePresence>\n </>,\n document.body,\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Tooltip (root, or one-line shorthand when given `content`) */\n/* -------------------------------------------------------------------------- */\n\nexport interface TooltipProps\n extends TooltipRootProps,\n Omit<TooltipContentProps, \"children\" | \"className\"> {\n /**\n * Shorthand: the tooltip's content. With it, `children` is the trigger\n * element; without it, compose `TooltipTrigger` and `TooltipContent`.\n */\n content?: ReactNode;\n /** Shorthand only: classes for the tooltip surface. */\n className?: string;\n}\n\nexport function Tooltip(props: TooltipProps) {\n if (!(\"content\" in props)) return <TooltipRoot {...props} />;\n const { content, children, side, align, sideOffset, arrow, anchorPoint, className, ...root } =\n props;\n if (!root.anchorRef && !isValidElement(children)) return children ?? null;\n return (\n <TooltipRoot {...root} initialEmpty={isEmpty(content)}>\n {isValidElement(children) ? <TooltipTrigger>{children}</TooltipTrigger> : null}\n <TooltipContent\n side={side}\n align={align}\n sideOffset={sideOffset}\n arrow={arrow}\n anchorPoint={anchorPoint}\n className={className}\n >\n {content}\n </TooltipContent>\n </TooltipRoot>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAYA,SAAgB,UAAU,MAAa,QAAsB;CAG3D,MAAM,MAAM;CACZ,OAAO,KAAK;EACV;GAAE,GAAG,KAAK,IAAI;GAAK,GAAG,KAAK,IAAI;EAAI;EACnC;GAAE,GAAG,KAAK,IAAI;GAAK,GAAG,KAAK,IAAI;EAAI;EACnC;GAAE,GAAG,KAAK,IAAI;GAAK,GAAG,KAAK,IAAI;EAAI;EACnC;GAAE,GAAG,KAAK,IAAI;GAAK,GAAG,KAAK,IAAI;EAAI;EACnC;GAAE,GAAG,OAAO;GAAM,GAAG,OAAO;EAAI;EAChC;GAAE,GAAG,OAAO;GAAO,GAAG,OAAO;EAAI;EACjC;GAAE,GAAG,OAAO;GAAO,GAAG,OAAO;EAAO;EACpC;GAAE,GAAG,OAAO;GAAM,GAAG,OAAO;EAAO;CACrC,CAAC;AACH;AAEA,SAAgB,MAAM,OAAc,KAAU;CAC5C,OAAO,MAAM,KAA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