import{slicedToArray as e,defineProperty as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import o,{forwardRef as i,useRef as r,useState as n,useEffect as s,useMemo as a,Fragment as l}from"react";import m from"classnames";import{AnimationType as d,HideShowEvent as p}from"../Dialog/DialogConstants.js";import c from"../../hooks/useMergeRef.js";import u from"../Tooltip/Tooltip.js";import f from"../IconButton/IconButton.js";import h from"./TipseenTitle.js";import{TipseenCloseButtonTheme as v,TipseenColor as T,TIPSEEN_CLOSE_BUTTON_ARIA_LABEL as g}from"./TipseenConstants.js";import{withStaticProps as y}from"../../types/withStaticProps.js";import"../../utils/colors-vars-map.js";import{ComponentDefaultTestId as C}from"../../tests/constants.js";import{getTestId as j}from"../../tests/testIds.js";import w from"../Text/Text.js";import N from"./Tipseen.module.scss.js";import{TooltipPositions as E}from"../Tooltip/TooltipConstants.js";import x from"../../../packages/icons/dist/react/CloseSmall.js";var W=o.createContext("primary"),k=y(i((function(i,d){var p=i.className,v=i.id,T=i.position,y=void 0===T?"bottom":T,E=i.animationType,k=void 0===E?"expand":E,B=i.hideDelay,D=void 0===B?0:B,S=i.showDelay,A=void 0===S?100:S,b=i.title,P=i.titleClassName,I=i.hideCloseButton,H=i.closeButtonTheme,R=void 0===H?"light":H,L=i.onClose,M=i.closeAriaLabel,O=i.children,_=void 0===O?null:O,z=i.content,q=i.containerSelector,F=i.hideTrigger,G=void 0===F?[]:F,J=i.showTrigger,K=void 0===J?[]:J,Q=i.width,U=i.moveBy,V=i.hideWhenReferenceHidden,X=void 0!==V&&V,Y=i.referenceWrapperClassName,Z=i.tip,$=void 0===Z||Z,ee=i.tooltipArrowClassName,te=i.modifiers,oe=void 0===te?[]:te,ie=i.floating,re=void 0!==ie&&ie,ne=i.color,se=i["data-testid"],ae=null!=ne?ne:"inverted",le=Array.isArray(K)&&Array.isArray(G)&&0===K.length&&A>0,me=r(null),de=c(d,me),pe=n(!le),ce=e(pe,2),ue=ce[0],fe=ce[1],he=M||g;s((function(){var e;return A&&(e=setTimeout((function(){fe(!0)}),A)),function(){clearTimeout(e)}}),[A,fe]);var ve=a((function(){return"inverted"===ae?"onInverted":"onPrimary"}),[ae]),Te=a((function(){return"light"===R?"inverted"===ae?"on-inverted-background":"on-primary-color":R}),[ae,R]),ge=d||v?"div":l,ye=o.createElement("div",null,o.createElement("div",{className:m(N.tipseenHeader)},I?null:o.createElement(f,{hideTooltip:!0,className:m(N.tipseenCloseButton,t({},N.dark,"dark"===R||"fixed-dark"===R)),onClick:L,size:"xs",kind:"tertiary",color:Te,ariaLabel:he,icon:x}),o.createElement(h,{text:b,className:m(N.tipseenTitle,P)})),o.createElement(w,{color:ve,type:"text2",element:"p",className:m(N.tipseenContent)},o.createElement(W.Provider,{value:ae},z)));return o.createElement(ge,{ref:de,id:v,"data-testid":se||j(C.TIPSEEN,v)},o.createElement(u,{className:m(N.tipseenWrapper,p,t(t({},N.tipseenWrapperWithoutCustomWidth,!Q),N.floating,re)),maxWidth:Q,arrowClassName:ee,style:Q?{width:Q}:void 0,shouldShowOnMount:!le,position:y,animationType:k,hideDelay:D,showDelay:0,hideTrigger:G,showTrigger:K,showOnDialogEnter:!1,content:ye,theme:"inverted"===ae?"dark":"primary",containerSelector:q,disableDialogSlide:!1,moveBy:U,hideWhenReferenceHidden:X,referenceWrapperClassName:Y,tip:$&&!re,modifiers:oe,open:le?ue:void 0,forceRenderWithoutChildren:re},_))})),{closeButtonThemes:v,animationTypes:d,hideShowTriggers:p,colors:T,positions:E});export{W as TipseenContext,k as default};
//# sourceMappingURL=Tipseen.js.map
