UNPKG

@synergy-design-system/angular

Version:
199 lines (195 loc) 7.84 kB
import * as i0 from '@angular/core'; import { EventEmitter, Output, Input, Component } from '@angular/core'; import '@synergy-design-system/components/components/radio-group/radio-group.js'; // --------------------------------------------------------------------- // 🔒 AUTOGENERATED @synergy-design-system/angular wrappers for @synergy-design-system/components // Please do not edit this file directly! // It will get recreated when running pnpm build. // --------------------------------------------------------------------- /** * @summary Radio groups are used to group multiple [radios](/components/radio) or [radio buttons](/components/radio-button) so they function as a single form control. * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-radio-group--docs * @status stable * @since 2.0 * * @dependency syn-button-group * * @slot - The default slot where `<syn-radio>` or `<syn-radio-button>` elements are placed. * @slot label - The radio group's label. Required for proper accessibility. Alternatively, you can use the `label` * attribute. * @slot help-text - Text that describes how to use the radio group. Alternatively, you can use the `help-text` attribute. * * @event syn-change - Emitted when the radio group's selected value changes. * @event syn-input - Emitted when the radio group receives user input. * @event syn-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied. * * @csspart form-control - The form control that wraps the label, input, and help text. * @csspart form-control-label - The label's wrapper. * @csspart form-control-input - The input's wrapper. * @csspart form-control-help-text - The help text's wrapper. * @csspart button-group - The button group that wraps radio buttons. * @csspart button-group__base - The button group's `base` part. */ class SynRadioGroupComponent { nativeElement; _ngZone; modelSignal = new AbortController(); constructor(e, ngZone) { this.nativeElement = e.nativeElement; this._ngZone = ngZone; this.nativeElement.addEventListener('syn-change', (e) => { this.synChangeEvent.emit(e); }); this.nativeElement.addEventListener('syn-input', (e) => { this.synInputEvent.emit(e); }); this.nativeElement.addEventListener('syn-invalid', (e) => { this.synInvalidEvent.emit(e); }); this.ngModelUpdateOn = 'syn-input'; } /** * The event that will trigger the ngModel update. * By default, this is set to "syn-input". */ set ngModelUpdateOn(v) { this.modelSignal.abort(); this.modelSignal = new AbortController(); const option = v || 'syn-input'; this.nativeElement.addEventListener(option, () => { this.valueChange.emit(this.value); }, { signal: this.modelSignal.signal, }); } get ngModelUpdateOn() { return this.ngModelUpdateOn; } /** * The radio group's label. * Required for proper accessibility. * If you need to display HTML, use the `label` slot instead. */ set label(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.label = v)); } get label() { return this.nativeElement.label; } /** * The radio groups's help text. * If you need to display HTML, use the `help-text` slot instead. */ set helpText(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.helpText = v)); } get helpText() { return this.nativeElement.helpText; } /** * The name of the radio group, submitted as a name/value pair with form data. */ set name(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.name = v)); } get name() { return this.nativeElement.name; } /** * The current value of the radio group, submitted as a name/value pair with form data. */ set value(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.value = v)); } get value() { return this.nativeElement.value; } /** * The radio group's size. * This size will be applied to all child radios and radio buttons. */ set size(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.size = v)); } get size() { return this.nativeElement.size; } /** * By default, form controls are associated with the nearest containing `<form>` element. * This attribute allows you to place the form control outside of a form and associate it with the form that has this `id`. * The form must be in the same document or shadow root for this to work. */ set form(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.form = v)); } get form() { return this.nativeElement.form; } /** * Ensures a child radio is checked before allowing the containing form to submit. */ set required(v) { this._ngZone.runOutsideAngular(() => (this.nativeElement.required = v === '' || v)); } get required() { return this.nativeElement.required; } /** * Emitted when the radio group's selected value changes. */ synChangeEvent = new EventEmitter(); /** * Emitted when the radio group receives user input. */ synInputEvent = new EventEmitter(); /** * Emitted when the form control has been checked for validity and its constraints aren't satisfied. */ synInvalidEvent = new EventEmitter(); /** * Support for two way data binding */ valueChange = new EventEmitter(); static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynRadioGroupComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.1", type: SynRadioGroupComponent, isStandalone: true, selector: "syn-radio-group", inputs: { ngModelUpdateOn: "ngModelUpdateOn", label: "label", helpText: "helpText", name: "name", value: "value", size: "size", form: "form", required: "required" }, outputs: { synChangeEvent: "synChangeEvent", synInputEvent: "synInputEvent", synInvalidEvent: "synInvalidEvent", valueChange: "valueChange" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SynRadioGroupComponent, decorators: [{ type: Component, args: [{ selector: 'syn-radio-group', standalone: true, template: '<ng-content></ng-content>', }] }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.NgZone }], propDecorators: { ngModelUpdateOn: [{ type: Input }], label: [{ type: Input }], helpText: [{ type: Input }], name: [{ type: Input }], value: [{ type: Input }], size: [{ type: Input }], form: [{ type: Input }], required: [{ type: Input }], synChangeEvent: [{ type: Output }], synInputEvent: [{ type: Output }], synInvalidEvent: [{ type: Output }], valueChange: [{ type: Output }] } }); /** * Generated bundle index. Do not edit. */ export { SynRadioGroupComponent }; //# sourceMappingURL=synergy-design-system-angular-components-radio-group.mjs.map