{"version":3,"file":"asoftwareworld-form-builder-pro-color-picker.mjs","sources":["../../src/components/color-picker/color-picker.ts","../../src/components/color-picker/color-picker.html","../../src/components/color-picker/color-picker.module.ts","../../src/components/color-picker/public_api.ts","../../src/components/color-picker/asoftwareworld-form-builder-pro-color-picker.ts"],"sourcesContent":["import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';\nimport { Constants } from '@asoftwareworld/form-builder-pro/common';\n\n@Component({\n    selector: 'asw-color-picker',\n    templateUrl: './color-picker.html'\n})\nexport class AswColorPicker implements OnInit {\n    @Input() isEditor = false;\n    @Input() textColor!: string;\n    @Input() backgroundColor!: string;\n    @Output() colorChange: EventEmitter<{ colorCode: string; where: string }> = new EventEmitter<{ colorCode: string; where: string }>();\n    constants = Constants;\n    public colorsName: string[] = [];\n\n    constructor() {}\n\n    ngOnInit(): void {\n        this.colorsName = Object.keys(this.constants.colors);\n    }\n\n    /**\n     * Change color from default colors\n     */\n    public onChange(color: string, where: string): void {\n        if (where === 'textColor') {\n            this.textColor = color;\n        } else {\n            this.backgroundColor = color;\n        }\n        this.colorChange.emit({ colorCode: color, where });\n    }\n\n    /**\n     * Change color from input\n     */\n    public changeColorManual(color: string, where: string): void {\n        const isValid = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(color);\n        if (isValid) {\n            this.onChange(color, where);\n        }\n    }\n}\n","<ng-container *ngIf=\"isEditor; else normalPicker\">\r\n    <div class=\"asw-color-picker\">\r\n        <div class=\"opened asw-opened\">\r\n            <div class=\"asw-row\">\r\n                <div class=\"asw-col-md-6\">\r\n                    <span>Background color</span>\r\n                    <div class=\"colors\">\r\n                        <div [ngClass]=\"colorName\" [class.selected]=\"backgroundColor == constants.colors[colorName]\"\r\n                            (click)=\"onChange(constants.colors[colorName], 'backgroundColor')\"\r\n                            *ngFor=\"let colorName of colorsName\" class=\"circle\"\r\n                            [style.background]=\"constants.colors[colorName]\"></div>\r\n                    </div>\r\n                    <div class=\"asw-hex-code\">\r\n                        <p>Hex Code</p>\r\n                        <div class=\"asw-input\">\r\n                            <input type=\"text\" maxlength=\"7\" [value]=\"backgroundColor\"\r\n                                (keyup)=\"changeColorManual(paintBackgroundColor.value, 'backgroundColor')\"\r\n                                #paintBackgroundColor />\r\n                        </div>\r\n                    </div>\r\n                </div>\r\n                <div class=\"asw-col-md-6\">\r\n                    <span>Text color</span>\r\n                    <div class=\"colors\">\r\n                        <div [ngClass]=\"colorName\" [class.selected]=\"textColor == constants.colors[colorName]\"\r\n                            (click)=\"onChange(constants.colors[colorName], 'textColor')\"\r\n                            *ngFor=\"let colorName of colorsName\" class=\"circle\"\r\n                            [style.background]=\"constants.colors[colorName]\"></div>\r\n                    </div>\r\n                    <div class=\"asw-hex-code\">\r\n                        <p>Hex Code</p>\r\n                        <div class=\"asw-input\">\r\n                            <input type=\"text\" maxlength=\"7\" [value]=\"textColor\"\r\n                                (keyup)=\"changeColorManual(paintTextColor.value, 'textColor')\" #paintTextColor />\r\n                        </div>\r\n                    </div>\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</ng-container>\r\n<ng-template #normalPicker>\r\n    <div class=\"asw-color-picker\">\r\n        <div class=\"opened-menu asw-opened-menu\">\r\n            <div class=\"colors\">\r\n                <div [ngClass]=\"colorName\" [class.selected]=\"backgroundColor == constants.colors[colorName]\"\r\n                    (click)=\"onChange(constants.colors[colorName], 'backgroundColor')\"\r\n                    *ngFor=\"let colorName of colorsName\" class=\"circle\"\r\n                    [style.background]=\"constants.colors[colorName]\"></div>\r\n            </div>\r\n            <div class=\"asw-hex-code\">\r\n                <p>Hex Code</p>\r\n                <div class=\"asw-input\">\r\n                    <input type=\"text\" maxlength=\"7\" [value]=\"backgroundColor\"\r\n                        (keyup)=\"changeColorManual(paintColor.value, 'backgroundColor')\" #paintColor />\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </div>\r\n</ng-template>","/**\n * @license\n * Copyright ASW (A Software World) All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file\n */\n\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AswColorPicker } from './color-picker';\n\n@NgModule({\n    imports: [CommonModule],\n    declarations: [AswColorPicker],\n    exports: [AswColorPicker]\n})\nexport class AswColorPickerModule {}\n","/**\n * @license\n * Copyright ASW (A Software World) All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file\n */\n\nexport * from './color-picker';\nexport * from './color-picker.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;MAOa,cAAc,CAAA;IACd,QAAQ,GAAG,KAAK;AAChB,IAAA,SAAS;AACT,IAAA,eAAe;AACd,IAAA,WAAW,GAAuD,IAAI,YAAY,EAAwC;IACpI,SAAS,GAAG,SAAS;IACd,UAAU,GAAa,EAAE;AAEhC,IAAA,WAAA,GAAA;IAEA,QAAQ,GAAA;AACJ,QAAA,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;;AAGxD;;AAEG;IACI,QAAQ,CAAC,KAAa,EAAE,KAAa,EAAA;AACxC,QAAA,IAAI,KAAK,KAAK,WAAW,EAAE;AACvB,YAAA,IAAI,CAAC,SAAS,GAAG,KAAK;;aACnB;AACH,YAAA,IAAI,CAAC,eAAe,GAAG,KAAK;;AAEhC,QAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;;AAGtD;;AAEG;IACI,iBAAiB,CAAC,KAAa,EAAE,KAAa,EAAA;QACjD,MAAM,OAAO,GAAG,oCAAoC,CAAC,IAAI,CAAC,KAAK,CAAC;QAChE,IAAI,OAAO,EAAE;AACT,YAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;;;uGAhC1B,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,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