{"version":3,"file":"pfe-health-index.min.js","sources":["../_temp/pfe-health-index.js"],"sourcesContent":["/*!\n * PatternFly Elements: PfeHealthIndex 1.12.3\n * @license\n * Copyright 2021 Red Hat, Inc.\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n * \n*/\n\nimport PFElement from \"../../pfelement/dist/pfelement.js\";\n\nclass PfeHealthIndex extends PFElement {\n\n // Injected at build-time\n static get version() {\n return \"1.12.3\";\n }\n\n // Injected at build-time\n get html() {\n return `\n\n${this.size !== \"lg\" ? `\n ${this.size === \"mini\" ? `\n
\n
\n
\n
\n
\n ` : `\n
\n
\n
\n
\n
\n
\n
\n
\n
\n `}\n` : `\n
\n
\n
A
\n
\n
\n
\n
B
\n
\n
\n
\n
C
\n
\n
\n
\n
D
\n
\n
\n
\n
E
\n
\n
\n
\n
F
\n
\n
\n
\n`}`;\n }\n\n // @TODO: Deprecating in 1.0 release\n // Injected at build-time\n static get schemaProperties() {\n return {\"health-index\":{\"title\":\"Health Index\",\"type\":\"string\",\"enum\":[\"A\",\"B\",\"C\",\"D\",\"E\",\"F\"],\"default\":\"A\",\"prefixed\":false},\"size\":{\"title\":\"Size\",\"type\":\"string\",\"enum\":[\"mini\",\"lg\"],\"default\":null,\"prefixed\":false}};\n }\n\n static get tag() {\n return \"pfe-health-index\";\n }\n\n get schemaUrl() {\n return \"pfe-health-index.json\";\n }\n\n get templateUrl() {\n return \"pfe-health-index.html\";\n }\n\n get styleUrl() {\n return \"pfe-health-index.scss\";\n }\n\n static get properties() {\n return {\n healthIndex: {\n title: \"Health index\",\n type: String,\n values: [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\"],\n default: \"A\",\n observer: \"_healthIndexChanged\",\n },\n size: {\n title: \"Size\",\n type: String,\n values: [\"mini\", \"lg\"],\n observer: \"_sizeChanged\",\n default: \"\",\n },\n };\n }\n\n constructor() {\n super(PfeHealthIndex, { delayRender: true });\n }\n\n _healthIndexChanged(oldValue, newValue) {\n // this.schemaProps.size.value = newValue;\n this.render();\n this.updateHealthIndex(newValue);\n }\n\n _sizeChanged(oldValue, newValue) {\n // this.schemaProps.size.value = this.getAttribute(\"size\");\n this.render();\n this.updateHealthIndex(this.healthIndex, oldValue);\n }\n\n updateHealthIndex(grade, oldValue) {\n const healthIndex = grade.toLowerCase();\n const healthIndexUpperCase = grade.toUpperCase();\n const boxes = [...this.shadowRoot.querySelectorAll(\".box\")];\n this.innerHTML = healthIndexUpperCase;\n\n if (this.size === \"mini\") {\n this.shadowRoot.querySelector(\".box\").classList.remove(oldValue);\n this.shadowRoot.querySelector(\".box\").classList.add(healthIndex);\n }\n\n boxes.forEach((box) => {\n if (box.classList.contains(healthIndex)) {\n box.classList.add(\"active\");\n } else {\n box.classList.remove(\"active\");\n }\n });\n\n if (this.size !== \"lg\") {\n this.shadowRoot.querySelector(\"#healthIndex\").innerText = healthIndexUpperCase;\n }\n\n if (!this.shadowRoot.querySelector(\".box.active\")) {\n this.warn(`a valid health-index was not provided. Please use A, B, C, D, E, or F`);\n }\n }\n}\n\nPFElement.create(PfeHealthIndex);\n\nexport default PfeHealthIndex;\n"],"names":["PfeHealthIndex","PFElement","version","html","this","size","schemaProperties","health-index","title","type","enum","default","prefixed","tag","schemaUrl","templateUrl","styleUrl","properties","healthIndex","String","values","observer","[object Object]","super","delayRender","oldValue","newValue","render","updateHealthIndex","grade","toLowerCase","healthIndexUpperCase","toUpperCase","boxes","shadowRoot","querySelectorAll","innerHTML","querySelector","classList","remove","add","forEach","box","contains","innerText","warn","create"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EA2BA,MAAMA,UAAuBC,EAG3BC,qBACE,MAAO,SAITC,WACE,MAAO,okRAEK,OAAdC,KAAKC,KAAgB,OACL,SAAdD,KAAKC,KAAkB,+IAMrB,gSAWF,inBAgCFC,8BACE,MAAO,CAACC,eAAe,CAACC,MAAQ,eAAeC,KAAO,SAASC,KAAO,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,KAAKC,QAAU,IAAIC,UAAW,GAAOP,KAAO,CAACG,MAAQ,OAAOC,KAAO,SAASC,KAAO,CAAC,OAAO,MAAMC,QAAU,KAAKC,UAAW,IAGxNC,iBACE,MAAO,mBAGTC,gBACE,MAAO,wBAGTC,kBACE,MAAO,wBAGTC,eACE,MAAO,wBAGTC,wBACE,MAAO,CACLC,YAAa,CACXV,MAAO,eACPC,KAAMU,OACNC,OAAQ,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,KAClCT,QAAS,IACTU,SAAU,uBAEZhB,KAAM,CACJG,MAAO,OACPC,KAAMU,OACNC,OAAQ,CAAC,OAAQ,MACjBC,SAAU,eACVV,QAAS,KAKfW,cACEC,MAAMvB,EAAgB,CAAEwB,aAAa,IAGvCF,oBAAoBG,EAAUC,GAE5BtB,KAAKuB,SACLvB,KAAKwB,kBAAkBF,GAGzBJ,aAAaG,EAAUC,GAErBtB,KAAKuB,SACLvB,KAAKwB,kBAAkBxB,KAAKc,YAAaO,GAG3CH,kBAAkBO,EAAOJ,GACvB,MAAMP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