@freshworks/crayons
Version:
Crayons Web Components library
41 lines (38 loc) • 1.01 kB
JavaScript
import { r as registerInstance, h, e as Host } from './index-25bc21e4.js';
import { c as createToastStack, a as createToastNotification } from './toast-util-eb89e79f.js';
import './index-04e9b0fa.js';
let Toast = class {
constructor(hostRef) {
registerInstance(this, hostRef);
/**
* position of the toast notification in screen
*/
this.position = 'top-center';
/**
* Time duration of the toast visibility
*/
this.timeout = 4000;
/**
* Type of the toast - success,failure, warning, inprogress
*/
this.type = 'warning';
/**
* The Content of the action link
*/
this.actionLinkText = '';
/**
* won't close automatically
*/
this.sticky = false;
}
componentWillLoad() {
this.toastContainer = createToastStack(this);
}
async trigger(opts) {
createToastNotification(opts, this.toastContainer, this);
}
render() {
return (h(Host, null, h("slot", null)));
}
};
export { Toast as fw_toast };