UNPKG

primereact

Version:

PrimeReact is an open source UI library for React featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with Prime

2 lines (1 loc) 24.6 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),n=require("primereact/componentbase"),r=require("primereact/csstransition"),o=require("primereact/hooks"),i=require("primereact/utils"),a=require("primereact/icons/times"),l=require("primereact/icons/windowmaximize"),c=require("primereact/icons/windowminimize"),s=require("primereact/portal"),u=require("primereact/ripple");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var m=p(e),f=d(e),g=p(t);function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},b.apply(this,arguments)}function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e){if(Array.isArray(e))return h(e)}function x(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function O(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}function w(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){if("object"!==y(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function D(e){var t=E(e,"string");return"symbol"===y(t)?t:String(t)}function S(e,t,n){return(t=D(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e){if(Array.isArray(e))return e}function j(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return l}}function z(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function I(e,t){return P(e)||j(e,t)||O(e,t)||z()}var k=n.ComponentBase.extend({defaultProps:{__TYPE:"FocusTrap",children:void 0},css:{styles:""},getProps:function(e){return i.ObjectUtils.getMergedProps(e,k.defaultProps)},getOtherProps:function(e){return i.ObjectUtils.getDiffProps(e,k.defaultProps)}});function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var H=m.default.memo(m.default.forwardRef((function(e,n){var r=m.default.useRef(null),a=m.default.useRef(null),l=m.default.useRef(null),c=m.default.useContext(t.PrimeReactContext),s=k.getProps(e,c),u={props:s};o.useStyle(k.css.styles,{name:"focustrap"});k.setMetaData(R({},u));m.default.useImperativeHandle(n,(function(){return{props:s,getInk:function(){return a.current},getTarget:function(){return r.current}}})),o.useMountEffect((function(){s.disabled||(r.current=y(),h(r.current))}));var p,d,f,g,b,y=function(){return a.current&&a.current.parentElement},h=function(e){var t=s||{},n=t.autoFocusSelector,r=t.firstFocusableSelector,o=void 0===r?"":r,a=t.autoFocus,l=void 0!==a&&a,c="".concat(v(void 0===n?"":n)),u="[autofocus]".concat(c,", [data-pc-autofocus='true']").concat(c),p=i.DomHandler.getFirstFocusableElement(e,u);l&&!p&&(p=i.DomHandler.getFirstFocusableElement(e,v(o))),i.DomHandler.focus(p)},v=function(e){return':not(.p-hidden-focusable):not([data-p-hidden-focusable="true"])'.concat(null!=e?e:"")},x=function(e){var t,n=e.currentTarget,o=e.relatedTarget,a=o!==n.$_pfocustrap_firsthiddenfocusableelement&&null!==(t=r.current)&&void 0!==t&&t.contains(o)?n.$_pfocustrap_firsthiddenfocusableelement:i.DomHandler.getLastFocusableElement(n.parentElement,v(n.$_pfocustrap_focusableselector));i.DomHandler.focus(a)};return d=void 0===(p=(s||{}).tabIndex)?0:p,g=(f=function(e,t){return m.default.createElement("span",{ref:"firstfocusableelement"===t?a:l,className:"p-hidden-accessible p-hidden-focusable",tabIndex:d,role:"presentation","aria-hidden":!0,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0,onFocus:e,"data-pc-section":t})})((function(e){var t,n=e.currentTarget,o=e.relatedTarget,a=o!==n.$_pfocustrap_lasthiddenfocusableelement&&null!==(t=r.current)&&void 0!==t&&t.contains(o)?n.$_pfocustrap_lasthiddenfocusableelement:i.DomHandler.getFirstFocusableElement(n.parentElement,v(n.$_pfocustrap_focusableselector));i.DomHandler.focus(a)}),"firstfocusableelement"),b=f(x,"lastfocusableelement"),g.ref.current&&b.ref.current&&(g.ref.current.$_pfocustrap_lasthiddenfocusableelement=b.ref.current,b.ref.current.$_pfocustrap_firsthiddenfocusableelement=g.ref.current),m.default.createElement(m.default.Fragment,null,g,s.children,b)})));function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var M=n.ComponentBase.extend({defaultProps:{__TYPE:"Dialog",__parentMetadata:null,appendTo:null,ariaCloseIconLabel:null,baseZIndex:0,blockScroll:!1,breakpoints:null,className:null,closable:!0,closeIcon:null,closeOnEscape:!0,content:null,contentClassName:null,contentStyle:null,dismissableMask:!1,draggable:!0,focusOnShow:!0,footer:null,footerClassName:null,header:null,headerClassName:null,headerStyle:null,icons:null,id:null,keepInViewport:!0,maskClassName:null,maskStyle:null,maximizable:!1,maximizeIcon:null,maximized:!1,minX:0,minY:0,minimizeIcon:null,modal:!0,onClick:null,onDrag:null,onDragEnd:null,onDragStart:null,onHide:null,onMaskClick:null,onMaximize:null,onResize:null,onResizeEnd:null,onResizeStart:null,onShow:null,position:"center",resizable:!0,rtl:!1,showHeader:!0,style:null,transitionOptions:null,visible:!1,children:void 0},css:{classes:{closeButtonIcon:"p-dialog-header-close-icon",closeButton:"p-dialog-header-icon p-dialog-header-close p-link",maximizableIcon:"p-dialog-header-maximize-icon",maximizableButton:"p-dialog-header-icon p-dialog-header-maximize p-link",header:function(e){return i.classNames("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return i.classNames("p-dialog-content",e.props.contentClassName)},footer:function(e){return i.classNames("p-dialog-footer",e.props.footerClassName)},mask:function(e){var t=e.props,n=e.maskVisibleState,r=["center","left","right","top","top-left","top-right","bottom","bottom-left","bottom-right"].find((function(e){return e===t.position||e.replace("-","")===t.position}));return i.classNames("p-dialog-mask",r?"p-dialog-".concat(r):"",{"p-component-overlay p-component-overlay-enter":t.modal,"p-dialog-visible":n,"p-dialog-draggable":t.draggable,"p-dialog-resizable":t.resizable},t.maskClassName)},root:function(e){var t=e.maximized,n=e.context;return i.classNames("p-dialog p-component",{"p-dialog-rtl":e.props.rtl,"p-dialog-maximized":t,"p-dialog-default":!t,"p-input-filled":n&&"filled"===n.inputStyle||"filled"===g.default.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===g.default.ripple})},transition:"p-dialog"},styles:"\n@layer primereact {\n .p-dialog-mask {\n background-color: transparent;\n transition-property: background-color;\n }\n\n .p-dialog-visible {\n display: flex;\n }\n\n .p-dialog-mask.p-component-overlay {\n pointer-events: auto;\n }\n\n .p-dialog {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n max-height: 90%;\n transform: scale(1);\n position: relative;\n }\n\n .p-dialog-content {\n overflow-y: auto;\n flex-grow: 1;\n }\n\n .p-dialog-header {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .p-dialog-footer {\n flex-shrink: 0;\n }\n\n .p-dialog .p-dialog-header-icons {\n display: flex;\n align-items: center;\n align-self: flex-start;\n flex-shrink: 0;\n }\n\n .p-dialog .p-dialog-header-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n }\n\n .p-dialog .p-dialog-title {\n flex-grow: 1;\n }\n\n /* Fluid */\n .p-fluid .p-dialog-footer .p-button {\n width: auto;\n }\n\n /* Animation */\n /* Center */\n .p-dialog-enter {\n opacity: 0;\n transform: scale(0.7);\n }\n\n .p-dialog-enter-active {\n opacity: 1;\n transform: scale(1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n }\n\n .p-dialog-enter-done {\n transform: none;\n }\n\n .p-dialog-exit-active {\n opacity: 0;\n transform: scale(0.7);\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Top, Bottom, Left, Right, Top* and Bottom* */\n .p-dialog-top .p-dialog,\n .p-dialog-bottom .p-dialog,\n .p-dialog-left .p-dialog,\n .p-dialog-right .p-dialog,\n .p-dialog-top-left .p-dialog,\n .p-dialog-top-right .p-dialog,\n .p-dialog-bottom-left .p-dialog,\n .p-dialog-bottom-right .p-dialog {\n margin: 0.75em;\n }\n\n .p-dialog-top .p-dialog-enter,\n .p-dialog-top .p-dialog-exit-active {\n transform: translate3d(0px, -100%, 0px);\n }\n\n .p-dialog-bottom .p-dialog-enter,\n .p-dialog-bottom .p-dialog-exit-active {\n transform: translate3d(0px, 100%, 0px);\n }\n\n .p-dialog-left .p-dialog-enter,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-enter,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-enter,\n .p-dialog-bottom-left .p-dialog-exit-active {\n transform: translate3d(-100%, 0px, 0px);\n }\n\n .p-dialog-right .p-dialog-enter,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-enter,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-enter,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transform: translate3d(100%, 0px, 0px);\n }\n\n .p-dialog-top .p-dialog-enter-active,\n .p-dialog-bottom .p-dialog-enter-active,\n .p-dialog-left .p-dialog-enter-active,\n .p-dialog-top-left .p-dialog-enter-active,\n .p-dialog-bottom-left .p-dialog-enter-active,\n .p-dialog-right .p-dialog-enter-active,\n .p-dialog-top-right .p-dialog-enter-active,\n .p-dialog-bottom-right .p-dialog-enter-active {\n transform: translate3d(0px, 0px, 0px);\n transition: all 0.3s ease-out;\n }\n\n .p-dialog-top .p-dialog-exit-active,\n .p-dialog-bottom .p-dialog-exit-active,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-exit-active,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transition: all 0.3s ease-out;\n }\n\n /* Maximize */\n .p-dialog-maximized {\n transition: none;\n transform: none;\n margin: 0;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n }\n\n .p-dialog-maximized .p-dialog-content {\n flex-grow: 1;\n }\n\n .p-confirm-dialog .p-dialog-content {\n display: flex;\n align-items: center;\n }\n\n /* Resizable */\n .p-dialog .p-resizable-handle {\n position: absolute;\n font-size: 0.1px;\n display: block;\n cursor: se-resize;\n width: 12px;\n height: 12px;\n right: 1px;\n bottom: 1px;\n }\n\n .p-dialog-draggable .p-dialog-header {\n cursor: move;\n }\n}\n",inlineStyles:{mask:function(e){var t=e.props;return N({position:"fixed",height:"100%",width:"100%",left:0,top:0,display:"flex",justifyContent:"left"===t.position||"top-left"===t.position||"bottom-left"===t.position?"flex-start":"right"===t.position||"top-right"===t.position||"bottom-right"===t.position?"flex-end":"center",alignItems:"top"===t.position||"top-left"===t.position||"top-right"===t.position?"flex-start":"bottom"===t.position||"bottom-left"===t.position||"bottom-right"===t.position?"flex-end":"center",pointerEvents:!t.modal&&"none"},t.maskStyle)}}}});function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var F=f.forwardRef((function(e,p){var d=o.useMergeProps(),m=f.useContext(t.PrimeReactContext),y=M.getProps(e,m),h=y.id?y.id:i.UniqueComponentId(),E=I(f.useState(h),2),D=E[0],S=I(f.useState(!1),2),P=S[0],j=S[1],z=I(f.useState(!1),2),k=z[0],C=z[1],R=I(f.useState(y.maximized),2),_=R[0],N=R[1],T=f.useRef(null),F=f.useRef(null),U=f.useRef(null),X=f.useRef(null),A=f.useRef(null),L=f.useRef(null),q=f.useRef(null),Y=f.useRef(!1),$=f.useRef(!1),V=f.useRef(null),Z=f.useRef(null),J=f.useRef(null),W=f.useRef(h),G=f.useRef(null),K=y.onMaximize?y.maximized:_,Q=k&&(y.blockScroll||y.maximizable&&K),ee=y.closable&&y.closeOnEscape&&k,te=o.useDisplayOrder("dialog",ee),ne=M.setMetaData(B(B({props:y},y.__parentMetadata),{},{state:{id:D,maximized:K,containerVisible:P}})),re=ne.ptm,oe=ne.cx,ie=ne.sx,ae=ne.isUnstyled;n.useHandleStyle(M.css.styles,ae,{name:"dialog"}),o.useGlobalOnEscapeKey({callback:function(e){ve(e)},when:ee&&te,priority:[o.ESC_KEY_HANDLING_PRIORITIES.DIALOG,te]});var le=I(o.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return ze(e)}}),2),ce=le[0],se=le[1],ue=I(o.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Ie(e)}}),2),pe=ue[0],de=ue[1],me=I(o.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return De(e)}}),2),fe=me[0],ge=me[1],be=I(o.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Se(e)}}),2),ye=be[0],he=be[1],ve=function(e){y.onHide(),e.preventDefault()},xe=function(e){U.current=e.target,y.onPointerDown&&y.onPointerDown(e)},Oe=function(e){y.dismissableMask&&y.modal&&F.current===e.target&&!U.current&&ve(e),y.onMaskClick&&y.onMaskClick(e),U.current=null},we=function(e){y.onMaximize?y.onMaximize({originalEvent:e,maximized:!K}):N((function(e){return!e})),e.preventDefault()},Ee=function(e){i.DomHandler.hasClass(e.target,"p-dialog-header-icon")||i.DomHandler.hasClass(e.target.parentElement,"p-dialog-header-icon")||y.draggable&&(Y.current=!0,V.current=e.pageX,Z.current=e.pageY,T.current.style.margin="0",i.DomHandler.addClass(document.body,"p-unselectable-text"),y.onDragStart&&y.onDragStart(e))},De=function(e){if(Y.current){var t=i.DomHandler.getOuterWidth(T.current),n=i.DomHandler.getOuterHeight(T.current),r=e.pageX-V.current,o=e.pageY-Z.current,a=T.current.getBoundingClientRect(),l=a.left+r,c=a.top+o,s=i.DomHandler.getViewport(),u=getComputedStyle(T.current),p=parseFloat(u.marginLeft),d=parseFloat(u.marginTop);T.current.style.position="fixed",y.keepInViewport?(l>=y.minX&&l+t<s.width&&(V.current=e.pageX,T.current.style.left=l-p+"px"),c>=y.minY&&c+n<s.height&&(Z.current=e.pageY,T.current.style.top=c-d+"px")):(V.current=e.pageX,T.current.style.left=l-p+"px",Z.current=e.pageY,T.current.style.top=c-d+"px"),y.onDrag&&y.onDrag(e)}},Se=function(e){Y.current&&(Y.current=!1,i.DomHandler.removeClass(document.body,"p-unselectable-text"),y.onDragEnd&&y.onDragEnd(e))},Pe=function(e){y.resizable&&($.current=!0,V.current=e.pageX,Z.current=e.pageY,i.DomHandler.addClass(document.body,"p-unselectable-text"),y.onResizeStart&&y.onResizeStart(e))},je=function(e,t,n){!n&&(n=i.DomHandler.getViewport());var r=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?r*(n[t]/100):r},ze=function(e){if($.current){var t=e.pageX-V.current,n=e.pageY-Z.current,r=i.DomHandler.getOuterWidth(T.current),o=i.DomHandler.getOuterHeight(T.current),a=T.current.getBoundingClientRect(),l=i.DomHandler.getViewport(),c=!parseInt(T.current.style.top)||!parseInt(T.current.style.left),s=je(T.current.style.minWidth,"width",l),u=je(T.current.style.minHeight,"height",l),p=r+t,d=o+n;c&&(p+=t,d+=n),(!s||p>s)&&a.left+p<l.width&&(T.current.style.width=p+"px"),(!u||d>u)&&a.top+d<l.height&&(T.current.style.height=d+"px"),V.current=e.pageX,Z.current=e.pageY,y.onResize&&y.onResize(e)}},Ie=function(e){$.current&&($.current=!1,i.DomHandler.removeClass(document.body,"p-unselectable-text"),y.onResizeEnd&&y.onResizeEnd(e))},ke=function(){T.current.style.position="",T.current.style.left="",T.current.style.top="",T.current.style.margin=""},Ce=function(){T.current.setAttribute(W.current,"")},Re=function(){var e;y.onShow&&y.onShow(),y.focusOnShow&&!((e=document.activeElement)&&T.current&&T.current.contains(e))&&y.closable&&y.showHeader&&q.current&&q.current.focus(),Ne()},He=function(){y.modal&&!ae()&&i.DomHandler.addClass(F.current,"p-component-overlay-leave")},_e=function(){Y.current=!1,i.ZIndexUtils.clear(F.current),j(!1),Me(),i.DomHandler.focus(G.current),G.current=null},Ne=function(){Be()},Me=function(){Fe()},Te=function(e){if(e&&k){var t={id:D,hasBlockScroll:Q};document.primeDialogParams||(document.primeDialogParams=[]);var n=document.primeDialogParams.findIndex((function(e){return e.id===D}));document.primeDialogParams=-1===n?[].concat(v(r=document.primeDialogParams)||x(r)||O(r)||w(),[t]):document.primeDialogParams.toSpliced(n,1,t)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==D}));var r;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?i.DomHandler.blockBodyScroll():i.DomHandler.unblockBodyScroll()},Be=function(){y.draggable&&(fe(),ye()),y.resizable&&(ce(),pe())},Fe=function(){ge(),he(),se(),de()},Ue=function(){J.current=i.DomHandler.createInlineStyle(m&&m.nonce||g.default.nonce,m&&m.styleContainer);var e="";for(var t in y.breakpoints)e+="\n @media screen and (max-width: ".concat(t,') {\n [data-pc-name="dialog"][').concat(W.current,"] {\n width: ").concat(y.breakpoints[t]," !important;\n }\n }\n ");J.current.innerHTML=e};o.useMountEffect((function(){Te(!0),y.visible&&j(!0)})),f.useEffect((function(){return y.breakpoints&&Ue(),function(){J.current=i.DomHandler.removeInlineStyle(J.current)}}),[y.breakpoints]),o.useUpdateEffect((function(){y.visible&&!P&&j(!0),y.visible!==k&&P&&C(y.visible),y.visible&&(G.current=document.activeElement)}),[y.visible,P]),o.useUpdateEffect((function(){P&&(i.ZIndexUtils.set("modal",F.current,m&&m.autoZIndex||g.default.autoZIndex,y.baseZIndex||m&&m.zIndex.modal||g.default.zIndex.modal),C(!0))}),[P]),o.useUpdateEffect((function(){Te(!0)}),[Q,k]),o.useUnmountEffect((function(){Me(),Te(!1),i.DomHandler.removeInlineStyle(J.current),i.ZIndexUtils.clear(F.current)})),f.useImperativeHandle(p,(function(){return{props:y,resetPosition:ke,getElement:function(){return T.current},getMask:function(){return F.current},getContent:function(){return X.current},getHeader:function(){return A.current},getFooter:function(){return L.current},getCloseButton:function(){return q.current}}}));var Xe=function(){if(y.closable){var e=y.ariaCloseIconLabel||t.ariaLabel("close"),n=d({className:oe("closeButtonIcon"),"aria-hidden":!0},re("closeButtonIcon")),r=i.IconUtils.getJSXIcon(y.closeIcon||f.createElement(a.TimesIcon,n),B({},n),{props:y}),o=d({ref:q,type:"button",className:oe("closeButton"),"aria-label":e,onClick:ve,onKeyDown:function(e){"Escape"!==e.key&&e.stopPropagation()}},re("closeButton"));return f.createElement("button",o,r,f.createElement(u.Ripple,null))}return null},Ae=function(){var e=d({className:oe("maximizableIcon")},re("maximizableIcon")),t=i.IconUtils.getJSXIcon(K?y.minimizeIcon||f.createElement(c.WindowMinimizeIcon,e):y.maximizeIcon||f.createElement(l.WindowMaximizeIcon,e),e,{props:y});if(y.maximizable){var n=d({type:"button",className:oe("maximizableButton"),onClick:we},re("maximizableButton"));return f.createElement("button",n,t,f.createElement(u.Ripple,null))}return null},Le=function(){if(y.showHeader){var e=Xe(),t=Ae(),n=i.ObjectUtils.getJSXElement(y.icons,y),r=i.ObjectUtils.getJSXElement(y.header,y),o=D+"_header",a=d({ref:A,style:y.headerStyle,className:oe("header"),onMouseDown:Ee},re("header")),l=d({id:o,className:oe("headerTitle")},re("headerTitle")),c=d({className:oe("headerIcons")},re("headerIcons"));return f.createElement("div",a,f.createElement("div",l,r),f.createElement("div",c,n,t,e))}return null},qe=function(){var e=i.ObjectUtils.getJSXElement(y.footer,y),t=d({ref:L,className:oe("footer")},re("footer"));return e&&f.createElement("div",t,e)};return P&&function(){var t,n,o,a,l,c,u=D+"_header",p=D+"_content",g={enter:"center"===y.position?150:300,exit:"center"===y.position?150:300},h=d({ref:F,style:ie("mask"),className:oe("mask"),onPointerUp:Oe},re("mask")),v=d({ref:T,id:D,className:i.classNames(y.className,oe("root",{props:y,maximized:K,context:m})),style:y.style,onClick:y.onClick,role:"dialog","aria-labelledby":u,"aria-describedby":p,"aria-modal":y.modal,onPointerDown:xe},M.getOtherProps(y),re("root")),x=d({classNames:oe("transition"),timeout:g,in:k,options:y.transitionOptions,unmountOnExit:!0,onEnter:Ce,onEntered:Re,onExiting:He,onExited:_e},re("transition")),O=null;null!=e&&e.content?(c={header:y.header,content:y.message,message:null==y||null===(l=y.children)||void 0===l||null===(l=l[1])||void 0===l||null===(l=l.props)||void 0===l?void 0:l.children},O=i.ObjectUtils.getJSXElement(e.content,{headerRef:A,contentRef:X,footerRef:L,closeRef:q,hide:ve,message:c})):(n=Le(),t=d({id:D+"_content",ref:X,style:y.contentStyle,className:oe("content")},re("content")),o=f.createElement("div",t,y.children),a=qe(),O=f.createElement(f.Fragment,null,n,o,a,y.resizable?f.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Pe}):null));var w=f.createElement("div",h,f.createElement(r.CSSTransition,b({nodeRef:T},x),f.createElement("div",v,f.createElement(H,{autoFocus:y.focusOnShow},O))));return f.createElement(s.Portal,{element:w,appendTo:y.appendTo,visible:!0})}()}));F.displayName="Dialog",exports.Dialog=F;