/**
 * @license
 * Copyright Endlessjs. All Rights Reserved.
 * Licensed under the MIT License. See License.txt in the project root for license information.
 */
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 __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Component, HostBinding, Input } from '@angular/core';
/**
 * Badge is a simple labeling component.
 * It can be used to add additional information to any content or highlight unread items.
 *
 * Element is absolute positioned, so parent should be
 * [positioned element](https://developer.mozilla.org/en-US/docs/Web/CSS/position).
 * It means parent `position` should be set to anything except `static`, e.g. `relative`,
 * `absolute`, `fixed`, or `sticky`.
 *
 * ### Installation
 *
 * Import `ElBadgeModule` to your feature module.
 * ```ts
 * @NgModule({
 *   imports: [
 *     // ...
 *     ElBadgeModule,
 *   ],
 * })
 * export class PageModule { }
 * ```
 * ### Usage
 *
 * Badge with default position and status(color):
 *
 * ```html
 * <el-badge text="badgeText"></el-badge>
 * ```
 *
 * For example, badge can be placed into el-card header:
 * @stacked-example(Showcase, badge/badge-showcase.component)
 *
 * Badge located on the bottom right with warning status:
 *
 * ```html
 * <el-badge text="badgeText" status="warning" position="bottom right">
 * </el-badge>
 * ```
 *
 * @styles
 *
 * badge-border-radius:
 * badge-text-font-family:
 * badge-text-font-size:
 * badge-text-font-weight:
 * badge-text-line-height:
 * badge-padding:
 * badge-primary-background-color:
 * badge-primary-text-color:
 * badge-success-background-color:
 * badge-success-text-color:
 * badge-info-background-color:
 * badge-info-text-color:
 * badge-warning-background-color:
 * badge-warning-text-color:
 * badge-danger-background-color:
 * badge-danger-text-color:
 */
var ElBadgeComponent = /** @class */ (function () {
    function ElBadgeComponent() {
        /**
         * Text to display
         * @type string
         */
        this.text = '';
        this._defaultPosition = 'top right';
        this._position = this._defaultPosition;
        /**
         * Badge status (adds specific styles):
         * 'primary', 'info', 'success', 'warning', 'danger'
         */
        this.status = 'primary';
    }
    Object.defineProperty(ElBadgeComponent.prototype, "position", {
        /**
         * Badge position
         *
         * Can be set to any class or to one of predefined positions:
         * 'top left', 'top right', 'bottom left', 'bottom right',
         * 'top start', 'top end', 'bottom start', 'bottom end'
         * @type string
         */
        get: function () {
            return this._position;
        },
        set: function (value) {
            this._position = value || this._defaultPosition;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ElBadgeComponent.prototype, "primary", {
        get: function () {
            return this.status === 'primary';
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ElBadgeComponent.prototype, "success", {
        get: function () {
            return this.status === 'success';
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ElBadgeComponent.prototype, "info", {
        get: function () {
            return this.status === 'info';
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ElBadgeComponent.prototype, "warning", {
        get: function () {
            return this.status === 'warning';
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ElBadgeComponent.prototype, "danger", {
        get: function () {
            return this.status === 'danger';
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ElBadgeComponent.prototype, "top", {
        get: function () {
            return this.position.includes('top');
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ElBadgeComponent.prototype, "right", {
        get: function () {
            return this.position.includes('right');
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ElBadgeComponent.prototype, "bottom", {
        get: function () {
            return this.position.includes('bottom');
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ElBadgeComponent.prototype, "left", {
        get: function () {
            return this.position.includes('left');
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ElBadgeComponent.prototype, "start", {
        get: function () {
            return this.position.includes('start');
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ElBadgeComponent.prototype, "end", {
        get: function () {
            return this.position.includes('end');
        },
        enumerable: true,
        configurable: true
    });
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], ElBadgeComponent.prototype, "text", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String),
        __metadata("design:paramtypes", [String])
    ], ElBadgeComponent.prototype, "position", null);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], ElBadgeComponent.prototype, "status", void 0);
    __decorate([
        HostBinding('class.status-primary'),
        __metadata("design:type", Boolean),
        __metadata("design:paramtypes", [])
    ], ElBadgeComponent.prototype, "primary", null);
    __decorate([
        HostBinding('class.status-success'),
        __metadata("design:type", Boolean),
        __metadata("design:paramtypes", [])
    ], ElBadgeComponent.prototype, "success", null);
    __decorate([
        HostBinding('class.status-info'),
        __metadata("design:type", Boolean),
        __metadata("design:paramtypes", [])
    ], ElBadgeComponent.prototype, "info", null);
    __decorate([
        HostBinding('class.status-warning'),
        __metadata("design:type", Boolean),
        __metadata("design:paramtypes", [])
    ], ElBadgeComponent.prototype, "warning", null);
    __decorate([
        HostBinding('class.status-danger'),
        __metadata("design:type", Boolean),
        __metadata("design:paramtypes", [])
    ], ElBadgeComponent.prototype, "danger", null);
    __decorate([
        HostBinding('class.position-top'),
        __metadata("design:type", Boolean),
        __metadata("design:paramtypes", [])
    ], ElBadgeComponent.prototype, "top", null);
    __decorate([
        HostBinding('class.position-right'),
        __metadata("design:type", Boolean),
        __metadata("design:paramtypes", [])
    ], ElBadgeComponent.prototype, "right", null);
    __decorate([
        HostBinding('class.position-bottom'),
        __metadata("design:type", Boolean),
        __metadata("design:paramtypes", [])
    ], ElBadgeComponent.prototype, "bottom", null);
    __decorate([
        HostBinding('class.position-left'),
        __metadata("design:type", Boolean),
        __metadata("design:paramtypes", [])
    ], ElBadgeComponent.prototype, "left", null);
    __decorate([
        HostBinding('class.position-start'),
        __metadata("design:type", Boolean),
        __metadata("design:paramtypes", [])
    ], ElBadgeComponent.prototype, "start", null);
    __decorate([
        HostBinding('class.position-end'),
        __metadata("design:type", Boolean),
        __metadata("design:paramtypes", [])
    ], ElBadgeComponent.prototype, "end", null);
    ElBadgeComponent = __decorate([
        Component({
            selector: 'el-badge',
            template: "{{text}}",
            styles: [":host{position:absolute;text-align:center;white-space:nowrap;vertical-align:baseline}:host(.position-top){top:0}:host(.position-right){right:0}:host(.position-bottom){bottom:0}:host(.position-left){left:0}[dir=ltr] :host(.position-start){left:0}[dir=rtl] :host(.position-start){right:0}[dir=ltr] :host(.position-end){right:0}[dir=rtl] :host(.position-end){left:0}\n"]
        })
    ], ElBadgeComponent);
    return ElBadgeComponent;
}());
export { ElBadgeComponent };
//# sourceMappingURL=badge.component.js.map