@salesforcedevs/docs-components 1.20.3 → 1.20.6-sticky-banner

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,11 +1,12 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.20.3",
3
+ "version": "1.20.6-sticky-banner",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "engines": {
8
- "node": "20.x"
8
+ "node": "20.x",
9
+ "yarn": "1.22.19"
9
10
  },
10
11
  "publishConfig": {
11
12
  "access": "public"
@@ -25,5 +26,9 @@
25
26
  "@types/lodash.orderby": "4.6.9",
26
27
  "@types/lodash.uniqby": "4.7.9"
27
28
  },
28
- "gitHead": "53341fe3e51cffb3368cbf3fbea5ef382250ce9e"
29
+ "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad",
30
+ "volta": {
31
+ "node": "20.19.0",
32
+ "yarn": "1.22.19"
33
+ }
29
34
  }
@@ -11,7 +11,6 @@
11
11
  <template if:true={renderDropdown}>
12
12
  <dx-dropdown
13
13
  analytics-event="custEv_breadcrumbClick"
14
- analytics-payload={ANALYTICS_PAYLOAD}
15
14
  if:true={renderDropdown}
16
15
  options={dropdownOptions}
17
16
  open-on-hover
@@ -17,8 +17,12 @@
17
17
  <slot name="sidebar-header" slot="version-picker"></slot>
18
18
  </dx-sidebar-old>
19
19
  <div class="content-body-doc-phase-container">
20
- <slot name="doc-phase"></slot>
21
- <slot name="version-banner"></slot>
20
+ <div class="doc-phase-wrapper">
21
+ <slot name="doc-phase"></slot>
22
+ </div>
23
+ <div class="version-banner-wrapper">
24
+ <slot name="version-banner"></slot>
25
+ </div>
22
26
  <div class="content-body-container">
23
27
  <div class="content-body">
24
28
  <doc-breadcrumbs
@@ -217,15 +217,16 @@ export default class ContentLayout extends LightningElement {
217
217
  ".sticky-doc-header"
218
218
  ) as HTMLElement;
219
219
 
220
- let docPhaseEl = (
221
- this.template.querySelector("[name=doc-phase]")! as any
220
+ const docPhaseWrapper = this.template.querySelector(".doc-phase-wrapper") as HTMLElement;
221
+ const versionBannerWrapper = this.template.querySelector(".version-banner-wrapper") as HTMLElement;
222
+
223
+ const docPhaseEl = (
224
+ docPhaseWrapper.querySelector("[name=doc-phase]")! as any
222
225
  ).assignedElements()[0] as HTMLSlotElement;
223
226
 
224
- if (!docPhaseEl) {
225
- docPhaseEl = (
226
- this.template.querySelector("[name=version-banner]")! as any
227
- ).assignedElements()[0] as HTMLSlotElement;
228
- }
227
+ const verBannerEl = (
228
+ versionBannerWrapper.querySelector("[name=version-banner]")! as any
229
+ ).assignedElements()[0] as HTMLSlotElement;
229
230
 
230
231
  if (!sidebarEl || !globalNavEl || !contextNavEl || !docHeaderEl) {
231
232
  console.warn("One or more required elements are missing.");
@@ -257,23 +258,18 @@ export default class ContentLayout extends LightningElement {
257
258
  `${globalNavHeight}px`
258
259
  );
259
260
 
261
+ const docPhaseElHeight = (docPhaseEl || verBannerEl)
262
+ ? (docPhaseEl || verBannerEl).getBoundingClientRect().height
263
+ : 0;
264
+
260
265
  // Adjusting the doc section heading on scroll.
261
266
  docHeadingEls.forEach((docHeadingEl) => {
262
- (docHeadingEl as any).style.scrollMarginTop = docPhaseEl
263
- ? `${
264
- totalHeaderHeight +
265
- docPhaseEl.getBoundingClientRect().height +
266
- 40
267
- }px`
268
- : `${totalHeaderHeight + 40}px`;
267
+ (docHeadingEl as any).style.scrollMarginTop = `${totalHeaderHeight + docPhaseElHeight + 40}px`;
269
268
  });
270
269
 
271
270
  // Adjusting the right nav bar on scroll.
272
271
  // setting maxheight to make the RNB scrollable based on different parent elements
273
272
  if (rightNavBarEl) {
274
- const docPhaseElHeight = docPhaseEl
275
- ? docPhaseEl.getBoundingClientRect().height
276
- : 0;
277
273
  const viewportHeight = window.innerHeight;
278
274
  const maxHeight =
279
275
  viewportHeight -
@@ -293,18 +289,15 @@ export default class ContentLayout extends LightningElement {
293
289
  }
294
290
  }
295
291
 
292
+ const docPhaseTop = window.innerWidth < 769 ? globalNavHeight + docHeaderHeight + sidebarEl.getBoundingClientRect().height : globalNavHeight + docHeaderHeight
293
+
296
294
  // If doc phase element exists, we need to account for its sticky position. Mobile should include the sidebar height (since it becomes sticky aswell).
295
+ // To handle sticky position for safari browser, position sticky given to wrapper class
297
296
  if (docPhaseEl) {
298
- docPhaseEl.style.setProperty(
299
- "--doc-c-phase-top",
300
- `${
301
- window.innerWidth < 769
302
- ? globalNavHeight +
303
- docHeaderHeight +
304
- sidebarEl.getBoundingClientRect().height
305
- : globalNavHeight + docHeaderHeight
306
- }px`
307
- );
297
+ docPhaseWrapper.style.top = `${docPhaseTop}px`;
298
+ } else if(verBannerEl) {
299
+ versionBannerWrapper.style.position = 'sticky';
300
+ versionBannerWrapper.style.top = `${docPhaseTop}px`;
308
301
  }
309
302
  });
