UNPKG

@teipublisher/pb-components

Version:
918 lines (787 loc) 117 kB
import{h as e,P as t,B as i,f as n,d as o,o as s,I as a,p as r,c as l,g as p,u as h,e as d,L as c,a as u,w as f,q as m}from"./paper-inky-focus-behavior-fa16796b.js"; /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */const g=e` <custom-style> <style is="custom-style"> html { --shadow-transition: { transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); }; --shadow-none: { box-shadow: none; }; /* from http://codepen.io/shyndman/pen/c5394ddf2e8b2a5c9185904b57421cdb */ --shadow-elevation-2dp: { box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2); }; --shadow-elevation-3dp: { box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.14), 0 1px 8px 0 rgba(0, 0, 0, 0.12), 0 3px 3px -2px rgba(0, 0, 0, 0.4); }; --shadow-elevation-4dp: { box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.4); }; --shadow-elevation-6dp: { box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12), 0 3px 5px -1px rgba(0, 0, 0, 0.4); }; --shadow-elevation-8dp: { box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.4); }; --shadow-elevation-12dp: { box-shadow: 0 12px 16px 1px rgba(0, 0, 0, 0.14), 0 4px 22px 3px rgba(0, 0, 0, 0.12), 0 6px 7px -4px rgba(0, 0, 0, 0.4); }; --shadow-elevation-16dp: { box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.4); }; --shadow-elevation-24dp: { box-shadow: 0 24px 38px 3px rgba(0, 0, 0, 0.14), 0 9px 46px 8px rgba(0, 0, 0, 0.12), 0 11px 15px -7px rgba(0, 0, 0, 0.4); }; } </style> </custom-style>`;g.setAttribute("style","display: none;"),document.head.appendChild(g.content); /** @license Copyright (c) 2017 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ const y=e` <dom-module id="paper-material-styles"> <template> <style> html { --paper-material: { display: block; position: relative; }; --paper-material-elevation-1: { @apply --shadow-elevation-2dp; }; --paper-material-elevation-2: { @apply --shadow-elevation-4dp; }; --paper-material-elevation-3: { @apply --shadow-elevation-6dp; }; --paper-material-elevation-4: { @apply --shadow-elevation-8dp; }; --paper-material-elevation-5: { @apply --shadow-elevation-16dp; }; } .paper-material { @apply --paper-material; } .paper-material[elevation="1"] { @apply --paper-material-elevation-1; } .paper-material[elevation="2"] { @apply --paper-material-elevation-2; } .paper-material[elevation="3"] { @apply --paper-material-elevation-3; } .paper-material[elevation="4"] { @apply --paper-material-elevation-4; } .paper-material[elevation="5"] { @apply --paper-material-elevation-5; } /* Duplicate the styles because of https://github.com/webcomponents/shadycss/issues/193 */ :host { --paper-material: { display: block; position: relative; }; --paper-material-elevation-1: { @apply --shadow-elevation-2dp; }; --paper-material-elevation-2: { @apply --shadow-elevation-4dp; }; --paper-material-elevation-3: { @apply --shadow-elevation-6dp; }; --paper-material-elevation-4: { @apply --shadow-elevation-8dp; }; --paper-material-elevation-5: { @apply --shadow-elevation-16dp; }; } :host(.paper-material) { @apply --paper-material; } :host(.paper-material[elevation="1"]) { @apply --paper-material-elevation-1; } :host(.paper-material[elevation="2"]) { @apply --paper-material-elevation-2; } :host(.paper-material[elevation="3"]) { @apply --paper-material-elevation-3; } :host(.paper-material[elevation="4"]) { @apply --paper-material-elevation-4; } :host(.paper-material[elevation="5"]) { @apply --paper-material-elevation-5; } </style> </template> </dom-module>`;y.setAttribute("style","display: none;"),document.head.appendChild(y.content), /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ t({is:"iron-request",hostAttributes:{hidden:!0},properties:{xhr:{type:Object,notify:!0,readOnly:!0,value:function(){return new XMLHttpRequest}},response:{type:Object,notify:!0,readOnly:!0,value:function(){return null}},status:{type:Number,notify:!0,readOnly:!0,value:0},statusText:{type:String,notify:!0,readOnly:!0,value:""},completes:{type:Object,readOnly:!0,notify:!0,value:function(){return new Promise(function(e,t){this.resolveCompletes=e,this.rejectCompletes=t}.bind(this))}},progress:{type:Object,notify:!0,readOnly:!0,value:function(){return{}}},aborted:{type:Boolean,notify:!0,readOnly:!0,value:!1},errored:{type:Boolean,notify:!0,readOnly:!0,value:!1},timedOut:{type:Boolean,notify:!0,readOnly:!0,value:!1}},get succeeded(){if(this.errored||this.aborted||this.timedOut)return!1;var e=this.xhr.status||0;return 0===e||e>=200&&e<300},send:function(e){var t=this.xhr;if(t.readyState>0)return null;t.addEventListener("progress",function(e){this._setProgress({lengthComputable:e.lengthComputable,loaded:e.loaded,total:e.total}),this.fire("iron-request-progress-changed",{value:this.progress})}.bind(this)),t.addEventListener("error",function(t){this._setErrored(!0),this._updateStatus();var i=e.rejectWithRequest?{error:t,request:this}:t;this.rejectCompletes(i)}.bind(this)),t.addEventListener("timeout",function(t){this._setTimedOut(!0),this._updateStatus();var i=e.rejectWithRequest?{error:t,request:this}:t;this.rejectCompletes(i)}.bind(this)),t.addEventListener("abort",function(){this._setAborted(!0),this._updateStatus();var t=new Error("Request aborted."),i=e.rejectWithRequest?{error:t,request:this}:t;this.rejectCompletes(i)}.bind(this)),t.addEventListener("loadend",function(){if(this._updateStatus(),this._setResponse(this.parseResponse()),this.succeeded)this.resolveCompletes(this);else{var t=new Error("The request failed with status code: "+this.xhr.status),i=e.rejectWithRequest?{error:t,request:this}:t;this.rejectCompletes(i)}}.bind(this)),this.url=e.url;var n=!1!==e.async;t.open(e.method||"GET",e.url,n);var o={json:"application/json",text:"text/plain",html:"text/html",xml:"application/xml",arraybuffer:"application/octet-stream"}[e.handleAs],s=e.headers||Object.create(null),a=Object.create(null);for(var r in s)a[r.toLowerCase()]=s[r];if(s=a,o&&!s.accept&&(s.accept=o),Object.keys(s).forEach((function(e){/[A-Z]/.test(e)&&i._error("Headers must be lower case, got",e),t.setRequestHeader(e,s[e])}),this),n){t.timeout=e.timeout;var l=e.handleAs;!e.jsonPrefix&&l||(l="text"),t.responseType=t._responseType=l,e.jsonPrefix&&(t._jsonPrefix=e.jsonPrefix)}t.withCredentials=!!e.withCredentials;var p=this._encodeBodyObject(e.body,s["content-type"]);return t.send(p),this.completes},parseResponse:function(){var e=this.xhr,t=e.responseType||e._responseType,i=!this.xhr.responseType,n=e._jsonPrefix&&e._jsonPrefix.length||0;try{switch(t){case"json":if(i||void 0===e.response)try{return JSON.parse(e.responseText)}catch(t){return console.warn("Failed to parse JSON sent from "+e.responseURL),null}return e.response;case"xml":return e.responseXML;case"blob":case"document":case"arraybuffer":return e.response;case"text":default:if(n)try{return JSON.parse(e.responseText.substring(n))}catch(t){return console.warn("Failed to parse JSON sent from "+e.responseURL),null}return e.responseText}}catch(e){this.rejectCompletes(new Error("Could not parse response. "+e.message))}},abort:function(){this._setAborted(!0),this.xhr.abort()},_encodeBodyObject:function(e,t){if("string"==typeof e)return e;var i=e;switch(t){case"application/json":return JSON.stringify(i);case"application/x-www-form-urlencoded":return this._wwwFormUrlEncode(i)}return e},_wwwFormUrlEncode:function(e){if(!e)return"";var t=[];return Object.keys(e).forEach((function(i){t.push(this._wwwFormUrlEncodePiece(i)+"="+this._wwwFormUrlEncodePiece(e[i]))}),this),t.join("&")},_wwwFormUrlEncodePiece:function(e){return null!=e&&e.toString?encodeURIComponent(e.toString().replace(/\r?\n/g,"\r\n")).replace(/%20/g,"+"):""},_updateStatus:function(){this._setStatus(this.xhr.status),this._setStatusText(void 0===this.xhr.statusText?"":this.xhr.statusText)}}), /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ t({is:"iron-ajax",hostAttributes:{hidden:!0},properties:{url:{type:String},params:{type:Object,value:function(){return{}}},method:{type:String,value:"GET"},headers:{type:Object,value:function(){return{}}},contentType:{type:String,value:null},body:{type:Object,value:null},sync:{type:Boolean,value:!1},handleAs:{type:String,value:"json"},withCredentials:{type:Boolean,value:!1},timeout:{type:Number,value:0},auto:{type:Boolean,value:!1},verbose:{type:Boolean,value:!1},lastRequest:{type:Object,notify:!0,readOnly:!0},lastProgress:{type:Object,notify:!0,readOnly:!0},loading:{type:Boolean,notify:!0,readOnly:!0},lastResponse:{type:Object,notify:!0,readOnly:!0},lastError:{type:Object,notify:!0,readOnly:!0},activeRequests:{type:Array,notify:!0,readOnly:!0,value:function(){return[]}},debounceDuration:{type:Number,value:0,notify:!0},jsonPrefix:{type:String,value:""},bubbles:{type:Boolean,value:!1},rejectWithRequest:{type:Boolean,value:!1},_boundHandleResponse:{type:Function,value:function(){return this._handleResponse.bind(this)}}},observers:["_requestOptionsChanged(url, method, params.*, headers, contentType, body, sync, handleAs, jsonPrefix, withCredentials, timeout, auto)"],created:function(){this._boundOnProgressChanged=this._onProgressChanged.bind(this)},get queryString(){var e,t,i=[];for(e in this.params)if(t=this.params[e],e=window.encodeURIComponent(e),Array.isArray(t))for(var n=0;n<t.length;n++)i.push(e+"="+window.encodeURIComponent(t[n]));else null!==t?i.push(e+"="+window.encodeURIComponent(t)):i.push(e);return i.join("&")},get requestUrl(){var e=this.queryString,t=this.url||"";if(e){var i=t.indexOf("?")>=0?"&":"?";return t+i+e}return t},get requestHeaders(){var e,t={},i=this.contentType;if(null==i&&"string"==typeof this.body&&(i="application/x-www-form-urlencoded"),i&&(t["content-type"]=i),"object"==typeof this.headers)for(e in this.headers)t[e]=this.headers[e].toString();return t},_onProgressChanged:function(e){this._setLastProgress(e.detail.value)},toRequestOptions:function(){return{url:this.requestUrl||"",method:this.method,headers:this.requestHeaders,body:this.body,async:!this.sync,handleAs:this.handleAs,jsonPrefix:this.jsonPrefix,withCredentials:this.withCredentials,timeout:this.timeout,rejectWithRequest:this.rejectWithRequest}},generateRequest:function(){var e=document.createElement("iron-request"),t=this.toRequestOptions();return this.push("activeRequests",e),e.completes.then(this._boundHandleResponse).catch(this._handleError.bind(this,e)).then(this._discardRequest.bind(this,e)),this.fire("iron-ajax-presend",{request:e,options:t},{bubbles:this.bubbles,cancelable:!0}).defaultPrevented?(e.abort(),e.rejectCompletes(e),e):(this.lastRequest&&this.lastRequest.removeEventListener("iron-request-progress-changed",this._boundOnProgressChanged),e.addEventListener("iron-request-progress-changed",this._boundOnProgressChanged),e.send(t),this._setLastProgress(null),this._setLastRequest(e),this._setLoading(!0),this.fire("request",{request:e,options:t},{bubbles:this.bubbles,composed:!0}),this.fire("iron-ajax-request",{request:e,options:t},{bubbles:this.bubbles,composed:!0}),e)},_handleResponse:function(e){e===this.lastRequest&&(this._setLastResponse(e.response),this._setLastError(null),this._setLoading(!1)),this.fire("response",e,{bubbles:this.bubbles,composed:!0}),this.fire("iron-ajax-response",e,{bubbles:this.bubbles,composed:!0})},_handleError:function(e,t){this.verbose&&i._error(t),e===this.lastRequest&&(this._setLastError({request:e,error:t,status:e.xhr.status,statusText:e.xhr.statusText,response:e.xhr.response}),this._setLastResponse(null),this._setLoading(!1)),this.fire("iron-ajax-error",{request:e,error:t},{bubbles:this.bubbles,composed:!0}),this.fire("error",{request:e,error:t},{bubbles:this.bubbles,composed:!0})},_discardRequest:function(e){var t=this.activeRequests.indexOf(e);t>-1&&this.splice("activeRequests",t,1)},_requestOptionsChanged:function(){this.debounce("generate-request",(function(){null!=this.url&&this.auto&&this.generateRequest()}),this.debounceDuration)}}); /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ const _=t({_template:e` <style> :host { display: inline-block; position: fixed; clip: rect(0px,0px,0px,0px); } </style> <div aria-live$="[[mode]]">[[_text]]</div> `,is:"iron-a11y-announcer",properties:{mode:{type:String,value:"polite"},timeout:{type:Number,value:150},_text:{type:String,value:""}},created:function(){_.instance||(_.instance=this),document.addEventListener("iron-announce",this._onIronAnnounce.bind(this))},announce:function(e){this._text="",this.async((function(){this._text=e}),this.timeout)},_onIronAnnounce:function(e){e.detail&&e.detail.text&&this.announce(e.detail.text)}}); /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ if(_.instance=null,_.requestAvailability=function(){_.instance||(_.instance=document.createElement("iron-a11y-announcer")),document.body?document.body.appendChild(_.instance):document.addEventListener("load",(function(){document.body.appendChild(_.instance)}))}, /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ t({_template:e` <style> :host { display: inline-block; } </style> <slot id="content"></slot> `,is:"iron-input",behaviors:[n],properties:{bindValue:{type:String,value:""},value:{type:String,computed:"_computeValue(bindValue)"},allowedPattern:{type:String},autoValidate:{type:Boolean,value:!1},_inputElement:Object},observers:["_bindValueChanged(bindValue, _inputElement)"],listeners:{input:"_onInput",keypress:"_onKeypress"},created:function(){_.requestAvailability(),this._previousValidInput="",this._patternAlreadyChecked=!1},attached:function(){this._observer=o(this).observeNodes(function(e){this._initSlottedInput()}.bind(this))},detached:function(){this._observer&&(o(this).unobserveNodes(this._observer),this._observer=null)},get inputElement(){return this._inputElement},_initSlottedInput:function(){this._inputElement=this.getEffectiveChildren()[0],this.inputElement&&this.inputElement.value&&(this.bindValue=this.inputElement.value),this.fire("iron-input-ready")},get _patternRegExp(){var e;if(this.allowedPattern)e=new RegExp(this.allowedPattern);else switch(this.inputElement.type){case"number":e=/[0-9.,e-]/}return e},_bindValueChanged:function(e,t){t&&(void 0===e?t.value=null:e!==t.value&&(this.inputElement.value=e),this.autoValidate&&this.validate(),this.fire("bind-value-changed",{value:e}))},_onInput:function(){this.allowedPattern&&!this._patternAlreadyChecked&&(this._checkPatternValidity()||(this._announceInvalidCharacter("Invalid string of characters not entered."),this.inputElement.value=this._previousValidInput));this.bindValue=this._previousValidInput=this.inputElement.value,this._patternAlreadyChecked=!1},_isPrintable:function(e){var t=8==e.keyCode||9==e.keyCode||13==e.keyCode||27==e.keyCode,i=19==e.keyCode||20==e.keyCode||45==e.keyCode||46==e.keyCode||144==e.keyCode||145==e.keyCode||e.keyCode>32&&e.keyCode<41||e.keyCode>111&&e.keyCode<124;return!(t||0==e.charCode&&i)},_onKeypress:function(e){if(this.allowedPattern||"number"===this.inputElement.type){var t=this._patternRegExp;if(t&&!(e.metaKey||e.ctrlKey||e.altKey)){this._patternAlreadyChecked=!0;var i=String.fromCharCode(e.charCode);this._isPrintable(e)&&!t.test(i)&&(e.preventDefault(),this._announceInvalidCharacter("Invalid character "+i+" not entered."))}}},_checkPatternValidity:function(){var e=this._patternRegExp;if(!e)return!0;for(var t=0;t<this.inputElement.value.length;t++)if(!e.test(this.inputElement.value[t]))return!1;return!0},validate:function(){if(!this.inputElement)return this.invalid=!1,!0;var e=this.inputElement.checkValidity();return e&&(this.required&&""===this.bindValue?e=!1:this.hasValidator()&&(e=n.validate.call(this,this.bindValue))),this.invalid=!e,this.fire("iron-input-validate"),e},_announceInvalidCharacter:function(e){this.fire("iron-announce",{text:e})},_computeValue:function(e){return e}}),!window.polymerSkipLoadingFontRoboto){const e=document.createElement("link");e.rel="stylesheet",e.type="text/css",e.crossOrigin="anonymous",e.href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,300,300italic,400italic,500,500italic,700,700italic",document.head.appendChild(e)} /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */const b=e`<custom-style> <style is="custom-style"> html { /* Shared Styles */ --paper-font-common-base: { font-family: 'Roboto', 'Noto', sans-serif; -webkit-font-smoothing: antialiased; }; --paper-font-common-code: { font-family: 'Roboto Mono', 'Consolas', 'Menlo', monospace; -webkit-font-smoothing: antialiased; }; --paper-font-common-expensive-kerning: { text-rendering: optimizeLegibility; }; --paper-font-common-nowrap: { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }; /* Material Font Styles */ --paper-font-display4: { @apply --paper-font-common-base; @apply --paper-font-common-nowrap; font-size: 112px; font-weight: 300; letter-spacing: -.044em; line-height: 120px; }; --paper-font-display3: { @apply --paper-font-common-base; @apply --paper-font-common-nowrap; font-size: 56px; font-weight: 400; letter-spacing: -.026em; line-height: 60px; }; --paper-font-display2: { @apply --paper-font-common-base; font-size: 45px; font-weight: 400; letter-spacing: -.018em; line-height: 48px; }; --paper-font-display1: { @apply --paper-font-common-base; font-size: 34px; font-weight: 400; letter-spacing: -.01em; line-height: 40px; }; --paper-font-headline: { @apply --paper-font-common-base; font-size: 24px; font-weight: 400; letter-spacing: -.012em; line-height: 32px; }; --paper-font-title: { @apply --paper-font-common-base; @apply --paper-font-common-nowrap; font-size: 20px; font-weight: 500; line-height: 28px; }; --paper-font-subhead: { @apply --paper-font-common-base; font-size: 16px; font-weight: 400; line-height: 24px; }; --paper-font-body2: { @apply --paper-font-common-base; font-size: 14px; font-weight: 500; line-height: 24px; }; --paper-font-body1: { @apply --paper-font-common-base; font-size: 14px; font-weight: 400; line-height: 20px; }; --paper-font-caption: { @apply --paper-font-common-base; @apply --paper-font-common-nowrap; font-size: 12px; font-weight: 400; letter-spacing: 0.011em; line-height: 20px; }; --paper-font-menu: { @apply --paper-font-common-base; @apply --paper-font-common-nowrap; font-size: 13px; font-weight: 500; line-height: 24px; }; --paper-font-button: { @apply --paper-font-common-base; @apply --paper-font-common-nowrap; font-size: 14px; font-weight: 500; letter-spacing: 0.018em; line-height: 24px; text-transform: uppercase; }; --paper-font-code2: { @apply --paper-font-common-code; font-size: 14px; font-weight: 700; line-height: 20px; }; --paper-font-code1: { @apply --paper-font-common-code; font-size: 14px; font-weight: 500; line-height: 20px; }; } </style> </custom-style>`;b.setAttribute("style","display: none;"),document.head.appendChild(b.content); /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ const v={attached:function(){this.fire("addon-attached")},update:function(e){}}; /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */t({_template:e` <style> :host { display: inline-block; float: right; @apply --paper-font-caption; @apply --paper-input-char-counter; } :host([hidden]) { display: none !important; } :host(:dir(rtl)) { float: left; } </style> <span>[[_charCounterStr]]</span> `,is:"paper-input-char-counter",behaviors:[v],properties:{_charCounterStr:{type:String,value:"0"}},update:function(e){if(e.inputElement){e.value=e.value||"";var t=e.value.toString().length.toString();e.inputElement.hasAttribute("maxlength")&&(t+="/"+e.inputElement.getAttribute("maxlength")),this._charCounterStr=t}}}); /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ const x=e` <custom-style> <style is="custom-style"> html { --paper-input-container-shared-input-style: { position: relative; /* to make a stacking context */ outline: none; box-shadow: none; padding: 0; margin: 0; width: 100%; max-width: 100%; background: transparent; border: none; color: var(--paper-input-container-input-color, var(--primary-text-color)); -webkit-appearance: none; text-align: inherit; vertical-align: var(--paper-input-container-input-align, bottom); @apply --paper-font-subhead; }; } </style> </custom-style> `;x.setAttribute("style","display: none;"),document.head.appendChild(x.content),t({_template:e` <style> :host { display: block; padding: 8px 0; @apply --paper-input-container; } :host([inline]) { display: inline-block; } :host([disabled]) { pointer-events: none; opacity: 0.33; @apply --paper-input-container-disabled; } :host([hidden]) { display: none !important; } [hidden] { display: none !important; } .floated-label-placeholder { @apply --paper-font-caption; } .underline { height: 2px; position: relative; } .focused-line { @apply --layout-fit; border-bottom: 2px solid var(--paper-input-container-focus-color, var(--primary-color)); -webkit-transform-origin: center center; transform-origin: center center; -webkit-transform: scale3d(0,1,1); transform: scale3d(0,1,1); @apply --paper-input-container-underline-focus; } .underline.is-highlighted .focused-line { -webkit-transform: none; transform: none; -webkit-transition: -webkit-transform 0.25s; transition: transform 0.25s; @apply --paper-transition-easing; } .underline.is-invalid .focused-line { border-color: var(--paper-input-container-invalid-color, var(--error-color)); -webkit-transform: none; transform: none; -webkit-transition: -webkit-transform 0.25s; transition: transform 0.25s; @apply --paper-transition-easing; } .unfocused-line { @apply --layout-fit; border-bottom: 1px solid var(--paper-input-container-color, var(--secondary-text-color)); @apply --paper-input-container-underline; } :host([disabled]) .unfocused-line { border-bottom: 1px dashed; border-color: var(--paper-input-container-color, var(--secondary-text-color)); @apply --paper-input-container-underline-disabled; } .input-wrapper { @apply --layout-horizontal; @apply --layout-center; position: relative; } .input-content { @apply --layout-flex-auto; @apply --layout-relative; max-width: 100%; } .input-content ::slotted(label), .input-content ::slotted(.paper-input-label) { position: absolute; top: 0; left: 0; width: 100%; font: inherit; color: var(--paper-input-container-color, var(--secondary-text-color)); -webkit-transition: -webkit-transform 0.25s, width 0.25s; transition: transform 0.25s, width 0.25s; -webkit-transform-origin: left top; transform-origin: left top; /* Fix for safari not focusing 0-height date/time inputs with -webkit-apperance: none; */ min-height: 1px; @apply --paper-font-common-nowrap; @apply --paper-font-subhead; @apply --paper-input-container-label; @apply --paper-transition-easing; } .input-content ::slotted(label):before, .input-content ::slotted(.paper-input-label):before { @apply --paper-input-container-label-before; } .input-content ::slotted(label):after, .input-content ::slotted(.paper-input-label):after { @apply --paper-input-container-label-after; } .input-content.label-is-floating ::slotted(label), .input-content.label-is-floating ::slotted(.paper-input-label) { -webkit-transform: translateY(-75%) scale(0.75); transform: translateY(-75%) scale(0.75); /* Since we scale to 75/100 of the size, we actually have 100/75 of the original space now available */ width: 133%; @apply --paper-input-container-label-floating; } :host(:dir(rtl)) .input-content.label-is-floating ::slotted(label), :host(:dir(rtl)) .input-content.label-is-floating ::slotted(.paper-input-label) { right: 0; left: auto; -webkit-transform-origin: right top; transform-origin: right top; } .input-content.label-is-highlighted ::slotted(label), .input-content.label-is-highlighted ::slotted(.paper-input-label) { color: var(--paper-input-container-focus-color, var(--primary-color)); @apply --paper-input-container-label-focus; } .input-content.is-invalid ::slotted(label), .input-content.is-invalid ::slotted(.paper-input-label) { color: var(--paper-input-container-invalid-color, var(--error-color)); } .input-content.label-is-hidden ::slotted(label), .input-content.label-is-hidden ::slotted(.paper-input-label) { visibility: hidden; } .input-content ::slotted(input), .input-content ::slotted(iron-input), .input-content ::slotted(textarea), .input-content ::slotted(iron-autogrow-textarea), .input-content ::slotted(.paper-input-input) { @apply --paper-input-container-shared-input-style; /* The apply shim doesn't apply the nested color custom property, so we have to re-apply it here. */ color: var(--paper-input-container-input-color, var(--primary-text-color)); @apply --paper-input-container-input; } .input-content ::slotted(input)::-webkit-outer-spin-button, .input-content ::slotted(input)::-webkit-inner-spin-button { @apply --paper-input-container-input-webkit-spinner; } .input-content.focused ::slotted(input), .input-content.focused ::slotted(iron-input), .input-content.focused ::slotted(textarea), .input-content.focused ::slotted(iron-autogrow-textarea), .input-content.focused ::slotted(.paper-input-input) { @apply --paper-input-container-input-focus; } .input-content.is-invalid ::slotted(input), .input-content.is-invalid ::slotted(iron-input), .input-content.is-invalid ::slotted(textarea), .input-content.is-invalid ::slotted(iron-autogrow-textarea), .input-content.is-invalid ::slotted(.paper-input-input) { @apply --paper-input-container-input-invalid; } .prefix ::slotted(*) { display: inline-block; @apply --paper-font-subhead; @apply --layout-flex-none; @apply --paper-input-prefix; } .suffix ::slotted(*) { display: inline-block; @apply --paper-font-subhead; @apply --layout-flex-none; @apply --paper-input-suffix; } /* Firefox sets a min-width on the input, which can cause layout issues */ .input-content ::slotted(input) { min-width: 0; } .input-content ::slotted(textarea) { resize: none; } .add-on-content { position: relative; } .add-on-content.is-invalid ::slotted(*) { color: var(--paper-input-container-invalid-color, var(--error-color)); } .add-on-content.is-highlighted ::slotted(*) { color: var(--paper-input-container-focus-color, var(--primary-color)); } </style> <div class="floated-label-placeholder" aria-hidden="true" hidden="[[noLabelFloat]]">&nbsp;</div> <div class="input-wrapper"> <span class="prefix"><slot name="prefix"></slot></span> <div class$="[[_computeInputContentClass(noLabelFloat,alwaysFloatLabel,focused,invalid,_inputHasContent)]]" id="labelAndInputContainer"> <slot name="label"></slot> <slot name="input"></slot> </div> <span class="suffix"><slot name="suffix"></slot></span> </div> <div class$="[[_computeUnderlineClass(focused,invalid)]]"> <div class="unfocused-line"></div> <div class="focused-line"></div> </div> <div class$="[[_computeAddOnContentClass(focused,invalid)]]"> <slot name="add-on"></slot> </div> `,is:"paper-input-container",properties:{noLabelFloat:{type:Boolean,value:!1},alwaysFloatLabel:{type:Boolean,value:!1},attrForValue:{type:String,value:"bind-value"},autoValidate:{type:Boolean,value:!1},invalid:{observer:"_invalidChanged",type:Boolean,value:!1},focused:{readOnly:!0,type:Boolean,value:!1,notify:!0},_addons:{type:Array},_inputHasContent:{type:Boolean,value:!1},_inputSelector:{type:String,value:"input,iron-input,textarea,.paper-input-input"},_boundOnFocus:{type:Function,value:function(){return this._onFocus.bind(this)}},_boundOnBlur:{type:Function,value:function(){return this._onBlur.bind(this)}},_boundOnInput:{type:Function,value:function(){return this._onInput.bind(this)}},_boundValueChanged:{type:Function,value:function(){return this._onValueChanged.bind(this)}}},listeners:{"addon-attached":"_onAddonAttached","iron-input-validate":"_onIronInputValidate"},get _valueChangedEvent(){return this.attrForValue+"-changed"},get _propertyForValue(){return s(this.attrForValue)},get _inputElement(){return o(this).querySelector(this._inputSelector)},get _inputElementValue(){return this._inputElement[this._propertyForValue]||this._inputElement.value},ready:function(){this.__isFirstValueUpdate=!0,this._addons||(this._addons=[]),this.addEventListener("focus",this._boundOnFocus,!0),this.addEventListener("blur",this._boundOnBlur,!0)},attached:function(){this.attrForValue?this._inputElement.addEventListener(this._valueChangedEvent,this._boundValueChanged):this.addEventListener("input",this._onInput),this._inputElementValue&&""!=this._inputElementValue?this._handleValueAndAutoValidate(this._inputElement):this._handleValue(this._inputElement)},_onAddonAttached:function(e){this._addons||(this._addons=[]);var t=e.target;-1===this._addons.indexOf(t)&&(this._addons.push(t),this.isAttached&&this._handleValue(this._inputElement))},_onFocus:function(){this._setFocused(!0)},_onBlur:function(){this._setFocused(!1),this._handleValueAndAutoValidate(this._inputElement)},_onInput:function(e){this._handleValueAndAutoValidate(e.target)},_onValueChanged:function(e){var t=e.target;this.__isFirstValueUpdate&&(this.__isFirstValueUpdate=!1,void 0===t.value||""===t.value)||this._handleValueAndAutoValidate(e.target)},_handleValue:function(e){var t=this._inputElementValue;t||0===t||"number"===e.type&&!e.checkValidity()?this._inputHasContent=!0:this._inputHasContent=!1,this.updateAddons({inputElement:e,value:t,invalid:this.invalid})},_handleValueAndAutoValidate:function(e){var t;this.autoValidate&&e&&(t=e.validate?e.validate(this._inputElementValue):e.checkValidity(),this.invalid=!t);this._handleValue(e)},_onIronInputValidate:function(e){this.invalid=this._inputElement.invalid},_invalidChanged:function(){this._addons&&this.updateAddons({invalid:this.invalid})},updateAddons:function(e){for(var t,i=0;t=this._addons[i];i++)t.update(e)},_computeInputContentClass:function(e,t,i,n,o){var s="input-content";if(e)o&&(s+=" label-is-hidden"),n&&(s+=" is-invalid");else{var a=this.querySelector("label");t||o?(s+=" label-is-floating",this.$.labelAndInputContainer.style.position="static",n?s+=" is-invalid":i&&(s+=" label-is-highlighted")):(a&&(this.$.labelAndInputContainer.style.position="relative"),n&&(s+=" is-invalid"))}return i&&(s+=" focused"),s},_computeUnderlineClass:function(e,t){var i="underline";return t?i+=" is-invalid":e&&(i+=" is-highlighted"),i},_computeAddOnContentClass:function(e,t){var i="add-on-content";return t?i+=" is-invalid":e&&(i+=" is-highlighted"),i}}), /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ t({_template:e` <style> :host { display: inline-block; visibility: hidden; color: var(--paper-input-container-invalid-color, var(--error-color)); @apply --paper-font-caption; @apply --paper-input-error; position: absolute; left:0; right:0; } :host([invalid]) { visibility: visible; } #a11yWrapper { visibility: hidden; } :host([invalid]) #a11yWrapper { visibility: visible; } </style> <!-- If the paper-input-error element is directly referenced by an \`aria-describedby\` attribute, such as when used as a paper-input add-on, then applying \`visibility: hidden;\` to the paper-input-error element itself does not hide the error. For more information, see: https://www.w3.org/TR/accname-1.1/#mapping_additional_nd_description --> <div id="a11yWrapper"> <slot></slot> </div> `,is:"paper-input-error",behaviors:[v],properties:{invalid:{readOnly:!0,reflectToAttribute:!0,type:Boolean}},update:function(e){this._setInvalid(e.invalid)}}); /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ const w={NextLabelID:1,NextAddonID:1,NextInputID:1},A={properties:{label:{type:String},value:{notify:!0,type:String},disabled:{type:Boolean,value:!1},invalid:{type:Boolean,value:!1,notify:!0},allowedPattern:{type:String},type:{type:String},list:{type:String},pattern:{type:String},required:{type:Boolean,value:!1},errorMessage:{type:String},charCounter:{type:Boolean,value:!1},noLabelFloat:{type:Boolean,value:!1},alwaysFloatLabel:{type:Boolean,value:!1},autoValidate:{type:Boolean,value:!1},validator:{type:String},autocomplete:{type:String,value:"off"},autofocus:{type:Boolean,observer:"_autofocusChanged"},inputmode:{type:String},minlength:{type:Number},maxlength:{type:Number},min:{type:String},max:{type:String},step:{type:String},name:{type:String},placeholder:{type:String,value:""},readonly:{type:Boolean,value:!1},size:{type:Number},autocapitalize:{type:String,value:"none"},autocorrect:{type:String,value:"off"},autosave:{type:String},results:{type:Number},accept:{type:String},multiple:{type:Boolean},_ariaDescribedBy:{type:String,value:""},_ariaLabelledBy:{type:String,value:""},_inputId:{type:String,value:""}},listeners:{"addon-attached":"_onAddonAttached"},keyBindings:{"shift+tab:keydown":"_onShiftTabDown"},hostAttributes:{tabindex:0},get inputElement(){return this.$||(this.$={}),this.$.input||(this._generateInputId(),this.$.input=this.$$("#"+this._inputId)),this.$.input},get _focusableElement(){return this.inputElement},created:function(){this._typesThatHaveText=["date","datetime","datetime-local","month","time","week","file"]},attached:function(){this._updateAriaLabelledBy(),!l&&this.inputElement&&-1!==this._typesThatHaveText.indexOf(this.inputElement.type)&&(this.alwaysFloatLabel=!0)},_appendStringWithSpace:function(e,t){return e=e?e+" "+t:t},_onAddonAttached:function(e){var t=o(e).rootTarget;if(t.id)this._ariaDescribedBy=this._appendStringWithSpace(this._ariaDescribedBy,t.id);else{var i="paper-input-add-on-"+w.NextAddonID++;t.id=i,this._ariaDescribedBy=this._appendStringWithSpace(this._ariaDescribedBy,i)}},validate:function(){return this.inputElement.validate()},_focusBlurHandler:function(e){a._focusBlurHandler.call(this,e),this.focused&&!this._shiftTabPressed&&this._focusableElement&&this._focusableElement.focus()},_onShiftTabDown:function(e){var t=this.getAttribute("tabindex");this._shiftTabPressed=!0,this.setAttribute("tabindex","-1"),this.async((function(){this.setAttribute("tabindex",t),this._shiftTabPressed=!1}),1)},_handleAutoValidate:function(){this.autoValidate&&this.validate()},updateValueAndPreserveCaret:function(e){try{var t=this.inputElement.selectionStart;this.value=e,this.inputElement.selectionStart=t,this.inputElement.selectionEnd=t}catch(t){this.value=e}},_computeAlwaysFloatLabel:function(e,t){return t||e},_updateAriaLabelledBy:function(){var e,t=o(this.root).querySelector("label");t?(t.id?e=t.id:(e="paper-input-label-"+w.NextLabelID++,t.id=e),this._ariaLabelledBy=e):this._ariaLabelledBy=""},_generateInputId:function(){this._inputId&&""!==this._inputId||(this._inputId="input-"+w.NextInputID++)},_onChange:function(e){this.shadowRoot&&this.fire(e.type,{sourceEvent:e},{node:this,bubbles:e.bubbles,cancelable:e.cancelable})},_autofocusChanged:function(){if(this.autofocus&&this._focusableElement){var e=document.activeElement;e instanceof HTMLElement&&e!==document.body&&e!==document.documentElement||this._focusableElement.focus()}}},C=[a,r,A]; /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ t({is:"paper-input",_template:e` <style> :host { display: block; } :host([focused]) { outline: none; } :host([hidden]) { display: none !important; } input { /* Firefox sets a min-width on the input, which can cause layout issues */ min-width: 0; } /* In 1.x, the <input> is distributed to paper-input-container, which styles it. In 2.x the <iron-input> is distributed to paper-input-container, which styles it, but in order for this to work correctly, we need to reset some of the native input's properties to inherit (from the iron-input) */ iron-input > input { @apply --paper-input-container-shared-input-style; font-family: inherit; font-weight: inherit; font-size: inherit; letter-spacing: inherit; word-spacing: inherit; line-height: inherit; text-shadow: inherit; color: inherit; cursor: inherit; } input:disabled { @apply --paper-input-container-input-disabled; } input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { @apply --paper-input-container-input-webkit-spinner; } input::-webkit-clear-button { @apply --paper-input-container-input-webkit-clear; } input::-webkit-calendar-picker-indicator { @apply --paper-input-container-input-webkit-calendar-picker-indicator; } input::-webkit-input-placeholder { color: var(--paper-input-container-color, var(--secondary-text-color)); } input:-moz-placeholder { color: var(--paper-input-container-color, var(--secondary-text-color)); } input::-moz-placeholder { color: var(--paper-input-container-color, var(--secondary-text-color)); } input::-ms-clear { @apply --paper-input-container-ms-clear; } input::-ms-reveal { @apply --paper-input-container-ms-reveal; } input:-ms-input-placeholder { color: var(--paper-input-container-color, var(--secondary-text-color)); } label { pointer-events: none; } </style> <paper-input-container id="container" no-label-float="[[noLabelFloat]]" always-float-label="[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]" auto-validate$="[[autoValidate]]" disabled$="[[disabled]]" invalid="[[invalid]]"> <slot name="prefix" slot="prefix"></slot> <label hidden$="[[!label]]" aria-hidden="true" for$="[[_inputId]]" slot="label">[[label]]</label> <!-- Need to bind maxlength so that the paper-input-char-counter works correctly --> <iron-input bind-value="{{value}}" slot="input" class="input-element" id$="[[_inputId]]" maxlength$="[[maxlength]]" allowed-pattern="[[allowedPattern]]" invalid="{{invalid}}" validator="[[validator]]"> <input aria-labelledby$="[[_ariaLabelledBy]]" aria-describedby$="[[_ariaDescribedBy]]" disabled$="[[disabled]]" title$="[[title]]" type$="[[type]]" pattern$="[[pattern]]" required$="[[required]]" autocomplete$="[[autocomplete]]" autofocus$="[[autofocus]]" inputmode$="[[inputmode]]" minlength$="[[minlength]]" maxlength$="[[maxlength]]" min$="[[min]]" max$="[[max]]" step$="[[step]]" name$="[[name]]" placeholder$="[[placeholder]]" readonly$="[[readonly]]" list$="[[list]]" size$="[[size]]" autocapitalize$="[[autocapitalize]]" autocorrect$="[[autocorrect]]" on-change="_onChange" tabindex$="[[tabIndex]]" autosave$="[[autosave]]" results$="[[results]]" accept$="[[accept]]" multiple$="[[multiple]]" role$="[[inputRole]]" aria-haspopup$="[[inputAriaHaspopup]]"> </iron-input> <slot name="suffix" slot="suffix"></slot> <template is="dom-if" if="[[errorMessage]]"> <paper-input-error aria-live="assertive" slot="add-on">[[errorMessage]]</paper-input-error> </template> <template is="dom-if" if="[[charCounter]]"> <paper-input-char-counter slot="add-on"></paper-input-char-counter> </template> </paper-input-container> `,behaviors:[C,p],properties:{value:{type:String},inputRole:{type:String,value:void 0},inputAriaHaspopup:{type:String,value:void 0}},get _focusableElement(){return this.inputElement._inputElement},listeners:{"iron-input-ready":"_onIronInputReady"},_onIronInputReady:function(){this.$.nativeInput||(this.$.nativeInput=this.$$("input")),this.inputElement&&-1!==this._typesThatHaveText.indexOf(this.$.nativeInput.type)&&(this.alwaysFloatLabel=!0),this.inputElement.bindValue&&this.$.container._handleValueAndAutoValidate(this.inputElement)}}); /** @license Copyright (c) 2015 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The comp