'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-609aba38.js');

const CorejamFormSelect = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.formEvent = index.createEvent(this, "formEvent", 7);
    this.multiple = false;
    this.extraProps = {};
  }
  onChange(e) {
    this.inputValue = e.currentTarget.value;
    this.formEvent.emit({
      name: this.formId,
      key: this.name,
      type: "select",
      value: this.inputValue,
    });
  }
  componentWillRender() {
    if (this.multiple) {
      this.extraProps["multiple"] = true;
    }
  }
  render() {
    return (index.h(index.Host, null, index.h("corejam-box", { flex: true, direction: "col", w: "12", mb: 3 }, index.h("corejam-box", { mb: 2 }, index.h("label", { htmlFor: this.name }, index.h("corejam-type", { size: "sm", color: "gray-500" }, this.label))), index.h("select", Object.assign({ id: this.name, name: this.name }, this.extraProps), this.options.map((option) => {
      const selected = {};
      if (option.selected) {
        selected["selected"] = true;
      }
      return (index.h("option", Object.assign({ value: option.value }, selected), option.key));
    })))));
  }
  get el() { return index.getElement(this); }
};

exports.corejam_form_select = CorejamFormSelect;
