@anoki/fse-ui
Version:
FSE UI components library
3 lines (2 loc) • 1.55 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./components/ui/InfoPopup/InfoPopup.css');const t=require("./index.cjs180.js"),a=require("react"),c=require("./index.cjs182.js");;/* empty css */const p=require("./index.cjs116.js"),f=({title:d="Info",description:o,isOpen:s=!1,onClickCloseBtn:e,className:l="",positionPopUp:x="right"})=>{const n=a.useRef(null),i=a.useRef(null);return a.useEffect(()=>{var u;const r=m=>{m.key==="Escape"&&s&&(e==null||e())};return s?(i.current=document.activeElement,(u=n.current)==null||u.focus(),document.addEventListener("keydown",r)):i.current&&i.current.focus(),()=>{document.removeEventListener("keydown",r)}},[s,e]),s?t.jsxRuntimeExports.jsx("div",{className:c.clsx("popupContainer",s?"open":"close",l),onClick:r=>{r.stopPropagation()},children:t.jsxRuntimeExports.jsxs("div",{ref:n,role:"dialog","aria-modal":"true","aria-labelledby":"dialog-title","aria-describedby":"dialog-description",className:c.clsx("dialog",`position-${x}`),tabIndex:-1,children:[t.jsxRuntimeExports.jsxs("div",{className:"header",children:[t.jsxRuntimeExports.jsx("h3",{id:"dialog-title",className:"title",children:d}),t.jsxRuntimeExports.jsx("button",{onClick:r=>{r.stopPropagation(),e==null||e()},className:"closeButton","aria-label":"Close dialog",children:t.jsxRuntimeExports.jsx(p.Close,{className:"closeIcon"})})]}),o&&t.jsxRuntimeExports.jsx("div",{id:"dialog-description",className:"content",children:o})]})}):null};exports.InfoPopup=f;
//# sourceMappingURL=index.cjs66.js.map