@widergy/energy-ui 3.0.0 → 3.0.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [3.0.1](https://github.com/widergy/energy-ui/compare/v3.0.0...v3.0.1) (2023-11-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * minor fix in carousel ([#395](https://github.com/widergy/energy-ui/issues/395)) ([c403296](https://github.com/widergy/energy-ui/commit/c403296f421e7ced5a55148d805556374ff76eef))
7
+
1
8
  # [3.0.0](https://github.com/widergy/energy-ui/compare/v2.11.0...v3.0.0) (2023-11-11)
2
9
 
3
10
 
@@ -21,24 +21,6 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
21
21
  class SliderContainer extends _react.PureComponent {
22
22
  constructor(props) {
23
23
  super(props);
24
- _defineProperty(this, "handleMouseDown", (0, _helperFunctions.throttle)(event => {
25
- this.containerRef.current.addEventListener('mousemove', this.handleMouseMove);
26
- window.addEventListener('mouseup', this.handleEventUp);
27
- return this.setState({
28
- initialPosition: event.clientX,
29
- shouldAnimate: false,
30
- timeMove: new Date().getTime()
31
- });
32
- }, this.state.timeAnimation));
33
- _defineProperty(this, "handleTouchDown", (0, _helperFunctions.throttle)(event => {
34
- this.containerRef.current.addEventListener('touchmove', this.handleTouchMove);
35
- window.addEventListener('touchend', this.handleEventUp);
36
- return this.setState({
37
- initialPosition: event.changedTouches[event.changedTouches.length - 1].clientX,
38
- shouldAnimate: false,
39
- timeMove: new Date().getTime()
40
- });
41
- }, this.state.timeAnimation));
42
24
  _defineProperty(this, "updateImgArray", () => {
43
25
  const firstSlide = this.props.slides[0];
44
26
  const lastSlide = this.props.slides[this.props.slides.length - 1];
@@ -173,8 +155,8 @@ class SliderContainer extends _react.PureComponent {
173
155
  this.setState({
174
156
  slideArray: arr
175
157
  });
176
- this.containerRef.current.addEventListener('touchstart', this.handleTouchDown);
177
- this.containerRef.current.addEventListener('mousedown', this.handleMouseDown);
158
+ this.containerRef.current.addEventListener('touchstart', this.handleTouchDown.bind(this));
159
+ this.containerRef.current.addEventListener('mousedown', this.handleMouseDown.bind(this));
178
160
  this.updateContainerWidth();
179
161
  window.addEventListener('resize', this.updateContainerWidth);
180
162
  if (this.props.autoPlay) setInterval(() => this.handleNextSlide(), this.props.autoPlayDelay);
@@ -196,6 +178,28 @@ class SliderContainer extends _react.PureComponent {
196
178
  window.removeEventListener('resize', this.updateContainerWidth);
197
179
  window.removeEventListener('touchend', this.handleEventUp);
198
180
  }
181
+ handleMouseDown() {
182
+ return (0, _helperFunctions.throttle)(event => {
183
+ this.containerRef.current.addEventListener('mousemove', this.handleMouseMove);
184
+ window.addEventListener('mouseup', this.handleEventUp);
185
+ return this.setState({
186
+ initialPosition: event.clientX,
187
+ shouldAnimate: false,
188
+ timeMove: new Date().getTime()
189
+ });
190
+ }, this.state.timeAnimation);
191
+ }
192
+ handleTouchDown() {
193
+ (0, _helperFunctions.throttle)(event => {
194
+ this.containerRef.current.addEventListener('touchmove', this.handleTouchMove);
195
+ window.addEventListener('touchend', this.handleEventUp);
196
+ return this.setState({
197
+ initialPosition: event.changedTouches[event.changedTouches.length - 1].clientX,
198
+ shouldAnimate: false,
199
+ timeMove: new Date().getTime()
200
+ });
201
+ }, this.state.timeAnimation);
202
+ }
199
203
  render() {
200
204
  const {
201
205
  shouldAnimate,
@@ -22,9 +22,9 @@ const ActionButton = _ref => {
22
22
  isHidden,
23
23
  buttonProps
24
24
  } = _ref;
25
- return /*#__PURE__*/(0, _react.isValidElement)(button) ? /*#__PURE__*/(0, _react.cloneElement)(button, {
25
+ return /*#__PURE__*/(0, _react.isValidElement)(button) ? ( /*#__PURE__*/(0, _react.cloneElement)(button, {
26
26
  className: "".concat(button.props.className, " ").concat(isHidden && _stylesModule.default.hiddenButton)
27
- }) : /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
27
+ })) : /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
28
28
  disabled: button.disabled,
29
29
  hideTextOnResponsive: true,
30
30
  onClick: button.onClick
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",