import createSimpleDialog from "./createSimpleDialog";
import { NumericInputField } from "teselagen-react-components";
import { get } from "lodash";
import { tryToRefocusEditor } from "../utils/editorUtils";
export default createSimpleDialog({
  formName: "goToDialog",
  fields: [{
    name: "sequencePosition",
    component: NumericInputField,
    validate: function validate(val, vals, props) {
      var _get = get(props, "extraProps.sequencePosition", {}),
        min = _get.min,
        max = _get.max;
      return min && val < min || max && val > max ? "Invalid position" : undefined;
    }
  }],
  withDialogProps: {
    title: "Go To",
    height: 190,
    onCloseHook: tryToRefocusEditor
  }
});