Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/common/components/InlineConfirm",["module","exports","require","@frontend-taglib-clay$clayui/button","@liferay/frontend-js-react-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./Button"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({cancelButtonLabel:e,confirmButtonLabel:t,message:n,onCancelButtonClick:u,onConfirmButtonClick:l}){const[i,f]=(0,a.useState)(!1),d=(0,a.useRef)(null),s=(0,o.useIsMounted)();return(0,a.useEffect)((()=>{d.current&&d.current.focus()}),[]),(0,a.useEffect)((()=>{if(d.current){const e=d.current.querySelector("page-editor__inline-confirm-button");e&&e.focus()}const e=()=>{requestAnimationFrame((()=>{d.current&&!i&&(d.current.contains(document.activeElement)||d.current===document.activeElement||u())}))};return document.addEventListener("focusout",e,!0),()=>window.removeEventListener("focusout",e,!0)}),[i,u]),a.default.createElement("div",{className:"page-editor__inline-confirm",onKeyDown:e=>"Escape"===e.key&&u(),ref:d,role:"alertdialog",tabIndex:"-1"},a.default.createElement("p",{className:"text-center text-secondary"},a.default.createElement("strong",null,n)),a.default.createElement(r.default.Group,{spaced:!0},a.default.createElement(c.default,{className:"page-editor__inline-confirm-button",disabled:i,displayType:"primary",loading:i,onClick:()=>{d.current&&d.current.focus(),f(!0),l().then((()=>{s()&&f(!1)}))},small:!0},t),a.default.createElement(c.default,{disabled:i,displayType:"secondary",onClick:u,small:!0,type:"button"},e)))};var r=l(n("@frontend-taglib-clay$clayui/button")),o=n("@liferay/frontend-js-react-web"),a=(l(n("liferay!frontend-js-react-web$prop-types")),function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=r?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react"))),c=l(n("./Button"));function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function l(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=InlineConfirm.js.map