UNPKG

@haxtheweb/haxcms-nodejs

Version:

HAXcms single and multisite nodejs server, api, and administration

74 lines (68 loc) 3.16 kB
/** @license Copyright (c) 2017 Vaadin Ltd. This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ */ import{PolymerElement as t}from"../../../@polymer/polymer/polymer-element.js";import{GestureEventListeners as e}from"../../../@polymer/polymer/lib/mixins/gesture-event-listeners.js";import{ThemableMixin as i}from"../../vaadin-themable-mixin/vaadin-themable-mixin.js";import{ControlStateMixin as n}from"../../vaadin-control-state-mixin/vaadin-control-state-mixin.js";import{ElementMixin as s}from"../../vaadin-element-mixin/vaadin-element-mixin.js";import{html as o}from"../../../@polymer/polymer/lib/utils/html-tag.js";import{addListener as r}from"../../../@polymer/polymer/lib/utils/gestures.js";class ButtonElement extends(s(n(i(e(t))))){static get template(){return o` <style> :host { display: inline-block; position: relative; outline: none; white-space: nowrap; } :host([hidden]) { display: none !important; } /* Ensure the button is always aligned on the baseline */ .vaadin-button-container::before { content: "\\2003"; display: inline-block; width: 0; } .vaadin-button-container { display: inline-flex; align-items: center; justify-content: center; text-align: center; width: 100%; height: 100%; min-height: inherit; text-shadow: inherit; -webkit-user-select: none; -moz-user-select: none; user-select: none; } [part="prefix"], [part="suffix"] { flex: none; } [part="label"] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #button { position: absolute; top: 0; left: 0; right: 0; width: 100%; height: 100%; opacity: 0; cursor: inherit; } </style> <div class="vaadin-button-container"> <div part="prefix"> <slot name="prefix"></slot> </div> <div part="label"> <slot></slot> </div> <div part="suffix"> <slot name="suffix"></slot> </div> </div> <button id="button" type="button"></button> `}static get is(){return"vaadin-button"}static get version(){return"2.4.0"}ready(){super.ready(),this.setAttribute("role","button"),this.$.button.setAttribute("role","presentation"),this._addActiveListeners(),window.ShadyDOM&&window.ShadyDOM.flush()}disconnectedCallback(){super.disconnectedCallback(),this.hasAttribute("active")&&this.removeAttribute("active")}_addActiveListeners(){r(this,"down",(()=>!this.disabled&&this.setAttribute("active",""))),r(this,"up",(()=>this.removeAttribute("active"))),this.addEventListener("keydown",(t=>!this.disabled&&[13,32].indexOf(t.keyCode)>=0&&this.setAttribute("active",""))),this.addEventListener("keyup",(()=>this.removeAttribute("active"))),this.addEventListener("blur",(()=>this.removeAttribute("active")))}get focusElement(){return this.$.button}}customElements.define(ButtonElement.is,ButtonElement);export{ButtonElement};