{"version":3,"file":"windows-plus-form-fields-custom-checkbox.mjs","sources":["../../../projects/windows-plus-form-fields/custom-checkbox/components/custom-checkbox/custom-checkbox.component.ts","../../../projects/windows-plus-form-fields/custom-checkbox/components/custom-checkbox/custom-checkbox.component.html","../../../projects/windows-plus-form-fields/custom-checkbox/custom-checkbox.module.ts","../../../projects/windows-plus-form-fields/custom-checkbox/public-api.ts","../../../projects/windows-plus-form-fields/custom-checkbox/windows-plus-form-fields-custom-checkbox.ts"],"sourcesContent":["import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core';\r\nimport { FormControl } from '@angular/forms'\r\nimport { Subscription } from 'rxjs'\r\n\r\n@Component({\r\n  selector: 'wp-custom-checkbox',\r\n  templateUrl: './custom-checkbox.component.html',\r\n  styleUrls: ['./custom-checkbox.component.sass']\r\n})\r\nexport class CustomCheckboxComponent implements OnInit, OnChanges, OnDestroy {\r\n\t/**\r\n\t * @description the custom checkbox identifier\r\n\t */\r\n\t@Input() id: string\r\n\t/**\r\n\t * @description the custom checkbox label\r\n\t */\r\n\t@Input() label: string\r\n\t/**\r\n\t * @description whether the checkbox is currently selected\r\n\t */\r\n\t@Input() isSelected: boolean\r\n\t/**\r\n\t * @description the name of the checkbox\r\n\t */\r\n\t@Input() name: string\r\n\t/**\r\n\t * @description whether the checkbox is disabled\r\n\t */\r\n\t@Input() disabled?: boolean\r\n\t/**\r\n\t * @description the callback method to be ran when the checkbox is interacted with\r\n\t */\r\n\t@Output() handleChange: EventEmitter<boolean> = new EventEmitter<boolean>()\r\n\t/**\r\n\t * @description the form control representing the current value of the checkbox\r\n\t */\r\n  checkboxControl: FormControl\r\n\t/**\r\n\t * @description the subscription to the checkbox value changes\r\n\t */\r\n  checkboxSubscription: Subscription\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description Class constructor specifying the required services for the component\r\n\t */\r\n\tconstructor() {\r\n\t\tthis.checkboxControl = new FormControl()\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description The method to be run when the component is rendered\r\n\t */\r\n\tngOnInit(): void {\r\n\t\tthis.checkboxSubscription = this.checkboxControl.valueChanges.subscribe((checked: boolean) => {\r\n      this.handleChange.emit(checked);\r\n    });\r\n\r\n    if (this.isSelected !== undefined) {\r\n      this.checkboxControl.setValue(this.isSelected, { emitEvent: false });\r\n    }\r\n\t}\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description the method to be run when the components input properties are changed\r\n\t * @param changes the changes to the input properties\r\n\t */\r\n\tngOnChanges(changes: SimpleChanges): void {\r\n    if (changes['isSelected'] != null && !changes['isSelected'].firstChange) {\r\n      this.checkboxControl.setValue(changes['isSelected'].currentValue, { emitEvent: false });\r\n    }\r\n\r\n\t\tif (changes['disabled']) {\r\n      if (changes['disabled'].currentValue) {\r\n        this.checkboxControl.disable({ emitEvent: false });\r\n      } else {\r\n        this.checkboxControl.enable({ emitEvent: false });\r\n      }\r\n    }\r\n  }\r\n\t/**\r\n\t * @author Alex Hodson\r\n\t * @description the method to be run when the component is destroyed\r\n\t */\r\n  ngOnDestroy(): void {\r\n    this.checkboxSubscription.unsubscribe();\r\n  }\r\n}\r\n","<div class=\"custom-checkbox\">\r\n\t<div class=\"boxes\">\r\n\t\t<label class=\"custom-label text-truncate\">\r\n\t\t\t<input\r\n\t\t\t\t[id]=\"id\"\r\n\t\t\t\ttype=\"checkbox\"\r\n\t\t\t\t[name]=\"name\"\r\n\t\t\t\t[formControl]=\"checkboxControl\"\r\n\t\t\t/>\r\n\t\t\t<span>{{label}}</span>\r\n\t\t</label>\r\n\t</div>\r\n</div>\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { CustomCheckboxComponent } from './components/custom-checkbox/custom-checkbox.component';\r\nimport { ReactiveFormsModule } from '@angular/forms'\r\n\r\n\r\n\r\n@NgModule({\r\n  declarations: [\r\n    CustomCheckboxComponent\r\n  ],\r\n  imports: [\r\n    CommonModule,\r\n\t\tReactiveFormsModule\r\n  ],\r\n  exports: [\r\n    CustomCheckboxComponent\r\n  ]\r\n})\r\nexport class CustomCheckboxModule { }\r\n","/*\r\n * Public API Surface of windows-plus-form-fields\r\n */\r\n\r\nexport * from './custom-checkbox.module'\r\nexport * from './components/custom-checkbox/custom-checkbox.component'\r\nexport * from './util/interface/custom-checkbox.interface'","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MASa,uBAAuB,CAAA;AAiCnC;;;AAGG;AACH,IAAA,WAAA,GAAA;AAhBA;;AAEG;AACO,QAAA,IAAA,CAAA,YAAY,GAA0B,IAAI,YAAY,EAAW,CAAA;AAc1E,QAAA,IAAI,CAAC,eAAe,GAAG,IAAI,WAAW,EAAE,CAAA;KACxC;AACD;;;AAGG;IACH,QAAQ,GAAA;AACP,QAAA,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,OAAgB,KAAI;AACzF,YAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAClC,SAAC,CAAC,CAAC;AAEH,QAAA,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE;AACjC,YAAA,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;SACtE;KACH;AACD;;;;AAIG;AACH,IAAA,WAAW,CAAC,OAAsB,EAAA;AAC/B,QAAA,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE;AACvE,YAAA,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;SACzF;AAEH,QAAA,IAAI,OAAO,CAAC,UAAU,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