import { h } from '@stencil/core';
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", null,
            getThumbnail(this),
            h("ion-label", { "text-wrap": true }, 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 {
        "image": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "image",
            "reflect": false
        },
        "label": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "label",
            "reflect": false
        },
        "value": {
            "type": "any",
            "mutable": false,
            "complexType": {
                "original": "any",
                "resolved": "any",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "value",
            "reflect": false
        }
    }; }
    static get events() { return [{
            "method": "glOptionChanged",
            "name": "glOptionChanged",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "complexType": {
                "original": "any",
                "resolved": "any",
                "references": {}
            }
        }]; }
    static get elementRef() { return "el"; }
}
