ember-bootstrap-toasts-manager
Version:
Ember-addon that provides a simple mechanism for interaction with user using toasts.
40 lines (34 loc) • 1.26 kB
text/typescript
import { action } from '@ember/object';
import Component from '@glimmer/component';
import ToastsBaseBodyComponent from 'ember-bootstrap-toasts-manager/components/toasts/base/body';
import ToastsBaseCloseComponent from 'ember-bootstrap-toasts-manager/components/toasts/base/close';
import ToastsBaseHeaderComponent from 'ember-bootstrap-toasts-manager/components/toasts/base/header';
import type { ToastOptions } from 'ember-bootstrap-toasts-manager/interfaces/toast-options.type';
export interface ToastsBaseSignature {
// The arguments accepted by the component
Args: {
options: ToastOptions;
onClose?: () => void;
};
// Any blocks yielded by the component
Blocks: {
default: { Params: { Positional: [] } };
};
// The element to which `...attributes` is applied in the component template
Element: HTMLDivElement;
}
export default class ToastsBaseComponent extends Component<ToastsBaseSignature> {
header = ToastsBaseHeaderComponent;
body = ToastsBaseBodyComponent;
close = ToastsBaseCloseComponent;
get showHeader(): boolean {
return this.args.options.showHeader ?? true;
}
get showBody(): boolean {
return this.args.options.showBody ?? true;
}
onClose(): void {
this.args.onClose?.();
}
}