import { _IdGenerator } from '@angular/cdk/a11y'; import * as i0 from '@angular/core'; import { InjectionToken, forwardRef, inject, ElementRef, ChangeDetectorRef, NgZone, ANIMATION_MODULE_TYPE, EventEmitter, HostAttributeToken, booleanAttribute, numberAttribute, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, ViewChild, Directive, NgModule } from '@angular/core'; import { NG_VALUE_ACCESSOR, NG_VALIDATORS, CheckboxRequiredValidator } from '@angular/forms'; import { _CdkPrivateStyleLoader } from '@angular/cdk/private'; import { _ as _MatInternalFormField } from './internal-form-field-grv62mCZ.mjs'; import { _ as _StructuralStylesLoader } from './structural-styles-BQUT6wsL.mjs'; import { M as MatRipple } from './ripple-BT3tzh6F.mjs'; import { M as MatCommonModule } from './common-module-WayjW0Pb.mjs'; import '@angular/cdk/platform'; import '@angular/cdk/coercion'; import '@angular/cdk/bidi'; /** Injection token to be used to override the default options for `mat-checkbox`. */ const MAT_CHECKBOX_DEFAULT_OPTIONS = new InjectionToken('mat-checkbox-default-options', { providedIn: 'root', factory: MAT_CHECKBOX_DEFAULT_OPTIONS_FACTORY, }); /** * @docs-private * @deprecated No longer used, will be removed. * @breaking-change 21.0.0 */ function MAT_CHECKBOX_DEFAULT_OPTIONS_FACTORY() { return { color: 'accent', clickAction: 'check-indeterminate', disabledInteractive: false, }; } /** * Represents the different states that require custom transitions between them. * @docs-private */ var TransitionCheckState; (function (TransitionCheckState) { /** The initial state of the component before any user interaction. */ TransitionCheckState[TransitionCheckState["Init"] = 0] = "Init"; /** The state representing the component when it's becoming checked. */ TransitionCheckState[TransitionCheckState["Checked"] = 1] = "Checked"; /** The state representing the component when it's becoming unchecked. */ TransitionCheckState[TransitionCheckState["Unchecked"] = 2] = "Unchecked"; /** The state representing the component when it's becoming indeterminate. */ TransitionCheckState[TransitionCheckState["Indeterminate"] = 3] = "Indeterminate"; })(TransitionCheckState || (TransitionCheckState = {})); /** * @deprecated Will stop being exported. * @breaking-change 19.0.0 */ const MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => MatCheckbox), multi: true, }; /** Change event object emitted by checkbox. */ class MatCheckboxChange { /** The source checkbox of the event. */ source; /** The new `checked` value of the checkbox. */ checked; } // Default checkbox configuration. const defaults = MAT_CHECKBOX_DEFAULT_OPTIONS_FACTORY(); class MatCheckbox { _elementRef = inject(ElementRef); _changeDetectorRef = inject(ChangeDetectorRef); _ngZone = inject(NgZone); _animationMode = inject(ANIMATION_MODULE_TYPE, { optional: true }); _options = inject(MAT_CHECKBOX_DEFAULT_OPTIONS, { optional: true, }); /** Focuses the checkbox. */ focus() { this._inputElement.nativeElement.focus(); } /** Creates the change event that will be emitted by the checkbox. */ _createChangeEvent(isChecked) { const event = new MatCheckboxChange(); event.source = this; event.checked = isChecked; return event; } /** Gets the element on which to add the animation CSS classes. */ _getAnimationTargetElement() { return this._inputElement?.nativeElement; } /** CSS classes to add when transitioning between the different checkbox states. */ _animationClasses = { uncheckedToChecked: 'mdc-checkbox--anim-unchecked-checked', uncheckedToIndeterminate: 'mdc-checkbox--anim-unchecked-indeterminate', checkedToUnchecked: 'mdc-checkbox--anim-checked-unchecked', checkedToIndeterminate: 'mdc-checkbox--anim-checked-indeterminate', indeterminateToChecked: 'mdc-checkbox--anim-indeterminate-checked', indeterminateToUnchecked: 'mdc-checkbox--anim-indeterminate-unchecked', }; /** * Attached to the aria-label attribute of the host element. In most cases, aria-labelledby will * take precedence so this may be omitted. */ ariaLabel = ''; /** * Users can specify the `aria-labelledby` attribute which will be forwarded to the input element */ ariaLabelledby = null; /** The 'aria-describedby' attribute is read after the element's label and field type. */ ariaDescribedby; /** * Users can specify the `aria-expanded` attribute which will be forwarded to the input element */ ariaExpanded; /** * Users can specify the `aria-controls` attribute which will be forwarded to the input element */ ariaControls; /** Users can specify the `aria-owns` attribute which will be forwarded to the input element */ ariaOwns; _uniqueId; /** A unique id for the checkbox input. If none is supplied, it will be auto-generated. */ id; /** Returns the unique id for the visual hidden input. */ get inputId() { return `${this.id || this._uniqueId}-input`; } /** Whether the checkbox is required. */ required; /** Whether the label should appear after or before the checkbox. Defaults to 'after' */ labelPosition = 'after'; /** Name value will be applied to the input element if present */ name = null; /** Event emitted when the checkbox's `checked` value changes. */ change = new EventEmitter(); /** Event emitted when the checkbox's `indeterminate` value changes. */ indeterminateChange = new EventEmitter(); /** The value attribute of the native input element */ value; /** Whether the checkbox has a ripple. */ disableRipple; /** The native `` element */ _inputElement; /** The native `