@salesforcedevs/docs-components 1.3.122 → 1.3.124-old-version-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,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.122",
3
+ "version": "1.3.124-old-version-banner",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -24,5 +24,5 @@
24
24
  "@types/lodash.orderby": "^4.6.7",
25
25
  "@types/lodash.uniqby": "^4.7.7"
26
26
  },
27
- "gitHead": "9741a2ed52c5106459cb1bd807bafac9aff25ff3"
27
+ "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
28
28
  }
@@ -4,6 +4,21 @@ doc-phase {
4
4
  );
5
5
  }
6
6
 
7
+ /* We need to apply some borders when there are two doc phases */
8
+ doc-phase:not(:only-child):first-child::part(container) {
9
+ border-top: 1px solid #f9e3b6 !important;
10
+ }
11
+
12
+ doc-phase:nth-child(2)::part(container) {
13
+ border-top: 1px solid #f9e3b6 !important;
14
+ border-bottom: 1px solid #f9e3b6 !important;
15
+ }
16
+
17
+ /* We don't want second component to sticky as we need to handle different cases like position*/
18
+ doc-phase:nth-child(2) {
19
+ position: static;
20
+ }
21
+
7
22
  .api-documentation {
8
23
  margin-top: 48px;
9
24
  }
@@ -21,6 +21,13 @@
21
21
  if:true={docPhaseInfo}
22
22
  doc-phase-info={docPhaseInfo}
23
23
  ></doc-phase>
24
+ <doc-phase
25
+ slot="version-banner"
26
+ if:true={oldVersionInfo}
27
+ doc-phase-info={oldVersionInfo}
28
+ dismissible="true"
29
+ icon="warning"
30
+ ></doc-phase>
24
31
  <div slot="sidebar-header" class="version-picker">
25
32
  <template if:true={isVersionEnabled}>
26
33
  <dx-dropdown
