@salesforcedevs/docs-components 1.3.115-alpha-001 → 1.3.120-alpha.0

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.3.115-alpha-001",
3
+ "version": "1.3.120-alpha.0",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -72,7 +72,7 @@ dx-toc {
72
72
  }
73
73
 
74
74
  .right-nav-bar {
75
- margin-left: var(--dx-c-content-vertical-spacing);
75
+ margin-left: var(--dx-g-spacing-2xl);
76
76
  }
77
77
 
78
78
  @media screen and (max-width: 1024px) {
@@ -100,6 +100,10 @@ dx-toc {
100
100
  padding-right: 0;
101
101
  }
102
102
 
103
+ .sidebar-open {
104
+ height: 0;
105
+ }
106
+
103
107
  .left-nav-bar {
104
108
  height: unset;
105
109
  z-index: 10;
@@ -6,6 +6,7 @@
6
6
  trees={sidebarContent}
7
7
  value={sidebarValue}
8
8
  header={sidebarHeader}
9
+ ontogglesidebar={onToggleSidebar}
9
10
  >
10
11
  <slot name="sidebar-header" slot="header"></slot>
11
12
  </dx-sidebar-old>
@@ -20,13 +21,14 @@
20
21
  coveo-public-access-token={coveoPublicAccessToken}
21
22
  coveo-search-hub={coveoSearchHub}
22
23
  coveo-advanced-query-config={coveoAdvancedQueryConfig}
24
+ ontogglesidebar={onToggleSidebar}
23
25
  >
24
26
  <slot name="sidebar-header" slot="header"></slot>
25
27
  </dx-sidebar>
26
28
  </template>
27
29
  <div class="content-body-doc-phase-container">
28
30
  <slot name="doc-phase"></slot>
29
- <div class="content-body-container">
31
+ <div class={contentBodyClass}>
30
32
  <div class="content-body">
31
33
  <doc-breadcrumbs
32
34
  if:true={showBreadcrumbs}
@@ -1,4 +1,5 @@
1
1
  import { LightningElement, api, track } from "lwc";
2
+ import cx from "classnames";
2
3
  import { closest } from "kagekiri";
3
4
  import { toJson } from "dxUtils/normalizers";
4
5
  import { highlightTerms } from "dxUtils/highlight";
@@ -83,6 +84,7 @@ export default class ContentLayout extends LightningElement {
83
84
  private observer?: IntersectionObserver;
84
85
  private hasRendered: boolean = false;
85
86
  private contentLoaded: boolean = false;
87
+ private sidebarOpen: boolean = false;
86
88
 
87
89
  get shouldDisplayFeedback() {
88
90
  return this.contentLoaded && typeof Sprig !== "undefined";
@@ -125,6 +127,13 @@ export default class ContentLayout extends LightningElement {
125
127
  );
126
128
  }
127
129
 
130
+ get contentBodyClass(): string {
131
+ return cx(
132
+ "content-body-container",
133
+ this.sidebarOpen ? "sidebar-open" : ""
134
+ );
135
+ }
136
+
128
137
  connectedCallback(): void {
129
138
  const hasParentHighlightListener = closest(
130
139
  "doc-xml-content",
@@ -153,6 +162,7 @@ export default class ContentLayout extends LightningElement {
153
162
  this.adjustNavPosition();
154
163
  window.addEventListener("scroll", this.adjustNavPosition);
155
164
  window.addEventListener("resize", this.adjustNavPosition);
165
+ window.addEventListener("resize", this.checkSidebarOpen);
156
166
 
157
167
  if (!this.hasRendered) {
158
168
  this.hasRendered = true;
@@ -168,6 +178,7 @@ export default class ContentLayout extends LightningElement {
168
178
  );
169
179
  window.removeEventListener("scroll", this.adjustNavPosition);
170
180
  window.removeEventListener("resize", this.adjustNavPosition);
181
+ window.removeEventListener("resize", this.checkSidebarOpen);
171
182
  this.searchSyncer.dispose();
172
183
  this.clearRenderObserverTimer();
173
184
 
@@ -185,7 +196,7 @@ export default class ContentLayout extends LightningElement {
185
196
  }
186
197
  };
187
198
 
188
- /*
199
+ /*
189
200
  This is a workaround for the global nav sticky header being decoupled from the doc header & doc phase.
190
201
  We have to account for the global nav changing height due to animations.
191
202
  */
@@ -391,4 +402,15 @@ export default class ContentLayout extends LightningElement {
391
402
  this.setSidebarInputValue(nextSearchParam);
392
403
  this.dispatchHighlightChange(nextSearchParam);
393
404
  }
405
+
406
+ private onToggleSidebar(e: CustomEvent): void {
407
+ this.sidebarOpen = e.detail.open;
408
+ }
409
+
410
+ // since the content body is set to a height of 0 when the sidebar is open, we need to reset the sidebarOpen state when the window is resized
411
+ private checkSidebarOpen = (): void => {
412
+ if (window.innerWidth > 769) {
413
+ this.sidebarOpen = false;
414
+ }
415
+ };
394
416
  }
@@ -2,7 +2,6 @@
2
2
  <div class="container">
3
3
  <doc-phase
4
4
  if:true={docPhaseInfo}
5
- max-width-size="large"
6
5
  doc-phase-info={docPhaseInfo}
7
6
  ></doc-phase>
8
7
 
@@ -21,10 +21,6 @@
21
21
  }
22
22
 
23
23
  .max-width-container {
24
- max-width: var(--dx-g-doc-content-body-max-width);
25
- }
26
-
27
- .doc-phase-max-width-large .max-width-container {
28
24
  max-width: var(--dx-g-doc-content-max-width);
29
25
  }
30
26
 
@@ -9,8 +9,6 @@ export default class Phase extends LightningElement {
9
9
 
10
10
  isBodyHidden = false;
11
11
 
12
- maxWidthSize: "small" | "large" = "small";
13
-
14
12
  get docPhaseTitle() {
15
13
  return this.docPhaseInfo?.title;
16
14
  }
@@ -32,8 +30,7 @@ export default class Phase extends LightningElement {
32
30
  return cx(
33
31
  "doc-status-base",
34
32
  "doc-status-container",
35
- "doc-phase-container",
36
- `doc-phase-max-width-${this.maxWidthSize}`
33
+ "doc-phase-container"
37
34
  );
38
35
  }
39
36
 
@@ -46,8 +43,9 @@ export default class Phase extends LightningElement {
46
43
  }
47
44
 
48
45
  renderedCallback() {
49
- const phaseBodyContainer =
50
- this.template.querySelector(".doc-phase-body");
46
+ const phaseBodyContainer = this.template.querySelector(
47
+ ".doc-phase-body"
48
+ );
51
49
  if (phaseBodyContainer && this.docPhaseInfo) {
52
50
  // eslint-disable-next-line @lwc/lwc/no-inner-html
53
51
  phaseBodyContainer.innerHTML = this.docPhaseInfo.body;