ui-kit-ck-consultant 0.5.156 → 0.5.157

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3851,6 +3851,7 @@ var Gauge = /*#__PURE__*/function (_React$Component) {
3851
3851
 
3852
3852
  _this = _React$Component.call(this, props) || this;
3853
3853
  _this.state = {
3854
+ isActive: false,
3854
3855
  position: 0
3855
3856
  };
3856
3857
  return _this;
@@ -3859,11 +3860,19 @@ var Gauge = /*#__PURE__*/function (_React$Component) {
3859
3860
  var _proto = Gauge.prototype;
3860
3861
 
3861
3862
  _proto.componentDidMount = function componentDidMount() {
3863
+ var _this2 = this;
3864
+
3862
3865
  if (this.props.position) {
3863
3866
  this.setState({
3864
3867
  position: this.props.position
3865
3868
  });
3866
3869
  }
3870
+
3871
+ window.addEventListener('mouseup', function () {
3872
+ _this2.setState({
3873
+ isActive: false
3874
+ });
3875
+ }, true);
3867
3876
  };
3868
3877
 
3869
3878
  _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
@@ -3875,7 +3884,7 @@ var Gauge = /*#__PURE__*/function (_React$Component) {
3875
3884
  };
3876
3885
 
3877
3886
  _proto.render = function render() {
3878
- var _this2 = this;
3887
+ var _this3 = this;
3879
3888
 
3880
3889
  return /*#__PURE__*/React__default.createElement("div", {
3881
3890
  className: this.props.className
@@ -3895,17 +3904,24 @@ var Gauge = /*#__PURE__*/function (_React$Component) {
3895
3904
  backgroundImage: this.props.colors.length === 3 ? "linear-gradient(to right, " + this.props.colors[0] + " 0%, " + this.props.colors[1] + " 50%, " + this.props.colors[2] + " 100%)" : "linear-gradient(to right, " + this.props.colors[0] + ", " + this.props.colors[1] + ")",
3896
3905
  borderRadius: '8px'
3897
3906
  },
3898
- onClick: function onClick(e) {
3899
- var currentTargetRect = e.currentTarget.getBoundingClientRect();
3900
- var width = currentTargetRect.width;
3901
- var positionX = e.pageX - currentTargetRect.left;
3902
- var step = _this2.props.step ? _this2.props.step : 1;
3903
- var position = positionX * 100 / width - positionX * 100 / width % step;
3904
-
3905
- _this2.setState({
3906
- position: position
3907
- }, function () {
3908
- return _this2.props.onChange ? _this2.props.onChange(position) : null;
3907
+ onMouseMove: function onMouseMove(e) {
3908
+ if (_this3.state.isActive) {
3909
+ var currentTargetRect = e.currentTarget.getBoundingClientRect();
3910
+ var width = currentTargetRect.width;
3911
+ var positionX = e.pageX - currentTargetRect.left;
3912
+ var step = _this3.props.step ? _this3.props.step : 1;
3913
+ var position = positionX * 100 / width - positionX * 100 / width % step;
3914
+
3915
+ _this3.setState({
3916
+ position: position
3917
+ }, function () {
3918
+ return _this3.props.onChange ? _this3.props.onChange(position) : null;
3919
+ });
3920
+ }
3921
+ },
3922
+ onMouseDown: function onMouseDown() {
3923
+ _this3.setState({
3924
+ isActive: true
3909
3925
  });
3910
3926
  }
3911
3927
  }, this.props.min ? /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement("span", {