import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import React from "react";
export default (function (_ref) {
  var config = _ref.config,
    valueSources = _ref.valueSources,
    valueSrc = _ref.valueSrc,
    title = _ref.title,
    setValueSrc = _ref.setValueSrc,
    readonly = _ref.readonly;
  var renderOptions = function renderOptions(valueSources) {
    return valueSources.map(function (_ref2) {
      var _ref3 = _slicedToArray(_ref2, 2),
        srcKey = _ref3[0],
        info = _ref3[1];
      return /*#__PURE__*/React.createElement("option", {
        key: srcKey,
        value: srcKey
      }, info.label);
    });
  };
  var onChange = function onChange(e) {
    return setValueSrc(e.target.value);
  };
  return /*#__PURE__*/React.createElement("select", {
    onChange: onChange,
    value: valueSrc || "",
    disabled: readonly
  }, renderOptions(valueSources));
});