indicator-ui 0.0.359 → 0.0.360

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
@@ -49439,8 +49439,8 @@ __webpack_require__.r(__webpack_exports__);
49439
49439
  /* harmony export */ });
49440
49440
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
49441
49441
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
49442
- /* harmony import */ var _hooks_useSmartScroll__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/hooks/useSmartScroll */ "./src/hooks/useSmartScroll/index.ts");
49443
49442
  /* harmony import */ var gsap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! gsap */ "./node_modules/gsap/index.js");
49443
+ /* harmony import */ var _useSmartScroll__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./useSmartScroll */ "./src/hooks/useSmartScroll/index.ts");
49444
49444
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
49445
49445
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
49446
49446
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
@@ -49459,6 +49459,9 @@ function useScrollIndicators() {
49459
49459
  var ref = args[0],
49460
49460
  _args$ = args[1],
49461
49461
  options = _args$ === void 0 ? {} : _args$;
49462
+ var offBottomEdge = options.offBottomEdge,
49463
+ offTopEdge = options.offTopEdge,
49464
+ wrapperClassName = options.wrapperClassName;
49462
49465
  var wrapperRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
49463
49466
  var topEdgeRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
49464
49467
  var bottomEdgeRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
@@ -49490,9 +49493,10 @@ function useScrollIndicators() {
49490
49493
  return hideEdge(bottomEdgeRef.current);
49491
49494
  });
49492
49495
  };
49493
- var _useSmartScroll = (0,_hooks_useSmartScroll__WEBPACK_IMPORTED_MODULE_1__.useSmartScroll)(ref, {
49496
+ var _useSmartScroll = (0,_useSmartScroll__WEBPACK_IMPORTED_MODULE_1__.useSmartScroll)(ref, {
49494
49497
  onScroll: function onScroll(_ref) {
49495
49498
  var state = _ref.state;
49499
+ console.log(state);
49496
49500
  switch (state) {
49497
49501
  case 'in-middle':
49498
49502
  showTopEdge();
@@ -49531,7 +49535,7 @@ function useScrollIndicators() {
49531
49535
  var wrapper = ((_options$wrapperRef2 = options.wrapperRef) === null || _options$wrapperRef2 === void 0 ? void 0 : _options$wrapperRef2.current) || document.createElement('div');
49532
49536
  wrapper.style.position = 'relative';
49533
49537
  wrapper.style.overflow = 'hidden';
49534
- wrapper.className = options.wrapperClassName;
49538
+ wrapper.className = wrapperClassName;
49535
49539
  if (!hasWrapper()) {
49536
49540
  wrapper.style.width = (container === null || container === void 0 ? void 0 : container.style.width) || '100%';
49537
49541
  wrapper.style.height = (container === null || container === void 0 ? void 0 : container.style.height) || '100%';
@@ -49540,8 +49544,6 @@ function useScrollIndicators() {
49540
49544
  return wrapper;
49541
49545
  };
49542
49546
  var initEdgesState = function initEdgesState() {
49543
- var topEdge = topEdgeRef.current;
49544
- var bottomEdge = bottomEdgeRef.current;
49545
49547
  var scrollState = getScrollCurState();
49546
49548
  if (scrollState) {
49547
49549
  var state = scrollState.state;
@@ -49566,8 +49568,8 @@ function useScrollIndicators() {
49566
49568
  }
49567
49569
  };
49568
49570
  var initEdges = function initEdges() {
49569
- var topEdge = document.createElement('div');
49570
- var bottomEdge = document.createElement('div');
49571
+ var topEdge = offTopEdge ? null : document.createElement('div');
49572
+ var bottomEdge = offBottomEdge ? null : document.createElement('div');
49571
49573
  topEdgeRef.current = topEdge;
49572
49574
  bottomEdgeRef.current = bottomEdge;
49573
49575
  var commonEdgeStyle = {
@@ -49579,14 +49581,18 @@ function useScrollIndicators() {
49579
49581
  pointerEvents: 'none',
49580
49582
  zIndex: '1'
49581
49583
  };
49582
- Object.assign(topEdge.style, commonEdgeStyle, {
49583
- top: '0',
49584
- background: 'linear-gradient(to bottom, rgba(255,255,255,255.2), transparent)'
49585
- });
49586
- Object.assign(bottomEdge.style, commonEdgeStyle, {
49587
- bottom: '0',
49588
- background: 'linear-gradient(to top, rgba(255,255,255,255.2), transparent)'
49589
- });
49584
+ if (topEdge) {
49585
+ Object.assign(topEdge.style, commonEdgeStyle, {
49586
+ top: '0',
49587
+ background: 'linear-gradient(to bottom, rgba(255,255,255,255.2), transparent)'
49588
+ });
49589
+ }
49590
+ if (bottomEdge) {
49591
+ Object.assign(bottomEdge.style, commonEdgeStyle, {
49592
+ bottom: '0',
49593
+ background: 'linear-gradient(to top, rgba(255,255,255,255.2), transparent)'
49594
+ });
49595
+ }
49590
49596
  return {
49591
49597
  topEdge: topEdge,
49592
49598
  bottomEdge: bottomEdge
@@ -49597,8 +49603,12 @@ function useScrollIndicators() {
49597
49603
  var topEdge = topEdgeRef.current;
49598
49604
  var bottomEdge = bottomEdgeRef.current;
49599
49605
  if (wrapper) {
49600
- wrapper.appendChild(topEdge);
49601
- wrapper.appendChild(bottomEdge);
49606
+ if (topEdge) {
49607
+ wrapper.appendChild(topEdge);
49608
+ }
49609
+ if (bottomEdge) {
49610
+ wrapper.appendChild(bottomEdge);
49611
+ }
49602
49612
  }
49603
49613
  };
49604
49614
  var replaceWrapper = function replaceWrapper() {