'use strict';

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
var React = require('react');
var formik = require('formik');
var ramda = require('ramda');
var Slider = require('../Slider.js');
var jsxRuntime = require('react/jsx-runtime');
require('antd/lib/config-provider');
require('antd/lib/slider');
require('react-i18next');
require('../constants.js');
require('antd/locale/de_DE');
require('antd/locale/en_US');
require('antd/locale/es_ES');
require('antd/locale/fr_FR');
require('antd/locale/nl_NL');
require('antd/locale/pl_PL');
require('antd/locale/pt_PT');
require('../Label.js');
require('classnames');
require('@bigbinary/neeto-icons/Help');
require('../Button.js');
require('react-router-dom');
require('../Spinner.js');
require('../Tooltip.js');
require('@tippyjs/react');
require('tippy.js');
require('@bigbinary/neeto-hotkeys');
require('../overlayManager.js');
require('@babel/runtime/helpers/classCallCheck');
require('@babel/runtime/helpers/createClass');
require('@bigbinary/neeto-cist');
require('qs');
require('../index-BgzkP01c.js');
require('@babel/runtime/helpers/toConsumableArray');
require('dayjs');
require('dayjs/plugin/localeData');
require('dayjs/plugin/utc');
require('dayjs/plugin/weekday');
require('dayjs/plugin/weekOfYear');
require('i18next');
require('../usePrefersReducedMotion-D2Ck84HM.js');
require('../Popover.js');
require('../Typography.js');
require('../useId-DXHUzdxd.js');
require('../index-CNZKW5X0.js');
require('../en-B1i-pQJm.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefault(_objectWithoutProperties);

var _excluded = ["name"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var FormikSlider = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
  var name = _ref.name,
    otherProps = _objectWithoutProperties__default.default(_ref, _excluded);
  var _useField = formik.useField(name),
    _useField2 = _slicedToArray__default.default(_useField, 3),
    field = _useField2[0],
    meta = _useField2[1],
    _useField2$ = _useField2[2],
    setValue = _useField2$.setValue,
    setTouched = _useField2$.setTouched;
  var _useFormikContext = formik.useFormikContext(),
    _useFormikContext$sta = _useFormikContext.status,
    status = _useFormikContext$sta === void 0 ? {} : _useFormikContext$sta,
    setStatus = _useFormikContext.setStatus;
  var fieldStatus = formik.getIn(status, name);
  return /*#__PURE__*/jsxRuntime.jsx(Slider, _objectSpread(_objectSpread({
    error: meta.error || fieldStatus || ""
  }, _objectSpread(_objectSpread({
    ref: ref
  }, field), {}, {
    name: name
  })), {}, {
    onBlur: function onBlur() {
      return setTouched(true);
    },
    onChange: function onChange(value) {
      setStatus(ramda.dissoc(name, status));
      setValue(value);
    }
  }, otherProps));
});
FormikSlider.displayName = "Slider";

module.exports = FormikSlider;
//# sourceMappingURL=Slider.js.map
