import{slicedToArray as o}from"../../../_virtual/_rollupPluginBabelHelpers.js";import i,{forwardRef as e,useRef as t,useState as a,useCallback as n}from"react";import{Info as r}from"@vibe/icons";import l from"../IconButton/IconButton.js";import{Dialog as s}from"@vibe/dialog/mockedClassNames";import"../../../_virtual/_tslib.js";import"classnames";import"../Link/Link.js";import"./components/InfoLink/InfoLink.module.scss.js";import d from"./components/InfoDialogContent/InfoDialogContent.js";import{ComponentDefaultTestId as c,ComponentVibeId as m}from"../../tests/constants.js";import{getTestId as u}from"../../tests/testIds.js";import f from"../../hooks/useMergeRef.js";var p=e((function(e,p){var b=e.id,g=e.className,v=e.title,k=e.body,y=e.link,I=e["aria-label"],h=e["aria-labelledby"],j=e.position,D=void 0===j?"bottom-start":j,N=e.disabled,B=void 0!==N&&N,L=e.onDialogShow,C=e.onDialogHide,E=e.hideButtonTooltip,H=e.dialogClassName,T=e.containerSelector,S=e["data-testid"],_=t(null),w=f(p,_),x=t(null),F=t(null),A=a(!1),O=o(A,2),P=O[0],R=O[1],q=b?"".concat(b,"-dialog"):void 0,z=n((function(){R(!0),null==L||L(),requestAnimationFrame((function(){var o;null===(o=F.current)||void 0===o||o.focus()}))}),[L]),M=n((function(o){var i;R(!1),null==C||C(),"Escape"===o.key&&(null===(i=_.current)||void 0===i||i.focus())}),[C]);return i.createElement(s,{ref:x,id:q,disable:B,position:D,moveBy:{main:4,secondary:0},showTrigger:["click"],hideTrigger:["click","clickoutside","esckey"],onDialogDidShow:z,onDialogDidHide:M,containerSelector:T,content:i.createElement(d,{ref:F,id:q,title:v,body:k,link:y,className:H}),hideWhenReferenceHidden:!0},i.createElement(l,{ref:w,id:b,className:g,icon:r,size:"xs",kind:"tertiary",active:P,disabled:B,ariaLabel:I,ariaLabeledBy:h,ariaControls:q,ariaHasPopup:"dialog",ariaExpanded:P,"data-testid":S||u(c.INFO,b),"data-vibe":m.INFO,hideTooltip:E}))}));export{p as default};
//# sourceMappingURL=Info.js.map