310
303
  };
@@ -16,8 +16,12 @@
16
16
  <slot name="sidebar-header" slot="version-picker"></slot>
17
17
  </dx-sidebar-old>
18
18
  <div class="content-body-doc-phase-container">
19
- <slot name="doc-phase"></slot>
20
- <slot name="version-banner"></slot>
19
+ <div class="doc-phase-wrapper">
20
+ <slot name="doc-phase"></slot>
21
+ </div>
22
+ <div class="version-banner-wrapper">
23
+ <slot name="version-banner"></slot>
24
+ </div>
21
25
  <div class="content-body-container">
22
26
  <div class={contentBodyClasses}>
23
27
  <doc-breadcrumbs
@@ -5,12 +5,6 @@
5
5
  :host {
6
6
  --doc-c-phase-top: 0;
7
7
  --doc-c-phase-container-align-items: flex-start;
8
-
9
- position: sticky;
10
- top: var(--doc-c-phase-top);
11
-
12
- /* NOTE: If you are changing z-index value here, ensure it's less than z-index of dx-sidebar in contentLayout.css */
13
- z-index: var(--dx-g-z-index-100);
14
8
  }
15
9
 
16
10
  .doc-phase-container {
@@ -2,6 +2,8 @@
2
2
  <div lwc:if={showVersionPicker} class="version-picker-container">
3
3
  <dx-dropdown
4
4
  options={versions}
5
+ analytics-event="custEv_docVersionSelect"
6
+ analytics-payload={analyticsPayload}
5
7
  value={selectedVersion.id}
6
8
  width="var(--doc-version-picker-width)"
7
9
  onchange={onVersionChange}
@@ -59,6 +59,19 @@ dx-toc {
59
59
  border-left: 1px solid var(--dx-g-gray-90);
60
60
  }
61
61
 
62
+ .doc-phase-wrapper,
63
+ .version-banner-wrapper {
64
+ z-index: var(--dx-g-z-index-100);
65
+ }
66
+
67
+ .doc-phase-wrapper {
68
+ position: sticky;
69
+ }
70
+
71
+ .version-banner-wrapper {
72
+ position: static;
73
+ }
74
+
62
75
  .content-body-container {
63
76
  display: flex;
64
77
  flex-direction: row;
package/LICENSE DELETED
@@ -1,12 +0,0 @@
1
- Copyright (c) 2020, Salesforce.com, Inc.
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
-
6
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
-
8
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
-
10
- * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
-
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.