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"../../Heading/Heading.js";import m from"../../Text/Text.js";import{useModal as l}from"../context/ModalContext.js";import d from"../../../../components/layout/dist/Flex/Flex.js";import p from"../../../../components/icon/dist/Icon/Icon.js";var f=o((function(o,f){var j=o.title,u=o.description,g=o.descriptionIcon,x=o.className,_=o.id,E=o["data-testid"],I=l(),y=I.modalId,N=I.setDescriptionId,b=I.setTitleId,h=_?"".concat(y,"_").concat(_,"_label"):"".concat(y,"_label"),H=_?"".concat(y,"_").concat(_,"_desc"):"".concat(y,"_desc");return s((function(){y&&(b(h),u&&N(H))}),[y,b,h,u,N,H]),e.createElement(d,{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(c,{id:h,align:"inherit",type:"h2",weight:"medium",maxLines:2,className:r.title},j):j,u&&e.createElement(d,{id:H},g&&e.createElement(p,{icon:"object"===t(g)?g.name:g,className:a(r.descriptionIcon,"object"===t(g)&&g.className)}),"string"==typeof u?e.createElement(m,{element:"span",align:"inherit",type:"text1"},u):u))}));export{f as default};
//# sourceMappingURL=ModalHeader.js.map
