import { getThumbnail } from '../utils';
export class Option {
    getRadio() {
        const field = this.el.closest('gl-field');
        const checked = field.getValue() === this.value;
        return (h("ion-item", { "text-wrap": true },
            getThumbnail(this),
            h("ion-label", null, this.label),
            h("ion-radio", { onIonSelect: () => this.glOptionChanged.emit(this.value), value: this.value, checked: checked })));
    }
    getSelectOption() {
        return (h("ion-select-option", { value: this.value }, this.label));
    }
    render() {
        let field = this.el.closest('gl-field');
        return (field.widget === 'radio') ?
            this.getRadio() : this.getSelectOption();
    }
    static get is() { return "gl-option"; }
    static get properties() { return {
        "el": {
            "elementRef": true
        },
        "image": {
            "type": String,
            "attr": "image"
        },
        "label": {
            "type": String,
            "attr": "label"
        },
        "value": {
            "type": "Any",
            "attr": "value"
        }
    }; }
    static get events() { return [{
            "name": "glOptionChanged",
            "method": "glOptionChanged",
            "bubbles": true,
            "cancelable": true,
            "composed": true
        }]; }
}
