@code.gov/code-gov-style
Advanced tools
Comparing version 1.10.19 to 1.10.20
@@ -456,2 +456,3 @@ 'use strict'; | ||
'use strict'; | ||
/*global HTMLElement*/ | ||
@@ -484,62 +485,59 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
(function () { | ||
/*global HTMLElement*/ | ||
var QualityTag = | ||
/*#__PURE__*/ | ||
function (_HTMLElement) { | ||
_inherits(QualityTag, _HTMLElement); | ||
var QualityTag = | ||
/*#__PURE__*/ | ||
function (_HTMLElement) { | ||
_inherits(QualityTag, _HTMLElement); | ||
function QualityTag() { | ||
_classCallCheck(this, QualityTag); | ||
function QualityTag() { | ||
_classCallCheck(this, QualityTag); | ||
// establish prototype chain | ||
return _possibleConstructorReturn(this, _getPrototypeOf(QualityTag).call(this)); | ||
// establish prototype chain | ||
return _possibleConstructorReturn(this, _getPrototypeOf(QualityTag).call(this)); | ||
} | ||
_createClass(QualityTag, [{ | ||
key: "connectedCallback", | ||
// fires after the element has been attached to the DOM | ||
value: function connectedCallback() { | ||
this.update(); | ||
} | ||
_createClass(QualityTag, [{ | ||
key: "connectedCallback", | ||
// fires after the element has been attached to the DOM | ||
value: function connectedCallback() { | ||
}, { | ||
key: "attributeChangedCallback", | ||
value: function attributeChangedCallback(attrName, oldVal, newVal) { | ||
if (attrName === 'score') { | ||
this.update(); | ||
} | ||
}, { | ||
key: "attributeChangedCallback", | ||
value: function attributeChangedCallback(attrName, oldVal, newVal) { | ||
if (attrName === 'score') { | ||
this.update(); | ||
} | ||
} | ||
}, { | ||
key: "update", | ||
value: function update() { | ||
var rounded = Math.round(Number(this.getAttribute('score')) * 10) / 10; | ||
var category = ''; | ||
if (rounded > 0 && rounded < 4) { | ||
category = 'low'; | ||
} else if (rounded >= 4 && rounded < 7) { | ||
category = 'medium'; | ||
} else if (rounded >= 7) { | ||
category = 'high'; | ||
} else { | ||
category = ''; | ||
} | ||
}, { | ||
key: "update", | ||
value: function update() { | ||
var rounded = Math.round(Number(this.getAttribute('score')) * 10) / 10; | ||
var category = ''; | ||
if (rounded > 0 && rounded < 4) { | ||
category = 'low'; | ||
} else if (rounded >= 4 && rounded < 7) { | ||
category = 'medium'; | ||
} else if (rounded >= 7) { | ||
category = 'high'; | ||
} else { | ||
category = ''; | ||
} | ||
this.innerHTML = "<div class=\"corner-tag ".concat(category, "\"><div class=\"corner-tag-value\">").concat(rounded, "</div></div>"); | ||
} | ||
}], [{ | ||
key: "observedAttributes", | ||
get: function get() { | ||
return ['score']; | ||
} | ||
}]); | ||
this.innerHTML = "<div class=\"corner-tag ".concat(category, "\"><div class=\"corner-tag-value\">").concat(rounded, "</div></div>"); | ||
} | ||
}], [{ | ||
key: "observedAttributes", | ||
get: function get() { | ||
return ['score']; | ||
} | ||
}]); | ||
return QualityTag; | ||
}(_wrapNativeSuper(HTMLElement)); // let the browser know about the custom element | ||
return QualityTag; | ||
}(_wrapNativeSuper(HTMLElement)); // let the browser know about the custom element | ||
/*global customElements*/ | ||
/*global customElements*/ | ||
customElements.define('quality-tag', QualityTag); | ||
customElements.define('quality-tag', QualityTag); | ||
})(); | ||
{ | ||
"name": "@code.gov/code-gov-style", | ||
"version": "1.10.19", | ||
"version": "1.10.20", | ||
"description": "Style for code.gov including buttons, banners, and cards. Inspired by and somewhat based on USWDS.", | ||
@@ -35,3 +35,3 @@ "main": "index.js", | ||
"@babel/polyfill": "^7.0.0", | ||
"@code.gov/code-gov-font": "0.7.0", | ||
"@code.gov/code-gov-font": "0.7.1", | ||
"@webcomponents/custom-elements": "^1.2.1", | ||
@@ -38,0 +38,0 @@ "custom-event-polyfill": "^1.0.6", |
'use strict'; | ||
(function() { | ||
/*global HTMLElement*/ | ||
class QualityTag extends HTMLElement { | ||
constructor() { | ||
// establish prototype chain | ||
super(); | ||
} | ||
/*global HTMLElement*/ | ||
class QualityTag extends HTMLElement { | ||
constructor() { | ||
// establish prototype chain | ||
super(); | ||
} | ||
static get observedAttributes() { | ||
return ['score']; | ||
} | ||
static get observedAttributes() { | ||
return ['score']; | ||
} | ||
// fires after the element has been attached to the DOM | ||
connectedCallback() { | ||
// fires after the element has been attached to the DOM | ||
connectedCallback() { | ||
this.update(); | ||
} | ||
attributeChangedCallback(attrName, oldVal, newVal) { | ||
if (attrName === 'score') { | ||
this.update(); | ||
} | ||
} | ||
attributeChangedCallback(attrName, oldVal, newVal) { | ||
if (attrName === 'score') { | ||
this.update(); | ||
} | ||
update() { | ||
const rounded = Math.round(Number(this.getAttribute('score')) * 10) / 10; | ||
let category = ''; | ||
if (rounded > 0 && rounded < 4) { | ||
category = 'low'; | ||
} else if (rounded >= 4 && rounded < 7) { | ||
category = 'medium' | ||
} else if (rounded >= 7) { | ||
category = 'high'; | ||
} else { | ||
category = ''; | ||
} | ||
this.innerHTML = `<div class="corner-tag ${category}"><div class="corner-tag-value">${rounded}</div></div>`; | ||
} | ||
update() { | ||
const rounded = Math.round(Number(this.getAttribute('score')) * 10) / 10; | ||
let category = ''; | ||
if (rounded > 0 && rounded < 4) { | ||
category = 'low'; | ||
} else if (rounded >= 4 && rounded < 7) { | ||
category = 'medium' | ||
} else if (rounded >= 7) { | ||
category = 'high'; | ||
} else { | ||
category = ''; | ||
} | ||
this.innerHTML = `<div class="corner-tag ${category}"><div class="corner-tag-value">${rounded}</div></div>`; | ||
} | ||
} | ||
} | ||
// let the browser know about the custom element | ||
/*global customElements*/ | ||
customElements.define('quality-tag', QualityTag); | ||
})(); | ||
// let the browser know about the custom element | ||
/*global customElements*/ | ||
customElements.define('quality-tag', QualityTag); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
897474
3146
+ Added@code.gov/code-gov-font@0.7.1(transitive)
- Removed@code.gov/code-gov-font@0.7.0(transitive)