@taiga-ui/kit
Version:
Taiga UI Angular main components kit
97 lines (92 loc) • 4.88 kB
JavaScript
import { __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 { AbstractTuiNullableControl, isNativeFocused, tuiDefaultProp, TUI_FOCUSABLE_ITEM_ACCESSOR, 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_1;
let TuiCheckboxLabeledComponent = TuiCheckboxLabeledComponent_1 = class TuiCheckboxLabeledComponent extends AbstractTuiNullableControl {
constructor(control, changeDetectorRef, modeDirective) {
super(control, changeDetectorRef);
this.modeDirective = modeDirective;
this.size = 'm';
}
get focused() {
return isNativeFocused(this.nativeFocusableElement);
}
get nativeFocusableElement() {
return this.checkbox ? this.checkbox.nativeFocusableElement : null;
}
get hostMode() {
return this.modeDirective ? this.modeDirective.mode : null;
}
onFocused(focused) {
this.updateFocused(focused);
}
onHovered(hovered) {
this.updateHovered(hovered);
}
onPressed(pressed) {
this.updatePressed(pressed);
}
onModelChange(value) {
this.updateValue(value);
}
};
TuiCheckboxLabeledComponent.ctorParameters = () => [
{ 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(() => 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);
let TuiCheckboxLabeledModule = class TuiCheckboxLabeledModule {
};
TuiCheckboxLabeledModule = __decorate([
NgModule({
imports: [
CommonModule,
FormsModule,
TuiHoveredModule,
TuiPressedModule,
TuiCheckboxModule,
],
declarations: [TuiCheckboxLabeledComponent],
exports: [TuiCheckboxLabeledComponent],
})
], TuiCheckboxLabeledModule);
/**
* Generated bundle index. Do not edit.
*/
export { TuiCheckboxLabeledComponent, TuiCheckboxLabeledModule };
//# sourceMappingURL=taiga-ui-kit-components-checkbox-labeled.js.map