@salesforcedevs/docs-components 0.56.2 → 0.57.1-callout-fix

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": "0.56.2",
3
+ "version": "0.57.1-callout-fix",
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": "47b838f7aa4fb0c55349f98074753103b693851f"
27
+ "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
28
28
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
2
  <dx-icon if:true={isBackArrowVariant} symbol="back"></dx-icon>
3
- <a if:true={href} href={href}>{label}</a>
3
+ <a if:true={href} href={href} onclick={onLinkClick}>{label}</a>
4
4
  <span if:false={href}>{label}</span>
5
5
  </template>
@@ -1,5 +1,6 @@
1
+ import { track } from "dxUtils/analytics";
1
2
  import { LightningElement, api } from "lwc";
2
- import { BreadcrumbItemVariant } from "typings/custom";
3
+ import { AnalyticsPayload, BreadcrumbItemVariant } from "typings/custom";
3
4
 
4
5
  const BREADCRUMB_LONG = "breadcrumb_long";
5
6
  const BREADCRUMB_BACK_ARROW = "breadcrumb_back-arrow";
@@ -7,6 +8,8 @@ const BREADCRUMB_BACK_ARROW = "breadcrumb_back-arrow";
7
8
  const LONG_LABEL_NUMBER = 30;
8
9
  export default class BreadcrumbItem extends LightningElement {
9
10
  @api href?: string;
11
+ @api analyticsEvent!: string;
12
+ @api analyticsBasePayload!: AnalyticsPayload;
10
13
 
11
14
  @api
12
15
  get label() {
@@ -46,4 +49,17 @@ export default class BreadcrumbItem extends LightningElement {
46
49
  private get isBackArrowVariant(): boolean {
47
50
  return this._variant === "back-arrow";
48
51
  }
52
+
53
+ private onLinkClick(event: Event): void {
54
+ if (!this.analyticsEvent) {
55
+ return;
56
+ }
57
+
58
+ track(event.target!, this.analyticsEvent, {
59
+ ...this.analyticsBasePayload,
60
+ clickText: this.label,
61
+ itemTitle: this.label,
62
+ pageLocation: window.location.pathname
63
+ });
64
+ }
49
65
  }
@@ -9,7 +9,6 @@
9
9
  nav {
10
10
  display: flex;
11
11
  align-items: center;
12
- height: 100%;
13
12
  position: relative;
14
13
  gap: var(--dx-g-spacing-sm);
15
14
  }
@@ -17,3 +16,10 @@ nav {
17
16
  .breadcrumb-item_slash {
18
17
  min-width: fit-content;
19
18
  }
19
+
20
+ dx-dropdown {
21
+ --dx-c-dropdown-option-font-size: var(--dx-g-text-sm);
22
+ --dx-c-dropdown-option-label-color: var(
23
+ --dx-c-breadcrumbs-breadcrumb-color
24
+ );
25
+ }
@@ -3,6 +3,8 @@
3
3
  <template if:false={renderSmallVariant}>
4
4
  <template if:true={renderFirstCrumb}>
5
5
  <doc-breadcrumb-item
6
+ analytics-event={analyticsEventName}
7
+ analytics-base-payload={analyticsBasePayload}
6
8
  href={firstCrumb.href}
7
9
  label={firstCrumb.label}
8
10
  ></doc-breadcrumb-item>
@@ -11,10 +13,14 @@
11
13
  <template if:true={renderDropdown}>
12
14
  <dx-dropdown
13
15
  if:true={renderDropdown}
16
+ analytics-event={analyticsEventName}
17
+ analytics-base-payload={analyticsBasePayload}
14
18
  options={dropdownOptions}
15
19
  open-on-hover
16
20
  placement="bottom"
17
- width="200px"
21
+ suppress-gtm-nav-headings
22
+ variant="indented"
23
+ width="fit-content"
18
24
  >
19
25
  <dx-button
20
26
  aria-label="Open Breadcrumbs Dropdown"
@@ -27,6 +33,8 @@
27
33
  </template>
28
34
  <template for:each={breadcrumbItems} for:item="breadcrumb">
29
35
  <doc-breadcrumb-item
36
+ analytics-event={analyticsEventName}
37
+ analytics-base-payload={analyticsBasePayload}
30
38
  href={breadcrumb.href}
31
39
  key={breadcrumb.label}
32
40
  label={breadcrumb.label}
@@ -39,6 +47,8 @@
39
47
  </template>
40
48
  <template if:true={renderSmallVariant}>
41
49
  <doc-breadcrumb-item
50
+ analytics-event={analyticsEventName}
51
+ analytics-base-payload={analyticsBasePayload}
42
52
  href={lastLinkCrump.href}
43
53
  label={lastLinkCrump.label}
44
54
  variant="back-arrow"
@@ -15,6 +15,13 @@ const CONSTANTS = {
15
15
  dropdownWidth: 32
16
16
  };
17
17
 
18
+ export const ANALYTICS_EVENT_NAME = "custEv_breadcrumbClick";
19
+ export const ANALYTICS_BASE_PAYLOAD = {
20
+ elementType: "breadcrumb",
21
+ locationOnPage: "breadcrumb",
22
+ ctaClick: true
23
+ };
24
+
18
25
  export default class Breadcrumbs extends LightningElement {
19
26
  @api ariaLabel: string = "Documentation Breadcrumbs";
20
27
 
@@ -84,6 +91,14 @@ export default class Breadcrumbs extends LightningElement {
84
91
  return this.breadcrumbs[this.breadcrumbs.length - 1];
85
92
  }
86
93
 
94
+ private get analyticsEventName() {
95
+ return ANALYTICS_EVENT_NAME;
96
+ }
97
+
98
+ private get analyticsBasePayload() {
99
+ return ANALYTICS_BASE_PAYLOAD;
100
+ }
101
+
87
102
  renderedCallback(): void {
88
103
  if (!this.observer) {
89
104
  this.observer = new ResizeObserver((entries) => {
@@ -150,7 +150,7 @@ export default class Content extends LightningElement {
150
150
  is: ContentCallout
151
151
  });
152
152
  const detailEls = calloutEl.querySelectorAll(
153
- "p, div.data, ol, ul, p+.codeSection, .mediaBd > span.ph"
153
+ "p, div.data, ol, ul, p+.codeSection, p~.codeSection, div >.codeSection, .mediaBd > span.ph"
154
154
  );
155
155
  detailEls.forEach((detailEl) => {
156
156
  if (detailEl.innerHTML.trim() !== "") {
@@ -159,7 +159,7 @@ export default class Content extends LightningElement {
159
159
  });
160
160
 
161
161
  let flag = 1;
162
- for (let i = 0; i < detailEls.length; i++) {
162
+ for (let i: number = 0; i < detailEls.length; i++) {
163
163
  flag &= detailEls[i].innerHTML.trim() === "";
164
164
  }
165
165
 
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.