@synerise/ds-scrollbar 0.11.23 → 0.12.0

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
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.12.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-scrollbar@0.11.24...@synerise/ds-scrollbar@0.12.0) (2025-01-29)
7
+
8
+
9
+ ### Features
10
+
11
+ * antd@4.24 react@18 ([d97a667](https://github.com/Synerise/synerise-design/commit/d97a667b1f33aed3177e1851de3b6f60be2d46a6))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.11.24](https://github.com/Synerise/synerise-design/compare/@synerise/ds-scrollbar@0.11.23...@synerise/ds-scrollbar@0.11.24) (2025-01-21)
18
+
19
+ **Note:** Version bump only for package @synerise/ds-scrollbar
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.11.23](https://github.com/Synerise/synerise-design/compare/@synerise/ds-scrollbar@0.11.22...@synerise/ds-scrollbar@0.11.23) (2025-01-15)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-scrollbar
package/dist/Scrollbar.js CHANGED
@@ -15,13 +15,12 @@ var Scrollbar = React.forwardRef(function (_ref, forwardedRef) {
15
15
  fetchData = _ref.fetchData,
16
16
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
17
17
  var Component = withDnd ? DnDScrollbar : VirtualScrollbar;
18
- var scrollbar = /*#__PURE__*/React.createElement(Component, _extends({}, props, {
19
- fetchData: fetchData,
20
- ref: forwardedRef
21
- }), children);
22
18
  return /*#__PURE__*/React.createElement(S.ScrollbarContainer, {
23
19
  className: className
24
- }, scrollbar, loading && /*#__PURE__*/React.createElement(S.LoaderWrapper, null, /*#__PURE__*/React.createElement(S.Loader, {
20
+ }, /*#__PURE__*/React.createElement(Component, _extends({}, props, {
21
+ fetchData: fetchData,
22
+ ref: forwardedRef
23
+ }), children), loading && /*#__PURE__*/React.createElement(S.LoaderWrapper, null, /*#__PURE__*/React.createElement(S.Loader, {
25
24
  loading: loading
26
25
  }, /*#__PURE__*/React.createElement(Icon, {
27
26
  component: /*#__PURE__*/React.createElement(SpinnerM, null),
@@ -1,12 +1,8 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
2
  import React, { useCallback, forwardRef, useRef, useEffect, useState } from 'react';
7
3
  import PerfectScrollbar from '@ofsajd/react-perfect-scrollbar';
8
- import { debounce } from 'lodash';
9
- import { useCombinedRefs } from '@synerise/ds-utils';
4
+ // import { debounce } from 'lodash';
5
+ import { useCombinedRefs, useResizeObserver } from '@synerise/ds-utils';
10
6
  import "./style/index.css";
11
7
  import * as S from './VirtualScrollbar.styles';
12
8
  // eslint-disable-next-line import/prefer-default-export
@@ -31,25 +27,17 @@ export var VirtualScrollbar = forwardRef(function (_ref, forwardedRef) {
31
27
  var _useState = useState(0),
32
28
  lastScrollTop = _useState[0],
33
29
  setLastScrollTop = _useState[1];
34
- var debouncedResize = useRef(debounce(function () {
35
- if (combinedScrollRef && combinedScrollRef.current) {
36
- var scrollEvent = new window.Event('scroll');
37
- combinedScrollRef.current.dispatchEvent(scrollEvent);
38
- }
39
- }, 100, {
40
- leading: true,
41
- trailing: true
42
- })).current;
43
- var resizeObserver = useRef(new ResizeObserver(debouncedResize)).current;
30
+ var _useResizeObserver = useResizeObserver(wrapperRef),
31
+ height = _useResizeObserver.height,
32
+ width = _useResizeObserver.width;
33
+ var triggerScrollbarGeometryUpdate = useCallback(function () {
34
+ var scrollEvent = new window.Event('scroll');
35
+ wrapperRef.current && wrapperRef.current.dispatchEvent(scrollEvent);
36
+ combinedScrollRef.current && combinedScrollRef.current.dispatchEvent(scrollEvent);
37
+ }, [combinedScrollRef]);
44
38
  useEffect(function () {
45
- if (wrapperRef.current) {
46
- resizeObserver.observe(wrapperRef.current);
47
- }
48
- return function () {
49
- resizeObserver.disconnect();
50
- debouncedResize.cancel();
51
- };
52
- }, [resizeObserver, debouncedResize]);
39
+ triggerScrollbarGeometryUpdate();
40
+ }, [height, width, triggerScrollbarGeometryUpdate]);
53
41
  var handleReachEnd = useCallback(function () {
54
42
  var _combinedScrollRef$cu;
55
43
  if ((combinedScrollRef == null || (_combinedScrollRef$cu = combinedScrollRef.current) == null ? void 0 : _combinedScrollRef$cu.scrollTop) === lastScrollTop) {
@@ -79,6 +67,20 @@ export var VirtualScrollbar = forwardRef(function (_ref, forwardedRef) {
79
67
  wrapper && handleWheel && wrapper.removeEventListener('wheel', handleWheel);
80
68
  };
81
69
  }, [confineScroll]);
70
+ useEffect(function () {
71
+ var endHandler = function endHandler(_ref2) {
72
+ var target = _ref2.target;
73
+ if (target instanceof HTMLElement && combinedScrollRef.current && target.contains(combinedScrollRef.current)) {
74
+ triggerScrollbarGeometryUpdate();
75
+ }
76
+ };
77
+ document.body.addEventListener('transitionend', endHandler);
78
+ document.body.addEventListener('animationend', endHandler);
79
+ return function () {
80
+ document.body.removeEventListener('transitionend', endHandler);
81
+ document.body.removeEventListener('animationend', endHandler);
82
+ };
83
+ });
82
84
  return /*#__PURE__*/React.createElement(PerfectScrollbar, {
83
85
  containerRef: function containerRef(ref) {
84
86
  combinedScrollRef.current = ref;
@@ -86,7 +88,7 @@ export var VirtualScrollbar = forwardRef(function (_ref, forwardedRef) {
86
88
  ,
87
89
  onScroll: onScroll,
88
90
  onScrollUp: handleScrollUp,
89
- options: _objectSpread({}, scrollbarOptions, {
91
+ options: _extends({}, scrollbarOptions, {
90
92
  minScrollbarLength: 48
91
93
  }),
92
94
  onYReachEnd: handleReachEnd,
@@ -1 +1 @@
1
- @import '~@ofsajd/react-perfect-scrollbar/dist/css/styles.css';.ps{overscroll-behavior:contain}.ps__rail-x.ps__rail-x{opacity:1;height:11px;position:absolute;width:calc(100% - 8px)!important;transform:translateX(-4px);overflow:hidden;margin-right:12px}.ps{overscroll-behavior:contain}.ps__rail-y.ps__rail-y{opacity:1;width:11px;position:absolute;height:calc(100% - 8px)!important;transform:translateY(4px);overflow:hidden;margin-bottom:12px}.ps:hover .ps__rail-x,.ps:hover .ps__rail-y{opacity:1}.ps .ps__rail-x.ps--clicking,.ps .ps__rail-x:focus,.ps .ps__rail-x:hover,.ps .ps__rail-y.ps--clicking,.ps .ps__rail-y:focus,.ps .ps__rail-y:hover{background-color:unset}.ps__thumb-x{background-color:#dbe0e3;border-radius:3px;height:3px;bottom:4px;margin:0 4px}.ps__thumb-y{background-color:#dbe0e3;border-radius:3px;width:3px;right:4px}.ps__rail-x.ps--clicking .ps__thumb-x,.ps__rail-x:focus>.ps__thumb-x,.ps__rail-x:hover>.ps__thumb-x{background-color:#949ea6;height:3px}.ps__rail-y.ps--clicking .ps__thumb-y,.ps__rail-y:focus>.ps__thumb-y,.ps__rail-y:hover>.ps__thumb-y{background-color:#949ea6;width:3px}.large-size .ps__rail-x.ps__rail-x,.large-size .ps__rail-y.ps__rail-y{opacity:1;width:26px;height:26px;position:absolute;overflow:hidden}.large-size .ps__rail-y.ps--clicking .ps__thumb-y,.large-size .ps__rail-y:focus>.ps__thumb-y,.large-size .ps__rail-y:hover>.ps__thumb-y,.large-size .ps__thumb-x,.large-size .ps__thumb-y,.large-size .ps__thumb-y--clicking,.large-size .ps__thumb-y:hover{background-color:#f4faff;border-radius:3px;width:16px;height:16px;border:1px solid #dbe0e3}.large-size .ps__rail-x.ps--clicking .ps__thumb-x,.large-size .ps__rail-x:focus>.ps__thumb-x,.large-size .ps__rail-x:hover>.ps__thumb-x,.large-size .ps__rail-y.ps--clicking .ps__thumb-y,.large-size .ps__rail-y:focus>.ps__thumb-y,.large-size .ps__rail-y:hover>.ps__thumb-y{background-color:#d9eeff;border:1px solid #b5bdc3;height:16px}
1
+ @import '~@ofsajd/react-perfect-scrollbar/dist/css/styles.css';.ps{overscroll-behavior:contain}.ps__rail-x.ps__rail-x{opacity:1;height:11px;top:unset!important;bottom:0;position:absolute;width:calc(100% - 8px)!important;transform:translateX(-4px);overflow:hidden;margin-right:12px}.ps{overscroll-behavior:contain}.ps__rail-y.ps__rail-y{opacity:1;width:11px;left:unset!important;right:0;position:absolute;height:calc(100% - 8px)!important;transform:translateY(4px);overflow:hidden;margin-bottom:12px}.ps:hover .ps__rail-x,.ps:hover .ps__rail-y{opacity:1}.ps .ps__rail-x.ps--clicking,.ps .ps__rail-x:focus,.ps .ps__rail-x:hover,.ps .ps__rail-y.ps--clicking,.ps .ps__rail-y:focus,.ps .ps__rail-y:hover{background-color:unset}.ps__thumb-x{background-color:#dbe0e3;border-radius:3px;height:3px;bottom:4px;margin:0 4px}.ps__thumb-y{background-color:#dbe0e3;border-radius:3px;width:3px;right:4px}.ps__rail-x.ps--clicking .ps__thumb-x,.ps__rail-x:focus>.ps__thumb-x,.ps__rail-x:hover>.ps__thumb-x{background-color:#949ea6;height:3px}.ps__rail-y.ps--clicking .ps__thumb-y,.ps__rail-y:focus>.ps__thumb-y,.ps__rail-y:hover>.ps__thumb-y{background-color:#949ea6;width:3px}.large-size .ps__rail-x.ps__rail-x,.large-size .ps__rail-y.ps__rail-y{opacity:1;width:26px;height:26px;position:absolute;overflow:hidden}.large-size .ps__rail-y.ps--clicking .ps__thumb-y,.large-size .ps__rail-y:focus>.ps__thumb-y,.large-size .ps__rail-y:hover>.ps__thumb-y,.large-size .ps__thumb-x,.large-size .ps__thumb-y,.large-size .ps__thumb-y--clicking,.large-size .ps__thumb-y:hover{background-color:#f4faff;border-radius:3px;width:16px;height:16px;border:1px solid #dbe0e3}.large-size .ps__rail-x.ps--clicking .ps__thumb-x,.large-size .ps__rail-x:focus>.ps__thumb-x,.large-size .ps__rail-x:hover>.ps__thumb-x,.large-size .ps__rail-y.ps--clicking .ps__thumb-y,.large-size .ps__rail-y:focus>.ps__thumb-y,.large-size .ps__rail-y:hover>.ps__thumb-y{background-color:#d9eeff;border:1px solid #b5bdc3;height:16px}
package/dist/modules.d.js CHANGED
@@ -1 +1 @@
1
- import '@testing-library/jest-dom/extend-expect';
1
+ import '@testing-library/jest-dom';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-scrollbar",
3
- "version": "0.11.23",
3
+ "version": "0.12.0",
4
4
  "description": "Scrollbar UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -35,14 +35,14 @@
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
37
  "@ofsajd/react-perfect-scrollbar": "1.0.0",
38
- "@synerise/ds-icon": "^0.69.1",
39
- "@synerise/ds-utils": "^0.31.2",
38
+ "@synerise/ds-icon": "^0.71.0",
39
+ "@synerise/ds-utils": "^0.32.0",
40
40
  "lodash": "^4.7.21"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@synerise/ds-core": "*",
44
- "react": ">=16.9.0 <= 17.0.2",
45
- "styled-components": "5.0.1"
44
+ "react": ">=16.9.0 <= 18.3.1",
45
+ "styled-components": "^5.3.3"
46
46
  },
47
- "gitHead": "f591d14d24d6a14aab76edcb60f04aaadec8336d"
47
+ "gitHead": "fbde34e126b492edaf148e469ab96247a891d6df"
48
48
  }