import _get from "lodash/get";
import * as React from "react";
import { connect } from "react-redux";
import { Typography } from "@webiny/ui/Typography";
import { Grid, Cell } from "@webiny/ui/Grid";
import { Select as SelectCmp } from "@webiny/ui/Select";
import { getActiveElement } from "../../../selectors";
import { css } from "emotion";
var selectStyle = /*#__PURE__*/css({
  select: {
    height: 35,
    paddingTop: "4px !important"
  }
}, "label:selectStyle;");

var Select = function Select(_ref) {
  var label = _ref.label,
      value = _ref.value,
      updateValue = _ref.updateValue,
      options = _ref.options,
      children = _ref.children;
  return /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
    span: 4
  }, /*#__PURE__*/React.createElement(Typography, {
    use: "overline"
  }, label)), /*#__PURE__*/React.createElement(Cell, {
    span: 8
  }, /*#__PURE__*/React.createElement(SelectCmp, {
    className: selectStyle,
    value: value,
    onChange: updateValue,
    options: options
  }, children)));
};

export default connect(function (state, _ref2) {
  var value = _ref2.value,
      valueKey = _ref2.valueKey,
      defaultValue = _ref2.defaultValue;
  return {
    value: valueKey ? _get(getActiveElement(state), valueKey, defaultValue) : value
  };
})( /*#__PURE__*/React.memo(Select));
//# sourceMappingURL=Select.js.map