import { ChangeDetectionStrategy , Component , EventEmitter , HostBinding , Input , Output , } from '@angular/core' ; import { UniqueIdGenerator } from '../../helpers/unique-id-generator.helper' ; @ Component ( { selector : 'kirby-checkbox' , templateUrl : './checkbox.component.html' , styleUrls : [ './checkbox.component.scss' ] , changeDetection : ChangeDetectionStrategy . OnPush , } ) export class CheckboxComponent { @ Input ( ) checked : boolean = false ; @ Input ( ) attentionLevel : '1' | '2' = '2' ; @ HostBinding ( 'class.has-label' ) @ Input ( ) text : string ; @ HostBinding ( 'class' ) @ Input ( ) size ? : 'xs' | 'sm' | 'md' ; @ HostBinding ( 'class.error' ) @ Input ( ) hasError : boolean = false ; @ Input ( ) disabled = false ; @ HostBinding ( 'attr.disabled' ) get _isDisabled ( ) { return this . disabled ? 'disabled' : null ; } @ HostBinding ( 'class.attention-level1' ) get isAttentionLevel1 ( ) { return this . attentionLevel === '1' ; } @ HostBinding ( 'class.attention-level2' ) get isAttentionLevel2 ( ) { return this . attentionLevel === '2' ; } @ Output ( ) checkedChange = new EventEmitter < boolean > ( ) ; onChecked ( checked ) { this . checked = checked ; this . checkedChange . emit ( this . checked ) ; } _labelId = UniqueIdGenerator . scopedTo ( 'kirby-checkbox-label' ) . next ( ) ; }