@salesforcedevs/docs-components 1.20.5 → 1.20.6-sticky-banner2

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/docs-components",
3
- "version": "1.20.5",
3
+ "version": "1.20.6-sticky-banner2",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -25,7 +25,7 @@
25
25
  "@types/lodash.orderby": "4.6.9",
26
26
  "@types/lodash.uniqby": "4.7.9"
27
27
  },
28
- "gitHead": "0e3af2211cf15d8c1679afc69cf502643806222d",
28
+ "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad",
29
29
  "volta": {
30
30
  "node": "20.19.0",
31
31
  "yarn": "1.22.19"
@@ -1,10 +1,3 @@
1
- doc-phase {
2
- --doc-c-phase-top: calc(
3
- var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) +
4
- var(--dx-g-spacing-xl)
5
- );
6
- }
7
-
8
1
  /* We need to apply some borders when there are two doc phases */
9
2
  doc-phase:not(:only-of-type)::part(container) {
10
3
  border-top: 1px solid var(--dx-g-yellow-vibrant-90);
@@ -15,11 +8,6 @@ doc-phase:nth-child(2)::part(container) {
15
8
  border-bottom: 1px solid var(--dx-g-yellow-vibrant-90);
16
9
  }
17
10
 
18
- /* We don't want second component to sticky as we need to handle different cases like position */
19
- doc-phase:nth-child(2) {
20
- position: static;
21
- }
22
-
23
11
  .api-documentation {
24
12
  margin-top: 48px;
25
13
  }
@@ -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-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,20 @@ 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(
221
+ ".doc-phase-wrapper"
222
+ ) as HTMLElement;
223
+ const versionWrapper = this.template.querySelector(
224
+ ".version-wrapper"
225
+ ) as HTMLElement;
226
+
227
+ const docPhaseEl = (
228
+ docPhaseWrapper.querySelector("[name=doc-phase]")! as any
222
229
  ).assignedElements()[0] as HTMLSlotElement;
223
230
 
224
- if (!docPhaseEl) {
225
- docPhaseEl = (
226
- this.template.querySelector("[name=version-banner]")! as any
227
- ).assignedElements()[0] as HTMLSlotElement;
228
- }
231
+ const verBannerEl = (
232
+ versionWrapper.querySelector("[name=version-banner]")! as any
233
+ ).assignedElements()[0] as HTMLSlotElement;
229
234
 
230
235
  if (!sidebarEl || !globalNavEl || !contextNavEl || !docHeaderEl) {
231
236
  console.warn("One or more required elements are missing.");
@@ -257,23 +262,21 @@ export default class ContentLayout extends LightningElement {
257
262
  `${globalNavHeight}px`
258
263
  );
259
264
 
265
+ const docPhaseElHeight =
266
+ docPhaseEl || verBannerEl
267
+ ? (docPhaseEl || verBannerEl).getBoundingClientRect().height
268
+ : 0;
269
+
260
270
  // Adjusting the doc section heading on scroll.
261
271
  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`;
272
+ (docHeadingEl as any).style.scrollMarginTop = `${
273
+ totalHeaderHeight + docPhaseElHeight + 40
274
+ }px`;
269
275
  });
270
276
 
271
277
  // Adjusting the right nav bar on scroll.
272
278
  // setting maxheight to make the RNB scrollable based on different parent elements
273
279
  if (rightNavBarEl) {
274
- const docPhaseElHeight = docPhaseEl
275
- ? docPhaseEl.getBoundingClientRect().height
276
- : 0;
277
280
  const viewportHeight = window.innerHeight;
278
281
  const maxHeight =
279
282
  viewportHeight -
@@ -293,18 +296,20 @@ export default class ContentLayout extends LightningElement {
293
296
  }
294
297
  }
295
298
 
299
+ const docPhaseTop =
300
+ window.innerWidth < 769
301
+ ? globalNavHeight +
302
+ docHeaderHeight +
303
+ sidebarEl.getBoundingClientRect().height
304
+ : globalNavHeight + docHeaderHeight;
305
+
296
306
  // If doc phase element exists, we need to account for its sticky position. Mobile should include the sidebar height (since it becomes sticky aswell).
307
+ // To handle sticky position for safari browser, position sticky given to wrapper class
297
308
  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
- );
309
+ docPhaseWrapper.style.top = `${docPhaseTop}px`;
310
+ } else if (verBannerEl) {
311
+ versionWrapper.style.position = "sticky";
312
+ versionWrapper.style.top = `${docPhaseTop}px`;
308
313
  }
309
314
  });
310
315
  };
@@ -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-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
@@ -3,14 +3,7 @@
3
3
  @import "docHelpers/status";
4
4
 
5
5
  :host {
6
- --doc-c-phase-top: 0;
7
6
  --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
7
  }
15
8
 
16
9
  .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}
@@ -31,10 +31,6 @@ dx-dropdown > dx-button:hover {
31
31
  --border-color: var(--button-primary-color-hover);
32
32
  }
33
33
 
34
- doc-phase {
35
- --doc-c-phase-top: var(--dx-g-global-header-height);
36
- }
37
-
38
34
  @media screen and (max-width: 768px) {
39
35
  doc-content-layout {
40
36
  --dx-g-doc-header-main-nav-height: 41px;
@@ -45,10 +41,4 @@ doc-phase {
45
41
  var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
46
42
  );
47
43
  }
48
-
49
- doc-phase {
50
- --doc-c-phase-top: calc(
51
- var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
52
- );
53
- }
54
44
  }
@@ -59,6 +59,21 @@ dx-toc {
59
59
  border-left: 1px solid var(--dx-g-gray-90);
60
60
  }
61
61
 
62
+ .doc-phase-wrapper,
63
+ .version-wrapper {
64
+ /* NOTE: If you are changing z-index value here, ensure it's less than z-index of dx-sidebar in contentLayout.css */
65
+ z-index: var(--dx-g-z-index-100);
66
+ }
67
+
68
+ .doc-phase-wrapper {
69
+ position: sticky;
70
+ }
71
+
72
+ /* We don't want second component to sticky */
73
+ .version-wrapper {
74
+ position: static;
75
+ }
76
+
62
77
  .content-body-container {
63
78
  display: flex;
64
79
  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.