@larva.io/webcomponents
Version:
Fentrica SmartUnits WebComponents package
79 lines (75 loc) • 3.22 kB
JavaScript
/*!
* (C) Fentrica http://fentrica.com - Seee LICENSE.md
*/
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-C4h1muVj.js';
const pushButtonCss = "slot-fb[hidden],slot[hidden]{display:initial !important}.content{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-height:15rem;padding:2rem}@media (max-width: 576px){.content{min-height:12rem}}";
const LarvaPushButton = class {
constructor(hostRef) {
registerInstance(this, hostRef);
this.output = createEvent(this, "output");
this.request = createEvent(this, "request");
/////// LarvaNode base properties
/**
* Component main icon
*/
this.icon = 'security';
/**
* The color to use from your application's color palette.
* Detrouble options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
*/
this.color = 'primary';
/**
* Disable quck actions
*/
this.disableQuickActions = false;
/**
* Is logging for this component enabled (lar-log subcomponent loaded)
*/
this.log = false;
/**
* Node size
*/
this.nodeSize = 'default';
/////// LarvaNode base properties and events - end
this.loading = false;
}
componentDidLoad() {
const el = this.el.shadowRoot || this.el;
this.node = el.querySelector('lar-node');
// this.output.emit(); // push button doesnt have a state
}
/**
* Larva error input
*/
async error(data) {
if (this.node) {
this.node.error(data);
}
this.loading = false;
}
/**
* Larva input message
*/
async input(data) {
this.loading = false;
}
handleClick(data) {
this.loading = true;
this.output.emit(data);
}
render() {
const componentProps = {
onClick: () => this.handleClick(true),
disabled: this.loading,
color: this.colorInputs || this.color,
};
return [
h("lar-node", { key: '2b21d7cee05679f644d1d4be3e9bdb8762d34e07', icon: this.icon, hideTitles: this.hideTitles, color: this.color, supTitle: this.supTitle, mainTitle: this.mainTitle, subTitle: this.subTitle, colorModal: this.colorModal, colorInputs: this.colorInputs, colorIconSmall: this.colorIconSmall, loading: this.loading, log: this.log, nodeSize: this.nodeSize, component: "lar-push-button-content", componentProps: componentProps }, this.disableQuickActions === false &&
h("lar-button-push", { key: 'a4146a54e830585bb88f50a40f59cc2e39c69e1b', slot: "titles", size: "small", color: this.colorInputs || this.color, disabled: this.loading, onClick: ev => this.handleClick(true) }), h("slot", { key: '34d011f22667e35be664669944335fbcc3feb45e' }))
];
}
get el() { return getElement(this); }
};
LarvaPushButton.style = pushButtonCss;
export { LarvaPushButton as lar_push_button };
//# sourceMappingURL=lar-push-button.entry.js.map