blob: 64f33646a6c42a61d9430b463d97b941dce4bf7b [file] [log] [blame]
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/observers"),require("@angular/core"),require("@angular/material/core"),require("@angular/cdk/a11y"),require("@angular/cdk/coercion"),require("@angular/forms"),require("@angular/platform-browser/animations")):"function"==typeof define&&define.amd?define("@angular/material/slide-toggle",["exports","@angular/cdk/observers","@angular/core","@angular/material/core","@angular/cdk/a11y","@angular/cdk/coercion","@angular/forms","@angular/platform-browser/animations"],t):t(((e=e||self).ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.slideToggle={}),e.ng.cdk.observers,e.ng.core,e.ng.material.core,e.ng.cdk.a11y,e.ng.cdk.coercion,e.ng.forms,e.ng.platformBrowser.animations)}(this,(function(e,t,n,i,a,o,l,r){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var g=new n.InjectionToken("mat-slide-toggle-default-options",{providedIn:"root",factory:function(){return{disableToggleValue:!1}}}),c=0,p={provide:l.NG_VALUE_ACCESSOR,useExisting:n.forwardRef((function(){return m})),multi:!0},u=function u(e,t){this.source=e,this.checked=t},m=function(e){function t(t,i,a,o,l,r){var s=e.call(this,t)||this;return s._focusMonitor=i,s._changeDetectorRef=a,s.defaults=l,s._animationMode=r,s._onChange=function(e){},s._onTouched=function(){},s._uniqueId="mat-slide-toggle-"+ ++c,s._required=!1,s._checked=!1,s.name=null,s.id=s._uniqueId,s.labelPosition="after",s.ariaLabel=null,s.ariaLabelledby=null,s.change=new n.EventEmitter,s.toggleChange=new n.EventEmitter,s.tabIndex=parseInt(o)||0,s}return d(t,e),Object.defineProperty(t.prototype,"required",{get:function(){return this._required},set:function(e){this._required=o.coerceBooleanProperty(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"checked",{get:function(){return this._checked},set:function(e){this._checked=o.coerceBooleanProperty(e),this._changeDetectorRef.markForCheck()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"inputId",{get:function(){return(this.id||this._uniqueId)+"-input"},enumerable:!1,configurable:!0}),t.prototype.ngAfterContentInit=function(){var e=this;this._focusMonitor.monitor(this._elementRef,!0).subscribe((function(t){"keyboard"===t||"program"===t?e._inputElement.nativeElement.focus():t||Promise.resolve().then((function(){return e._onTouched()}))}))},t.prototype.ngOnDestroy=function(){this._focusMonitor.stopMonitoring(this._elementRef)},t.prototype._onChangeEvent=function(e){e.stopPropagation(),this.toggleChange.emit(),this.defaults.disableToggleValue?this._inputElement.nativeElement.checked=this.checked:(this.checked=this._inputElement.nativeElement.checked,this._emitChangeEvent())},t.prototype._onInputClick=function(e){e.stopPropagation()},t.prototype.writeValue=function(e){this.checked=!!e},t.prototype.registerOnChange=function(e){this._onChange=e},t.prototype.registerOnTouched=function(e){this._onTouched=e},t.prototype.setDisabledState=function(e){this.disabled=e,this._changeDetectorRef.markForCheck()},t.prototype.focus=function(e,t){t?this._focusMonitor.focusVia(this._inputElement,t,e):this._inputElement.nativeElement.focus(e)},t.prototype.toggle=function(){this.checked=!this.checked,this._onChange(this.checked)},t.prototype._emitChangeEvent=function(){this._onChange(this.checked),this.change.emit(new u(this,this.checked))},t.prototype._onLabelTextChange=function(){this._changeDetectorRef.detectChanges()},t}(i.mixinTabIndex(i.mixinColor(i.mixinDisableRipple(i.mixinDisabled((function h(e){this._elementRef=e}))),"accent")));m.decorators=[{type:n.Component,args:[{selector:"mat-slide-toggle",exportAs:"matSlideToggle",host:{class:"mat-slide-toggle","[id]":"id","[attr.tabindex]":"disabled ? null : -1","[attr.aria-label]":"null","[attr.aria-labelledby]":"null","[class.mat-checked]":"checked","[class.mat-disabled]":"disabled","[class.mat-slide-toggle-label-before]":'labelPosition == "before"',"[class._mat-animation-noopable]":'_animationMode === "NoopAnimations"'},template:'<label [attr.for]="inputId" class="mat-slide-toggle-label" #label>\n <div #toggleBar class="mat-slide-toggle-bar"\n [class.mat-slide-toggle-bar-no-side-margin]="!labelContent.textContent || !labelContent.textContent.trim()">\n\n <input #input class="mat-slide-toggle-input cdk-visually-hidden" type="checkbox"\n role="switch"\n [id]="inputId"\n [required]="required"\n [tabIndex]="tabIndex"\n [checked]="checked"\n [disabled]="disabled"\n [attr.name]="name"\n [attr.aria-checked]="checked.toString()"\n [attr.aria-label]="ariaLabel"\n [attr.aria-labelledby]="ariaLabelledby"\n (change)="_onChangeEvent($event)"\n (click)="_onInputClick($event)">\n\n <div class="mat-slide-toggle-thumb-container" #thumbContainer>\n <div class="mat-slide-toggle-thumb"></div>\n <div class="mat-slide-toggle-ripple mat-focus-indicator" mat-ripple\n [matRippleTrigger]="label"\n [matRippleDisabled]="disableRipple || disabled"\n [matRippleCentered]="true"\n [matRippleRadius]="20"\n [matRippleAnimation]="{enterDuration: 150}">\n\n <div class="mat-ripple-element mat-slide-toggle-persistent-ripple"></div>\n </div>\n </div>\n\n </div>\n\n <span class="mat-slide-toggle-content" #labelContent (cdkObserveContent)="_onLabelTextChange()">\n \x3c!-- Add an invisible span so JAWS can read the label --\x3e\n <span style="display:none">&nbsp;</span>\n <ng-content></ng-content>\n </span>\n</label>\n',providers:[p],inputs:["disabled","disableRipple","color","tabIndex"],encapsulation:n.ViewEncapsulation.None,changeDetection:n.ChangeDetectionStrategy.OnPush,styles:[".mat-slide-toggle{display:inline-block;height:24px;max-width:100%;line-height:24px;white-space:nowrap;outline:none;-webkit-tap-highlight-color:transparent}.mat-slide-toggle.mat-checked .mat-slide-toggle-thumb-container{transform:translate3d(16px, 0, 0)}[dir=rtl] .mat-slide-toggle.mat-checked .mat-slide-toggle-thumb-container{transform:translate3d(-16px, 0, 0)}.mat-slide-toggle.mat-disabled{opacity:.38}.mat-slide-toggle.mat-disabled .mat-slide-toggle-label,.mat-slide-toggle.mat-disabled .mat-slide-toggle-thumb-container{cursor:default}.mat-slide-toggle-label{display:flex;flex:1;flex-direction:row;align-items:center;height:inherit;cursor:pointer}.mat-slide-toggle-content{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mat-slide-toggle-label-before .mat-slide-toggle-label{order:1}.mat-slide-toggle-label-before .mat-slide-toggle-bar{order:2}[dir=rtl] .mat-slide-toggle-label-before .mat-slide-toggle-bar,.mat-slide-toggle-bar{margin-right:8px;margin-left:0}[dir=rtl] .mat-slide-toggle-bar,.mat-slide-toggle-label-before .mat-slide-toggle-bar{margin-left:8px;margin-right:0}.mat-slide-toggle-bar-no-side-margin{margin-left:0;margin-right:0}.mat-slide-toggle-thumb-container{position:absolute;z-index:1;width:20px;height:20px;top:-3px;left:0;transform:translate3d(0, 0, 0);transition:all 80ms linear;transition-property:transform}._mat-animation-noopable .mat-slide-toggle-thumb-container{transition:none}[dir=rtl] .mat-slide-toggle-thumb-container{left:auto;right:0}.mat-slide-toggle-thumb{height:20px;width:20px;border-radius:50%}.mat-slide-toggle-bar{position:relative;width:36px;height:14px;flex-shrink:0;border-radius:8px}.mat-slide-toggle-input{bottom:0;left:10px}[dir=rtl] .mat-slide-toggle-input{left:auto;right:10px}.mat-slide-toggle-bar,.mat-slide-toggle-thumb{transition:all 80ms linear;transition-property:background-color;transition-delay:50ms}._mat-animation-noopable .mat-slide-toggle-bar,._mat-animation-noopable .mat-slide-toggle-thumb{transition:none}.mat-slide-toggle .mat-slide-toggle-ripple{position:absolute;top:calc(50% - 20px);left:calc(50% - 20px);height:40px;width:40px;z-index:1;pointer-events:none}.mat-slide-toggle .mat-slide-toggle-ripple .mat-ripple-element:not(.mat-slide-toggle-persistent-ripple){opacity:.12}.mat-slide-toggle-persistent-ripple{width:100%;height:100%;transform:none}.mat-slide-toggle-bar:hover .mat-slide-toggle-persistent-ripple{opacity:.04}.mat-slide-toggle:not(.mat-disabled).cdk-keyboard-focused .mat-slide-toggle-persistent-ripple{opacity:.12}.mat-slide-toggle-persistent-ripple,.mat-slide-toggle.mat-disabled .mat-slide-toggle-bar:hover .mat-slide-toggle-persistent-ripple{opacity:0}@media(hover: none){.mat-slide-toggle-bar:hover .mat-slide-toggle-persistent-ripple{display:none}}.cdk-high-contrast-active .mat-slide-toggle-thumb,.cdk-high-contrast-active .mat-slide-toggle-bar{border:1px solid}.cdk-high-contrast-active .mat-slide-toggle.cdk-keyboard-focused .mat-slide-toggle-bar{outline:2px dotted;outline-offset:5px}\n"]}]}],m.ctorParameters=function(){return[{type:n.ElementRef},{type:a.FocusMonitor},{type:n.ChangeDetectorRef},{type:String,decorators:[{type:n.Attribute,args:["tabindex"]}]},{type:void 0,decorators:[{type:n.Inject,args:[g]}]},{type:String,decorators:[{type:n.Optional},{type:n.Inject,args:[r.ANIMATION_MODULE_TYPE]}]}]},m.propDecorators={_thumbEl:[{type:n.ViewChild,args:["thumbContainer"]}],_thumbBarEl:[{type:n.ViewChild,args:["toggleBar"]}],name:[{type:n.Input}],id:[{type:n.Input}],labelPosition:[{type:n.Input}],ariaLabel:[{type:n.Input,args:["aria-label"]}],ariaLabelledby:[{type:n.Input,args:["aria-labelledby"]}],required:[{type:n.Input}],checked:[{type:n.Input}],change:[{type:n.Output}],toggleChange:[{type:n.Output}],_inputElement:[{type:n.ViewChild,args:["input"]}]};var b,f,y={provide:l.NG_VALIDATORS,useExisting:n.forwardRef((function(){return _})),multi:!0},_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return d(t,e),t}(l.CheckboxRequiredValidator);_.decorators=[{type:n.Directive,args:[{selector:"mat-slide-toggle[required][formControlName],\n mat-slide-toggle[required][formControl], mat-slide-toggle[required][ngModel]",providers:[y]}]}],(b=function b(){}).decorators=[{type:n.NgModule,args:[{exports:[_],declarations:[_]}]}],(f=function f(){}).decorators=[{type:n.NgModule,args:[{imports:[b,i.MatRippleModule,i.MatCommonModule,t.ObserversModule],exports:[b,m,i.MatCommonModule],declarations:[m]}]}],
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
e.MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS=g,e.MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR=y,e.MAT_SLIDE_TOGGLE_VALUE_ACCESSOR=p,e.MatSlideToggle=m,e.MatSlideToggleChange=u,e.MatSlideToggleModule=f,e.MatSlideToggleRequiredValidator=_,e._MatSlideToggleRequiredValidatorModule=b,Object.defineProperty(e,"__esModule",{value:!0})}));