import { Atom } from "../../atom";
import { Helpers } from "../../setup";
export class ChipsAtom extends Atom {
    constructor() {
        super(...arguments);
        this.removeItem = async (index) => this.getLocator()
            .locator(Helpers.page.locator(`.${ChipsAtom.itemRemoveIconClass}`))
            .nth(index)
            .click();
        this.clearAll = async () => {
            await this.getLocator()
                .locator(`.${ChipsAtom.clearAllLinkClass}`)
                .click();
        };
        this.click = async () => this.getLocator().click();
    }
    static { this.CSS_CLASS = "nui-chips"; }
    static { this.qtyLabelClass = "nui-chips__count"; }
    static { this.itemClass = "nui-chip__value"; }
    static { this.itemRemoveIconClass = "nui-chip__value-remove"; }
    static { this.groupNameClass = "nui-chips__group-name"; }
    static { this.clearAllLinkClass = "nui-chips__clear"; }
    static { this.chipsoverflowedClass = "nui-chips-overflowed__counter"; }
    get groups() {
        return this.getLocator().locator(Helpers.page.locator(`.${ChipsAtom.groupNameClass}`));
    }
    get getChipElements() {
        return this.getLocator().locator(`.${ChipsAtom.itemClass}`);
    }
    getChipElement(index) {
        return this.getLocator().locator(`.${ChipsAtom.itemClass}`).nth(index);
    }
    async getChipsQuantityFromLabel() {
        const t = await this.getLocator()
            .locator(`.${ChipsAtom.qtyLabelClass}`)
            .textContent();
        if (!t) {
            return Promise.resolve(-1);
        }
        return +t.slice(1, -1);
    }
    get getChipsOverflow() {
        return this.getLocator().locator(Helpers.page.locator(`.${ChipsAtom.chipsoverflowedClass}`));
    }
    get popup() {
        return Helpers.page.locator(`.nui-popover-container__content`);
    }
}
//# sourceMappingURL=chips.atom.js.map