1; (function (root, factory) { 2 const ns = root.FieldKit = root.FieldKit || {}; 3 ns.icons = ns.icons || {}; 4 factory(ns); 5})(window, function (FieldKit) { 6 const icons = FieldKit.icons; 7 const { BaseIcon } = icons; 8 9 class RevealIcon extends BaseIcon { 10 render() { 11 const button = document.createElement('button'); 12 button.type = 'button'; 13 button.className = 'field__action field__action--reveal'; 14 button.setAttribute('aria-label', 'Show password'); 15 button.setAttribute('aria-pressed', 'false'); 16 button.innerHTML = '<i class="fa fa-eye-slash"></i>'; 17 return button; 18 } 19 20 bind() { 21 this.element.addEventListener('click', () => { 22 const shown = this.host.element.type === 'text'; 23 this.host.element.type = shown ? 'password' : 'text'; 24 25 // glyph swap 26 this.element.querySelector('i').className = `fa fa-${shown ? 'eye-slash' : 'eye'}`; 27 28 // accessibility 29 this.element.setAttribute('aria-pressed', String(!shown)); 30 this.element.setAttribute( 31 'aria-label', 32 shown ? 'Show password' : 'Hide password', 33 ); 34 }); 35 } 36 } 37 38 // Namespace export 39 icons.RevealIcon = RevealIcon; 40});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.