| 36 | shadow: true, |
| 37 | }) |
| 38 | export class Toggle implements ComponentInterface { |
| 39 | private inputId = `ion-tg-${toggleIds++}`; |
| 40 | private inputLabelId = `${this.inputId}-lbl`; |
| 41 | private helperTextId = `${this.inputId}-helper-text`; |
| 42 | private errorTextId = `${this.inputId}-error-text`; |
| 43 | private gesture?: Gesture; |
| 44 | private lastDrag = 0; |
| 45 | private inheritedAttributes: Attributes = {}; |
| 46 | private toggleTrack?: HTMLElement; |
| 47 | private didLoad = false; |
| 48 | private validationObserver?: MutationObserver; |
| 49 | |
| 50 | @Element() el!: HTMLIonToggleElement; |
| 51 | |
| 52 | @State() activated = false; |
| 53 | |
| 54 | /** |
| 55 | * Track validation state for proper aria-live announcements. |
| 56 | */ |
| 57 | @State() isInvalid = false; |
| 58 | |
| 59 | @State() private hintTextId?: string; |
| 60 | |
| 61 | /** |
| 62 | * The color to use from your application's color palette. |
| 63 | * Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. |
| 64 | * For more information on colors, see [theming](/docs/theming/basics). |
| 65 | */ |
| 66 | @Prop({ reflect: true }) color?: Color; |
| 67 | |
| 68 | /** |
| 69 | * The name of the control, which is submitted with the form data. |
| 70 | */ |
| 71 | @Prop() name: string = this.inputId; |
| 72 | |
| 73 | /** |
| 74 | * If `true`, the toggle is selected. |
| 75 | */ |
| 76 | @Prop({ mutable: true }) checked = false; |
| 77 | |
| 78 | /** |
| 79 | * If `true`, the user cannot interact with the toggle. |
| 80 | */ |
| 81 | @Prop() disabled = false; |
| 82 | |
| 83 | /** |
| 84 | * Text that is placed under the toggle label and displayed when an error is detected. |
| 85 | */ |
| 86 | @Prop() errorText?: string; |
| 87 | |
| 88 | /** |
| 89 | * Text that is placed under the toggle label and displayed when no error is detected. |
| 90 | */ |
| 91 | @Prop() helperText?: string; |
| 92 | |
| 93 | /** |
| 94 | * The value of the toggle does not mean if it's checked or not, use the `checked` |
| 95 | * property for that. |
nothing calls this directly
no test coverage detected