;(function(define){define(['require','exports','module','gaia-component'],function(require,exports,module){ /*jshint esnext:true*/ /** * Dependencies */ var component = require('gaia-component'); /** * Exports */ module.exports = component.register('gaia-progress', { created: function() { this.setupShadowRoot(); this.els = { inner: this.shadowRoot.querySelector('.inner'), bar: this.shadowRoot.querySelector('.bar'), }; this.els.inner.setAttribute('role', 'progressbar'); this.els.inner.setAttribute('aria-valuemin', '0'); this.els.inner.setAttribute('aria-valuemax', '100'); this.value = this.getAttribute('value') || 0; }, fillTime: 2000, attrs: { value: { get: function() { return this._value || 0; }, set: function(value) { // Clamp it value = Math.min(100, Math.max(0, Number(value))); if (value) { var delta = Math.abs(this.value - value); var duration = (delta / 100) * this.fillTime; this.els.bar.style.transform = `translateX(${value}%)`; this.els.bar.style.transitionDuration = duration + 'ms'; this.els.inner.setAttribute('aria-valuenow', value); } else { this.els.inner.removeAttribute('aria-valuenow'); } this.els.inner.classList.toggle('no-value', !value); this._value = value; } } }, template: `
`, globalCss: ` @keyframes moving-backward { 0% { transform: translateX(0); } 100% { transform: translateX(-142px); } } ` }); });})(typeof define=='function'&&define.amd?define :(function(n,w){'use strict';return typeof module=='object'?function(c){ c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){ return w[n];},m.exports,m);w[n]=m.exports;};})('gaia-progress',this));