import { Component, ComponentInterface, Element, Event, EventEmitter, Prop, State, Watch } from '@stencil/core'; import { CheckedInputChangeEvent, Color, Mode, StyleEvent } from '../../interface'; import { renderHiddenInput } from '../../utils/helpers'; import { createColorClasses, hostContext } from '../../utils/theme'; @Component({ tag: 'ion-checkbox', styleUrls: { ios: 'checkbox.ios.scss', md: 'checkbox.md.scss' }, shadow: true }) export class Checkbox implements ComponentInterface { private inputId = `ion-cb-${checkboxIds++}`; private labelId = `${this.inputId}-lbl`; @Element() el!: HTMLElement; @State() keyFocus = false; /** * The color to use from your application's color palette. * Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. * For more information on colors, see [theming](/docs/theming/basics). */ @Prop() color?: Color; /** * The mode determines which platform styles to use. * Possible values are: `"ios"` or `"md"`. */ @Prop() mode!: Mode; /** * The name of the control, which is submitted with the form data. */ @Prop() name: string = this.inputId; /** * If `true`, the checkbox is selected. Defaults to `false`. */ @Prop({ mutable: true }) checked = false; /** * If `true`, the user cannot interact with the checkbox. Defaults to `false`. */ @Prop() disabled = false; /** * The value of the toggle does not mean if it's checked or not, use the `checked` * property for that. * * The value of a toggle is analogous to the value of a ``, * it's only used when the toggle participates in a native `