import { Component, Prop, h, Event, EventEmitter } from '@stencil/core'; @Component({ tag: 'atria-button', styleUrl: 'button.scss', shadow: true }) export class AtriaButtonComponent { // Props equivalent to Angular @Input() @Prop() buttonId: string = ""; @Prop() buttonText: string = ""; @Prop() buttonType: string = 'primary'; @Prop() buttonIconLeft: string = ""; @Prop() buttonIconRight: string = ""; @Prop() disabled: boolean = false; @Prop() loading: boolean = false; @Prop() active: boolean = false; @Prop() width: string = ""; @Prop() buttonRole: string = 'button'; // Event equivalent to Angular @Output() @Event() btnClick!: EventEmitter; // Click Handler private onClick = () => { if (!this.disabled && !this.loading) { this.btnClick.emit({ id: this.buttonId, text: this.buttonText, type: this.buttonType, active: this.active }); } }; render() { const classes = [ 'bh-btn', this.buttonType, this.loading ? 'bh-loading' : '', this.disabled ? 'disabled' : '', this.active ? 'active' : '', !this.buttonText && !this.loading && this.buttonIconLeft ? 'bh-icon-only' : '' ] .filter(Boolean) .join(' '); return ( ); } }