web-component-stencil-test
Version:
Stencil Component Starter
1 lines • 1.48 kB
JavaScript
System.register(["./p-f3df5a36.system.js"],(function(e){"use strict";var t,n;return{setters:[function(e){t=e.r;n=e.h}],execute:function(){var i=e("simple_button",function(){function e(e){var n=this;t(this,e);this.showNbOfClick=false;this.theme="primary";this.nbOfClicks=0;this.handleClick=function(){n.nbOfClicks+=1}}e.prototype.validateTheme=function(e){var t=["primary","secondary"];var n=t.indexOf(e)>-1;if(!n){throw new Error("theme: not a valide theme")}};e.prototype.componentWillLoad=function(){this.validateTheme(this.theme)};e.prototype.render=function(){return n("button",{class:"simple-button "+this.theme,onClick:this.handleClick},n("span",{class:"label"},n("slot",null)),this.showNbOfClick&&this.nbOfClicks>0&&n("span",{class:"nb-of-clicks"}," - "+this.nbOfClicks))};Object.defineProperty(e,"watchers",{get:function(){return{theme:["validateTheme"]}},enumerable:true,configurable:true});Object.defineProperty(e,"style",{get:function(){return".simple-button{background:inherit;border:none;color:inherit;cursor:pointer;display:inline-block;font-family:sans-serif;font-size:1rem;padding:1rem 2rem;margin:0;text-align:center;text-decoration:none;-webkit-transition:all .25s ease-in-out;transition:all .25s ease-in-out;-webkit-appearance:none;-moz-appearance:none}.primary{background:#0069ed;color:#fff}.primary:hover{background:#4396fc}.secondary{background:#715aff;color:#fff}.secondary:hover{background:#8a78ff}"},enumerable:true,configurable:true});return e}())}}}));