diff --git a/CHANGELOG.md b/CHANGELOG.md index dc2e7cc..956b9f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2.1.1-next] - 2021-06-08 +## [2.1.3-next] - 2021-06-08 ### Changed - Update material-ui peer-dep to alpha.36 diff --git a/dist/index.js b/dist/index.js index 0848f3c..b0eec62 100644 --- a/dist/index.js +++ b/dist/index.js @@ -11,11 +11,11 @@ object-assign (c) Sindre Sorhus @license MIT -*/var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function s(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,a,u=s(e),l=1;l=0||(i[n]=e[n]);return i}function p(){return(p=Object.assign||function(e){for(var t=1;t<+~=|^:(),"'`\s])/g,E="undefined"!=typeof CSS&&CSS.escape,B=function(e){return E?E(e):e.replace(j,"\\$1")},A=function(){function e(e,t,n){this.type="style",this.key=void 0,this.isProcessed=!1,this.style=void 0,this.renderer=void 0,this.renderable=void 0,this.options=void 0;var r=n.sheet,i=n.Renderer;this.key=e,this.options=n,this.style=t,r?this.renderer=r.renderer:i&&(this.renderer=new i)}return e.prototype.prop=function(e,t,n){if(void 0===t)return this.style[e];var r=!!n&&n.force;if(!r&&this.style[e]===t)return this;var i=t;n&&!1===n.process||(i=this.options.jss.plugins.onChangeValue(t,e,this));var o=null==i||!1===i,s=e in this.style;if(o&&!s&&!r)return this;var a=o&&s;if(a?delete this.style[e]:this.style[e]=i,this.renderable&&this.renderer)return a?this.renderer.removeProperty(this.renderable,e):this.renderer.setProperty(this.renderable,e,i),this;var u=this.options.sheet;return u&&u.attached,this},e}(),_=function(e){function t(t,n,r){var i;(i=e.call(this,t,n,r)||this).selectorText=void 0,i.id=void 0,i.renderable=void 0;var o=r.selector,s=r.scoped,a=r.sheet,u=r.generateId;return o?i.selectorText=o:!1!==s&&(i.id=u(x(x(i)),a),i.selectorText="."+B(i.id)),i}b(t,e);var n=t.prototype;return n.applyTo=function(e){var t=this.renderer;if(t){var n=this.toJSON();for(var r in n)t.setProperty(e,r,n[r])}return this},n.toJSON=function(){var e={};for(var t in this.style){var n=this.style[t];"object"!=typeof n?e[t]=n:Array.isArray(n)&&(e[t]=O(n))}return e},n.toString=function(e){var t=this.options.sheet,n=!!t&&t.options.link?p({},e,{allowEmpty:!0}):e;return R(this.selectorText,this.style,n)},m(t,[{key:"selector",set:function(e){if(e!==this.selectorText){this.selectorText=e;var t=this.renderer,n=this.renderable;if(n&&t)t.setSelector(n,e)||t.replaceRule(n,this)}},get:function(){return this.selectorText}}]),t}(A),I={onCreateRule:function(e,t,n){return"@"===e[0]||n.parent&&"keyframes"===n.parent.type?null:new _(e,t,n)}},N={indent:1,children:!0},T=/@([\w-]+)/,M=function(){function e(e,t,n){this.type="conditional",this.at=void 0,this.key=void 0,this.query=void 0,this.rules=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0,this.key=e;var r=e.match(T);for(var i in this.at=r?r[1]:"unknown",this.query=n.name||"@"+this.at,this.options=n,this.rules=new oe(p({},n,{parent:this})),t)this.rules.add(i,t[i]);this.rules.process()}var t=e.prototype;return t.getRule=function(e){return this.rules.get(e)},t.indexOf=function(e){return this.rules.indexOf(e)},t.addRule=function(e,t,n){var r=this.rules.add(e,t,n);return r?(this.options.jss.plugins.onProcessRule(r),r):null},t.toString=function(e){if(void 0===e&&(e=N),null==e.indent&&(e.indent=N.indent),null==e.children&&(e.children=N.children),!1===e.children)return this.query+" {}";var t=this.rules.toString(e);return t?this.query+" {\n"+t+"\n}":""},e}(),q=/@media|@supports\s+/,D={onCreateRule:function(e,t,n){return q.test(e)?new M(e,t,n):null}},L={indent:1,children:!0},U=/@keyframes\s+([\w-]+)/,$=function(){function e(e,t,n){this.type="keyframes",this.at="@keyframes",this.key=void 0,this.name=void 0,this.id=void 0,this.rules=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0;var r=e.match(U);r&&r[1]?this.name=r[1]:this.name="noname",this.key=this.type+"-"+this.name,this.options=n;var i=n.scoped,o=n.sheet,s=n.generateId;for(var a in this.id=!1===i?this.name:B(s(this,o)),this.rules=new oe(p({},n,{parent:this})),t)this.rules.add(a,t[a],p({},n,{parent:this}));this.rules.process()}return e.prototype.toString=function(e){if(void 0===e&&(e=L),null==e.indent&&(e.indent=L.indent),null==e.children&&(e.children=L.children),!1===e.children)return this.at+" "+this.id+" {}";var t=this.rules.toString(e);return t&&(t="\n"+t+"\n"),this.at+" "+this.id+" {"+t+"}"},e}(),G=/@keyframes\s+/,V=/\$([\w-]+)/g,W=function(e,t){return"string"==typeof e?e.replace(V,(function(e,n){return n in t?t[n]:e})):e},z=function(e,t,n){var r=e[t],i=W(r,n);i!==r&&(e[t]=i)},F={onCreateRule:function(e,t,n){return"string"==typeof e&&G.test(e)?new $(e,t,n):null},onProcessStyle:function(e,t,n){return"style"===t.type&&n?("animation-name"in e&&z(e,"animation-name",n.keyframes),"animation"in e&&z(e,"animation",n.keyframes),e):e},onChangeValue:function(e,t,n){var r=n.options.sheet;if(!r)return e;switch(t){case"animation":case"animation-name":return W(e,r.keyframes);default:return e}}},J=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i=this.index)t.push(e);else for(var r=0;rn)return void t.splice(r,0,e)},t.reset=function(){this.registry=[]},t.remove=function(e){var t=this.registry.indexOf(e);this.registry.splice(t,1)},t.toString=function(e){for(var t=void 0===e?{}:e,n=t.attached,r=d(t,["attached"]),i="",o=0;o0){var n=function(e,t){for(var n=0;nt.index&&r.options.insertionPoint===t.insertionPoint)return r}return null}(t,e);if(n&&n.renderer)return{parent:n.renderer.element.parentNode,node:n.renderer.element};if((n=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(r.attached&&r.options.insertionPoint===t.insertionPoint)return r}return null}(t,e))&&n.renderer)return{parent:n.renderer.element.parentNode,node:n.renderer.element.nextSibling}}var r=e.insertionPoint;if(r&&"string"==typeof r){var i=function(e){for(var t=ge(),n=0;nn?n:t},Pe=function(){function e(e){this.getPropertyValue=he,this.setProperty=ye,this.removeProperty=ve,this.setSelector=me,this.element=void 0,this.sheet=void 0,this.hasInsertedRules=!1,this.cssRules=[],e&&ue.add(e),this.sheet=e;var t=this.sheet?this.sheet.options:{},n=t.media,r=t.meta,i=t.element;this.element=i||function(){var e=document.createElement("style");return e.textContent="\n",e}(),this.element.setAttribute("data-jss",""),n&&this.element.setAttribute("media",n),r&&this.element.setAttribute("data-meta",r);var o=xe();o&&this.element.setAttribute("nonce",o)}var t=e.prototype;return t.attach=function(){if(!this.element.parentNode&&this.sheet){!function(e,t){var n=t.insertionPoint,r=be(t);if(!1!==r&&r.parent)r.parent.insertBefore(e,r.node);else if(n&&"number"==typeof n.nodeType){var i=n,o=i.parentNode;o&&o.insertBefore(e,i.nextSibling)}else ge().appendChild(e)}(this.element,this.sheet.options);var e=Boolean(this.sheet&&this.sheet.deployed);this.hasInsertedRules&&e&&(this.hasInsertedRules=!1,this.deploy())}},t.detach=function(){if(this.sheet){var e=this.element.parentNode;e&&e.removeChild(this.element),this.sheet.options.link&&(this.cssRules=[],this.element.textContent="\n")}},t.deploy=function(){var e=this.sheet;e&&(e.options.link?this.insertRules(e.rules):this.element.textContent="\n"+e.toString()+"\n")},t.insertRules=function(e,t){for(var n=0;n=0||(i[n]=e[n]);return i}function p(){return(p=Object.assign||function(e){for(var t=1;t<+~=|^:(),"'`\s])/g,E="undefined"!=typeof CSS&&CSS.escape,B=function(e){return E?E(e):e.replace(j,"\\$1")},A=function(){function e(e,t,n){this.type="style",this.key=void 0,this.isProcessed=!1,this.style=void 0,this.renderer=void 0,this.renderable=void 0,this.options=void 0;var r=n.sheet,i=n.Renderer;this.key=e,this.options=n,this.style=t,r?this.renderer=r.renderer:i&&(this.renderer=new i)}return e.prototype.prop=function(e,t,n){if(void 0===t)return this.style[e];var r=!!n&&n.force;if(!r&&this.style[e]===t)return this;var i=t;n&&!1===n.process||(i=this.options.jss.plugins.onChangeValue(t,e,this));var o=null==i||!1===i,s=e in this.style;if(o&&!s&&!r)return this;var a=o&&s;if(a?delete this.style[e]:this.style[e]=i,this.renderable&&this.renderer)return a?this.renderer.removeProperty(this.renderable,e):this.renderer.setProperty(this.renderable,e,i),this;var u=this.options.sheet;return u&&u.attached,this},e}(),I=function(e){function t(t,n,r){var i;(i=e.call(this,t,n,r)||this).selectorText=void 0,i.id=void 0,i.renderable=void 0;var o=r.selector,s=r.scoped,a=r.sheet,u=r.generateId;return o?i.selectorText=o:!1!==s&&(i.id=u(x(x(i)),a),i.selectorText="."+B(i.id)),i}b(t,e);var n=t.prototype;return n.applyTo=function(e){var t=this.renderer;if(t){var n=this.toJSON();for(var r in n)t.setProperty(e,r,n[r])}return this},n.toJSON=function(){var e={};for(var t in this.style){var n=this.style[t];"object"!=typeof n?e[t]=n:Array.isArray(n)&&(e[t]=O(n))}return e},n.toString=function(e){var t=this.options.sheet,n=!!t&&t.options.link?p({},e,{allowEmpty:!0}):e;return R(this.selectorText,this.style,n)},m(t,[{key:"selector",set:function(e){if(e!==this.selectorText){this.selectorText=e;var t=this.renderer,n=this.renderable;if(n&&t)t.setSelector(n,e)||t.replaceRule(n,this)}},get:function(){return this.selectorText}}]),t}(A),_={onCreateRule:function(e,t,n){return"@"===e[0]||n.parent&&"keyframes"===n.parent.type?null:new I(e,t,n)}},N={indent:1,children:!0},T=/@([\w-]+)/,M=function(){function e(e,t,n){this.type="conditional",this.at=void 0,this.key=void 0,this.query=void 0,this.rules=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0,this.key=e;var r=e.match(T);for(var i in this.at=r?r[1]:"unknown",this.query=n.name||"@"+this.at,this.options=n,this.rules=new oe(p({},n,{parent:this})),t)this.rules.add(i,t[i]);this.rules.process()}var t=e.prototype;return t.getRule=function(e){return this.rules.get(e)},t.indexOf=function(e){return this.rules.indexOf(e)},t.addRule=function(e,t,n){var r=this.rules.add(e,t,n);return r?(this.options.jss.plugins.onProcessRule(r),r):null},t.toString=function(e){if(void 0===e&&(e=N),null==e.indent&&(e.indent=N.indent),null==e.children&&(e.children=N.children),!1===e.children)return this.query+" {}";var t=this.rules.toString(e);return t?this.query+" {\n"+t+"\n}":""},e}(),q=/@media|@supports\s+/,D={onCreateRule:function(e,t,n){return q.test(e)?new M(e,t,n):null}},L={indent:1,children:!0},U=/@keyframes\s+([\w-]+)/,$=function(){function e(e,t,n){this.type="keyframes",this.at="@keyframes",this.key=void 0,this.name=void 0,this.id=void 0,this.rules=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0;var r=e.match(U);r&&r[1]?this.name=r[1]:this.name="noname",this.key=this.type+"-"+this.name,this.options=n;var i=n.scoped,o=n.sheet,s=n.generateId;for(var a in this.id=!1===i?this.name:B(s(this,o)),this.rules=new oe(p({},n,{parent:this})),t)this.rules.add(a,t[a],p({},n,{parent:this}));this.rules.process()}return e.prototype.toString=function(e){if(void 0===e&&(e=L),null==e.indent&&(e.indent=L.indent),null==e.children&&(e.children=L.children),!1===e.children)return this.at+" "+this.id+" {}";var t=this.rules.toString(e);return t&&(t="\n"+t+"\n"),this.at+" "+this.id+" {"+t+"}"},e}(),G=/@keyframes\s+/,V=/\$([\w-]+)/g,W=function(e,t){return"string"==typeof e?e.replace(V,(function(e,n){return n in t?t[n]:e})):e},z=function(e,t,n){var r=e[t],i=W(r,n);i!==r&&(e[t]=i)},F={onCreateRule:function(e,t,n){return"string"==typeof e&&G.test(e)?new $(e,t,n):null},onProcessStyle:function(e,t,n){return"style"===t.type&&n?("animation-name"in e&&z(e,"animation-name",n.keyframes),"animation"in e&&z(e,"animation",n.keyframes),e):e},onChangeValue:function(e,t,n){var r=n.options.sheet;if(!r)return e;switch(t){case"animation":case"animation-name":return W(e,r.keyframes);default:return e}}},J=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i=this.index)t.push(e);else for(var r=0;rn)return void t.splice(r,0,e)},t.reset=function(){this.registry=[]},t.remove=function(e){var t=this.registry.indexOf(e);this.registry.splice(t,1)},t.toString=function(e){for(var t=void 0===e?{}:e,n=t.attached,r=d(t,["attached"]),i="",o=0;o0){var n=function(e,t){for(var n=0;nt.index&&r.options.insertionPoint===t.insertionPoint)return r}return null}(t,e);if(n&&n.renderer)return{parent:n.renderer.element.parentNode,node:n.renderer.element};if((n=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(r.attached&&r.options.insertionPoint===t.insertionPoint)return r}return null}(t,e))&&n.renderer)return{parent:n.renderer.element.parentNode,node:n.renderer.element.nextSibling}}var r=e.insertionPoint;if(r&&"string"==typeof r){var i=function(e){for(var t=ge(),n=0;nn?n:t},Pe=function(){function e(e){this.getPropertyValue=he,this.setProperty=ye,this.removeProperty=ve,this.setSelector=me,this.element=void 0,this.sheet=void 0,this.hasInsertedRules=!1,this.cssRules=[],e&&ue.add(e),this.sheet=e;var t=this.sheet?this.sheet.options:{},n=t.media,r=t.meta,i=t.element;this.element=i||function(){var e=document.createElement("style");return e.textContent="\n",e}(),this.element.setAttribute("data-jss",""),n&&this.element.setAttribute("media",n),r&&this.element.setAttribute("data-meta",r);var o=xe();o&&this.element.setAttribute("nonce",o)}var t=e.prototype;return t.attach=function(){if(!this.element.parentNode&&this.sheet){!function(e,t){var n=t.insertionPoint,r=be(t);if(!1!==r&&r.parent)r.parent.insertBefore(e,r.node);else if(n&&"number"==typeof n.nodeType){var i=n,o=i.parentNode;o&&o.insertBefore(e,i.nextSibling)}else ge().appendChild(e)}(this.element,this.sheet.options);var e=Boolean(this.sheet&&this.sheet.deployed);this.hasInsertedRules&&e&&(this.hasInsertedRules=!1,this.deploy())}},t.detach=function(){if(this.sheet){var e=this.element.parentNode;e&&e.removeChild(this.element),this.sheet.options.link&&(this.cssRules=[],this.element.textContent="\n")}},t.deploy=function(){var e=this.sheet;e&&(e.options.link?this.insertRules(e.rules):this.element.textContent="\n"+e.toString()+"\n")},t.insertRules=function(e,t){for(var n=0;n{n[e]&&(i[e]=`${t[e]} ${n[e]}`)}),i}var Ee={set:(e,t,n,r)=>{let i=e.get(t);i||(i=new Map,e.set(t,i)),i.set(n,r)},get:(e,t,n)=>{const r=e.get(t);return r?r.get(n):void 0},delete:(e,t,n)=>{e.get(t).delete(n)}};var Be=r.createContext(null);var Ae="function"==typeof Symbol&&Symbol.for?Symbol.for("mui.nested"):"__THEME_NESTED__";const _e=["checked","disabled","error","focused","focusVisible","required","expanded","selected"];var Ie=Date.now(),Ne="fnValues"+Ie,Te="fnStyle"+ ++Ie,Me=function(){return{onCreateRule:function(e,t,n){if("function"!=typeof t)return null;var r=P(e,{},n);return r[Te]=t,r},onProcessStyle:function(e,t){if(Ne in t||Te in t)return e;var n={};for(var r in e){var i=e[r];"function"==typeof i&&(delete e[r],n[r]=i)}return t[Ne]=n,e},onUpdate:function(e,t,n,r){var i=t,o=i[Te];o&&(i.style=o(e)||{});var s=i[Ne];if(s)for(var a in s)i.prop(a,s[a](e),r)}}},qe="@global",De=function(){function e(e,t,n){for(var r in this.type="global",this.at=qe,this.rules=void 0,this.options=void 0,this.key=void 0,this.isProcessed=!1,this.key=e,this.options=n,this.rules=new oe(p({},n,{parent:this})),t)this.rules.add(r,t[r]);this.rules.process()}var t=e.prototype;return t.getRule=function(e){return this.rules.get(e)},t.addRule=function(e,t,n){var r=this.rules.add(e,t,n);return r&&this.options.jss.plugins.onProcessRule(r),r},t.indexOf=function(e){return this.rules.indexOf(e)},t.toString=function(){return this.rules.toString()},e}(),Le=function(){function e(e,t,n){this.type="global",this.at=qe,this.options=void 0,this.rule=void 0,this.isProcessed=!1,this.key=void 0,this.key=e,this.options=n;var r=e.substr("@global ".length);this.rule=n.jss.createRule(r,t,p({},n,{parent:this}))}return e.prototype.toString=function(e){return this.rule?this.rule.toString(e):""},e}(),Ue=/\s*,\s*/g;function $e(e,t){for(var n=e.split(Ue),r="",i=0;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n-1){var i=Vt[e];if(!Array.isArray(i))return mt+Rt(i)in t&>+i;if(!r)return!1;for(var o=0;ot?1:-1:e.length-t.length};return{onProcessStyle:function(t,n){if("style"!==n.type)return t;for(var r={},i=Object.keys(t).sort(e),o=0;o(o+=1,o);return(e,o)=>{const a=o.options.name;if(a&&0===a.indexOf("Mui")&&!o.options.link&&!t){if(-1!==_e.indexOf(e.key))return"Mui-"+e.key;const t=`${i}${a}-${e.key}`;return o.options.theme[Ae]&&""===r?`${t}-${s()}`:t}return`${i}${n}${s()}`}}(),jss:ln,sheetsCache:null,sheetsManager:new Map,sheetsRegistry:null},fn=r.createContext(cn);let dn=-1e9;function pn(e){return null!==e&&"object"==typeof e&&e.constructor===Object}function hn(e,t,n={clone:!0}){const r=n.clone?p({},e):e;return pn(e)&&pn(t)&&Object.keys(t).forEach(i=>{"__proto__"!==i&&(pn(t[i])&&i in e&&pn(e[i])?r[i]=hn(e[i],t[i],n):r[i]=t[i])}),r}function yn(e){if("string"!=typeof e)throw new Error(function(e){let t="https://material-ui.com/production-error/?code="+e;for(let e=1;e{let i;try{i=t?e(n):e}catch(e){throw e}if(!r||!n.components||!n.components[r]||!n.components[r].styleOverrides&&!n.components[r].variants)return i;const o=n.components[r].styleOverrides||{},s=n.components[r].variants||[],a=p({},i);return Object.keys(o).forEach(e=>{a[e]=hn(a[e]||{},o[e])}),s.forEach(e=>{const t=function(e){const{variant:t}=e,n=d(e,["variant"]);let r=t||"";return Object.keys(n).sort().forEach(t=>{r+="color"===t?vn(r)?e[t]:yn(e[t]):`${vn(r)?t:yn(t)}${yn(e[t].toString())}`}),r}(e.props);a[t]=hn(a[t]||{},e.style)}),a},options:{}}}var gn={};function bn({state:e,theme:t,stylesOptions:n,stylesCreator:r,name:i},o){if(n.disableGeneration)return;let s=Ee.get(n.sheetsManager,r,t);s||(s={refs:0,staticSheet:null,dynamicStyles:null},Ee.set(n.sheetsManager,r,t,s));const a=p({},r.options,n,{theme:t,flip:"boolean"==typeof n.flip?n.flip:"rtl"===t.direction});a.generateId=a.serverGenerateClassName||a.generateClassName;const u=n.sheetsRegistry;if(0===s.refs){let e;n.sheetsCache&&(e=Ee.get(n.sheetsCache,r,t));const o=r.create(t,i);e||(e=n.jss.createStyleSheet(o,p({link:!1},a)),e.attach(),n.sheetsCache&&Ee.set(n.sheetsCache,r,t,e)),u&&u.add(e),s.staticSheet=e,s.dynamicStyles=function e(t){var n=null;for(var r in t){var i=t[r],o=typeof i;if("function"===o)n||(n={}),n[r]=i;else if("object"===o&&null!==i&&!Array.isArray(i)){var s=e(i);s&&(n||(n={}),n[r]=s)}}return n}(o)}if(s.dynamicStyles){const t=n.jss.createStyleSheet(s.dynamicStyles,p({link:!0},a));t.update(o),t.attach(),e.dynamicSheet=t,e.classes=je({baseClasses:s.staticSheet.classes,newClasses:t.classes}),u&&u.add(t)}else e.classes=s.staticSheet.classes;s.refs+=1}var xn=function(e){var t=e.mdUp,n=void 0!==t&&t,r=e.mdDown,i=void 0!==r&&r,o=e.children,s=Object(f.useMediaQuery)((function(e){return e.breakpoints.down("md")}),{noSsr:!0});return n&&s||i&&!s?null:o};function wn(){return(wn=Object.assign||function(e){for(var t=1;t{const t=r.useContext(Be)||s,i=p({},r.useContext(fn),a),l=r.useRef(),c=r.useRef();!function(e,t){const n=r.useRef([]);let i;const o=r.useMemo(()=>({}),t);n.current!==o&&(n.current=o,i=e()),r.useEffect(()=>()=>{i&&i()},[o])}(()=>{const r={name:n,state:{},stylesCreator:u,stylesOptions:i,theme:t};return bn(r,e),c.current=!1,l.current=r,()=>{!function({state:e,theme:t,stylesOptions:n,stylesCreator:r}){if(n.disableGeneration)return;const i=Ee.get(n.sheetsManager,r,t);i.refs-=1;const o=n.sheetsRegistry;0===i.refs&&(Ee.delete(n.sheetsManager,r,t),n.jss.removeStyleSheet(i.staticSheet),o&&o.remove(i.staticSheet)),e.dynamicSheet&&(n.jss.removeStyleSheet(e.dynamicSheet),o&&o.remove(e.dynamicSheet))}(r)}},[t,u]),r.useEffect(()=>{c.current&&function({state:e},t){e.dynamicSheet&&e.dynamicSheet.update(t)}(l.current,e),c.current=!0});return function({state:e,stylesOptions:t},n,r){if(t.disableGeneration)return n||{};e.cacheClasses||(e.cacheClasses={value:null,lastProp:null,lastJSS:{}});let i=!1;return e.classes!==e.cacheClasses.lastJSS&&(e.cacheClasses.lastJSS=e.classes,i=!0),n!==e.cacheClasses.lastProp&&(e.cacheClasses.lastProp=n,i=!0),i&&(e.cacheClasses.value=je({baseClasses:e.cacheClasses.lastJSS,newClasses:n,Component:r})),e.cacheClasses.value}(l.current,e.classes,o)}}((function(e){return{root:{display:"block",width:"100%",marginLeft:"auto",marginRight:"auto"},cardContent:{paddingBottom:8,paddingRight:8},cardContentIconAppBar:(t={paddingLeft:16,paddingTop:16},n=e.breakpoints.down("md"),r={paddingTop:24},n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t),cardContentIconNoAppBar:{paddingLeft:16,paddingTop:24},cardContentNoIconAppBar:{paddingLeft:24,paddingTop:8},cardContentNoIconNoAppBar:{paddingLeft:16,paddingTop:24},avatar:{backgroundColor:e.palette.primary.main,height:40,width:40},flex:{flexGrow:1},buttons:{whiteSpace:"nowrap",alignSelf:"flex-end",paddingLeft:"90px !important"},label:{alignSelf:"center"}};var t,n,r}),{name:"MuiBanner"}),Pn=i.a.forwardRef((function(e,t){var n=e.open,o=e.label,s=e.icon,a=e.iconProps,u=e.appBar,l=e.showDismissButton,d=e.dismissButtonLabel,p=e.dismissButtonProps,h=e.buttonOnClick,y=e.buttonLabel,v=e.buttonComponent,m=e.buttonProps,g=e.paperProps,b=e.cardProps,x=e.onClose,w=Sn(),S=Boolean(l||y),P=Object(r.useMemo)((function(){return i.a.createElement(i.a.Fragment,null,i.a.createElement("span",{className:w.flex}),i.a.createElement(f.Grid,{item:!0,className:w.buttons},l&&i.a.createElement(f.Button,wn({variant:"text",onClick:x},p),d),!!y&&i.a.createElement(f.Button,wn({variant:"text",onClick:h,component:v},m),y)))}),[l,x,p,d,h,y,v,m]),k={};return u&&(k={component:f.Container,maxWidth:"lg"}),i.a.createElement(f.Collapse,{in:n,ref:t},i.a.createElement(f.Paper,wn({elevation:0,className:w.root},g),i.a.createElement(f.Card,wn({elevation:0},k,b),i.a.createElement(f.CardContent,{className:c()(w.cardContent,s&&u&&w.cardContentIconAppBar,s&&!u&&w.cardContentIconNoAppBar,!s&&u&&w.cardContentNoIconAppBar,!s&&!u&&w.cardContentNoIconNoAppBar)},i.a.createElement(f.Grid,{container:!0,wrap:"nowrap",spacing:u?3:2,direction:"row",justifyContent:"flex-start",alignItems:"flex-start"},s&&i.a.createElement(f.Grid,{item:!0},i.a.createElement(f.Avatar,wn({className:w.avatar},a),s)),i.a.createElement(f.Grid,{item:!0,className:w.label},i.a.createElement(f.Typography,{variant:"body2"},o)),i.a.createElement(xn,{mdDown:!0},u&&S&&P))),!u&&S&&i.a.createElement(xn,{mdDown:!0},i.a.createElement(f.CardActions,null,P)),S&&i.a.createElement(xn,{mdUp:!0},i.a.createElement(f.CardActions,null,P)),i.a.createElement(xn,{mdDown:!0},i.a.createElement("div",null))),i.a.createElement(f.Divider,null)))}));Pn.propTypes={open:u.a.bool.isRequired,label:u.a.string.isRequired,buttonLabel:u.a.string,buttonOnClick:u.a.func,buttonComponent:u.a.any,buttonProps:u.a.object,showDismissButton:u.a.bool,dismissButtonLabel:u.a.string,dismissButtonProps:u.a.object,onClose:u.a.func,icon:u.a.element,iconProps:u.a.object,appBar:u.a.bool,paperProps:u.a.object,cardProps:u.a.object},Pn.defaultProps={open:!0,buttonOnClick:function(){},showDismissButton:!0,dismissButtonLabel:"Dismiss",dismissButtonProps:{},appBar:!1,buttonComponent:f.ButtonBase,buttonProps:{},iconProps:{},paperProps:{},cardProps:{}},Pn.displayName="MuiBanner";var kn=Pn;function On(e){return(On="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})(e)}function Cn(){return(Cn=Object.assign||function(e){for(var t=1;t{n[e]&&(i[e]=`${t[e]} ${n[e]}`)}),i}var Ee={set:(e,t,n,r)=>{let i=e.get(t);i||(i=new Map,e.set(t,i)),i.set(n,r)},get:(e,t,n)=>{const r=e.get(t);return r?r.get(n):void 0},delete:(e,t,n)=>{e.get(t).delete(n)}};var Be=r.createContext(null);var Ae="function"==typeof Symbol&&Symbol.for?Symbol.for("mui.nested"):"__THEME_NESTED__";const Ie=["checked","disabled","error","focused","focusVisible","required","expanded","selected"];var _e=Date.now(),Ne="fnValues"+_e,Te="fnStyle"+ ++_e,Me=function(){return{onCreateRule:function(e,t,n){if("function"!=typeof t)return null;var r=P(e,{},n);return r[Te]=t,r},onProcessStyle:function(e,t){if(Ne in t||Te in t)return e;var n={};for(var r in e){var i=e[r];"function"==typeof i&&(delete e[r],n[r]=i)}return t[Ne]=n,e},onUpdate:function(e,t,n,r){var i=t,o=i[Te];o&&(i.style=o(e)||{});var s=i[Ne];if(s)for(var a in s)i.prop(a,s[a](e),r)}}},qe="@global",De=function(){function e(e,t,n){for(var r in this.type="global",this.at=qe,this.rules=void 0,this.options=void 0,this.key=void 0,this.isProcessed=!1,this.key=e,this.options=n,this.rules=new oe(p({},n,{parent:this})),t)this.rules.add(r,t[r]);this.rules.process()}var t=e.prototype;return t.getRule=function(e){return this.rules.get(e)},t.addRule=function(e,t,n){var r=this.rules.add(e,t,n);return r&&this.options.jss.plugins.onProcessRule(r),r},t.indexOf=function(e){return this.rules.indexOf(e)},t.toString=function(){return this.rules.toString()},e}(),Le=function(){function e(e,t,n){this.type="global",this.at=qe,this.options=void 0,this.rule=void 0,this.isProcessed=!1,this.key=void 0,this.key=e,this.options=n;var r=e.substr("@global ".length);this.rule=n.jss.createRule(r,t,p({},n,{parent:this}))}return e.prototype.toString=function(e){return this.rule?this.rule.toString(e):""},e}(),Ue=/\s*,\s*/g;function $e(e,t){for(var n=e.split(Ue),r="",i=0;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n-1){var i=Vt[e];if(!Array.isArray(i))return mt+Rt(i)in t&>+i;if(!r)return!1;for(var o=0;ot?1:-1:e.length-t.length};return{onProcessStyle:function(t,n){if("style"!==n.type)return t;for(var r={},i=Object.keys(t).sort(e),o=0;o(o+=1,o);return(e,o)=>{const a=o.options.name;if(a&&0===a.indexOf("Mui")&&!o.options.link&&!t){if(-1!==Ie.indexOf(e.key))return"Mui-"+e.key;const t=`${i}${a}-${e.key}`;return o.options.theme[Ae]&&""===r?`${t}-${s()}`:t}return`${i}${n}${s()}`}}(),jss:ln,sheetsCache:null,sheetsManager:new Map,sheetsRegistry:null},fn=r.createContext(cn);let dn=-1e9;function pn(e){return null!==e&&"object"==typeof e&&e.constructor===Object}function hn(e,t,n={clone:!0}){const r=n.clone?p({},e):e;return pn(e)&&pn(t)&&Object.keys(t).forEach(i=>{"__proto__"!==i&&(pn(t[i])&&i in e&&pn(e[i])?r[i]=hn(e[i],t[i],n):r[i]=t[i])}),r}function yn(e){if("string"!=typeof e)throw new Error(function(e){let t="https://material-ui.com/production-error/?code="+e;for(let e=1;e{let i;try{i=t?e(n):e}catch(e){throw e}if(!r||!n.components||!n.components[r]||!n.components[r].styleOverrides&&!n.components[r].variants)return i;const o=n.components[r].styleOverrides||{},s=n.components[r].variants||[],a=p({},i);return Object.keys(o).forEach(e=>{a[e]=hn(a[e]||{},o[e])}),s.forEach(e=>{const t=function(e){const{variant:t}=e,n=d(e,["variant"]);let r=t||"";return Object.keys(n).sort().forEach(t=>{r+="color"===t?vn(r)?e[t]:yn(e[t]):`${vn(r)?t:yn(t)}${yn(e[t].toString())}`}),r}(e.props);a[t]=hn(a[t]||{},e.style)}),a},options:{}}}var gn={};function bn({state:e,theme:t,stylesOptions:n,stylesCreator:r,name:i},o){if(n.disableGeneration)return;let s=Ee.get(n.sheetsManager,r,t);s||(s={refs:0,staticSheet:null,dynamicStyles:null},Ee.set(n.sheetsManager,r,t,s));const a=p({},r.options,n,{theme:t,flip:"boolean"==typeof n.flip?n.flip:"rtl"===t.direction});a.generateId=a.serverGenerateClassName||a.generateClassName;const u=n.sheetsRegistry;if(0===s.refs){let e;n.sheetsCache&&(e=Ee.get(n.sheetsCache,r,t));const o=r.create(t,i);e||(e=n.jss.createStyleSheet(o,p({link:!1},a)),e.attach(),n.sheetsCache&&Ee.set(n.sheetsCache,r,t,e)),u&&u.add(e),s.staticSheet=e,s.dynamicStyles=function e(t){var n=null;for(var r in t){var i=t[r],o=typeof i;if("function"===o)n||(n={}),n[r]=i;else if("object"===o&&null!==i&&!Array.isArray(i)){var s=e(i);s&&(n||(n={}),n[r]=s)}}return n}(o)}if(s.dynamicStyles){const t=n.jss.createStyleSheet(s.dynamicStyles,p({link:!0},a));t.update(o),t.attach(),e.dynamicSheet=t,e.classes=je({baseClasses:s.staticSheet.classes,newClasses:t.classes}),u&&u.add(t)}else e.classes=s.staticSheet.classes;s.refs+=1}var xn=function(){return Object(f.useMediaQuery)((function(e){return e.breakpoints.down("md")}),{noSsr:!0})},wn=function(e){var t=e.mdUp,n=void 0!==t&&t,r=e.mdDown,i=void 0!==r&&r,o=e.children,s=xn();return n&&s||i&&!s?null:o};function Sn(){return(Sn=Object.assign||function(e){for(var t=1;t{const t=r.useContext(Be)||s,i=p({},r.useContext(fn),a),l=r.useRef(),c=r.useRef();!function(e,t){const n=r.useRef([]);let i;const o=r.useMemo(()=>({}),t);n.current!==o&&(n.current=o,i=e()),r.useEffect(()=>()=>{i&&i()},[o])}(()=>{const r={name:n,state:{},stylesCreator:u,stylesOptions:i,theme:t};return bn(r,e),c.current=!1,l.current=r,()=>{!function({state:e,theme:t,stylesOptions:n,stylesCreator:r}){if(n.disableGeneration)return;const i=Ee.get(n.sheetsManager,r,t);i.refs-=1;const o=n.sheetsRegistry;0===i.refs&&(Ee.delete(n.sheetsManager,r,t),n.jss.removeStyleSheet(i.staticSheet),o&&o.remove(i.staticSheet)),e.dynamicSheet&&(n.jss.removeStyleSheet(e.dynamicSheet),o&&o.remove(e.dynamicSheet))}(r)}},[t,u]),r.useEffect(()=>{c.current&&function({state:e},t){e.dynamicSheet&&e.dynamicSheet.update(t)}(l.current,e),c.current=!0});return function({state:e,stylesOptions:t},n,r){if(t.disableGeneration)return n||{};e.cacheClasses||(e.cacheClasses={value:null,lastProp:null,lastJSS:{}});let i=!1;return e.classes!==e.cacheClasses.lastJSS&&(e.cacheClasses.lastJSS=e.classes,i=!0),n!==e.cacheClasses.lastProp&&(e.cacheClasses.lastProp=n,i=!0),i&&(e.cacheClasses.value=je({baseClasses:e.cacheClasses.lastJSS,newClasses:n,Component:r})),e.cacheClasses.value}(l.current,e.classes,o)}}((function(e){return{root:{display:"block",width:"100%",marginLeft:"auto",marginRight:"auto"},cardContent:{paddingBottom:8,paddingRight:8},cardContentIconAppBar:{paddingLeft:16,paddingTop:16},cardContentIconAppBarMobile:{paddingLeft:16,paddingTop:24},cardContentIconNoAppBar:{paddingLeft:16,paddingTop:24},cardContentNoIconAppBar:{paddingLeft:24,paddingTop:8},cardContentNoIconNoAppBar:{paddingLeft:16,paddingTop:24},avatar:{backgroundColor:e.palette.primary.main,height:40,width:40},flex:{flexGrow:1},buttons:{whiteSpace:"nowrap",alignSelf:"flex-end",paddingLeft:"90px !important"},label:{alignSelf:"center"}}}),{name:"MuiBanner"}),kn=i.a.forwardRef((function(e,t){var n=e.open,o=e.label,s=e.icon,a=e.iconProps,u=e.appBar,l=e.showDismissButton,d=e.dismissButtonLabel,p=e.dismissButtonProps,h=e.buttonOnClick,y=e.buttonLabel,v=e.buttonComponent,m=e.buttonProps,g=e.paperProps,b=e.cardProps,x=e.onClose,w=Pn(),S=xn(),P=Boolean(l||y),k=Object(r.useMemo)((function(){return i.a.createElement(i.a.Fragment,null,i.a.createElement("span",{className:w.flex}),i.a.createElement(f.Grid,{item:!0,className:w.buttons},l&&i.a.createElement(f.Button,Sn({variant:"text",onClick:x},p),d),!!y&&i.a.createElement(f.Button,Sn({variant:"text",onClick:h,component:v},m),y)))}),[l,x,p,d,h,y,v,m]),O={};return u&&(O={component:f.Container,maxWidth:"lg"}),i.a.createElement(f.Collapse,{in:n,ref:t},i.a.createElement(f.Paper,Sn({elevation:0,className:w.root},g),i.a.createElement(f.Card,Sn({elevation:0},O,b),i.a.createElement(f.CardContent,{className:c()(w.cardContent,s&&u&&!S&&w.cardContentIconAppBar,s&&u&&S&&w.cardContentIconAppBarMobile,s&&!u&&w.cardContentIconNoAppBar,!s&&u&&w.cardContentNoIconAppBar,!s&&!u&&w.cardContentNoIconNoAppBar)},i.a.createElement(f.Grid,{container:!0,wrap:"nowrap",spacing:u?3:2,direction:"row",justifyContent:"flex-start",alignItems:"flex-start"},s&&i.a.createElement(f.Grid,{item:!0},i.a.createElement(f.Avatar,Sn({className:w.avatar,sx:{bgcolor:"primary.main"}},a),s)),i.a.createElement(f.Grid,{item:!0,className:w.label},i.a.createElement(f.Typography,{variant:"body2"},o)),i.a.createElement(wn,{mdDown:!0},u&&P&&k))),!u&&P&&i.a.createElement(wn,{mdDown:!0},i.a.createElement(f.CardActions,null,k)),P&&i.a.createElement(wn,{mdUp:!0},i.a.createElement(f.CardActions,null,k)),i.a.createElement(wn,{mdDown:!0},i.a.createElement("div",null))),i.a.createElement(f.Divider,null)))}));kn.propTypes={open:u.a.bool.isRequired,label:u.a.string.isRequired,buttonLabel:u.a.string,buttonOnClick:u.a.func,buttonComponent:u.a.any,buttonProps:u.a.object,showDismissButton:u.a.bool,dismissButtonLabel:u.a.string,dismissButtonProps:u.a.object,onClose:u.a.func,icon:u.a.element,iconProps:u.a.object,appBar:u.a.bool,paperProps:u.a.object,cardProps:u.a.object},kn.defaultProps={open:!0,buttonOnClick:function(){},showDismissButton:!0,dismissButtonLabel:"Dismiss",dismissButtonProps:{},appBar:!1,buttonComponent:f.ButtonBase,buttonProps:{},iconProps:{},paperProps:{},cardProps:{}},kn.displayName="MuiBanner";var On=kn;function Cn(e){return(Cn="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})(e)}function Rn(){return(Rn=Object.assign||function(e){for(var t=1;t ({ root: { @@ -23,10 +23,10 @@ const useStyles = makeStyles((theme) => ({ cardContentIconAppBar: { paddingLeft: 16, paddingTop: 16, - - [theme.breakpoints.down('md')]: { - paddingTop: 24, - }, + }, + cardContentIconAppBarMobile: { + paddingLeft: 16, + paddingTop: 24, }, cardContentIconNoAppBar: { paddingLeft: 16, @@ -77,6 +77,8 @@ const MuiBanner = React.forwardRef(({ }, ref) => { const classes = useStyles(); + const isMobile = useIsMobile(); + const hasButton = Boolean(showDismissButton || buttonLabel); const renderButtons = useMemo(() => ( <> @@ -123,7 +125,8 @@ const MuiBanner = React.forwardRef(({ {icon} diff --git a/src/components/Hide.jsx b/src/components/Hide.jsx index 55d40c5..2e139f6 100644 --- a/src/components/Hide.jsx +++ b/src/components/Hide.jsx @@ -3,7 +3,7 @@ import { useMediaQuery } from '@material-ui/core'; /** * Checks whether or not the current device is a mobile device, based on device width */ -const useIsMobile = () => useMediaQuery((theme) => theme.breakpoints.down('md'), { noSsr: true }); +export const useIsMobile = () => useMediaQuery((theme) => theme.breakpoints.down('md'), { noSsr: true }); export const Hide = ({ mdUp = false, mdDown = false, children }) => { const isMobile = useIsMobile();