@salesforcedevs/dx-components 1.19.4-test → 1.20.0-rnb-scroll

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.
@@ -25,8 +25,11 @@
25
25
  margin-bottom: var(--dx-g-spacing-md);
26
26
  }
27
27
 
28
+ .toc-content-header {
29
+ width: 100%;
30
+ }
31
+
28
32
  .toc-content-header[show-shadow="true"] {
29
- width: 132px;
30
33
  box-shadow: 0 4px 4px -2px var(--dx-g-gray-90);
31
34
  }
32
35
 
@@ -35,9 +38,18 @@
35
38
  }
36
39
 
37
40
  .toc-items {
38
- max-height: 760px;
39
41
  overflow-y: auto;
40
42
  padding-bottom: 80px;
43
+ padding-right: 10px;
44
+ }
45
+
46
+ .scroll-shadow {
47
+ position: sticky;
48
+ bottom: -80px; /* to maintain padding given to toc-items */
49
+ height: 5px;
50
+ background: linear-gradient(to bottom, transparent, var(--dx-g-gray-90));
51
+ transition: opacity 0.3s;
52
+ opacity: 0;
41
53
  }
42
54
 
43
55
  .dx-text-display-8 {
@@ -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>
@@ -3,12 +3,11 @@ import cx from "classnames";
3
3
  import { ContentElement } from "typings/custom";
4
4
  import { toJson } from "dxUtils/normalizers";
5
5
  import { track as sendGtm } from "dxUtils/analytics";
6
- import { SidebarBase } from "dxBaseElements/sidebarBase";
6
+ import { handleScroll } from "dxUtils/handleScroll";
7
7
 
8
8
  export default class Toc extends LightningElement {
9
9
  showBoxShadow: boolean = false;
10
- private scrolling: boolean = false;
11
- handleScroll: (e: any) => void = () => {};
10
+ handleScroll = handleScroll.bind(this);
12
11
 
13
12
  @api header!: string;
14
13
 
@@ -43,10 +42,6 @@ export default class Toc extends LightningElement {
43
42
 
44
43
  @track _options!: Array<ContentElement>;
45
44
 
46
- connectedCallback() {
47
- this.handleScroll = SidebarBase.prototype.handleScroll.bind(this);
48
- }
49
-
50
45
  private onClick(e: Event) {
51
46
  const target = e.currentTarget as HTMLElement;
52
47
  const id = target.getAttribute("contentid");
@@ -0,0 +1,269 @@
1
+ /* Code generated by scripts/postinstall.js DO NOT EDIT*/
2
+
3
+
4
+ /* -------------------------------------------------------------------
5
+ Microtip
6
+
7
+ Modern, lightweight css-only tooltips
8
+ Just 1kb minified and gzipped
9
+
10
+ @author Ghosh
11
+ @package Microtip
12
+
13
+ ----------------------------------------------------------------------
14
+ 1. Base Styles
15
+ 2. Direction Modifiers
16
+ 3. Position Modifiers
17
+ --------------------------------------------------------------------*/
18
+
19
+
20
+ /* ------------------------------------------------
21
+ [1] Base Styles
22
+ -------------------------------------------------*/
23
+
24
+ [aria-label][role~="tooltip"] {
25
+ position: relative;
26
+ }
27
+
28
+ [aria-label][role~="tooltip"]::before,
29
+ [aria-label][role~="tooltip"]::after {
30
+ transform: translate3d(0, 0, 0);
31
+ -webkit-backface-visibility: hidden;
32
+ backface-visibility: hidden;
33
+ will-change: transform;
34
+ opacity: 0;
35
+ pointer-events: none;
36
+ transition: all var(--microtip-transition-duration, .18s) var(--microtip-transition-easing, ease-in-out) var(--microtip-transition-delay, 0s);
37
+ position: absolute;
38
+ box-sizing: border-box;
39
+ z-index: 10;
40
+ transform-origin: top;
41
+ }
42
+
43
+ [aria-label][role~="tooltip"]::before {
44
+ background-size: 100% auto !important;
45
+ content: "";
46
+ }
47
+
48
+ [aria-label][role~="tooltip"]::after {
49
+ background: rgba(17, 17, 17, .9);
50
+ border-radius: 4px;
51
+ color: #ffffff;
52
+ content: attr(aria-label);
53
+ font-size: var(--microtip-font-size, 13px);
54
+ font-weight: var(--microtip-font-weight, normal);
55
+ text-transform: var(--microtip-text-transform, none);
56
+ padding: .5em 1em;
57
+ white-space: nowrap;
58
+ box-sizing: content-box;
59
+ }
60
+
61
+ [aria-label][role~="tooltip"]:hover::before,
62
+ [aria-label][role~="tooltip"]:hover::after,
63
+ [aria-label][role~="tooltip"]:focus::before,
64
+ [aria-label][role~="tooltip"]:focus::after {
65
+ opacity: 1;
66
+ pointer-events: auto;
67
+ }
68
+
69
+
70
+
71
+ /* ------------------------------------------------
72
+ [2] Position Modifiers
73
+ -------------------------------------------------*/
74
+
75
+ [role~="tooltip"][data-microtip-position|="top"]::before {
76
+ background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%280%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
77
+ height: 6px;
78
+ width: 18px;
79
+ margin-bottom: 5px;
80
+ }
81
+
82
+ [role~="tooltip"][data-microtip-position|="top"]::after {
83
+ margin-bottom: 11px;
84
+ }
85
+
86
+ [role~="tooltip"][data-microtip-position|="top"]::before {
87
+ transform: translate3d(-50%, 0, 0);
88
+ bottom: 100%;
89
+ left: 50%;
90
+ }
91
+
92
+ [role~="tooltip"][data-microtip-position|="top"]:hover::before {
93
+ transform: translate3d(-50%, -5px, 0);
94
+ }
95
+
96
+ [role~="tooltip"][data-microtip-position|="top"]::after {
97
+ transform: translate3d(-50%, 0, 0);
98
+ bottom: 100%;
99
+ left: 50%;
100
+ }
101
+
102
+ [role~="tooltip"][data-microtip-position="top"]:hover::after {
103
+ transform: translate3d(-50%, -5px, 0);
104
+ }
105
+
106
+ /* ------------------------------------------------
107
+ [2.1] Top Left
108
+ -------------------------------------------------*/
109
+ [role~="tooltip"][data-microtip-position="top-left"]::after {
110
+ transform: translate3d(calc(-100% + 16px), 0, 0);
111
+ bottom: 100%;
112
+ }
113
+
114
+ [role~="tooltip"][data-microtip-position="top-left"]:hover::after {
115
+ transform: translate3d(calc(-100% + 16px), -5px, 0);
116
+ }
117
+
118
+
119
+ /* ------------------------------------------------
120
+ [2.2] Top Right
121
+ -------------------------------------------------*/
122
+ [role~="tooltip"][data-microtip-position="top-right"]::after {
123
+ transform: translate3d(calc(0% + -16px), 0, 0);
124
+ bottom: 100%;
125
+ }
126
+
127
+ [role~="tooltip"][data-microtip-position="top-right"]:hover::after {
128
+ transform: translate3d(calc(0% + -16px), -5px, 0);
129
+ }
130
+
131
+
132
+ /* ------------------------------------------------
133
+ [2.3] Bottom
134
+ -------------------------------------------------*/
135
+ [role~="tooltip"][data-microtip-position|="bottom"]::before {
136
+ background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28180%2018%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
137
+ height: 6px;
138
+ width: 18px;
139
+ margin-top: 5px;
140
+ margin-bottom: 0;
141
+ }
142
+
143
+ [role~="tooltip"][data-microtip-position|="bottom"]::after {
144
+ margin-top: 11px;
145
+ }
146
+
147
+ [role~="tooltip"][data-microtip-position|="bottom"]::before {
148
+ transform: translate3d(-50%, -10px, 0);
149
+ bottom: auto;
150
+ left: 50%;
151
+ top: 100%;
152
+ }
153
+
154
+ [role~="tooltip"][data-microtip-position|="bottom"]:hover::before {
155
+ transform: translate3d(-50%, 0, 0);
156
+ }
157
+
158
+ [role~="tooltip"][data-microtip-position|="bottom"]::after {
159
+ transform: translate3d(-50%, -10px, 0);
160
+ top: 100%;
161
+ left: 50%;
162
+ }
163
+
164
+ [role~="tooltip"][data-microtip-position="bottom"]:hover::after {
165
+ transform: translate3d(-50%, 0, 0);
166
+ }
167
+
168
+
169
+ /* ------------------------------------------------
170
+ [2.4] Bottom Left
171
+ -------------------------------------------------*/
172
+ [role~="tooltip"][data-microtip-position="bottom-left"]::after {
173
+ transform: translate3d(calc(-100% + 16px), -10px, 0);
174
+ top: 100%;
175
+ }
176
+
177
+ [role~="tooltip"][data-microtip-position="bottom-left"]:hover::after {
178
+ transform: translate3d(calc(-100% + 16px), 0, 0);
179
+ }
180
+
181
+
182
+ /* ------------------------------------------------
183
+ [2.5] Bottom Right
184
+ -------------------------------------------------*/
185
+ [role~="tooltip"][data-microtip-position="bottom-right"]::after {
186
+ transform: translate3d(calc(0% + -16px), -10px, 0);
187
+ top: 100%;
188
+ }
189
+
190
+ [role~="tooltip"][data-microtip-position="bottom-right"]:hover::after {
191
+ transform: translate3d(calc(0% + -16px), 0, 0);
192
+ }
193
+
194
+
195
+ /* ------------------------------------------------
196
+ [2.6] Left
197
+ -------------------------------------------------*/
198
+ [role~="tooltip"][data-microtip-position="left"]::before,
199
+ [role~="tooltip"][data-microtip-position="left"]::after {
200
+ bottom: auto;
201
+ left: auto;
202
+ right: 100%;
203
+ top: 50%;
204
+ transform: translate3d(10px, -50%, 0);
205
+ }
206
+
207
+ [role~="tooltip"][data-microtip-position="left"]::before {
208
+ background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28-90%2018%2018%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
209
+ height: 18px;
210
+ width: 6px;
211
+ margin-right: 5px;
212
+ margin-bottom: 0;
213
+ }
214
+
215
+ [role~="tooltip"][data-microtip-position="left"]::after {
216
+ margin-right: 11px;
217
+ }
218
+
219
+ [role~="tooltip"][data-microtip-position="left"]:hover::before,
220
+ [role~="tooltip"][data-microtip-position="left"]:hover::after {
221
+ transform: translate3d(0, -50%, 0);
222
+ }
223
+
224
+
225
+ /* ------------------------------------------------
226
+ [2.7] Right
227
+ -------------------------------------------------*/
228
+ [role~="tooltip"][data-microtip-position="right"]::before,
229
+ [role~="tooltip"][data-microtip-position="right"]::after {
230
+ bottom: auto;
231
+ left: 100%;
232
+ top: 50%;
233
+ transform: translate3d(-10px, -50%, 0);
234
+ }
235
+
236
+ [role~="tooltip"][data-microtip-position="right"]::before {
237
+ background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%2890%206%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
238
+ height: 18px;
239
+ width: 6px;
240
+ margin-bottom: 0;
241
+ margin-left: 5px;
242
+ }
243
+
244
+ [role~="tooltip"][data-microtip-position="right"]::after {
245
+ margin-left: 11px;
246
+ }
247
+
248
+ [role~="tooltip"][data-microtip-position="right"]:hover::before,
249
+ [role~="tooltip"][data-microtip-position="right"]:hover::after {
250
+ transform: translate3d(0, -50%, 0);
251
+ }
252
+
253
+ /* ------------------------------------------------
254
+ [3] Size
255
+ -------------------------------------------------*/
256
+ [role~="tooltip"][data-microtip-size="small"]::after {
257
+ white-space: initial;
258
+ width: 80px;
259
+ }
260
+
261
+ [role~="tooltip"][data-microtip-size="medium"]::after {
262
+ white-space: initial;
263
+ width: 150px;
264
+ }
265
+
266
+ [role~="tooltip"][data-microtip-size="large"]::after {
267
+ white-space: initial;
268
+ width: 260px;
269
+ }
@@ -2,12 +2,14 @@ import { LightningElement, api } from "lwc";
2
2
  import type { OptionWithLink } from "typings/custom";
3
3
  import { toJson } from "dxUtils/normalizers";
4
4
  import { Brand, DevCenterConfig } from "typings/custom";
5
+ import { handleScroll } from "dxUtils/handleScroll";
5
6
 
6
7
  export const HEIGHT_OF_SIDEBAR_ITEM = 32;
7
8
  export const WAIT_TIME_BEFORE_SCROLL_IN_MS = 500;
8
9
 
9
10
  export class SidebarBase extends LightningElement {
10
11
  _sidebarContent: HTMLElement | null = null;
12
+ handleScroll = handleScroll.bind(this);
11
13
 
12
14
  selectedElement: HTMLElement | null = null;
13
15
  timerId: ReturnType<typeof setTimeout> | null = null;
@@ -16,7 +18,6 @@ export class SidebarBase extends LightningElement {
16
18
  expanded: boolean = true;
17
19
  _value?: string = undefined;
18
20
  showBoxShadow: boolean = false;
19
- private scrolling: boolean = false;
20
21
  _devCenter!: DevCenterConfig;
21
22
 
22
23
  @api langValuePath: string = "id";
@@ -61,29 +62,6 @@ export class SidebarBase extends LightningElement {
61
62
  return this._sidebarContent;
62
63
  }
63
64
 
64
- /**
65
- * This method is to handle the scroll event for LNB and show box shadow
66
- * @param scrollEvent
67
- */
68
- handleScroll(scrollEvent: any) {
69
- const lnb = scrollEvent.target;
70
-
71
- if (!this.scrolling) {
72
- this.scrolling = true;
73
- // Set a timeout to handle scroll event after a delay
74
- setTimeout(() => {
75
- // Check if lnb is scrolled
76
- if (lnb.scrollTop > 0 && lnb.scrollHeight > lnb.clientHeight) {
77
- this.showBoxShadow = true;
78
- } else {
79
- this.showBoxShadow = false;
80
- }
81
- // Reset scrolling back to false after handling the scroll
82
- this.scrolling = false;
83
- }, 200);
84
- }
85
- }
86
-
87
65
  renderedCallback(): void {
88
66
  /**
89
67
  * Implementing debouncing kind of logic here to scroll to selected element once tree rendering is done
@@ -0,0 +1,17 @@
1
+ export function handleScroll(this: any, scrollEvent: any) {
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; //subtracting to maintain the padding given to toc-items
10
+
11
+ shadow.style.opacity = isScrollable && !isAtBottom ? 1 : 0;
12
+ }
13
+
14
+ setTimeout(() => {
15
+ this.showBoxShadow = scrollTop > 0 && scrollHeight > clientHeight;
16
+ }, 200);
17
+ }
@@ -88,7 +88,7 @@ const OPTIONAL_LANGUAGES: Record<string, any> = {
88
88
  // @ts-ignore
89
89
  dataweave: getCustomLanguageGrammars().dataweave,
90
90
  // @ts-ignore
91
- afscript: getCustomLanguageGrammars().afscript
91
+ agentscript: getCustomLanguageGrammars().agentscript
92
92
  };
93
93
 
94
94
  // Initialize Shiki highlighter with fine-grained modules for better performance