import { h } from "@stencil/core";
export class BceElementSlider {
    constructor() {
        this.value = null;
        this.handleInput = (event) => {
            event.cancelBubble = true;
            const target = event.target;
            this.value = target.value;
            this.el.dispatchEvent(new Event('input', { bubbles: true }));
        };
    }
    async validate(silent = false) {
        const slider = this.el.shadowRoot.querySelector('bce-slider');
        return slider.validate(silent);
    }
    render() {
        if (!this.template)
            return null;
        return [
            h("p", null, this.handler.t('question')),
            h("div", null,
                h("label", null, this.handler.t('minText')),
                h("label", { class: "bold" }, this.value),
                h("label", null, this.handler.t('maxText'))),
            h("bce-slider", { block: true, value: this.value, validation: this.template.required ? 'required' : '', step: this.template.step, min: this.template.min, max: this.template.max, onInput: this.handleInput }),
            h("div", null,
                h("label", null, this.template.min),
                h("label", null, this.template.max))
        ];
    }
    static get is() { return "bce-element-slider"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() { return {
        "$": ["bce-element-slider.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["bce-element-slider.css"]
    }; }
    static get properties() { return {
        "handler": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "InputHandler",
                "resolved": "InputHandler",
                "references": {
                    "InputHandler": {
                        "location": "import",
                        "path": "../../../utils/input-handler"
                    }
                }
            },
            "required": true,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            }
        },
        "language": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string | undefined",
                "references": {}
            },
            "required": false,
            "optional": true,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "language",
            "reflect": false
        },
        "template": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "SliderElement",
                "resolved": "SliderElement",
                "references": {
                    "SliderElement": {
                        "location": "import",
                        "path": "./element-slider"
                    }
                }
            },
            "required": true,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            }
        },
        "value": {
            "type": "any",
            "mutable": false,
            "complexType": {
                "original": "any",
                "resolved": "any",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "value",
            "reflect": false,
            "defaultValue": "null"
        }
    }; }
    static get methods() { return {
        "validate": {
            "complexType": {
                "signature": "(silent?: boolean) => Promise<import(\"/Users/ngfk/Repositories/bce-module-editor/node_modules/@bcase/core/dist/types/index\").ValidatorError[]>",
                "parameters": [{
                        "tags": [],
                        "text": ""
                    }],
                "references": {
                    "Promise": {
                        "location": "global"
                    },
                    "ValidatorError": {
                        "location": "global"
                    }
                },
                "return": "Promise<ValidatorError[]>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        }
    }; }
    static get elementRef() { return "el"; }
}
