import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
import React__default from 'react';
import { Slider } from '@mui/material';
import { HeatmapSliderWrapper } from './style.js';
import theme from '../../../Globals/theme.js';
import { ThemeProvider } from 'styled-components';
import globalStyle from '../../../Globals/global-styles.js';

var HeatmapSlider = function HeatmapSlider(_ref) {
  var size = _ref.size;

  function valuetext(value) {
    return "".concat(value);
  }

  var minDistance = 10;

  var _React$useState = React__default.useState([0, 100]),
      _React$useState2 = _slicedToArray(_React$useState, 2),
      value2 = _React$useState2[0],
      setValue2 = _React$useState2[1];

  var handleChange2 = function handleChange2(event, newValue, activeThumb) {
    if (!Array.isArray(newValue)) {
      return;
    }

    if (newValue[1] - newValue[0] < minDistance) {
      if (activeThumb === 0) {
        var clamped = Math.min(newValue[0], 100 - minDistance);
        setValue2([clamped, clamped + minDistance]);
      } else {
        var _clamped = Math.max(newValue[1], minDistance);

        setValue2([_clamped - minDistance, _clamped]);
      }
    } else {
      setValue2(newValue);
    }
  };

  var Class = function Class(dimension) {
    if (dimension === "small") {
      return "small-slider";
    } else if (dimension === "medium") {
      return "medium-slider";
    } else if (dimension === "large") {
      return "large-slider";
    } else {
      return "";
    }
  };

  return /*#__PURE__*/React__default.createElement(ThemeProvider, {
    theme: theme
  }, /*#__PURE__*/React__default.createElement(globalStyle, null), /*#__PURE__*/React__default.createElement(HeatmapSliderWrapper, {
    className: Class(size)
  }, /*#__PURE__*/React__default.createElement(Slider, {
    getAriaLabel: function getAriaLabel() {
      return "Minimum distance shift";
    },
    value: value2,
    onChange: handleChange2,
    valueLabelDisplay: "auto",
    getAriaValueText: valuetext,
    disableSwap: true
  })));
};

export { HeatmapSlider as default };
//# sourceMappingURL=index.js.map
