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