import{typeof as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import t,{forwardRef as a,useEffect as o}from"react";import s from"classnames";import{getTestId as i}from"../../../tests/testIds.js";import{ComponentDefaultTestId as r}from"../../../tests/constants.js";import c from"./ModalHeader.module.scss.js";import{Flex as m}from"@vibe/layout/mockedClassNames";import n from"../../Heading/Heading.js";import l from"../../Text/Text.js";import{Icon as d}from"@vibe/icon/mockedClassNames";import{useModal as p}from"../context/ModalContext.js";var f=a((function(a,f){var u=a.title,g=a.description,_=a.descriptionIcon,j=a.className,x=a.id,E=a["data-testid"],N=p(),b=N.modalId,y=N.setDescriptionId,I=N.setTitleId,h=x?"".concat(b,"_").concat(x,"_label"):"".concat(b,"_label"),v=x?"".concat(b,"_").concat(x,"_desc"):"".concat(b,"_desc");return o((function(){b&&(I(h),g&&y(v))}),[b,I,h,g,y,v]),t.createElement(m,{gap:"xs",direction:"column",align:"start",ref:f,className:s(c.header,j),id:x,"data-testid":E||i(r.MODAL_NEXT_HEADER,x)},"string"==typeof u?t.createElement(n,{id:h,align:"inherit",type:"h2",weight:"medium",maxLines:2,className:c.title},u):u,g&&t.createElement(m,{id:v},_&&t.createElement(d,{icon:"object"===e(_)?_.name:_,className:s(c.descriptionIcon,"object"===e(_)&&_.className)}),"string"==typeof g?t.createElement(l,{element:"span",align:"inherit",type:"text1"},g):g))}));export{f as default};
//# sourceMappingURL=ModalHeader.js.map
