@salesforcedevs/dx-components 1.32.0-alpha.2 → 1.32.0-alpha.5

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.32.0-alpha.2",
3
+ "version": "1.32.0-alpha.5",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -44,5 +44,5 @@
44
44
  "luxon": "3.4.4",
45
45
  "msw": "^2.12.4"
46
46
  },
47
- "gitHead": "f42dc4194e762fe78415b45c729e966c0a680f8d"
47
+ "gitHead": "e470c1e1ce20a2e45377e1527c65dbb231119f13"
48
48
  }
@@ -51,7 +51,6 @@ export default class Sidebar extends SidebarBase {
51
51
  private searchValue: string | null = null;
52
52
  private searchResults: SidebarSearchResult[] = [];
53
53
  private scrollToSelectedSearchResult: boolean = false;
54
- private selectedSearchResultIndex: number = -1;
55
54
  private requestedFetchMoreResults: boolean = false;
56
55
 
57
56
  private get areResultsEmpty(): boolean {
@@ -167,11 +166,6 @@ export default class Sidebar extends SidebarBase {
167
166
  }
168
167
 
169
168
  private onSearchLoading(e: CustomEvent) {
170
- if (!e.detail.loading && this.scrollToSelectedSearchResult) {
171
- this.selectedSearchResultIndex = this.searchResults.findIndex(
172
- (r) => r.selected
173
- );
174
- }
175
169
  this.isSearchLoading = e.detail;
176
170
  }
177
171
 
@@ -196,23 +190,37 @@ export default class Sidebar extends SidebarBase {
196
190
  }
197
191
 
198
192
  private initializeSearchScrollPosition() {
199
- if (
200
- this.scrollToSelectedSearchResult &&
201
- this.selectedSearchResultIndex >= 0
202
- ) {
203
- const selectedResult = this.template.querySelector(
204
- `dx-sidebar-search-result:nth-child(${
205
- this.selectedSearchResultIndex + 1
206
- })`
207
- );
208
- if (!selectedResult || !selectedResult.parentNode) {
209
- return;
210
- }
211
- (selectedResult.parentNode as HTMLElement).scrollTop =
212
- selectedResult.offsetTop -
213
- (selectedResult.parentNode as HTMLElement).offsetTop;
214
- this.scrollToSelectedSearchResult = false;
193
+ if (!this.scrollToSelectedSearchResult || this.isSearchLoading) {
194
+ return;
195
+ }
196
+
197
+ const selectedSearchResultIndex = this.searchResults.findIndex(
198
+ (r) => r.selected
199
+ );
200
+ if (selectedSearchResultIndex < 0) {
201
+ return;
215
202
  }
203
+
204
+ const searchContent = this.template.querySelector(
205
+ ".sidebar-content-search"
206
+ ) as HTMLElement | null;
207
+ const allResultItems = searchContent?.querySelectorAll(
208
+ "dx-sidebar-search-result"
209
+ );
210
+ const selectedResult =
211
+ (allResultItems?.[selectedSearchResultIndex] as HTMLElement) ||
212
+ null;
213
+ if (!searchContent || !selectedResult) {
214
+ return;
215
+ }
216
+
217
+ window.requestAnimationFrame(() => {
218
+ selectedResult.scrollIntoView({
219
+ block: "start",
220
+ inline: "nearest"
221
+ });
222
+ this.scrollToSelectedSearchResult = false;
223
+ });
216
224
  }
217
225
 
218
226
  private assignValueToLabel(node: TreeNode): void {
@@ -10,8 +10,7 @@ a {
10
10
 
11
11
  /* Match "Results" heading alignment. Less item padding so total height unchanged when box has more inner padding. */
12
12
  .sidebar-item {
13
- padding: var(--dx-g-spacing-xs) var(--dx-g-spacing-lg)
14
- var(--dx-g-spacing-xs) var(--dx-c-sidebar-left-padding);
13
+ padding: 0 var(--dx-g-spacing-lg) 0 var(--dx-c-sidebar-left-padding);
15
14
  background: transparent;
16
15
  transition: background-color var(--dx-g-transition-hue-1x, 0.1s ease);
17
16
  overflow: visible;
@@ -74,6 +73,7 @@ a {
74
73
 
75
74
  .title {
76
75
  color: var(--dx-g-text-heading-color);
76
+ line-height: var(--dx-g-spacing-mlg);
77
77
  }
78
78
 
79
79
  /* Match full-doc search highlight: light yellow from dx-css-variables */
@@ -73,7 +73,7 @@ export default class SidebarSearchResult extends LightningElement {
73
73
 
74
74
  private onClick(e: PointerEvent) {
75
75
  e.preventDefault();
76
- track(e.currentTarget!, "custEv_linkClick", {
76
+ track(e.currentTarget!, "custEv_scopedSearchItemSelected", {
77
77
  click_text: this.header,
78
78
  click_url: this.href,
79
79
  element_title: this.header,