UNPKG

@taiga-ui/kit

Version:
116 lines (111 loc) 6.08 kB
import { __extends, __decorate, __param } from 'tslib'; import { Optional, Self, Inject, ChangeDetectorRef, Input, HostBinding, ViewChild, Component, ChangeDetectionStrategy, forwardRef, NgModule } from '@angular/core'; import { NgControl, FormsModule } from '@angular/forms'; import { isNativeFocused, tuiDefaultProp, TUI_FOCUSABLE_ITEM_ACCESSOR, AbstractTuiNullableControl, TuiHoveredModule, TuiPressedModule } from '@taiga-ui/cdk'; import { TuiModeDirective } from '@taiga-ui/core'; import { TuiCheckboxComponent, TuiCheckboxModule } from '@taiga-ui/kit/components/checkbox'; import { CommonModule } from '@angular/common'; var TuiCheckboxLabeledComponent = /** @class */ (function (_super) { __extends(TuiCheckboxLabeledComponent, _super); function TuiCheckboxLabeledComponent(control, changeDetectorRef, modeDirective) { var _this = _super.call(this, control, changeDetectorRef) || this; _this.modeDirective = modeDirective; _this.size = 'm'; return _this; } TuiCheckboxLabeledComponent_1 = TuiCheckboxLabeledComponent; Object.defineProperty(TuiCheckboxLabeledComponent.prototype, "focused", { get: function () { return isNativeFocused(this.nativeFocusableElement); }, enumerable: true, configurable: true }); Object.defineProperty(TuiCheckboxLabeledComponent.prototype, "nativeFocusableElement", { get: function () { return this.checkbox ? this.checkbox.nativeFocusableElement : null; }, enumerable: true, configurable: true }); Object.defineProperty(TuiCheckboxLabeledComponent.prototype, "hostMode", { get: function () { return this.modeDirective ? this.modeDirective.mode : null; }, enumerable: true, configurable: true }); TuiCheckboxLabeledComponent.prototype.onFocused = function (focused) { this.updateFocused(focused); }; TuiCheckboxLabeledComponent.prototype.onHovered = function (hovered) { this.updateHovered(hovered); }; TuiCheckboxLabeledComponent.prototype.onPressed = function (pressed) { this.updatePressed(pressed); }; TuiCheckboxLabeledComponent.prototype.onModelChange = function (value) { this.updateValue(value); }; var TuiCheckboxLabeledComponent_1; TuiCheckboxLabeledComponent.ctorParameters = function () { return [ { type: NgControl, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NgControl,] }] }, { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] }, { type: TuiModeDirective, decorators: [{ type: Optional }, { type: Inject, args: [TuiModeDirective,] }] } ]; }; __decorate([ Input(), HostBinding('attr.data-tui-host-size'), tuiDefaultProp() ], TuiCheckboxLabeledComponent.prototype, "size", void 0); __decorate([ ViewChild(TuiCheckboxComponent) ], TuiCheckboxLabeledComponent.prototype, "checkbox", void 0); __decorate([ HostBinding('attr.data-mode') ], TuiCheckboxLabeledComponent.prototype, "hostMode", null); TuiCheckboxLabeledComponent = TuiCheckboxLabeledComponent_1 = __decorate([ Component({ selector: 'tui-checkbox-labeled', template: "<label\n class=\"wrapper\"\n (tuiHoveredChange)=\"onHovered($event)\"\n (tuiPressedChange)=\"onPressed($event)\"\n>\n <tui-checkbox\n [disabled]=\"computedDisabled\"\n [readOnly]=\"readOnly\"\n [focusable]=\"focusable\"\n [nativeId]=\"nativeId\"\n [pseudoInvalid]=\"computedInvalid\"\n [pseudoFocused]=\"pseudoFocused\"\n [pseudoHovered]=\"computedHovered\"\n [pseudoPressed]=\"computedPressed\"\n [size]=\"size\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (focusedChange)=\"onFocused($event)\"\n ></tui-checkbox>\n <div class=\"content\" [class.content_disabled]=\"computedDisabled\">\n <ng-content></ng-content>\n </div>\n</label>\n", changeDetection: ChangeDetectionStrategy.OnPush, providers: [ { provide: TUI_FOCUSABLE_ITEM_ACCESSOR, useExisting: forwardRef(function () { return TuiCheckboxLabeledComponent_1; }), }, ], styles: [":host{position:relative;display:block;line-height:0}:host._disabled,:host._readonly{pointer-events:none}.wrapper{display:inline-flex;max-width:100%;cursor:pointer}:host._disabled .wrapper{cursor:default}:host[data-mode=onDark] .wrapper{color:var(--tui-base-01)}.content{font:var(--tui-font-text-s);line-height:16px;word-wrap:break-word;min-width:0}.content_disabled{opacity:var(--tui-disabled-opacity)}:host[data-tui-host-size='m'] .content{margin-left:8px}:host[data-tui-host-size='l'] .content{font:var(--tui-font-text-m);margin-left:12px}"] }), __param(0, Optional()), __param(0, Self()), __param(0, Inject(NgControl)), __param(1, Inject(ChangeDetectorRef)), __param(2, Optional()), __param(2, Inject(TuiModeDirective)) ], TuiCheckboxLabeledComponent); return TuiCheckboxLabeledComponent; }(AbstractTuiNullableControl)); var TuiCheckboxLabeledModule = /** @class */ (function () { function TuiCheckboxLabeledModule() { } TuiCheckboxLabeledModule = __decorate([ NgModule({ imports: [ CommonModule, FormsModule, TuiHoveredModule, TuiPressedModule, TuiCheckboxModule, ], declarations: [TuiCheckboxLabeledComponent], exports: [TuiCheckboxLabeledComponent], }) ], TuiCheckboxLabeledModule); return TuiCheckboxLabeledModule; }()); /** * Generated bundle index. Do not edit. */ export { TuiCheckboxLabeledComponent, TuiCheckboxLabeledModule }; //# sourceMappingURL=taiga-ui-kit-components-checkbox-labeled.js.map