@@ -44,6 +44,12 @@ export default class AmfReference extends LightningElement {
44
44
  @track
45
45
  protected topicModel!: TopicModel;
46
46
 
47
+ @api oldVersionInfo = {
48
+ title: "Newer Version Available",
49
+ body: `This content describes an older version of this product. <a style="font-weight: bold;" href="https://developer.salesforce.com/">
50
+ View Latest</a>`,
51
+ }
52
+
47
53
  get isVersionEnabled(): boolean {
48
54
  return !!this._referenceSetConfig?.versions?.length;
49
55
  }
@@ -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,12 +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>
31
+ <slot name="version-banner"></slot>
29
32
  <div class="content-body-container">
30
33
  <div class="content-body">
31
34
  <doc-breadcrumbs
@@ -83,6 +83,7 @@ export default class ContentLayout extends LightningElement {
83
83
  private observer?: IntersectionObserver;
84
84
  private hasRendered: boolean = false;
85
85
  private contentLoaded: boolean = false;
86
+ private sidebarOpen: boolean = false;
86
87
 
87
88
  get shouldDisplayFeedback() {
88
89
  return this.contentLoaded && typeof Sprig !== "undefined";
@@ -185,7 +186,7 @@ export default class ContentLayout extends LightningElement {
185
186
  }
186
187
  };
187
188
 
188
- /*
189
+ /*
189
190
  This is a workaround for the global nav sticky header being decoupled from the doc header & doc phase.
190
191
  We have to account for the global nav changing height due to animations.
191
192
  */
@@ -391,4 +392,15 @@ export default class ContentLayout extends LightningElement {
391
392
  this.setSidebarInputValue(nextSearchParam);
392
393
  this.dispatchHighlightChange(nextSearchParam);
393
394
  }
395
+
396
+ private onToggleSidebar(e: CustomEvent): void {
397
+ this.sidebarOpen = e.detail.open;
398
+
399
+ // eslint-disable-next-line @lwc/lwc/no-document-query
400
+ const footer = document.querySelector("dx-footer") as HTMLElement;
401
+
402
+ if (footer) {
403
+ footer.style.display = this.sidebarOpen ? "none" : "block";
404
+ }
405
+ }
394
406
  }
@@ -64,6 +64,10 @@ dx-button {
64
64
  color: var(--dx-g-blue-vibrant-50);
65
65
  }
66
66
 
67
+ .dismissible-icon {
68
+ margin-left: auto;
69
+ }
70
+
67
71
  /* Small Devices */
68
72
  @media screen and (max-width: 480px) {
69
73
  .doc-phase-container {
@@ -4,7 +4,7 @@
4
4
  <div class="doc-phase-title-container">
5
5
  <dx-icon
6
6
  class="doc-status-icon doc-phase-icon"
7
- symbol="recipe"
7
+ symbol={iconName}
8
8
  size="large"
9
9
  color="status-icon-color"
10
10
  ></dx-icon>
@@ -12,18 +12,27 @@
12
12
  {docPhaseTitle}
13
13
  </p>
14
14
  <dx-button
15
+ if:false={dismissible}
15
16
  variant="inline"
16
- onclick={onButtonClick}
17
+ onclick={onShowHide}
17
18
  aria-label={hideBodyText}
18
19
  >
19
20
  {hideBodyText}
20
21
  </dx-button>
22
+ <dx-icon
23
+ class="dismissible-icon"
24
+ onclick={onDismiss}
25
+ if:true={dismissible}
26
+ symbol="close"
27
+ size="large"
28
+ color="status-icon-color"
29
+ ></dx-icon>
21
30
  </div>
22
31
  <!--
23
- NOTE: Here we are rendering mark up using lwc:dom & innerHTML
24
- option instead of slots because the html markup will come as a
25
- property to the component from a configuration
26
- -->
32
+ NOTE: Here we are rendering mark up using lwc:dom & innerHTML
33
+ option instead of slots because the html markup will come as a
34
+ property to the component from a configuration
35
+ -->
27
36
  <span lwc:dom="manual" class={bodyClassName}></span>
28
37
  </div>
29
38
  </div>
@@ -2,16 +2,12 @@ import { LightningElement, api } from "lwc";
2
2
  import cx from "classnames";
3
3
 
4
4
  import { DocPhaseInfo } from "typings/custom";
5
- import { toJson } from "dxUtils/normalizers";
5
+ import { toJson, normalizeBoolean } from "dxUtils/normalizers";
6
6
 
7
7
  export default class Phase extends LightningElement {
8
8
  _docPhaseInfo: DocPhaseInfo | null = null;
9
-
10
- isBodyHidden = false;
11
-
12
- get docPhaseTitle() {
13
- return this.docPhaseInfo?.title;
14
- }
9
+ _dismissible = false;
10
+ _iconName = 'recipe';
15
11
 
16
12
  @api
17
13
  get docPhaseInfo(): DocPhaseInfo | null {
@@ -22,6 +18,34 @@ export default class Phase extends LightningElement {
22
18
  this._docPhaseInfo = toJson(value);
23
19
  }
24
20
 
21
+ @api
22
+ get dismissible(): boolean {
23
+ return this._dismissible;
24
+ }
25
+
26
+ set dismissible(value) {
27
+ if (value) {
28
+ this._dismissible = normalizeBoolean(value);
29
+ }
30
+ }
31
+
32
+ @api
33
+ get iconName(): string {
34
+ return this._iconName;
35
+ }
36
+
37
+ set iconName(value) {
38
+ if (value) {
39
+ this._iconName = value;
40
+ }
41
+ }
42
+
43
+ isBodyHidden = false;
44
+
45
+ get docPhaseTitle() {
46
+ return this.docPhaseInfo?.title;
47
+ }
48
+
25
49
  get hideBodyText() {
26
50
  return this.isBodyHidden ? "Show" : "Hide";
27
51
  }
@@ -52,7 +76,19 @@ export default class Phase extends LightningElement {
52
76
  }
53
77
  }
54
78
 
55
- onButtonClick() {
79
+ onShowHide() {
56
80
  this.isBodyHidden = !this.isBodyHidden;
57
81
  }
82
+
83
+ onDismiss(){
84
+ this.dispatchEvent(
85
+ new CustomEvent("dismissbanner", {
86
+ detail: {
87
+ docPhaseInfo: this.docPhaseInfo
88
+ },
89
+ composed: true,
90
+ bubbles: true
91
+ })
92
+ );
93
+ }
58
94
  }
@@ -11,6 +11,13 @@
11
11
  onselect={handleSelect}
12
12
  use-old-sidebar={useOldSidebar}
13
13
  >
14
+ <doc-phase
15
+ slot="version-banner"
16
+ if:true={oldVersionInfo}
17
+ doc-phase-info={oldVersionInfo}
18
+ dismissible="true"
19
+ icon="warning"
20
+ ></doc-phase>
14
21
  <div slot="sidebar-header" class="document-pickers">
15
22
  <dx-dropdown
16
23
  data-type="version"
@@ -34,6 +34,12 @@ export default class DocXmlContent extends LightningElementWithState<{
34
34
  @api coveoPublicAccessToken!: string;
35
35
  @api coveoSearchHub!: string;
36
36
 
37
+ @api oldVersionInfo = {
38
+ title: "Newer Version Available",
39
+ body: `This content describes an older version of this product. <a style="font-weight: bold;" href="https://developer.salesforce.com/">
40
+ View Latest</a>`,
41
+ }
42
+
37
43
  @api
38
44
  get allLanguages(): Array<Language> {
39
45
  return this._allLanguages;
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.