/* globals define */ (function(define){'use strict';define(function(require,exports,module){ /** * Dependencies */ var component = require('gaia-component'); /** * Simple logger * @type {Function} */ var debug = 0 ? console.log.bind(console) : function() {}; /** * Exports */ module.exports = component.register('gaia-button', { extends: HTMLButtonElement.prototype, created: function() { this.setupShadowRoot(); // Configure this.disabled = this.getAttribute('disabled'); // process everything that doesn't affect user interaction // after the component is created setTimeout(() => this.makeAccessible()); }, /** * Accessibility enhancements. * Read gaia-button as button. * make it tabable * read its disabled state */ makeAccessible: function() { this.setAttribute('role', 'button'); // Make tabable this.tabIndex = 0; if (this.disabled) { this.setAttribute('aria-disabled', true); } }, attrs: { circular: { get: function() { return this.getAttribute('circular'); }, set: function(value) { value = !!(value === '' || value); if (value) { this.setAttribute('circular', ''); } else { this.removeAttribute('circular'); } } }, disabled: { get: function() { return this._disabled; }, set: function(value) { value = !!(value || value === ''); if (this._disabled === value) { return; } debug('set disabled', value); this._disabled = value; if (value) { this.setAttr('disabled', ''); this.setAttribute('aria-disabled', true); } else { this.removeAttr('disabled'); this.removeAttribute('aria-disabled'); } } } }, template: `
` }); });})(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-button',this));