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