()
| 436 | } |
| 437 | |
| 438 | render() { |
| 439 | const { |
| 440 | activated, |
| 441 | alignment, |
| 442 | checked, |
| 443 | color, |
| 444 | disabled, |
| 445 | el, |
| 446 | hasLabel, |
| 447 | inheritedAttributes, |
| 448 | inputId, |
| 449 | inputLabelId, |
| 450 | justify, |
| 451 | labelPlacement, |
| 452 | name, |
| 453 | required, |
| 454 | } = this; |
| 455 | |
| 456 | const mode = getIonMode(this); |
| 457 | const value = this.getValue(); |
| 458 | const rtl = isRTL(el) ? 'rtl' : 'ltr'; |
| 459 | renderHiddenInput(true, el, name, checked ? value : '', disabled); |
| 460 | |
| 461 | return ( |
| 462 | <Host |
| 463 | role="switch" |
| 464 | aria-checked={`${checked}`} |
| 465 | aria-describedby={this.hintTextId} |
| 466 | aria-invalid={this.isInvalid ? 'true' : undefined} |
| 467 | onClick={this.onClick} |
| 468 | aria-labelledby={hasLabel ? inputLabelId : null} |
| 469 | aria-label={inheritedAttributes['aria-label'] || null} |
| 470 | aria-disabled={disabled ? 'true' : null} |
| 471 | aria-required={required ? 'true' : undefined} |
| 472 | tabindex={disabled ? undefined : 0} |
| 473 | onKeyDown={this.onKeyDown} |
| 474 | onFocus={this.onFocus} |
| 475 | onBlur={this.onBlur} |
| 476 | class={createColorClasses(color, { |
| 477 | [mode]: true, |
| 478 | 'in-item': hostContext('ion-item', el), |
| 479 | 'toggle-activated': activated, |
| 480 | 'toggle-checked': checked, |
| 481 | 'toggle-disabled': disabled, |
| 482 | [`toggle-justify-${justify}`]: justify !== undefined, |
| 483 | [`toggle-alignment-${alignment}`]: alignment !== undefined, |
| 484 | [`toggle-label-placement-${labelPlacement}`]: true, |
| 485 | [`toggle-${rtl}`]: true, |
| 486 | })} |
| 487 | > |
| 488 | <label class="toggle-wrapper" htmlFor={inputId}> |
| 489 | {/* |
| 490 | The native control must be rendered |
| 491 | before the visible label text due to https://bugs.webkit.org/show_bug.cgi?id=251951 |
| 492 | */} |
| 493 | <input |
| 494 | type="checkbox" |
| 495 | role="switch" |
nothing calls this directly
no test coverage detected