UNPKG

@taiga-ui/kit

Version:
16 lines (14 loc) 8.72 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("@taiga-ui/cdk"),require("@taiga-ui/core"),require("@taiga-ui/kit/components/checkbox")):"function"==typeof define&&define.amd?define("@taiga-ui/kit/components/checkbox-block",["exports","@angular/core","@angular/forms","@taiga-ui/cdk","@taiga-ui/core","@taiga-ui/kit/components/checkbox"],t):t(((e=e||self)["taiga-ui"]=e["taiga-ui"]||{},e["taiga-ui"].kit=e["taiga-ui"].kit||{},e["taiga-ui"].kit.components=e["taiga-ui"].kit.components||{},e["taiga-ui"].kit.components["checkbox-block"]={}),e.ng.core,e.ng.forms,e.cdk,e.core$1,e["taiga-ui"].kit.components.checkbox)}(this,(function(e,t,o,i,n,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 a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(e,t)};function s(e,t,o,i){var n,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(r<3?n(a):r>3?n(t,o,a):n(t,o))||a);return r>3&&a&&Object.defineProperty(t,o,a),a}function c(e,t){return function(o,i){t(o,i,e)}}var u=function(e){function u(t,o,i){var n=e.call(this,t,o)||this;return n.modeDirective=i,n.contentAlign="right",n.hideCheckbox=!1,n.size="l",n}var d;return function(e,t){function o(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}(u,e),d=u,Object.defineProperty(u.prototype,"nativeFocusableElement",{get:function(){return this.checkbox?this.checkbox.nativeFocusableElement:null},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"checked",{get:function(){return!1!==this.value&&this.hideCheckbox},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"checkboxSize",{get:function(){return"l"===this.size?"l":"m"},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"focused",{get:function(){return i.isNativeFocused(this.nativeFocusableElement)},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"appearance",{get:function(){return this.modeDirective&&this.modeDirective.mode?this.checked?"primary":"secondary":this.checked?"whiteblock-active":"whiteblock"},enumerable:!0,configurable:!0}),u.prototype.onFocused=function(e){this.updateFocused(e)},u.prototype.onHovered=function(e){this.updateHovered(e)},u.prototype.onPressed=function(e){this.updatePressed(e)},u.prototype.onFocusVisible=function(e){this.updateFocusVisible(e)},u.prototype.onModelChange=function(e){this.updateValue(e)},u.ctorParameters=function(){return[{type:o.NgControl,decorators:[{type:t.Optional},{type:t.Self},{type:t.Inject,args:[o.NgControl]}]},{type:t.ChangeDetectorRef,decorators:[{type:t.Inject,args:[t.ChangeDetectorRef]}]},{type:n.TuiModeDirective,decorators:[{type:t.Optional},{type:t.Inject,args:[n.TuiModeDirective]}]}]},s([t.Input(),t.HostBinding("attr.data-tui-host-align"),i.tuiDefaultProp()],u.prototype,"contentAlign",void 0),s([t.Input(),t.HostBinding("class._hidden_checkbox"),i.tuiDefaultProp()],u.prototype,"hideCheckbox",void 0),s([t.Input(),t.HostBinding("attr.data-tui-host-size"),i.tuiDefaultProp()],u.prototype,"size",void 0),s([t.ViewChild(r.TuiCheckboxComponent)],u.prototype,"checkbox",void 0),s([t.HostBinding("class._active")],u.prototype,"checked",null),u=d=s([t.Component({selector:"tui-checkbox-block",template:'<label\n class="wrapper"\n (tuiHoveredChange)="onHovered($event)"\n (tuiPressedChange)="onPressed($event)"\n>\n <tui-wrapper\n [appearance]="appearance"\n [disabled]="computedDisabled"\n [focused]="computedFocusVisible"\n [hovered]="computedHovered"\n [pressed]="computedPressed"\n [invalid]="computedInvalid"\n >\n <div class="content-wrapper">\n <div class="content">\n <tui-checkbox\n class="view"\n [disabled]="computedDisabled || readOnly"\n [nativeId]="nativeId"\n [pseudoInvalid]="computedInvalid"\n [pseudoFocused]="false"\n [pseudoHovered]="computedHovered"\n [pseudoPressed]="computedPressed"\n [size]="checkboxSize"\n [focusable]="focusable"\n [ngModel]="value"\n (ngModelChange)="onModelChange($event)"\n (focusedChange)="onFocused($event)"\n (focusVisibleChange)="onFocusVisible($event)"\n ></tui-checkbox>\n <div class="label">\n <ng-content></ng-content>\n </div>\n </div>\n </div>\n </tui-wrapper>\n</label>\n',changeDetection:t.ChangeDetectionStrategy.OnPush,providers:[{provide:i.TUI_FOCUSABLE_ITEM_ACCESSOR,useExisting:t.forwardRef((function(){return d}))}],styles:[":host{font:var(--tui-font-text-s);color:var(--tui-text-01);display:inline-block;vertical-align:top;border-radius:var(--tui-radius-m)}:host[data-tui-host-size='l'],:host[data-tui-host-size='m']{font:var(--tui-font-text-m)}:host._disabled,:host._readonly{pointer-events:none}:host-context(.tui-group_collapsed):not(:last-child){margin-right:-2px}:host-context(.tui-group_collapsed.tui-group_orientation_vertical):not(:last-child){margin-bottom:-2px;margin-right:0}.wrapper{position:relative;border-radius:inherit;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.content-wrapper{display:flex;flex-direction:column}:host[data-tui-host-size='s'] .content-wrapper{min-height:var(--tui-height-s)}:host[data-tui-host-size='m'] .content-wrapper{min-height:var(--tui-height-m)}:host[data-tui-host-size='l'] .content-wrapper{min-height:var(--tui-height-l)}.content{display:flex;align-items:center;min-height:inherit}:host[data-tui-host-align=right] .content{flex-direction:row-reverse}:host[data-tui-host-size='s'] .content{padding:0 16px 0 8px}:host[data-tui-host-size='s'][data-tui-host-align=right] .content{padding:0 8px 0 16px}:host[data-tui-host-size='s']._hidden_checkbox .content{padding:0 16px}:host[data-tui-host-size='m'] .content{padding:0 16px 0 12px}:host[data-tui-host-size='m'][data-tui-host-align=right] .content{padding:0 12px 0 16px}:host[data-tui-host-size='m']._hidden_checkbox .content{padding:0 24px}:host[data-tui-host-size='l'] .content{padding:0 16px}:host[data-tui-host-size='l']._hidden_checkbox .content{padding:0 36px}.view{margin-top:12px;margin-right:12px;align-self:flex-start}:host[data-tui-host-align=right] .view{margin-left:12px;margin-right:0}:host[data-tui-host-size='s'] .view{margin-top:8px;margin-right:8px}:host[data-tui-host-size='s'][data-tui-host-align=right] .view{margin-left:8px}:host[data-tui-host-size='m'] .view{margin-top:14px}:host[data-tui-host-size='l'] .view{margin-top:16px}:host._hidden_checkbox .view{position:absolute;height:1px;width:1px;margin:-1px;border:0;padding:0;overflow:hidden;clip:rect(0,0,0,0);-webkit-clip-path:inset(0);clip-path:inset(0)}.label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-grow:1}:host._hidden_checkbox .label{text-align:center}"]}),c(0,t.Optional()),c(0,t.Self()),c(0,t.Inject(o.NgControl)),c(1,t.Inject(t.ChangeDetectorRef)),c(2,t.Optional()),c(2,t.Inject(n.TuiModeDirective))],u)}(i.AbstractTuiNullableControl),d=function(){function e(){}return e=s([t.NgModule({imports:[o.FormsModule,i.TuiHoveredModule,i.TuiPressedModule,r.TuiCheckboxModule,n.TuiWrapperModule],declarations:[u],exports:[u]})],e)}();e.TuiCheckboxBlockComponent=u,e.TuiCheckboxBlockModule=d,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=taiga-ui-kit-components-checkbox-block.umd.min.js.map