@microblink/photopay-in-browser-sdk
Version:
A simple payment barcode scanning library for WebAssembly-enabled browsers.
40 lines (36 loc) • 1.77 kB
JavaScript
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-986855e2.js';
import { s as setWebComponentParts, c as classNames } from './generic.helpers-22ad84c4.js';
const mbButtonClassicCss = ":host{box-sizing:border-box;display:block}:host a{display:block;margin:0;padding:0;width:100%;height:32px;line-height:32px;color:var(--mb-component-button-classic-text-color);background:var(--mb-component-button-classic-background);text-align:center;text-decoration:none;font-family:var(--mb-font-family);font-size:var(--mb-component-button-classic-font-size);font-weight:var(--mb-component-button-classic-font-weight)}:host a:hover,:host a:active,:host a:focus{cursor:pointer}:host(.disabled){opacity:0.5}:host(.disabled) a{cursor:default}";
let MbButtonClassic = class {
constructor(hostRef) {
registerInstance(this, hostRef);
this.buttonClick = createEvent(this, "buttonClick", 7);
/**
* Set to 'true' if button should be disabled, and if click events should not be triggered.
*/
this.disabled = false;
/**
* Set to 'true' if default event should be prevented.
*/
this.preventDefault = false;
}
handleClick(ev) {
if (this.preventDefault) {
ev.preventDefault();
}
if (this.disabled) {
ev.stopPropagation();
return;
}
this.buttonClick.emit(ev);
}
connectedCallback() {
setWebComponentParts(this.hostEl);
}
render() {
return (h(Host, { className: classNames({ disabled: this.disabled }), onClick: (ev) => this.handleClick(ev) }, h("a", { href: "javascript:void(0)" }, h("slot", null))));
}
get hostEl() { return getElement(this); }
};
MbButtonClassic.style = mbButtonClassicCss;
export { MbButtonClassic as mb_button_classic };