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