import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-8dc1a0b7.js';

const CorejamFormSelect = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.formEvent = 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 (h(Host, null, h("corejam-box", { flex: true, direction: "col", w: "12", mb: 3 }, h("corejam-box", { mb: 2 }, h("label", { htmlFor: this.name }, h("corejam-type", { size: "sm", color: "gray-500" }, this.label))), 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 (h("option", Object.assign({ value: option.value }, selected), option.key));
    })))));
  }
  get el() { return getElement(this); }
};

export { CorejamFormSelect as corejam_form_select };
