'use client';import { Content, Provider, Root, Trigger, Portal } from '@radix-ui/react-tooltip';
import { cx } from '@onbeam/styled-system/css';
import { forwardRef, useRef, useState, useEffect } from 'react';
import { TooltipIcon } from '@onbeam/icons';
import { tooltip, customScrollbar } from '@onbeam/styled-system/recipes';
import { useHasTouch } from '@onbeam/utils';
import { jsx, jsxs } from 'react/jsx-runtime';

var i=forwardRef(({className:r,...n},p)=>{let s=tooltip();return jsx(Content,{ref:p,className:cx(s.tooltip,r),...n})});i.displayName=Content.displayName;var D=forwardRef(({label:r,width:n,children:p,disabled:s},C)=>{let l=useHasTouch(),e=useRef(null),f=useRef(),[g,a]=useState(!1),h=tooltip();return useEffect(()=>{if(!e.current)return;e.current.getRootNode().nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(f.current=e.current.getRootNode());},[]),jsx(Provider,{delayDuration:l?0:250,children:jsxs(Root,{open:s?!1:g,onOpenChange:a,children:[jsx(Trigger,{ref:e,asChild:!0,onClick:t=>{l&&(t.preventDefault(),a(!0));},children:p??jsx("button",{type:"button",className:h.icon,children:jsx(TooltipIcon,{height:16,width:16})})}),jsx(Portal,{container:f.current,children:jsx(i,{onWheel:t=>t.stopPropagation(),onTouchMove:t=>t.stopPropagation(),ref:C,style:{width:n},className:customScrollbar(),side:"bottom",sideOffset:4,children:r})})]})})});D.displayName="Tooltip";var A={Root:Root,Trigger:Trigger,Content:i,Provider:Provider};

export { D as a, A as b };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-O5727WE6.js.map