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.
59 lines (58 loc) • 2.66 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;
};
var IgcSnackbarComponent_1;
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 { themes } from '../../theming/theming-decorator.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';
let IgcSnackbarComponent = IgcSnackbarComponent_1 = class IgcSnackbarComponent extends EventEmitterMixin(IgcBaseAlertLikeComponent) {
constructor() {
super(...arguments);
this.contentRef = createRef();
this._animationPlayer = addAnimationController(this, this.contentRef);
}
static register() {
registerComponent(IgcSnackbarComponent_1, IgcButtonComponent);
}
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];
__decorate([
property({ attribute: 'action-text' })
], IgcSnackbarComponent.prototype, "actionText", void 0);
IgcSnackbarComponent = IgcSnackbarComponent_1 = __decorate([
themes(all)
], IgcSnackbarComponent);
export default IgcSnackbarComponent;
//# sourceMappingURL=snackbar.js.map