import { customElement, html, DeesElement, property, TemplateResult } from '@designestate/dees-element';
import * as domtools from '@designestate/dees-domtools';
@customElement('dees-button')
export class DeesButton extends DeesElement {
public static demo = () => html``
@property()
text: string;
@property()
eventDetailData: string;
@property()
disabled = false;
@property()
isHidden = false;
@property()
public type: 'normal' | 'highlighted' | 'discreet' | 'big' = 'normal';
constructor() {
super();
}
public render(): TemplateResult {
return html`
${domtools.elementBasic.styles}
${this.text ? this.text : this.textContent}
`;
}
public async dispatchClick() {
if (this.disabled) {
return;
}
this.dispatchEvent(new CustomEvent('clicked', {
detail: {
data: this.eventDetailData
},
bubbles: true
}));
}
public async firstUpdated () {
if (!this.textContent) {
this.textContent = 'Button';
this.performUpdate();
}
}
}