UNPKG

@ngx-uk-frontend/core

Version:

Core utilities and shared functionality for ngx-uk-frontend libraries

41 lines 2.27 kB
import { Directive, inject, input } from '@angular/core'; import { CommonFormInputDirective, injectNgControl, } from '@ngx-uk-frontend/core/form-utils'; import * as i0 from "@angular/core"; /** * Core radio directive that provides common functionality * for radio components across different design systems. * * This directive handles: * - Form control integration * - Basic radio configuration * - Accessibility attributes * - Common radio functionality */ export class RadioDirective { // Form control integration ngControl = injectNgControl(); commonFormInput = inject(CommonFormInputDirective); // Basic radio configuration small = input(false, ...(ngDevMode ? [{ debugName: "small" }] : [])); inline = input(false, ...(ngDevMode ? [{ debugName: "inline" }] : [])); /** * Sets the selected value of the radio group. * Only updates the form control if the value has changed. * * @param value The value to set for the radio group */ setValue(value) { if (this.ngControl.control && this.ngControl.control.value !== value) { this.ngControl.control.setValue(value); } } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RadioDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.6", type: RadioDirective, isStandalone: true, selector: "[libRadio]", inputs: { small: { classPropertyName: "small", publicName: "small", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RadioDirective, decorators: [{ type: Directive, args: [{ selector: '[libRadio]', }] }], propDecorators: { small: [{ type: i0.Input, args: [{ isSignal: true, alias: "small", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", required: false }] }] } }); //# sourceMappingURL=radio.directive.js.map