@salesforcedevs/dx-components 1.18.9-rnb-scroll4 → 1.18.9-rnb-scroll5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.18.9-rnb-scroll4",
3
+ "version": "1.18.9-rnb-scroll5",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -43,6 +43,19 @@
43
43
  padding-right: 10px;
44
44
  }
45
45
 
46
+ .scroll-shadow {
47
+ position: sticky;
48
+ bottom: -80px; /* toc-items are 80px padding from bottom */
49
+ height: 5px;
50
+ background: linear-gradient(
51
+ to bottom,
52
+ rgba(229, 229, 229, 0),
53
+ rgba(229, 229, 229, 0.8)
54
+ );
55
+ transition: opacity 0.3s;
56
+ opacity: 0;
57
+ }
58
+
46
59
  .dx-text-display-8 {
47
60
  padding-top: var(--dx-g-spacing-sm);
48
61
  transition: var(--dx-g-transition-hue-1x);
@@ -17,6 +17,7 @@
17
17
  {option.label}
18
18
  </a>
19
19
  </template>
20
+ <div class="scroll-shadow"></div>
20
21
  </div>
21
22
  </div>
22
23
  </div>
@@ -1,7 +1,17 @@
1
1
  export function handleScroll(this: any, scrollEvent: any) {
2
- const list = scrollEvent.target;
2
+ const { scrollTop, scrollHeight, clientHeight } = scrollEvent.target;
3
+
4
+ // to show shadow box at bottom of list container
5
+ const shadow = this.template.querySelector(".scroll-shadow");
6
+
7
+ if(shadow) {
8
+ const isScrollable = scrollHeight > clientHeight;
9
+ const isAtBottom = scrollTop + clientHeight >= scrollHeight - 75; //to maintain the padding 80px given to toc-items
10
+
11
+ shadow.style.opacity = (isScrollable && !isAtBottom) ? 1 : 0;
12
+ }
3
13
 
4
14
  setTimeout(() => {
5
- this.showBoxShadow = (list.scrollTop > 0 && list.scrollHeight > list.clientHeight);
15
+ this.showBoxShadow = (scrollTop > 0 && scrollHeight > clientHeight);
6
16
  }, 200);
7
17
  }