"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../tslib.es6-C4EgNkz1.js"),e=require("react"),R=require("classnames"),d=require("../utils-C9NL3q0j.js"),c=require("../use-tooltip-Bsf51pP_.js"),P=require("../dialog-previous-button-D-rmw6O1.js");require("react-remove-scroll");require("makeup-screenreader-trap");require("makeup-keyboard-trap");const F=require("../icon-I30uh1Ov.js");require("../icon-button-AJ6dtyvc.js");const $=require("classnames/dedupe"),D=require("../forwardRef-DBQKIlPy.js"),B=require("../lightbox-dialog--Xag7SCa.js"),M=require("../icons/ebay-icon-information-16/index.js"),S=t=>{var{icon:n,className:o,children:i,forwardedRef:u,variant:p}=t,a=g.__rest(t,["icon","className","children","forwardedRef","variant"]);const f=p==="modal"?"dialog--mini":"infotip",s=typeof n=="string"?e.createElement(F.EbayIcon,{name:n}):n,r=i instanceof Function?i({icon:s}):i;return e.createElement("button",Object.assign({},a,{className:$("icon-btn icon-btn--transparent",o,`${f}__host`),type:"button",ref:u}),r||s||null)},E=D.withForwardRef(S),k=({variant:t="default",pointer:n,overlayStyle:o,disabled:i,onExpand:u,onCollapse:p,children:a,initialExpanded:f,icon:s=e.createElement(M.EbayIconInformation16,null),a11yCloseText:r,"aria-label":H,className:j})=>{const y=e.useRef(null),{isExpanded:l,expandTooltip:v,collapseTooltip:m}=c.useTooltip({onCollapse:p,onExpand:u,initialExpanded:f,hostRef:y}),b=t==="modal",O=e.useRef(null),I=d.findComponent(a,T),h=d.findComponent(a,w),q=d.findComponent(a,E)||e.createElement(E),x=()=>{l?m():v()};if(!h)throw new Error("EbayInfotip: Please use a EbayInfotipContent that defines the content of the infotip");const _=h.props,{children:C}=_,N=g.__rest(_,["children"]);return e.createElement(e.Fragment,null,e.createElement(c.Tooltip,{type:"infotip",isExpanded:l,className:R(j,{"dialog--mini":b}),ref:O},e.createElement(c.TooltipHost,null,e.cloneElement(q,Object.assign({ref:y,onClick:x,disabled:i,variant:t,"aria-label":H,"aria-expanded":l,icon:s},q.props))),!b&&e.createElement(c.TooltipContent,Object.assign({},N,{type:"infotip",style:o,pointer:n,showCloseButton:!0,a11yCloseText:r,onClose:m}),I,C)),b&&e.createElement(B.EbayLightboxDialog,Object.assign({},N,{open:l,onClose:m,a11yCloseText:r,className:"dialog--mini__overlay"}),e.createElement(P.EbayDialogHeader,null,I),C))},T=t=>{var{className:n}=t,o=g.__rest(t,["className"]);return e.createElement("span",Object.assign({},o,{className:R("infotip__heading",n)}))},w=({children:t})=>e.createElement(e.Fragment,null,t);exports.EbayInfotip=k;exports.EbayInfotipContent=w;exports.EbayInfotipHeading=T;exports.EbayInfotipHost=E;
