@taiga-ui/kit
Version:
Taiga UI Angular main components kit
16 lines (14 loc) • 9.21 kB
JavaScript
!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/radio")):"function"==typeof define&&define.amd?define("@taiga-ui/kit/components/radio-block",["exports","@angular/core","@angular/forms","@taiga-ui/cdk","@taiga-ui/core","@taiga-ui/kit/components/radio"],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["radio-block"]={}),e.ng.core,e.ng.forms,e.cdk,e.core$1,e["taiga-ui"].kit.components.radio)}(this,(function(e,t,i,o,n,a){"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 r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function s(e,t,i,o){var n,a=arguments.length,r=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(r=(a<3?n(r):a>3?n(t,i,r):n(t,i))||r);return a>3&&r&&Object.defineProperty(t,i,r),r}function d(e,t){return function(i,o){t(i,o,e)}}var u=function(e){function u(t,i,n){var a=e.call(this,t,i)||this;return a.modeDirective=n,a.identityMatcher=o.TUI_DEFAULT_IDENTITY_MATCHER,a.contentAlign="right",a.size="l",a.hideRadio=!1,a.pseudoDisabled=!1,a}var p;return function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(u,e),p=u,Object.defineProperty(u.prototype,"nativeFocusableElement",{get:function(){return this.radio?this.radio.nativeFocusableElement:null},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"focused",{get:function(){return!!this.radio&&this.radio.focused},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"computedDisabled",{get:function(){return this.disabled||this.pseudoDisabled},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"checked",{get:function(){return this.value===this.item&&this.hideRadio},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,"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:i.NgControl,decorators:[{type:t.Optional},{type:t.Self},{type:t.Inject,args:[i.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()],u.prototype,"item",void 0),s([t.Input(),o.tuiDefaultProp()],u.prototype,"identityMatcher",void 0),s([t.Input(),t.HostBinding("attr.data-tui-host-align"),o.tuiDefaultProp()],u.prototype,"contentAlign",void 0),s([t.Input(),t.HostBinding("attr.data-tui-host-size"),o.tuiDefaultProp()],u.prototype,"size",void 0),s([t.Input(),t.HostBinding("class._hidden_radio"),o.tuiDefaultProp()],u.prototype,"hideRadio",void 0),s([t.Input(),o.tuiDefaultProp()],u.prototype,"pseudoDisabled",void 0),s([t.ViewChild(a.TuiRadioComponent)],u.prototype,"radio",void 0),s([t.HostBinding("class._disabled")],u.prototype,"computedDisabled",null),s([t.HostBinding("class._active")],u.prototype,"checked",null),u=p=s([t.Component({selector:"tui-radio-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-radio\n class="view"\n [focusable]="focusable"\n [identityMatcher]="identityMatcher"\n [item]="item"\n [name]="computedName"\n [nativeId]="nativeId"\n [readOnly]="readOnly"\n [pseudoDisabled]="computedDisabled"\n [pseudoInvalid]="computedInvalid"\n [pseudoFocused]="false"\n [pseudoHovered]="computedHovered"\n [pseudoPressed]="computedPressed"\n [size]="checkboxSize"\n [ngModel]="value"\n (ngModelChange)="onModelChange($event)"\n (focusedChange)="onFocused($event)"\n (focusVisibleChange)="onFocusVisible($event)"\n ></tui-radio>\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:o.TUI_FOCUSABLE_ITEM_ACCESSOR,useExisting:t.forwardRef((function(){return p}))}],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._readonly{pointer-events:none}.wrapper{position:relative;border-radius:inherit;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host._disabled .wrapper{cursor:default}.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_radio .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_radio .content{padding:0 24px}:host[data-tui-host-size='l'] .content{padding:0 16px}:host[data-tui-host-size='l']._hidden_radio .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[data-tui-host-size='l'][data-tui-host-align=right] .view{margin-left:16px;margin-right:0}:host._hidden_radio .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_radio .label{text-align:center}"]}),d(0,t.Optional()),d(0,t.Self()),d(0,t.Inject(i.NgControl)),d(1,t.Inject(t.ChangeDetectorRef)),d(2,t.Optional()),d(2,t.Inject(n.TuiModeDirective))],u)}(o.AbstractTuiNullableControl),p=function(){function e(){}return e=s([t.NgModule({imports:[i.FormsModule,o.TuiHoveredModule,o.TuiPressedModule,a.TuiRadioModule,n.TuiWrapperModule],declarations:[u],exports:[u]})],e)}();e.TuiRadioBlockComponent=u,e.TuiRadioBlockModule=p,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=taiga-ui-kit-components-radio-block.umd.min.js.map