react-dialog-polyfill
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e||self).reactDialogPolyfill={},e.react)}(this,function(e,n){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=/*#__PURE__*/t(n);function r(){return r=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},r.apply(this,arguments)}var u=function(){return"undefined"!=typeof document&&document.head},f=["children","open","ready","onCancel","onClose","useAsModal"],l=n.forwardRef(function(e,t){var l,c,a=e.children,i=e.open,d=e.ready,s=e.onCancel,p=e.onClose,y=e.useAsModal,h=function(e,n){if(null==e)return{};var t,o,r={},u=Object.keys(e);for(o=0;o<u.length;o++)n.indexOf(t=u[o])>=0||(r[t]=e[t]);return r}(e,f);return l="dialog:not([open]){display: none;}",c=n.useRef(),n.useEffect(function(){if(u())return c.current=document.createElement("style"),c.current.innerHTML=l,document.head.appendChild(c.current),function(){u()&&c.current&&document.head.removeChild(c.current)}},[l]),n.useEffect(function(){var e=t.current;e&&d&&e.open!==i&&(i?y?function(){return e.showModal()}:function(){return e.show()}:function(){return e.close()})()},[d,i,t,y]),/*#__PURE__*/o.default.createElement("dialog",r({},h,{ref:t,onCancel:function(e){e.preventDefault(),s(e,t.current)},onClose:function(e){p(e,t.current)}}),a)});l.defaultProps={onClose:function(){},onCancel:function(){}};var c=function(e){var t=n.createRef(),u=n.useState(),f=u[0],c=u[1];return n.useEffect(function(){var e=t.current;if(!f&&e){var n=!0;return("undefined"!=typeof window&&window.HTMLDialogElement?Promise.resolve():import("dialog-polyfill")).then(function(n){n&&n.default.registerDialog(e)}).catch(function(e){console.warn("dialog-polyfill could not be loaded",e)}).finally(function(){n&&c(!0)}),function(){return n=!1}}},[t,f]),/*#__PURE__*/o.default.createElement(l,r({},e,{ready:f,ref:t}))};e.Dialog=function(e){/*#__PURE__*/return o.default.createElement(c,r({},e,{useAsModal:!1}))},e.Modal=function(e){/*#__PURE__*/return o.default.createElement(c,r({},e,{useAsModal:!0}))}}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e||self).reactDialogPolyfill={},e.react)}(this,function(e,n){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=/*#__PURE__*/t(n);function r(){return r=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},r.apply(this,arguments)}var f=function(){return"undefined"!=typeof window&&!!window.HTMLDialogElement},u=0,i="_rdp",l=function(){return"undefined"!=typeof document&&document.head},c=["children","open","_rd","onCancel","onClose","_md"],a=n.forwardRef(function(e,t){var a=e.children,d=e.open,s=e._rd,p=e.onCancel,m=e.onClose,h=e._md,y=function(e,n){if(null==e)return{};var t,o,r={},f=Object.keys(e);for(o=0;o<f.length;o++)n.indexOf(t=f[o])>=0||(r[t]=e[t]);return r}(e,c);return n.useEffect(function(){if(l()&&!f()){if(u<=0){var e=document.createElement("style");e.innerHTML="dialog:not([open]){display: none;}",e.id=i,document.head.appendChild(e)}return u++,function(){if(u--,l()&&!(u>0)){var e=document.getElementById(i);elelement&&document.head.removeChild(e)}}}},[]),n.useEffect(function(){var e=t.current;e&&s&&e.open!==d&&(d?h?function(){return e.showModal()}:function(){return e.show()}:function(){return e.close()})()},[s,d,t,h]),/*#__PURE__*/o.default.createElement("dialog",r({},y,{ref:t,onCancel:function(e){e.preventDefault(),p(e,t.current)},onClose:function(e){m(e,t.current)}}),a)});a.defaultProps={onClose:function(){},onCancel:function(){}};var d=function(e){var t=n.createRef(),u=n.useState(),i=u[0],l=u[1];return n.useEffect(function(){var e=t.current;if(!i&&e){var n=!0;return(f()?Promise.resolve():import("dialog-polyfill")).then(function(n){n&&n.default.registerDialog(e)}).catch(function(e){console.warn("dialog-polyfill could not be loaded",e)}).finally(function(){n&&l(!0)}),function(){return n=!1}}},[t,i]),/*#__PURE__*/o.default.createElement(a,r({},e,{_rd:i,ref:t}))};e.Dialog=function(e){/*#__PURE__*/return o.default.createElement(d,r({},e,{_md:!1}))},e.Modal=function(e){/*#__PURE__*/return o.default.createElement(d,r({},e,{_md:!0}))}}); |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e||self).reactDialogPolyfill={},e.react)}(this,function(e,n){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=/*#__PURE__*/t(n);function o(){return o=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},o.apply(this,arguments)}var u=function(){return"undefined"!=typeof document&&document.head},f=["children","open","ready","onCancel","onClose","useAsModal"],c=n.forwardRef(function(e,t){var c,a,i=e.children,l=e.open,d=e.ready,s=e.onCancel,p=e.onClose,y=e.useAsModal,h=function(e,n){if(null==e)return{};var t,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)n.indexOf(t=u[r])>=0||(o[t]=e[t]);return o}(e,f);return c="dialog:not([open]){display: none;}",a=n.useRef(),n.useEffect(function(){if(u())return a.current=document.createElement("style"),a.current.innerHTML=c,document.head.appendChild(a.current),function(){u()&&a.current&&document.head.removeChild(a.current)}},[c]),n.useEffect(function(){var e=t.current;e&&d&&e.open!==l&&(l?y?function(){return e.showModal()}:function(){return e.show()}:function(){return e.close()})()},[d,l,t,y]),/*#__PURE__*/r.default.createElement("dialog",o({},h,{ref:t,onCancel:function(e){e.preventDefault(),s(e,t.current)},onClose:function(e){p(e,t.current)}}),i)});c.defaultProps={onClose:function(){},onCancel:function(){}};var a=function(e){var t=n.createRef(),u=n.useState(),f=u[0],a=u[1];return n.useEffect(function(){var e=t.current;if(!f&&e){var n=!0;return("undefined"!=typeof window&&window.HTMLDialogElement?Promise.resolve():import("dialog-polyfill")).then(function(n){n&&n.default.registerDialog(e)}).catch(function(e){}).finally(function(){n&&a(!0)}),function(){return n=!1}}},[t,f]),/*#__PURE__*/r.default.createElement(c,o({},e,{ready:f,ref:t}))};e.Dialog=function(e){/*#__PURE__*/return r.default.createElement(a,o({},e,{useAsModal:!1}))},e.Modal=function(e){/*#__PURE__*/return r.default.createElement(a,o({},e,{useAsModal:!0}))}}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e||self).reactDialogPolyfill={},e.react)}(this,function(e,n){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=/*#__PURE__*/t(n);function o(){return o=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},o.apply(this,arguments)}var f=function(){return"undefined"!=typeof window&&!!window.HTMLDialogElement},u=0,i="_rdp",c=function(){return"undefined"!=typeof document&&document.head},l=["children","open","_rd","onCancel","onClose","_md"],a=n.forwardRef(function(e,t){var a=e.children,d=e.open,s=e._rd,p=e.onCancel,m=e.onClose,h=e._md,v=function(e,n){if(null==e)return{};var t,r,o={},f=Object.keys(e);for(r=0;r<f.length;r++)n.indexOf(t=f[r])>=0||(o[t]=e[t]);return o}(e,l);return n.useEffect(function(){if(c()&&!f()){if(u<=0){var e=document.createElement("style");e.innerHTML="dialog:not([open]){display: none;}",e.id=i,document.head.appendChild(e)}return u++,function(){if(u--,c()&&!(u>0)){var e=document.getElementById(i);elelement&&document.head.removeChild(e)}}}},[]),n.useEffect(function(){var e=t.current;e&&s&&e.open!==d&&(d?h?function(){return e.showModal()}:function(){return e.show()}:function(){return e.close()})()},[s,d,t,h]),/*#__PURE__*/r.default.createElement("dialog",o({},v,{ref:t,onCancel:function(e){e.preventDefault(),p(e,t.current)},onClose:function(e){m(e,t.current)}}),a)});a.defaultProps={onClose:function(){},onCancel:function(){}};var d=function(e){var t=n.createRef(),u=n.useState(),i=u[0],c=u[1];return n.useEffect(function(){var e=t.current;if(!i&&e){var n=!0;return(f()?Promise.resolve():import("dialog-polyfill")).then(function(n){n&&n.default.registerDialog(e)}).catch(function(e){}).finally(function(){n&&c(!0)}),function(){return n=!1}}},[t,i]),/*#__PURE__*/r.default.createElement(a,o({},e,{_rd:i,ref:t}))};e.Dialog=function(e){/*#__PURE__*/return r.default.createElement(d,o({},e,{_md:!1}))},e.Modal=function(e){/*#__PURE__*/return r.default.createElement(d,o({},e,{_md:!0}))}}); |
@@ -1,1 +0,1 @@ | ||
import n,{useRef as e,useEffect as r,forwardRef as t,createRef as o,useState as u}from"react";function c(){return c=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t])}return n},c.apply(this,arguments)}var l=function(){return"undefined"!=typeof document&&document.head},i=["children","open","ready","onCancel","onClose","useAsModal"],a=t(function(t,o){var u,a,f=t.children,d=t.open,s=t.ready,p=t.onCancel,m=t.onClose,h=t.useAsModal,v=function(n,e){if(null==n)return{};var r,t,o={},u=Object.keys(n);for(t=0;t<u.length;t++)e.indexOf(r=u[t])>=0||(o[r]=n[r]);return o}(t,i);return u="dialog:not([open]){display: none;}",a=e(),r(function(){if(l())return a.current=document.createElement("style"),a.current.innerHTML=u,document.head.appendChild(a.current),function(){l()&&a.current&&document.head.removeChild(a.current)}},[u]),r(function(){var n=o.current;n&&s&&n.open!==d&&(d?h?function(){return n.showModal()}:function(){return n.show()}:function(){return n.close()})()},[s,d,o,h]),/*#__PURE__*/n.createElement("dialog",c({},v,{ref:o,onCancel:function(n){n.preventDefault(),p(n,o.current)},onClose:function(n){m(n,o.current)}}),f)});a.defaultProps={onClose:function(){},onCancel:function(){}};var f=function(e){var t=o(),l=u(),i=l[0],f=l[1];return r(function(){var n=t.current;if(!i&&n){var e=!0;return("undefined"!=typeof window&&window.HTMLDialogElement?Promise.resolve():import("dialog-polyfill")).then(function(e){e&&e.default.registerDialog(n)}).catch(function(n){console.warn("dialog-polyfill could not be loaded",n)}).finally(function(){e&&f(!0)}),function(){return e=!1}}},[t,i]),/*#__PURE__*/n.createElement(a,c({},e,{ready:i,ref:t}))},d=function(e){/*#__PURE__*/return n.createElement(f,c({},e,{useAsModal:!0}))},s=function(e){/*#__PURE__*/return n.createElement(f,c({},e,{useAsModal:!1}))};export{s as Dialog,d as Modal}; | ||
import n,{useEffect as e,forwardRef as t,createRef as r,useState as o}from"react";function i(){return i=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},i.apply(this,arguments)}var u=function(){return"undefined"!=typeof window&&!!window.HTMLDialogElement},c=0,l=function(){return"undefined"!=typeof document&&document.head},a=["children","open","_rd","onCancel","onClose","_md"],f=t(function(t,r){var o=t.children,f=t.open,d=t._rd,m=t.onCancel,p=t.onClose,s=t._md,v=function(n,e){if(null==n)return{};var t,r,o={},i=Object.keys(n);for(r=0;r<i.length;r++)e.indexOf(t=i[r])>=0||(o[t]=n[t]);return o}(t,a);return e(function(){if(l()&&!u()){if(c<=0){var n=document.createElement("style");n.innerHTML="dialog:not([open]){display: none;}",n.id="_rdp",document.head.appendChild(n)}return c++,function(){if(c--,l()&&!(c>0)){var n=document.getElementById("_rdp");elelement&&document.head.removeChild(n)}}}},[]),e(function(){var n=r.current;n&&d&&n.open!==f&&(f?s?function(){return n.showModal()}:function(){return n.show()}:function(){return n.close()})()},[d,f,r,s]),/*#__PURE__*/n.createElement("dialog",i({},v,{ref:r,onCancel:function(n){n.preventDefault(),m(n,r.current)},onClose:function(n){p(n,r.current)}}),o)});f.defaultProps={onClose:function(){},onCancel:function(){}};var d=function(t){var c=r(),l=o(),a=l[0],d=l[1];return e(function(){var n=c.current;if(!a&&n){var e=!0;return(u()?Promise.resolve():import("dialog-polyfill")).then(function(e){e&&e.default.registerDialog(n)}).catch(function(n){console.warn("dialog-polyfill could not be loaded",n)}).finally(function(){e&&d(!0)}),function(){return e=!1}}},[c,a]),/*#__PURE__*/n.createElement(f,i({},t,{_rd:a,ref:c}))},m=function(e){/*#__PURE__*/return n.createElement(d,i({},e,{_md:!0}))},p=function(e){/*#__PURE__*/return n.createElement(d,i({},e,{_md:!1}))};export{p as Dialog,m as Modal}; |
@@ -1,1 +0,1 @@ | ||
import n,{useRef as e,useEffect as r,forwardRef as t,createRef as o,useState as u}from"react";function c(){return c=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t])}return n},c.apply(this,arguments)}var i=function(){return"undefined"!=typeof document&&document.head},a=["children","open","ready","onCancel","onClose","useAsModal"],l=t(function(t,o){var u,l,f=t.children,d=t.open,s=t.ready,p=t.onCancel,m=t.onClose,h=t.useAsModal,v=function(n,e){if(null==n)return{};var r,t,o={},u=Object.keys(n);for(t=0;t<u.length;t++)e.indexOf(r=u[t])>=0||(o[r]=n[r]);return o}(t,a);return u="dialog:not([open]){display: none;}",l=e(),r(function(){if(i())return l.current=document.createElement("style"),l.current.innerHTML=u,document.head.appendChild(l.current),function(){i()&&l.current&&document.head.removeChild(l.current)}},[u]),r(function(){var n=o.current;n&&s&&n.open!==d&&(d?h?function(){return n.showModal()}:function(){return n.show()}:function(){return n.close()})()},[s,d,o,h]),/*#__PURE__*/n.createElement("dialog",c({},v,{ref:o,onCancel:function(n){n.preventDefault(),p(n,o.current)},onClose:function(n){m(n,o.current)}}),f)});l.defaultProps={onClose:function(){},onCancel:function(){}};var f=function(e){var t=o(),i=u(),a=i[0],f=i[1];return r(function(){var n=t.current;if(!a&&n){var e=!0;return("undefined"!=typeof window&&window.HTMLDialogElement?Promise.resolve():import("dialog-polyfill")).then(function(e){e&&e.default.registerDialog(n)}).catch(function(n){}).finally(function(){e&&f(!0)}),function(){return e=!1}}},[t,a]),/*#__PURE__*/n.createElement(l,c({},e,{ready:a,ref:t}))},d=function(e){/*#__PURE__*/return n.createElement(f,c({},e,{useAsModal:!0}))},s=function(e){/*#__PURE__*/return n.createElement(f,c({},e,{useAsModal:!1}))};export{s as Dialog,d as Modal}; | ||
import n,{useEffect as e,forwardRef as t,createRef as r,useState as o}from"react";function u(){return u=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},u.apply(this,arguments)}var i=function(){return"undefined"!=typeof window&&!!window.HTMLDialogElement},c=0,l=function(){return"undefined"!=typeof document&&document.head},f=["children","open","_rd","onCancel","onClose","_md"],a=t(function(t,r){var o=t.children,a=t.open,d=t._rd,m=t.onCancel,p=t.onClose,s=t._md,v=function(n,e){if(null==n)return{};var t,r,o={},u=Object.keys(n);for(r=0;r<u.length;r++)e.indexOf(t=u[r])>=0||(o[t]=n[t]);return o}(t,f);return e(function(){if(l()&&!i()){if(c<=0){var n=document.createElement("style");n.innerHTML="dialog:not([open]){display: none;}",n.id="_rdp",document.head.appendChild(n)}return c++,function(){if(c--,l()&&!(c>0)){var n=document.getElementById("_rdp");elelement&&document.head.removeChild(n)}}}},[]),e(function(){var n=r.current;n&&d&&n.open!==a&&(a?s?function(){return n.showModal()}:function(){return n.show()}:function(){return n.close()})()},[d,a,r,s]),/*#__PURE__*/n.createElement("dialog",u({},v,{ref:r,onCancel:function(n){n.preventDefault(),m(n,r.current)},onClose:function(n){p(n,r.current)}}),o)});a.defaultProps={onClose:function(){},onCancel:function(){}};var d=function(t){var c=r(),l=o(),f=l[0],d=l[1];return e(function(){var n=c.current;if(!f&&n){var e=!0;return(i()?Promise.resolve():import("dialog-polyfill")).then(function(e){e&&e.default.registerDialog(n)}).catch(function(n){}).finally(function(){e&&d(!0)}),function(){return e=!1}}},[c,f]),/*#__PURE__*/n.createElement(a,u({},t,{_rd:f,ref:c}))},m=function(e){/*#__PURE__*/return n.createElement(d,u({},e,{_md:!0}))},p=function(e){/*#__PURE__*/return n.createElement(d,u({},e,{_md:!1}))};export{p as Dialog,m as Modal}; |
{ | ||
"name": "react-dialog-polyfill", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "<dialog> element bundled with polyfill for React", | ||
"main": "lib/index.js", | ||
"module": "lib/index.module.js", | ||
"sideEffects": false, | ||
"sideEffects": ["./src/use-inject-style.js"], | ||
"src": "src/index.js", | ||
@@ -9,0 +9,0 @@ "types": "lib/index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19898