/*!
 *
 * carbon-angular v0.0.7 | table-toolbar-search.component.js
 *
 * Copyright 2014, 2019 IBM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import { Search } from "./../../search/search.component";
import { Component, HostBinding, Input } from "@angular/core";
var TableToolbarSearch = /** @class */ (function (_super) {
    __extends(TableToolbarSearch, _super);
    function TableToolbarSearch() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.tableSearch = true;
        _this.expandable = false;
        return _this;
    }
    Object.defineProperty(TableToolbarSearch.prototype, "persistentClass", {
        get: function () { return !this.expandable; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(TableToolbarSearch.prototype, "activeClass", {
        get: function () {
            return this.active && (this.value !== null || this.value !== "");
        },
        enumerable: true,
        configurable: true
    });
    TableToolbarSearch.prototype.ngOnInit = function () {
        this.size = "sm";
        if (this.expandable) {
            this.toolbar = true;
        }
    };
    TableToolbarSearch.decorators = [
        { type: Component, args: [{
                    selector: "ibm-table-toolbar-search",
                    template: "<div\n\tclass=\"bx--search\"\n\t[ngClass]=\"{\n\t\t'bx--search--sm': size === 'sm',\n\t\t'bx--search--xl': size === 'xl',\n\t\t'bx--search--light': theme === 'light',\n\t\t'bx--skeleton': skeleton,\n\t\t'bx--toolbar-search': toolbar,\n\t\t'bx--toolbar-search--active': toolbar && active\n\t}\"\n\trole=\"search\">\n\t<label class=\"bx--label\" [for]=\"id\">{{label}}</label>\n\n\t<div *ngIf=\"skeleton; else enableInput\" class=\"bx--search-input\"></div>\n\t<ng-template #enableInput>\n\t\t<input\n\t\t\t#input\n\t\t\t*ngIf=\"!toolbar || active || value !== ''\"\n\t\t\tclass=\"bx--search-input\"\n\t\t\t[type]=\"tableSearch || !toolbar ? 'text' : 'search'\"\n\t\t\trole=\"search\"\n\t\t\t[id]=\"id\"\n\t\t\t[value]=\"value\"\n\t\t\t[autocomplete]=\"autocomplete\"\n\t\t\t[placeholder]=\"placeholder\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[required]=\"required\"\n\t\t\t(input)=\"onSearch($event.target.value)\"/>\n\t\t<button *ngIf=\"!tableSearch && toolbar\" class=\"bx--toolbar-search__btn\" (click)=\"openSearch()\">\n\t\t\t<ibm-icon-search16 class=\"bx--search-magnifier\"></ibm-icon-search16>\n\t\t</button>\n\t\t<ibm-icon-search16 *ngIf=\"tableSearch || !toolbar\" (click)=\"openSearch()\" class=\"bx--search-magnifier\"></ibm-icon-search16>\n\t</ng-template>\n\n\t<button\n\t\t*ngIf=\"tableSearch || !toolbar\"\n\t\tclass=\"bx--search-close\"\n\t\t[ngClass]=\"{\n\t\t\t'bx--search-close--hidden': !value || value.length === 0\n\t\t}\"\n\t\t[title]=\"clearButtonTitle\"\n\t\t[attr.aria-label]=\"clearButtonTitle\"\n\t\t(click)=\"clearSearch()\">\n\t\t<ibm-icon-close16></ibm-icon-close16>\n\t</button>\n</div>\n"
                },] },
    ];
    TableToolbarSearch.propDecorators = {
        expandable: [{ type: HostBinding, args: ["class.bx--toolbar-search-container-expandable",] }, { type: Input }],
        persistentClass: [{ type: HostBinding, args: ["class.bx--toolbar-search-container-persistent",] }],
        activeClass: [{ type: HostBinding, args: ["class.bx--toolbar-search-container-active",] }]
    };
    return TableToolbarSearch;
}(Search));
export { TableToolbarSearch };
//# sourceMappingURL=table-toolbar-search.component.js.map