()
| 320 | } |
| 321 | |
| 322 | render() { |
| 323 | const { |
| 324 | color, |
| 325 | checked, |
| 326 | disabled, |
| 327 | el, |
| 328 | getSVGPath, |
| 329 | indeterminate, |
| 330 | inheritedAttributes, |
| 331 | inputId, |
| 332 | justify, |
| 333 | labelPlacement, |
| 334 | name, |
| 335 | value, |
| 336 | alignment, |
| 337 | required, |
| 338 | } = this; |
| 339 | const mode = getIonMode(this); |
| 340 | const path = getSVGPath(mode, indeterminate); |
| 341 | |
| 342 | renderHiddenInput(true, el, name, checked ? value : '', disabled); |
| 343 | |
| 344 | // The host element must have a checkbox role to ensure proper VoiceOver |
| 345 | // support in Safari for accessibility. |
| 346 | return ( |
| 347 | <Host |
| 348 | role="checkbox" |
| 349 | aria-checked={indeterminate ? 'mixed' : `${checked}`} |
| 350 | aria-describedby={this.hintTextId} |
| 351 | aria-invalid={this.isInvalid ? 'true' : undefined} |
| 352 | aria-labelledby={this.hasLabelContent ? this.inputLabelId : null} |
| 353 | aria-label={inheritedAttributes['aria-label'] || null} |
| 354 | aria-disabled={disabled ? 'true' : null} |
| 355 | aria-required={required ? 'true' : undefined} |
| 356 | tabindex={disabled ? undefined : 0} |
| 357 | onKeyDown={this.onKeyDown} |
| 358 | onFocus={this.onFocus} |
| 359 | onBlur={this.onBlur} |
| 360 | onClick={this.onClick} |
| 361 | class={createColorClasses(color, { |
| 362 | [mode]: true, |
| 363 | 'in-item': hostContext('ion-item', el), |
| 364 | 'checkbox-checked': checked, |
| 365 | 'checkbox-disabled': disabled, |
| 366 | 'checkbox-indeterminate': indeterminate, |
| 367 | interactive: true, |
| 368 | [`checkbox-justify-${justify}`]: justify !== undefined, |
| 369 | [`checkbox-alignment-${alignment}`]: alignment !== undefined, |
| 370 | [`checkbox-label-placement-${labelPlacement}`]: true, |
| 371 | })} |
| 372 | > |
| 373 | <label class="checkbox-wrapper" htmlFor={inputId}> |
| 374 | {/* |
| 375 | The native control must be rendered |
| 376 | before the visible label text due to https://bugs.webkit.org/show_bug.cgi?id=251951 |
| 377 | */} |
| 378 | <input |
| 379 | type="checkbox" |
nothing calls this directly
no test coverage detected