@salesforcedevs/docs-components 1.3.123 → 1.3.124-old-version-banner-2

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.123",
3
+ "version": "1.3.124-old-version-banner-2",
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": "3422495fd1b10fb79493d4c5c599c27ba238f7ff"
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,13 @@ export default class AmfReference extends LightningElement {
44
44
  @track
45
45
  protected topicModel!: TopicModel;
46
46
 
47
+ /*TODO: Get the info based on logic*/
48
+ @api oldVersionInfo = {
49
+ title: "Newer Version Available",
50
+ body: `This content describes an older version of this product. <a style="font-weight: bold;" href="https://developer.salesforce.com/">
51
+ View Latest</a>`,
52
+ }
53
+
47
54
  get isVersionEnabled(): boolean {
48
55
  return !!this._referenceSetConfig?.versions?.length;
49
56
  }
@@ -28,6 +28,7 @@
28
28
  </template>
29
29
  <div class="content-body-doc-phase-container">
30
30
  <slot name="doc-phase"></slot>
31
+ <slot name="version-banner"></slot>
31
32
  <div class="content-body-container">
32
33
  <div class="content-body">
33
34
  <doc-breadcrumbs
@@ -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
  }
@@ -44,3 +44,9 @@ dx-dropdown > dx-button:hover {
44
44
  margin-left: auto;
45
45
  margin-right: var(--dx-g-spacing-sm);
46
46
  }
47
+
48
+ doc-phase {
49
+ --doc-c-phase-top: calc(
50
+ var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
51
+ );
52
+ }
@@ -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,13 @@ export default class DocXmlContent extends LightningElementWithState<{
34
34
  @api coveoPublicAccessToken!: string;
35
35
  @api coveoSearchHub!: string;
36
36
 
37
+ /*TODO: Get the info based on logic*/
38
+ @api oldVersionInfo = {
39
+ title: "Newer Version Available",
40
+ body: `This content describes an older version of this product. <a style="font-weight: bold;" href="https://developer.salesforce.com/">
41
+ View Latest</a>`,
42
+ }
43
+
37
44
  @api
38
45
  get allLanguages(): Array<Language> {
39
46
  return this._allLanguages;
@@ -264,9 +271,8 @@ export default class DocXmlContent extends LightningElementWithState<{
264
271
 
265
272
  private get sidebarValue(): string {
266
273
  if (this.pageReference?.contentDocumentId) {
267
- const hashedUri = `${
268
- this.pageReference.contentDocumentId
269
- }${this.normalizeHash(this.pageReference.hash)}`;
274
+ const hashedUri = `${this.pageReference.contentDocumentId
275
+ }${this.normalizeHash(this.pageReference.hash)}`;
270
276
  if (hashedUri in this.tocMap) {
271
277
  return hashedUri;
272
278
  }
@@ -287,14 +293,14 @@ export default class DocXmlContent extends LightningElementWithState<{
287
293
  return this.disableVersion
288
294
  ? this.availableVersions
289
295
  : this.availableVersions.map((version) => ({
290
- ...version,
291
- link: {
292
- href: this.pageReferenceToString({
293
- ...this.pageReference,
294
- docId: version.url
295
- })
296
- }
297
- }));
296
+ ...version,
297
+ link: {
298
+ href: this.pageReferenceToString({
299
+ ...this.pageReference,
300
+ docId: version.url
301
+ })
302
+ }
303
+ }));
298
304
  }
299
305
 
300
306
  private get breadcrumbPixelPerCharacter() {
@@ -404,7 +410,7 @@ export default class DocXmlContent extends LightningElementWithState<{
404
410
  isSamePage(reference: PageReference): boolean {
405
411
  return (
406
412
  this.pageReference.contentDocumentId ===
407
- reference.contentDocumentId &&
413
+ reference.contentDocumentId &&
408
414
  this.pageReference.docId === reference.docId &&
409
415
  this.pageReference.page === reference.page &&
410
416
  this.pageReference.deliverable === reference.deliverable
@@ -695,9 +701,9 @@ export default class DocXmlContent extends LightningElementWithState<{
695
701
  metadescription.setAttribute(
696
702
  "href",
697
703
  window.location.protocol +
698
- "//" +
699
- window.location.host +
700
- this.pageReferenceToString(copyPageReference)
704
+ "//" +
705
+ window.location.host +
706
+ this.pageReferenceToString(copyPageReference)
701
707
  );
702
708
  }
703
709
  }
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.