{"version":3,"file":"pepperi-addons-ngx-lib-button.mjs","sources":["../../../projects/ngx-lib/button/button.model.ts","../../../projects/ngx-lib/button/button.component.ts","../../../projects/ngx-lib/button/button.component.html","../../../projects/ngx-lib/button/button.module.ts","../../../projects/ngx-lib/button/public-api.ts","../../../projects/ngx-lib/button/pepperi-addons-ngx-lib-button.ts"],"sourcesContent":["export class PepButton {\n    key: string;\n    value?: string;\n    classNames?: string;\n    disabled?: boolean;\n    iconName?: string;\n    iconPosition?: 'start' | 'end';\n    callback?: (action: IPepButtonClickEvent) => void;\n\n    constructor(data: Partial<PepButton>) {\n        Object.assign(this, data);\n    }\n}\n\nexport interface IPepButtonClickEvent {\n    source: PepButton;\n    event?: Event;\n}\n","import {\n    Component,\n    OnDestroy,\n    Input,\n    Output,\n    EventEmitter,\n    Renderer2,\n    ElementRef,\n} from '@angular/core';\nimport {\n    PepStyleType,\n    PepStyleStateType,\n    PepSizeType,\n} from '@pepperi-addons/ngx-lib';\nimport { PepIconType } from '@pepperi-addons/ngx-lib/icon';\nimport { PepButton, IPepButtonClickEvent } from './button.model';\n\n/**\n * This is a button component that support pepperi theme\n * style & state & sizes\n *\n * @export\n * @class PepButtonComponent\n * @implements {OnDestroy}\n */\n@Component({\n    selector: 'pep-button',\n    templateUrl: './button.component.html',\n    styleUrls: ['./button.component.scss', './button.component.theme.scss'],\n})\nexport class PepButtonComponent implements OnDestroy {\n    /**\n     * The button key\n     *\n     * @type {string}\n     * @memberof PepButtonComponent\n     */\n    @Input() key: string;\n\n    /**\n     * The text on the button.\n     *\n     * @type {string}\n     * @memberof PepButtonComponent\n     */\n    @Input() value: string;\n\n    /**\n     * The style of the button.\n     *\n     * @type {PepStyleType}\n     * @memberof PepButtonComponent\n     */\n    @Input() styleType: PepStyleType = 'weak';\n\n    /**\n     * The style state of the button.\n     *\n     * @type {PepStyleStateType}\n     * @memberof PepButtonComponent\n     */\n    @Input() styleStateType: PepStyleStateType = 'system';\n\n    /**\n     * The size of the button.\n     *\n     * @type {PepSizeType}\n     * @memberof PepButtonComponent\n     */\n    @Input() sizeType: PepSizeType = 'md';\n\n    /**\n     * Class names that should be on the button element tag like classNames=\"class1 class2\"\n     *\n     * @memberof PepButtonComponent\n     */\n    @Input() classNames = '';\n\n    /**\n     * If the button is disable or not.\n     *\n     * @type {boolean}\n     * @memberof PepButtonComponent\n     */\n    @Input() disabled = false;\n\n    /**\n     * The icon name to show on the button. look in (@link icon -> All icons)\n     *\n     * @type {PepIconType} See {@link PepIconType}\n     * @memberof PepButtonComponent\n     */\n    @Input() iconName: PepIconType;\n\n    /**\n     * The icon position.\n     *\n     * @type {('start' | 'end')}\n     * @memberof PepButtonComponent\n     */\n    @Input() iconPosition: 'start' | 'end' = 'end';\n\n    private _visible = true;\n    /**\n     * If the button is visible or not.\n     *\n     * @memberof PepButtonComponent\n     */\n    @Input()\n    set visible(visible: boolean) {\n        if (visible !== undefined) {\n            this._visible = !!visible;\n            if (visible) {\n                this.renderer.removeClass(\n                    this.element.nativeElement,\n                    'hidden-element'\n                );\n            } else {\n                this.renderer.addClass(\n                    this.element.nativeElement,\n                    'hidden-element'\n                );\n            }\n        }\n    }\n    get visible(): boolean {\n        return this._visible;\n    }\n\n    /**\n     * The button click event.\n     *\n     * @type {EventEmitter<IPepButtonClickEvent>}\n     * @memberof PepButtonComponent\n     */\n    @Output()\n    buttonClick: EventEmitter<IPepButtonClickEvent> = new EventEmitter<IPepButtonClickEvent>();\n\n    constructor(private renderer: Renderer2, private element: ElementRef) { }\n\n    ngOnDestroy(): void {\n        // if (this.buttonClick) {\n        //     this.buttonClick.unsubscribe();\n        // }\n    }\n\n    /**\n     * The button click\n     */\n    onButtonClicked(event: Event): void {\n        const button = new PepButton({\n            key: this.key,\n            value: this.value,\n        });\n\n        const buttonClick = {\n            source: button,\n            event,\n        };\n\n        this.buttonClick.emit(buttonClick);\n    }\n}\n","<button mat-button [pepDataQa]=\"key ? key : value\"\n    class=\"pep-button {{ sizeType }} {{ styleType }} {{ styleStateType }} {{ classNames }}\"\n    [ngClass]=\"{ 'icon-button': iconName && !value }\" [disabled]=\"disabled\" (click)=\"onButtonClicked($event)\">\n    <ng-container *ngTemplateOutlet=\"contentTemplate\">\n    </ng-container>\n</button>\n\n<ng-template #contentTemplate>\n    <mat-icon *ngIf=\"iconName && iconPosition === 'start'\" [ngClass]=\"{ 'pull-left flip': value }\">\n        <pep-icon name=\"{{iconName}}\"></pep-icon>\n    </mat-icon>\n    <span *ngIf=\"value\" class=\"ellipsis pull-left flip\"\n        [ngClass]=\"{ 'button-title-with-icon': iconName, 'icon-before': iconPosition === 'start' }\" [title]=\"value\">\n        {{value}}\n    </span>\n    <mat-icon *ngIf=\"iconName && iconPosition === 'end'\" [ngClass]=\"{ 'pull-left flip': value }\">\n        <pep-icon name=\"{{iconName}}\"></pep-icon>\n    </mat-icon>\n</ng-template>","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { MatCommonModule } from '@angular/material/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { PepIconModule } from '@pepperi-addons/ngx-lib/icon';\nimport { PepNgxLibModule } from '@pepperi-addons/ngx-lib';\n\nimport { PepButtonComponent } from './button.component';\n\n@NgModule({\n    imports: [\n        CommonModule,\n        // Material modules\n        MatCommonModule,\n        MatButtonModule,\n        MatIconModule,\n        // ngx-lib modules\n        PepNgxLibModule,\n        PepIconModule,\n    ],\n    exports: [PepButtonComponent],\n    declarations: [PepButtonComponent],\n})\nexport class PepButtonModule {}\n","/*\n * Public API Surface of ngx-lib/button\n */\nexport * from './button.module';\nexport * from './button.component';\nexport * from './button.model';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MAAa,SAAS,CAAA;AASlB,IAAA,WAAA,CAAY,IAAwB,EAAA;AAChC,QAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;KAC7B;A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