import { Component, Input } from '@angular/core';
import { BehaviorSubject, interval } from 'rxjs';
import { first } from 'rxjs/operators';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@aztrix/icons";
import * as i3 from "@aztrix/components/button";
import * as i4 from "@angular/cdk/clipboard";
export class CopyButtonComponent {
    constructor() {
        this.color = 'grey';
        this.copied$ = new BehaviorSubject(false);
    }
    didClickCopy() {
        this.copied$.next(true);
        interval(5000)
            .pipe(first())
            .subscribe(() => {
            this.copied$.next(false);
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CopyButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: CopyButtonComponent, selector: "ax-copy-button", inputs: { value: "value", color: "color" }, ngImport: i0, template: "<button\n  axButton\n  icon-button\n  [cdkCopyToClipboard]=\"value || ''\"\n  (cdkCopyToClipboardCopied)=\"didClickCopy()\"\n  [color]=\"color === 'grey' ? undefined : 'white'\"\n>\n  <ax-icon\n    class=\"icon\"\n    [ngClass]=\"{copied: copied$ | async, white: color === 'white'}\"\n    [name]=\"(copied$ | async) ? 'check-circle' : 'content-copy'\"\n  ></ax-icon>\n</button>\n", styles: [":host{display:flex;align-items:center;justify-content:center}.copied{color:var(--primary-color-500)}.copied.white{color:#fff}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i2.IconComponent, selector: "ax-icon", inputs: ["name", "inline"] }, { kind: "directive", type: i3.ButtonDirective, selector: "[axButton]", inputs: ["color", "labelHideMobile", "smallButton", "bigButton", "fullWidth", "filled", "outline", "icon-button", "hoverLabel", "hover", "lowercase", "disabled"] }, { kind: "directive", type: i4.CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CopyButtonComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-copy-button', template: "<button\n  axButton\n  icon-button\n  [cdkCopyToClipboard]=\"value || ''\"\n  (cdkCopyToClipboardCopied)=\"didClickCopy()\"\n  [color]=\"color === 'grey' ? undefined : 'white'\"\n>\n  <ax-icon\n    class=\"icon\"\n    [ngClass]=\"{copied: copied$ | async, white: color === 'white'}\"\n    [name]=\"(copied$ | async) ? 'check-circle' : 'content-copy'\"\n  ></ax-icon>\n</button>\n", styles: [":host{display:flex;align-items:center;justify-content:center}.copied{color:var(--primary-color-500)}.copied.white{color:#fff}\n"] }]
        }], propDecorators: { value: [{
                type: Input
            }], color: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29weS1idXR0b24uY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb21wb25lbnRzL2NvcHktdGV4dC9jb3B5LWJ1dHRvbi9jb3B5LWJ1dHRvbi5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2NvbXBvbmVudHMvY29weS10ZXh0L2NvcHktYnV0dG9uL2NvcHktYnV0dG9uLmNvbXBvbmVudC5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQyxTQUFTLEVBQUUsS0FBSyxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBQy9DLE9BQU8sRUFBQyxlQUFlLEVBQUUsUUFBUSxFQUFDLE1BQU0sTUFBTSxDQUFDO0FBQy9DLE9BQU8sRUFBQyxLQUFLLEVBQUMsTUFBTSxnQkFBZ0IsQ0FBQzs7Ozs7O0FBT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