/**
 * Foundation adapters.
 */ /**
 * Container adapter interface
 * Default implementations are noop and returns meaningless value.
 */ export class ContainerAdapter { public addClass ( _className ) { } public removeClass ( _className ) { } public registerAnimationEndHandler ( _handler ) { } public deregisterAnimationEndHandler ( _handler ) { } public forceLayout ( ) { } public isAttachedToDOM ( ) { return false ; } public isChecked ( ) { return null ; } } /**
 * Native control adapter interface
 * Default implementations are noop and returns meaningless value.
 */ export class NativeControlAdapter { public registerChangeHandler ( _handler ) { } public deregisterChangeHandler ( _handler ) { } public getNativeControl ( ) { return null ; } public setDefaultOnChangeHandler ( _onChange ) { } } /**
 * Composite adapter for MDCChcekboxFoundation
 */ export class FoundationAdapter { private containerAdapter : ContainerAdapter ; private nativeControlAdapter : NativeControlAdapter ; private defaultOnchangeHandler : React . ChangeEventHandler < any > ; constructor ( ) { this . containerAdapter = new ContainerAdapter ( ) ; this . nativeControlAdapter = new NativeControlAdapter ( ) ; this . defaultOnchangeHandler = ( ) => { } ; } public setContainerAdapter ( containerAdapter ) { this . containerAdapter = containerAdapter ; } public setNativeControlAdapter ( nativeControlAdapter ) { this . nativeControlAdapter = nativeControlAdapter ; this . nativeControlAdapter . setDefaultOnChangeHandler ( this . defaultOnchangeHandler ) ; } public addClass ( className ) { this . containerAdapter . addClass ( className ) ; } public removeClass ( className ) { this . containerAdapter . removeClass ( className ) ; } public registerAnimationEndHandler ( handler ) { this . containerAdapter . registerAnimationEndHandler ( handler ) ; } public deregisterAnimationEndHandler ( handler ) { this . containerAdapter . deregisterAnimationEndHandler ( handler ) ; } public registerChangeHandler ( handler ) { this . nativeControlAdapter . registerChangeHandler ( handler ) ; } public deregisterChangeHandler ( handler ) { this . nativeControlAdapter . deregisterChangeHandler ( handler ) ; } public getNativeControl ( ) { return this . nativeControlAdapter . getNativeControl ( ) ; } public forceLayout ( ) { this . containerAdapter . forceLayout ( ) ; } public isAttachedToDOM ( ) { return this . containerAdapter . isAttachedToDOM ( ) ; } public setDefaultOnChangeHandler ( onChange ) { this . nativeControlAdapter . setDefaultOnChangeHandler ( onChange ) ; } public isChecked ( ) { return this . containerAdapter . isChecked ( ) ; } /**
     * MDCFoundation accepts only object as adapter
     * So we create object-proxy of instance.
     */ public toObject ( ) { const keys = Object . getOwnPropertyNames ( Object . getPrototypeOf ( this ) ) ; const object = { } ; keys . forEach ( ( key ) => { object [ key ] = ( ... args ) => this [ key ] ( ... args ) ; } ) ; return object ; } }