fix(): update to Stencil One 🎉🎊

This commit is contained in:
Manu MA
2019-06-19 21:33:50 +02:00
committed by GitHub
parent 7f1829eb21
commit b40f7d36d5
572 changed files with 14426 additions and 9916 deletions

View File

@ -1,9 +1,13 @@
import { Component, ComponentInterface, Element, Event, EventEmitter, Listen, Prop, Watch } from '@stencil/core';
import { Component, ComponentInterface, Element, Event, EventEmitter, Listen, Prop, Watch, h } from '@stencil/core';
import { CheckboxChangeEventDetail, Color, Mode, StyleEventDetail } from '../../interface';
import { getIonMode } from '../../global/ionic-global';
import { CheckboxChangeEventDetail, Color, StyleEventDetail } from '../../interface';
import { findItemLabel, renderHiddenInput } from '../../utils/helpers';
import { createColorClasses, hostContext } from '../../utils/theme';
/**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
*/
@Component({
tag: 'ion-checkbox',
styleUrls: {
@ -26,11 +30,6 @@ export class Checkbox implements ComponentInterface {
*/
@Prop() color?: Color;
/**
* The mode determines which platform styles to use.
*/
@Prop() mode!: Mode;
/**
* The name of the control, which is submitted with the form data.
*/
@ -126,6 +125,7 @@ export class Checkbox implements ComponentInterface {
hostData() {
const { inputId, disabled, checked, color, el } = this;
const labelId = inputId + '-lbl';
const mode = getIonMode(this);
const label = findItemLabel(el);
if (label) {
label.id = labelId;
@ -137,7 +137,7 @@ export class Checkbox implements ComponentInterface {
'aria-labelledby': labelId,
class: {
...createColorClasses(color),
[`${this.mode}`]: true,
[`${mode}`]: true,
'in-item': hostContext('ion-item', el),
'checkbox-checked': checked,
'checkbox-disabled': disabled,
@ -148,13 +148,15 @@ export class Checkbox implements ComponentInterface {
}
render() {
const mode = getIonMode(this);
renderHiddenInput(true, this.el, this.name, (this.checked ? this.value : ''), this.disabled);
let path = this.indeterminate
? <path d="M6 12L18 12"/>
: <path d="M5.9,12.5l3.8,3.8l8.8-8.8" />;
if (this.mode === 'md') {
if (mode === 'md') {
path = this.indeterminate
? <path d="M2 12H22"/>
: <path d="M1.73,12.91 8.1,19.28 22.79,4.59"/>;