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);
        });
    }
}
CopyButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: CopyButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
CopyButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.5", 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:block}.input{overflow:hidden;color:#555;margin:0;padding:0}.hidden{display:inline;position:relative;font-size:1rem}.hidden .text{display:inline-flex;width:100%;overflow:hidden;padding-left:.25rem;filter:blur(3px)}.show{position:absolute;left:50%;transform:translate(-50%);background-color:#fff;box-shadow:0 0 5px 10px #fff}.copied{color:var(--primary-color-500)}.copied.white{color:#fff}.code{display:grid;grid-template-columns:1fr 34px;background-color:#efefef;padding:1rem}.code>code{min-width:0}.code pre{white-space:pre-wrap;word-break:break-word;margin:0}@keyframes slide-in{to{margin-left:1rem}}\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: "15.1.5", 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:block}.input{overflow:hidden;color:#555;margin:0;padding:0}.hidden{display:inline;position:relative;font-size:1rem}.hidden .text{display:inline-flex;width:100%;overflow:hidden;padding-left:.25rem;filter:blur(3px)}.show{position:absolute;left:50%;transform:translate(-50%);background-color:#fff;box-shadow:0 0 5px 10px #fff}.copied{color:var(--primary-color-500)}.copied.white{color:#fff}.code{display:grid;grid-template-columns:1fr 34px;background-color:#efefef;padding:1rem}.code>code{min-width:0}.code pre{white-space:pre-wrap;word-break:break-word;margin:0}@keyframes slide-in{to{margin-left:1rem}}\n"] }]
        }], propDecorators: { value: [{
                type: Input
            }], color: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29weS1idXR0b24uY29tcG9uZW50LmpzIiwic291cmNlUm9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