{"version":3,"file":"checkbox.mjs","sources":["../../../../../k8-fastbuild-ST-46c76129e412/bin/src/material/checkbox/checkbox-config.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/src/material/checkbox/checkbox.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/src/material/checkbox/checkbox.html","../../../../../k8-fastbuild-ST-46c76129e412/bin/src/material/checkbox/checkbox-required-validator.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/src/material/checkbox/module.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\nimport {InjectionToken} from '@angular/core';\nimport {ThemePalette} from '../core';\n\n/** Default `mat-checkbox` options that can be overridden. */\nexport interface MatCheckboxDefaultOptions {\n /**\n * Default theme color of the checkbox. This API is supported in M2 themes\n * only, it has no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/checkbox/styling.\n *\n * For information on applying color variants in M3, see\n * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants\n */\n color?: ThemePalette;\n\n /** Default checkbox click action for checkboxes. */\n clickAction?: MatCheckboxClickAction;\n\n /** Whether disabled checkboxes should be interactive. */\n disabledInteractive?: boolean;\n}\n\n/** Injection token to be used to override the default options for `mat-checkbox`. */\nexport const MAT_CHECKBOX_DEFAULT_OPTIONS = new InjectionToken(\n 'mat-checkbox-default-options',\n {\n providedIn: 'root',\n factory: MAT_CHECKBOX_DEFAULT_OPTIONS_FACTORY,\n },\n);\n\n/**\n * @docs-private\n * @deprecated No longer used, will be removed.\n * @breaking-change 21.0.0\n */\nexport function MAT_CHECKBOX_DEFAULT_OPTIONS_FACTORY(): MatCheckboxDefaultOptions {\n return {\n color: 'accent',\n clickAction: 'check-indeterminate',\n disabledInteractive: false,\n };\n}\n\n/**\n * Checkbox click action when user click on input element.\n * noop: Do not toggle checked or indeterminate.\n * check: Only toggle checked status, ignore indeterminate.\n * check-indeterminate: Toggle checked status, set indeterminate to false. Default behavior.\n * undefined: Same as `check-indeterminate`.\n */\nexport type MatCheckboxClickAction = 'noop' | 'check' | 'check-indeterminate' | undefined;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {_IdGenerator, FocusableOption} from '@angular/cdk/a11y';\nimport {\n ANIMATION_MODULE_TYPE,\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n NgZone,\n OnChanges,\n Output,\n SimpleChanges,\n ViewChild,\n ViewEncapsulation,\n booleanAttribute,\n forwardRef,\n numberAttribute,\n inject,\n HostAttributeToken,\n} from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator,\n} from '@angular/forms';\nimport {MatRipple, _MatInternalFormField, _StructuralStylesLoader} from '../core';\nimport {\n MAT_CHECKBOX_DEFAULT_OPTIONS,\n MAT_CHECKBOX_DEFAULT_OPTIONS_FACTORY,\n MatCheckboxDefaultOptions,\n} from './checkbox-config';\nimport {_CdkPrivateStyleLoader} from '@angular/cdk/private';\n\n/**\n * Represents the different states that require custom transitions between them.\n * @docs-private\n */\nexport enum TransitionCheckState {\n /** The initial state of the component before any user interaction. */\n Init,\n /** The state representing the component when it's becoming checked. */\n Checked,\n /** The state representing the component when it's becoming unchecked. */\n Unchecked,\n /** The state representing the component when it's becoming indeterminate. */\n Indeterminate,\n}\n\n/**\n * @deprecated Will stop being exported.\n * @breaking-change 19.0.0\n */\nexport const MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MatCheckbox),\n multi: true,\n};\n\n/** Change event object emitted by checkbox. */\nexport class MatCheckboxChange {\n /** The source checkbox of the event. */\n source: MatCheckbox;\n /** The new `checked` value of the checkbox. */\n checked: boolean;\n}\n\n// Default checkbox configuration.\nconst defaults = MAT_CHECKBOX_DEFAULT_OPTIONS_FACTORY();\n\n@Component({\n selector: 'mat-checkbox',\n templateUrl: 'checkbox.html',\n styleUrl: 'checkbox.css',\n host: {\n 'class': 'mat-mdc-checkbox',\n '[attr.tabindex]': 'null',\n '[attr.aria-label]': 'null',\n '[attr.aria-labelledby]': 'null',\n '[class._mat-animation-noopable]': `_animationMode === 'NoopAnimations'`,\n '[class.mdc-checkbox--disabled]': 'disabled',\n '[id]': 'id',\n // Add classes that users can use to more easily target disabled or checked checkboxes.\n '[class.mat-mdc-checkbox-disabled]': 'disabled',\n '[class.mat-mdc-checkbox-checked]': 'checked',\n '[class.mat-mdc-checkbox-disabled-interactive]': 'disabledInteractive',\n '[class]': 'color ? \"mat-\" + color : \"mat-accent\"',\n },\n providers: [\n MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR,\n {\n provide: NG_VALIDATORS,\n useExisting: MatCheckbox,\n multi: true,\n },\n ],\n exportAs: 'matCheckbox',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [MatRipple, _MatInternalFormField],\n})\nexport class MatCheckbox\n implements AfterViewInit, OnChanges, ControlValueAccessor, Validator, FocusableOption\n{\n _elementRef = inject>(ElementRef);\n private _changeDetectorRef = inject(ChangeDetectorRef);\n private _ngZone = inject(NgZone);\n _animationMode? = inject(ANIMATION_MODULE_TYPE, {optional: true});\n private _options = inject(MAT_CHECKBOX_DEFAULT_OPTIONS, {\n optional: true,\n });\n\n /** Focuses the checkbox. */\n focus() {\n this._inputElement.nativeElement.focus();\n }\n\n /** Creates the change event that will be emitted by the checkbox. */\n protected _createChangeEvent(isChecked: boolean) {\n const event = new MatCheckboxChange();\n event.source = this;\n event.checked = isChecked;\n return event;\n }\n\n /** Gets the element on which to add the animation CSS classes. */\n protected _getAnimationTargetElement() {\n return this._inputElement?.nativeElement;\n }\n\n /** CSS classes to add when transitioning between the different checkbox states. */\n protected _animationClasses = {\n uncheckedToChecked: 'mdc-checkbox--anim-unchecked-checked',\n uncheckedToIndeterminate: 'mdc-checkbox--anim-unchecked-indeterminate',\n checkedToUnchecked: 'mdc-checkbox--anim-checked-unchecked',\n checkedToIndeterminate: 'mdc-checkbox--anim-checked-indeterminate',\n indeterminateToChecked: 'mdc-checkbox--anim-indeterminate-checked',\n indeterminateToUnchecked: 'mdc-checkbox--anim-indeterminate-unchecked',\n };\n\n /**\n * Attached to the aria-label attribute of the host element. In most cases, aria-labelledby will\n * take precedence so this may be omitted.\n */\n @Input('aria-label') ariaLabel: string = '';\n\n /**\n * Users can specify the `aria-labelledby` attribute which will be forwarded to the input element\n */\n @Input('aria-labelledby') ariaLabelledby: string | null = null;\n\n /** The 'aria-describedby' attribute is read after the element's label and field type. */\n @Input('aria-describedby') ariaDescribedby: string;\n\n /**\n * Users can specify the `aria-expanded` attribute which will be forwarded to the input element\n */\n @Input({alias: 'aria-expanded', transform: booleanAttribute}) ariaExpanded: boolean;\n\n /**\n * Users can specify the `aria-controls` attribute which will be forwarded to the input element\n */\n @Input('aria-controls') ariaControls: string;\n\n /** Users can specify the `aria-owns` attribute which will be forwarded to the input element */\n @Input('aria-owns') ariaOwns: string;\n\n private _uniqueId: string;\n\n /** A unique id for the checkbox input. If none is supplied, it will be auto-generated. */\n @Input() id: string;\n\n /** Returns the unique id for the visual hidden input. */\n get inputId(): string {\n return `${this.id || this._uniqueId}-input`;\n }\n\n /** Whether the checkbox is required. */\n @Input({transform: booleanAttribute}) required: boolean;\n\n /** Whether the label should appear after or before the checkbox. Defaults to 'after' */\n @Input() labelPosition: 'before' | 'after' = 'after';\n\n /** Name value will be applied to the input element if present */\n @Input() name: string | null = null;\n\n /** Event emitted when the checkbox's `checked` value changes. */\n @Output() readonly change = new EventEmitter();\n\n /** Event emitted when the checkbox's `indeterminate` value changes. */\n @Output() readonly indeterminateChange: EventEmitter = new EventEmitter();\n\n /** The value attribute of the native input element */\n @Input() value: string;\n\n /** Whether the checkbox has a ripple. */\n @Input({transform: booleanAttribute}) disableRipple: boolean;\n\n /** The native `` element */\n @ViewChild('input') _inputElement: ElementRef;\n\n /** The native `