igniteui-webcomponents
Version:
Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.
56 lines (55 loc) • 2.51 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { html, nothing } from 'lit';
import { property } from 'lit/decorators.js';
import { createRef, ref } from 'lit/directives/ref.js';
import { addAnimationController } from '../../animations/player.js';
import { addThemingController } from '../../theming/theming-controller.js';
import IgcButtonComponent from '../button/button.js';
import { registerComponent } from '../common/definitions/register.js';
import { IgcBaseAlertLikeComponent } from '../common/mixins/alert.js';
import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
import { styles as shared } from './themes/shared/snackbar.common.css.js';
import { styles } from './themes/snackbar.base.css.js';
import { all } from './themes/themes.js';
class IgcSnackbarComponent extends EventEmitterMixin(IgcBaseAlertLikeComponent) {
static register() {
registerComponent(IgcSnackbarComponent, IgcButtonComponent);
}
constructor() {
super();
this._contentRef = createRef();
this._player = addAnimationController(this, this._contentRef);
addThemingController(this, all);
}
_handleClick() {
this.emitEvent('igcAction');
}
render() {
return html `
<div ${ref(this._contentRef)} part="base" .inert=${!this.open}>
<span part="message">
<slot></slot>
</span>
<slot name="action" part="action-container" @click=${this._handleClick}>
${this.actionText
? html `<igc-button type="button" part="action" variant="flat">
${this.actionText}
</igc-button>`
: nothing}
</slot>
</div>
`;
}
}
IgcSnackbarComponent.tagName = 'igc-snackbar';
IgcSnackbarComponent.styles = [styles, shared];
export default IgcSnackbarComponent;
__decorate([
property({ attribute: 'action-text' })
], IgcSnackbarComponent.prototype, "actionText", void 0);
//# sourceMappingURL=snackbar.js.map