@salesforcedevs/dx-components 1.3.136 → 1.3.138-coveo-alpha1

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.
Files changed (33) hide show
  1. package/lwc.config.json +2 -0
  2. package/package.json +2 -3
  3. package/src/modules/dx/cardBlogPost/cardBlogPost.ts +1 -1
  4. package/src/modules/dx/cardCallout/cardCallout.ts +1 -1
  5. package/src/modules/dx/cardDocs/cardDocs.ts +4 -4
  6. package/src/modules/dx/cardNews/cardNews.css +5 -0
  7. package/src/modules/dx/cardNews/cardNews.html +1 -0
  8. package/src/modules/dx/cardNews/cardNews.ts +3 -1
  9. package/src/modules/dx/cardTrial/cardTrial.ts +1 -1
  10. package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.ts +1 -1
  11. package/src/modules/dx/featuredContentHeader/featuredContentHeader.css +21 -0
  12. package/src/modules/dx/featuredContentHeader/featuredContentHeader.html +21 -0
  13. package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +12 -0
  14. package/src/modules/dx/featuresListHeader/featuresListHeader.css +12 -9
  15. package/src/modules/dx/featuresListHeader/featuresListHeader.ts +4 -4
  16. package/src/modules/dx/footer/footer.html +12 -6
  17. package/src/modules/dx/footer/footer.ts +20 -0
  18. package/src/modules/dx/footerOption/footerOption.ts +8 -2
  19. package/src/modules/dx/groupText/groupText.ts +5 -1
  20. package/src/modules/dx/mainContentHeader/mainContentHeader.ts +12 -4
  21. package/src/modules/dx/section/section.html +1 -0
  22. package/src/modules/dx/section/section.ts +13 -0
  23. package/src/modules/dx/sectionBanner/sectionBanner.html +1 -1
  24. package/src/modules/dx/sectionBanner/sectionBanner.ts +1 -0
  25. package/src/modules/dx/sidebarSearch/sidebarSearch.ts +1 -0
  26. package/src/modules/dx/stepSequence/stepSequence.css +46 -0
  27. package/src/modules/dx/stepSequence/stepSequence.html +9 -0
  28. package/src/modules/dx/stepSequence/stepSequence.ts +197 -0
  29. package/src/modules/dx/stepSequenceStep/stepSequenceStep.html +3 -0
  30. package/src/modules/dx/stepSequenceStep/stepSequenceStep.ts +60 -0
  31. package/src/modules/dx/toc/toc.ts +1 -1
  32. package/src/modules/dx/treeItem/treeItem.ts +8 -2
  33. package/LICENSE +0 -12
package/lwc.config.json CHANGED
@@ -77,6 +77,8 @@
77
77
  "dx/skipNavLink",
78
78
  "dx/socials",
79
79
  "dx/spinner",
80
+ "dx/stepSequence",
81
+ "dx/stepSequenceStep",
80
82
  "dx/tabPanel",
81
83
  "dx/tabPanelList",
82
84
  "dx/tbidAvatarButton",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.3.136",
3
+ "version": "1.3.138-coveo-alpha1",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -39,6 +39,5 @@
39
39
  "@types/vimeo__player": "^2.16.2",
40
40
  "eventsourcemock": "^2.0.0",
41
41
  "luxon": "^3.1.0"
42
- },
43
- "gitHead": "c076bf146988d61bedc4710e6443a18d7e27b1ca"
42
+ }
44
43
  }
@@ -23,7 +23,7 @@ export default class CardBlogPost extends LightningElement {
23
23
  private onLinkClick(event: Event) {
24
24
  const payload = {
25
25
  click_text: this.title,
26
- click_url: this.href,
26
+ click_url: `${window.location.origin}${this.href}`,
27
27
  element_title: this.title,
28
28
  element_type: "card",
29
29
  content_category: "link"
@@ -32,7 +32,7 @@ export default class CardCallout extends LightningElement {
32
32
  private sendGtm(e: PointerEvent) {
33
33
  track(e.currentTarget!, "custEv_ctaLinkClick", {
34
34
  click_text: this.title,
35
- click_url: this.href,
35
+ click_url: `${window.location.origin}${this.href}`,
36
36
  element_title: this.title,
37
37
  element_type: "link",
38
38
  content_category: "cta"
@@ -39,13 +39,13 @@ export default class CardDocs extends LightningElement {
39
39
  ...payloadInnerButton,
40
40
  element_title: this.title,
41
41
  click_text: slotElement.innerText,
42
- click_url: slotElement.href
42
+ click_url: `${window.location.origin}${slotElement.href}`
43
43
  });
44
44
  track(event.currentTarget!, "custEv_linkClick", {
45
45
  ...payloadInnerButton,
46
46
  element_title: this.title,
47
47
  click_text: slotElement.innerText,
48
- click_url: slotElement.href
48
+ click_url: `${window.location.origin}${slotElement.href}`
49
49
  });
50
50
  });
51
51
  });
@@ -56,7 +56,7 @@ export default class CardDocs extends LightningElement {
56
56
  const payloadCardInfo = {
57
57
  click_text: this.title,
58
58
  element_title: this.title,
59
- click_url: this.href,
59
+ click_url: `${window.location.origin}${this.href}`,
60
60
  element_type: "link",
61
61
  content_category: "cta"
62
62
  };
@@ -68,7 +68,7 @@ export default class CardDocs extends LightningElement {
68
68
  const payloadCardTextInfo = {
69
69
  click_text: this.body,
70
70
  element_title: this.title,
71
- click_url: this.href,
71
+ click_url: `${window.location.origin}${this.href}`,
72
72
  element_type: "tile",
73
73
  content_category: "cta"
74
74
  };
@@ -39,6 +39,11 @@ p {
39
39
  margin: 16px 0;
40
40
  }
41
41
 
42
+ .inline-button {
43
+ --dx-c-button-primary-color: var(--dx-g-blue-natural-40);
44
+ --dx-c-button-primary-color-hover: var(--dx-g-blue-natural-30);
45
+ }
46
+
42
47
  img {
43
48
  display: none;
44
49
  margin: 0;
@@ -18,6 +18,7 @@
18
18
  </dx-button>
19
19
 
20
20
  <dx-button
21
+ class="inline-button"
21
22
  if:false={hasLargeButton}
22
23
  variant="inline"
23
24
  inline-text-color={buttonColor}
@@ -67,7 +67,9 @@ export default class CardNews extends LightningElement {
67
67
  private trackClick(e: Event) {
68
68
  const payload = {
69
69
  click_text: this.buttonText,
70
- click_url: this.href,
70
+ click_url: this.href.includes("http")
71
+ ? this.href
72
+ : `${window.location.origin}${this.href}`,
71
73
  element_title: this.title,
72
74
  element_type: "link",
73
75
  content_category: "cta"
@@ -119,7 +119,7 @@ export default class CardTrial extends LightningElement {
119
119
  click_text: this.label,
120
120
  element_title: "dx-button",
121
121
  element_type: "card",
122
- click_url: this.href,
122
+ click_url: `${window.location.origin}${this.href}`,
123
123
  content_category: "cta"
124
124
  };
125
125
  track(e.currentTarget!, "custEv_signupStart", payload);
@@ -74,7 +74,7 @@ export default class CardTrial extends LightningElement {
74
74
  click_text: this.buttonCta,
75
75
  element_title: this.title,
76
76
  element_type: "card",
77
- click_url: this.href,
77
+ click_url: `${window.location.origin}${this.href}`,
78
78
  content_category: "cta"
79
79
  };
80
80
  track(e.currentTarget!, "custEv_signupStart", payload);
@@ -374,6 +374,19 @@ a.image-container > img {
374
374
  display: block;
375
375
  }
376
376
 
377
+ /* BUTTONS */
378
+
379
+ .buttons {
380
+ display: flex;
381
+ padding-top: var(--item-spacing);
382
+ padding-bottom: var(--item-spacing);
383
+ }
384
+
385
+ dx-button {
386
+ display: inline-block;
387
+ padding-right: var(--dx-g-spacing-lg);
388
+ }
389
+
377
390
  /* AUTHORS */
378
391
 
379
392
  .authors {
@@ -495,6 +508,14 @@ dx-image-and-label {
495
508
  line-height: var(--dx-g-spacing-lg);
496
509
  }
497
510
 
511
+ .buttons {
512
+ flex-direction: column;
513
+ }
514
+
515
+ dx-button {
516
+ padding-bottom: var(--dx-g-spacing-sm);
517
+ }
518
+
498
519
  .authors {
499
520
  padding-top: 0;
500
521
  }
@@ -50,6 +50,27 @@
50
50
  </template>
51
51
  </div>
52
52
  <span class="body dx-text-body-1">{body}</span>
53
+ <div class="buttons" if:true={hasButtons}>
54
+ <dx-button
55
+ if:true={ctaPrimaryLabel}
56
+ href={ctaPrimaryHref}
57
+ icon-symbol={ctaPrimarySymbol}
58
+ target={ctaPrimaryTarget}
59
+ size="large"
60
+ >
61
+ {ctaPrimaryLabel}
62
+ </dx-button>
63
+ <dx-button
64
+ if:true={ctaSecondaryLabel}
65
+ href={ctaSecondaryHref}
66
+ variant="secondary"
67
+ icon-symbol={ctaSecondarySymbol}
68
+ target={ctaSecondaryTarget}
69
+ size="large"
70
+ >
71
+ {ctaSecondaryLabel}
72
+ </dx-button>
73
+ </div>
53
74
  <div class="slot-container">
54
75
  <slot onslotchange={onSlotChange}></slot>
55
76
  </div>
@@ -11,6 +11,14 @@ export default class FeaturedContentHeader extends LightningElement {
11
11
  @api label?: string | null = null;
12
12
  @api labelAsPrimaryHeading: boolean = false;
13
13
  @api body!: string;
14
+ @api ctaPrimaryLabel?: string;
15
+ @api ctaPrimaryHref?: string;
16
+ @api ctaPrimarySymbol?: string;
17
+ @api ctaPrimaryTarget?: string;
18
+ @api ctaSecondaryLabel?: string;
19
+ @api ctaSecondaryHref?: string;
20
+ @api ctaSecondarySymbol?: string;
21
+ @api ctaSecondaryTarget?: string;
14
22
  @api imgSrc?: string;
15
23
  @api imgAlt?: string = "Featured content image";
16
24
  @api imgPlacement?: "inline" | "below" = "inline";
@@ -69,6 +77,10 @@ export default class FeaturedContentHeader extends LightningElement {
69
77
  );
70
78
  }
71
79
 
80
+ private get hasButtons() {
81
+ return this.ctaPrimaryLabel && this.ctaSecondaryLabel;
82
+ }
83
+
72
84
  private get style() {
73
85
  return cx(
74
86
  this.backgroundImg &&
@@ -4,6 +4,8 @@
4
4
  .container {
5
5
  display: flex;
6
6
  flex-direction: row;
7
+ align-items: center;
8
+ justify-content: space-between;
7
9
  padding: 0 var(--dx-g-page-padding-horizontal);
8
10
  }
9
11
 
@@ -35,8 +37,8 @@
35
37
  }
36
38
 
37
39
  .features-list {
38
- display: flex;
39
- flex-wrap: wrap;
40
+ display: grid;
41
+ grid-template-columns: 1fr 1fr;
40
42
  margin-top: var(--dx-g-spacing-lg);
41
43
  gap: var(--dx-g-spacing-md);
42
44
  }
@@ -44,10 +46,8 @@
44
46
  .feature-item {
45
47
  display: flex;
46
48
  align-items: center;
47
- text-align: left;
48
49
  gap: var(--dx-g-spacing-smd);
49
- flex-basis: calc(50% - var(--dx-g-spacing-smd));
50
- flex-grow: 1;
50
+ text-align: left;
51
51
  }
52
52
 
53
53
  .feature-item span {
@@ -62,10 +62,6 @@ dx-button {
62
62
  margin-top: var(--dx-g-spacing-smd);
63
63
  }
64
64
 
65
- img {
66
- object-fit: contain;
67
- }
68
-
69
65
  img.mobile {
70
66
  display: none;
71
67
  }
@@ -94,6 +90,7 @@ img.mobile {
94
90
  img.mobile {
95
91
  display: block;
96
92
  margin-top: var(--dx-g-spacing-3xl);
93
+ margin-bottom: var(--dx-g-spacing-4xl);
97
94
  }
98
95
  }
99
96
 
@@ -108,3 +105,9 @@ img.mobile {
108
105
  line-height: var(--dx-g-text-4xl);
109
106
  }
110
107
  }
108
+
109
+ @media screen and (max-width: 640px) {
110
+ .features-list {
111
+ grid-template-columns: 1fr;
112
+ }
113
+ }
@@ -42,7 +42,7 @@ export default class FeaturesListHeader extends LightningElement {
42
42
  if (e.currentTarget) {
43
43
  track(e.currentTarget, "custEv_ctaButtonClick", {
44
44
  click_text: this.ctaLabel,
45
- click_url: this.ctaHref,
45
+ click_url: `${window.location.origin}${this.ctaHref}`,
46
46
  element_type: "button",
47
47
  element_title: this.title,
48
48
  content_category: "cta"
@@ -50,7 +50,7 @@ export default class FeaturesListHeader extends LightningElement {
50
50
  track(e.currentTarget!, "custEv_linkClick", {
51
51
  click_text: this.ctaLabel,
52
52
  element_title: this.title,
53
- click_url: this.ctaHref,
53
+ click_url: `${window.location.origin}${this.ctaHref}`,
54
54
  element_type: "link",
55
55
  content_category: "cta"
56
56
  });
@@ -61,7 +61,7 @@ export default class FeaturesListHeader extends LightningElement {
61
61
  if (e.currentTarget) {
62
62
  track(e.currentTarget, "custEv_ctaButtonClick", {
63
63
  click_text: this.ctaLabelSecondary,
64
- click_url: this.ctaHrefSecondary,
64
+ click_url: `${window.location.origin}${this.ctaHrefSecondary}`,
65
65
  element_type: "button",
66
66
  element_title: this.title,
67
67
  content_category: "cta"
@@ -69,7 +69,7 @@ export default class FeaturesListHeader extends LightningElement {
69
69
  track(e.currentTarget!, "custEv_linkClick", {
70
70
  click_text: this.ctaLabelSecondary,
71
71
  element_title: this.title,
72
- click_url: this.ctaHrefSecondary,
72
+ click_url: `${window.location.origin}${this.ctaHrefSecondary}`,
73
73
  element_type: "link",
74
74
  content_category: "cta"
75
75
  });
@@ -7,8 +7,10 @@
7
7
  <div class="graphic graphic-trees" alt=""></div>
8
8
  <div class="graphic graphic-mountains" alt=""></div>
9
9
  <div class="graphic graphic-mountains-mobile" alt=""></div>
10
- <span class="subheading">Sign up for developer updates</span>
11
- <dx-button href="/newsletter">SIGN UP</dx-button>
10
+ <span class="subheading">{signupLabel}</span>
11
+ <dx-button onclick={handleSignup} href={signupPath}>
12
+ SIGN UP
13
+ </dx-button>
12
14
  <div class="graphic graphic-trees-small" alt=""></div>
13
15
  </div>
14
16
  <div
@@ -18,11 +20,15 @@
18
20
  <div class="graphic graphic-large" alt=""></div>
19
21
  <div class="subscription">
20
22
  <h2 class="dx-text-display-4">
21
- Get timely developer updates
22
- <br />
23
- delivered to your inbox.
23
+ <dx-formatted-rich-text
24
+ value={signupLabel}
25
+ ></dx-formatted-rich-text>
24
26
  </h2>
25
- <dx-button href="/newsletter" size="large">
27
+ <dx-button
28
+ onclick={handleSignup}
29
+ href={signupPath}
30
+ size="large"
31
+ >
26
32
  Sign up now
27
33
  </dx-button>
28
34
  </div>
@@ -8,6 +8,7 @@ import {
8
8
  socialLinks,
9
9
  intellectualHref
10
10
  } from "./links";
11
+ import { track } from "dxUtils/analytics";
11
12
 
12
13
  export default class Footer extends LightningElement {
13
14
  @api locale: string | null = null;
@@ -35,6 +36,7 @@ export default class Footer extends LightningElement {
35
36
  private intellectualHref = intellectualHref;
36
37
  private socialLinks = socialLinks;
37
38
  private termsLinks = termsLinks;
39
+ private signupPath = "/newsletter";
38
40
 
39
41
  @api
40
42
  set variant(value: FooterVariant) {
@@ -80,6 +82,12 @@ export default class Footer extends LightningElement {
80
82
  return date.getFullYear();
81
83
  }
82
84
 
85
+ get signupLabel(): string {
86
+ return this.showLargeSignup
87
+ ? "Get timely developer updates<br />delivered to your inbox."
88
+ : "Sign up for developer updates";
89
+ }
90
+
83
91
  get className() {
84
92
  return cx(`signup-variant-${this.variant}`);
85
93
  }
@@ -98,4 +106,16 @@ export default class Footer extends LightningElement {
98
106
  "terms-only"
99
107
  ].includes(value);
100
108
  }
109
+
110
+ private handleSignup(e: Event) {
111
+ track(e.currentTarget, "custEv_ctaButtonClick", {
112
+ click_text: this.signupLabel,
113
+ click_url: `${window.location.origin}${this.signupPath}`,
114
+ element_type: "button",
115
+ element_title: this.showSmallSignup
116
+ ? "Get Developer Updates"
117
+ : "get the latest developer updates.",
118
+ content_category: "cta"
119
+ });
120
+ }
101
121
  }
@@ -11,7 +11,10 @@ export default class FooterOption extends LightningElement {
11
11
  sendGtm(e: PointerEvent) {
12
12
  track(e.currentTarget, "custEv_bottomNavLinkClick", {
13
13
  click_text: this.label || undefined,
14
- click_url: this.href || undefined,
14
+ click_url:
15
+ (this.href && this.href.includes("http")
16
+ ? this.href
17
+ : `${window.location.origin}${this.href}`) || undefined,
15
18
  nav_item: this.label || undefined,
16
19
  nav_level: "1",
17
20
  element_type: "link",
@@ -20,7 +23,10 @@ export default class FooterOption extends LightningElement {
20
23
  track(e.currentTarget!, "custEv_linkClick", {
21
24
  click_text: this.label,
22
25
  element_title: this.generalLabel,
23
- click_url: this.href,
26
+ click_url:
27
+ (this.href && this.href.includes("http")
28
+ ? this.href
29
+ : `${window.location.origin}${this.href}`) || undefined,
24
30
  element_type: "link",
25
31
  content_category: "cta"
26
32
  });
@@ -87,7 +87,11 @@ export default class GroupText extends LightningElement {
87
87
  track(event.target!, "custEv_ctaButtonClick", {
88
88
  click_text: event.currentTarget.innerText,
89
89
  item_title: event.currentTarget.innerText,
90
- click_url: event.currentTarget.href,
90
+ click_url: `${
91
+ event.currentTarget.href.includes("http")
92
+ ? event.currentTarget.href
93
+ : window.location.origin + event.currentTarget.href
94
+ }`,
91
95
  element_type: "button",
92
96
  element_title: this.title,
93
97
  content_category: "cta"
@@ -39,7 +39,9 @@ export default class MainContentHeader extends LightningElement {
39
39
  if (e.currentTarget) {
40
40
  track(e.currentTarget, "custEv_ctaButtonClick", {
41
41
  click_text: this.ctaLabel,
42
- click_url: this.ctaHref,
42
+ click_url: this.ctaHref.includes("http")
43
+ ? this.ctaHref
44
+ : `${window.location.origin}${this.ctaHref}`,
43
45
  element_type: "button",
44
46
  element_title: this.title,
45
47
  content_category: "cta"
@@ -47,7 +49,9 @@ export default class MainContentHeader extends LightningElement {
47
49
  track(e.currentTarget!, "custEv_linkClick", {
48
50
  click_text: this.ctaLabel,
49
51
  element_title: this.title,
50
- click_url: this.ctaHref,
52
+ click_url: this.ctaHref.includes("http")
53
+ ? this.ctaHref
54
+ : `${window.location.origin}${this.ctaHref}`,
51
55
  element_type: "link",
52
56
  content_category: "cta"
53
57
  });
@@ -58,7 +62,9 @@ export default class MainContentHeader extends LightningElement {
58
62
  if (e.currentTarget) {
59
63
  track(e.currentTarget, "custEv_ctaButtonClick", {
60
64
  click_text: this.ctaLabelSecondary,
61
- click_url: this.ctaHrefSecondary,
65
+ click_url: this.ctaHrefSecondary!.includes("http")
66
+ ? this.ctaHrefSecondary
67
+ : `${window.location.origin}${this.ctaHrefSecondary}`,
62
68
  element_type: "button",
63
69
  element_title: this.title,
64
70
  content_category: "cta"
@@ -66,7 +72,9 @@ export default class MainContentHeader extends LightningElement {
66
72
  track(e.currentTarget!, "custEv_linkClick", {
67
73
  click_text: this.ctaLabelSecondary,
68
74
  element_title: this.title,
69
- click_url: this.ctaHrefSecondary,
75
+ click_url: this.ctaHrefSecondary!.includes("http")
76
+ ? this.ctaHrefSecondary
77
+ : `${window.location.origin}${this.ctaHrefSecondary}`,
70
78
  element_type: "link",
71
79
  content_category: "cta"
72
80
  });
@@ -37,6 +37,7 @@
37
37
  variant={ctaBtnVariant}
38
38
  icon-symbol={ctaBtnSymbol}
39
39
  target={ctaBtnTarget}
40
+ onclick={handleLabelClick}
40
41
  >
41
42
  {ctaLabel}
42
43
  </dx-button>
@@ -1,6 +1,7 @@
1
1
  import { LightningElement, api } from "lwc";
2
2
  import cx from "classnames";
3
3
  import { toDxColor } from "dxUtils/css";
4
+ import { track } from "dxUtils/analytics";
4
5
 
5
6
  export default class Section extends LightningElement {
6
7
  @api backgroundColor: string = "transparent";
@@ -48,4 +49,16 @@ export default class Section extends LightningElement {
48
49
  private get hasText(): boolean {
49
50
  return !!(this.title || this.label || this.subtitle);
50
51
  }
52
+
53
+ private handleLabelClick(e: Event) {
54
+ track(e.target!, "custEv_ctaLinkClick", {
55
+ click_text: this.ctaLabel,
56
+ element_title: this.title,
57
+ click_url: this.ctaHref!.includes("http")
58
+ ? this.ctaHref
59
+ : `${window.location.origin}${this.ctaHref}`,
60
+ element_type: "link",
61
+ content_category: "cta"
62
+ });
63
+ }
51
64
  }
@@ -11,7 +11,7 @@
11
11
  {title}
12
12
  </h3>
13
13
  <div class="content-body-container">
14
- <img if:true={hasQuote} src="/assets/svg/quotes.svg" alt="" />
14
+ <img if:true={hasQuote} src={quoteGraphicSrc} alt="" />
15
15
  <div class={quoteContentStyle}>
16
16
  <p class={contentBodyStyle}>{body}</p>
17
17
  <p if:true={footNote} class="foot-note dx-text-display-7">
@@ -11,6 +11,7 @@ export default class SectionBanner extends LightningElement {
11
11
  @api hideTopGraphic = false;
12
12
  @api backgroundColor = "indigo-vibrant-20";
13
13
  @api hasQuote = false;
14
+ @api quoteGraphicSrc?: string;
14
15
 
15
16
  get containerStyle() {
16
17
  return cx("container", !this.hideTopGraphic && "top-margin");
@@ -45,6 +45,7 @@ export default class SidebarSearch extends LightningElement {
45
45
  }
46
46
  set coveoAdvancedQueryConfig(value) {
47
47
  const jsonValue = toJson(value);
48
+ console.log("Coveo AQ query: " + value);
48
49
  const hasChanged =
49
50
  this._coveoAdvancedQueryConfig &&
50
51
  Object.entries(jsonValue).some(
@@ -0,0 +1,46 @@
1
+ /*
2
+ This CSS will automatically handle the displaying of child dx-step-sequence-step components,
3
+ including animations, if they are enabled. There is no other UI for this component.
4
+ */
5
+ ::slotted(*) {
6
+ position: absolute;
7
+ top: 0;
8
+ transition: transform 0.4s ease, opacity 0.4s ease;
9
+ width: 100%;
10
+ }
11
+
12
+ .hidden {
13
+ visibility: hidden;
14
+ }
15
+
16
+ .no-animations ::slotted(*) {
17
+ display: none;
18
+ }
19
+
20
+ ::slotted(.visible) {
21
+ display: block;
22
+ }
23
+
24
+ ::slotted(.active-step) {
25
+ position: relative;
26
+ }
27
+
28
+ ::slotted(.animate-left-out) {
29
+ opacity: 0;
30
+ transform: translateX(-100%);
31
+ }
32
+
33
+ ::slotted(.animate-in) {
34
+ opacity: 1;
35
+ transform: translateX(0);
36
+ }
37
+
38
+ ::slotted(.animate-right-out) {
39
+ opacity: 0;
40
+ transform: translateX(100%);
41
+ }
42
+
43
+ .step-sequence-container {
44
+ overflow: hidden;
45
+ position: relative;
46
+ }
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <div class={containerClassName}>
3
+ <slot
4
+ onslotchange={handleSlotChange}
5
+ onstepincrement={handleStepIncrement}
6
+ onstepdecrement={handleStepDecrement}
7
+ ></slot>
8
+ </div>
9
+ </template>
@@ -0,0 +1,197 @@
1
+ /* eslint-disable no-restricted-globals */
2
+ import { api, LightningElement } from "lwc";
3
+ import cx from "classnames";
4
+
5
+ // This is a UI-agnostic wrapper component that turns its children components into a sequence of
6
+ // of steps. The children must be dx-step-sequence-step components. Navigation works both via the browser's
7
+ // forward/back buttons and via any action buttons defined in the dx-step-sequence-step components (see that
8
+ // component for details on the action buttons).
9
+ export default class StepSequence extends LightningElement {
10
+ @api initialStepIndex: string | undefined;
11
+ @api animateTransitions = false;
12
+
13
+ private currentStepIndex = 0;
14
+ private steps: Array<HTMLElement> = [];
15
+ private isHiddenForInitialAnimation = true;
16
+
17
+ private get containerClassName() {
18
+ return cx("step-sequence-container", {
19
+ "no-animations": !this.animateTransitions,
20
+ hidden: this.isHiddenForInitialAnimation
21
+ });
22
+ }
23
+
24
+ connectedCallback() {
25
+ const initialStepIndex = parseInt(this.initialStepIndex as string, 10);
26
+ if (!isNaN(initialStepIndex)) {
27
+ this.currentStepIndex = initialStepIndex;
28
+ }
29
+ history.replaceState(
30
+ {
31
+ currentStepIndex: this.currentStepIndex
32
+ },
33
+ ""
34
+ );
35
+ window.addEventListener("popstate", this.handleHistoryPopstate);
36
+ if (this.animateTransitions) {
37
+ this.addEventListener("transitionend", this.handleTransitionEnd);
38
+ } else {
39
+ this.isHiddenForInitialAnimation = false;
40
+ }
41
+ }
42
+
43
+ disconnectedCallback() {
44
+ window.removeEventListener("popstate", this.handleHistoryPopstate);
45
+ this.removeEventListener("transitionend", this.handleTransitionEnd);
46
+ }
47
+
48
+ // Used only if this.animateTransitions is truthy
49
+ private handleTransitionEnd = ({ target }: Event) => {
50
+ if (
51
+ (target as HTMLElement).tagName?.toLowerCase() !==
52
+ "dx-step-sequence-step"
53
+ ) {
54
+ // Ignore transitions of other nested elements
55
+ return;
56
+ }
57
+
58
+ if (this.isHiddenForInitialAnimation) {
59
+ this.isHiddenForInitialAnimation = false;
60
+ }
61
+
62
+ // Ensure subsequent steps are no longer visible:
63
+ const prevStep = this.steps[this.currentStepIndex - 1];
64
+ const nextStep = this.steps[this.currentStepIndex + 1];
65
+ if (prevStep?.classList.contains("visible")) {
66
+ prevStep.classList.remove("visible");
67
+ }
68
+ if (nextStep?.classList.contains("visible")) {
69
+ nextStep.classList.remove("visible");
70
+ }
71
+
72
+ // Mark the current step as fully active:
73
+ this.steps[this.currentStepIndex].classList.add("active-step");
74
+ };
75
+
76
+ private changeActiveStep(nextStepIndex: number, updateHistory = true) {
77
+ if (nextStepIndex === this.currentStepIndex) {
78
+ // Should never happen, but covering all logical bases. Nothing to do here.
79
+ return;
80
+ }
81
+
82
+ if (!this.animateTransitions) {
83
+ this.steps[this.currentStepIndex].className = "";
84
+ this.steps[nextStepIndex].className = "visible active-step";
85
+ } else {
86
+ // If animations are enabled, we need to animate in the correct directions:
87
+ if (nextStepIndex > this.currentStepIndex) {
88
+ this.steps[this.currentStepIndex].className =
89
+ "visible animate-left-out";
90
+ this.steps[nextStepIndex].className = "visible animate-in";
91
+ } else {
92
+ this.steps[this.currentStepIndex].className =
93
+ "visible animate-right-out";
94
+ this.steps[nextStepIndex].className = "visible animate-in";
95
+ }
96
+ }
97
+
98
+ if (updateHistory) {
99
+ history.pushState(
100
+ {
101
+ currentStepIndex: nextStepIndex
102
+ },
103
+ ""
104
+ );
105
+ }
106
+ this.currentStepIndex = nextStepIndex;
107
+ }
108
+
109
+ private initializeStepAnimationClasses(
110
+ currentStepIndex: number,
111
+ step: HTMLElement,
112
+ stepIndex: number
113
+ ) {
114
+ // All steps to the "left" of the current step are treated as though they've already
115
+ // animated out in that direction, and similarly for all steps to the "right." Only
116
+ // the current step is initialized as visible and active.
117
+ if (stepIndex < currentStepIndex) {
118
+ step.className = "animate-left-out";
119
+ } else if (stepIndex > currentStepIndex) {
120
+ step.className = "animate-right-out";
121
+ } else {
122
+ step.className = "visible active-step";
123
+ }
124
+ }
125
+
126
+ // This method is available in case there are scenarios where a sequence needs to "jump" in some cases
127
+ @api
128
+ public jumpToStep(stepIndex: number) {
129
+ if (stepIndex < 0 || stepIndex >= this.steps.length) {
130
+ // illegal value; ignore
131
+ return;
132
+ }
133
+
134
+ this.changeActiveStep(stepIndex);
135
+
136
+ if (this.animateTransitions) {
137
+ this.steps.forEach((step, index) =>
138
+ this.initializeStepAnimationClasses(stepIndex, step, index)
139
+ );
140
+ }
141
+ }
142
+
143
+ handleHistoryPopstate = ({ state }: PopStateEvent) => {
144
+ if (typeof state.currentStepIndex === "number") {
145
+ this.changeActiveStep(state.currentStepIndex, false);
146
+ }
147
+ };
148
+
149
+ handleStepDecrement(e: CustomEvent) {
150
+ e.stopPropagation();
151
+ if (this.currentStepIndex <= 0) {
152
+ return;
153
+ }
154
+ this.changeActiveStep(this.currentStepIndex - 1);
155
+ }
156
+
157
+ handleStepIncrement(e: CustomEvent) {
158
+ e.stopPropagation();
159
+ if (this.currentStepIndex >= this.steps.length - 1) {
160
+ return;
161
+ }
162
+ this.changeActiveStep(this.currentStepIndex + 1);
163
+ }
164
+
165
+ // Assign steps and appropriate classNames when slots are loaded. This component was built on
166
+ // the assumption that the slotChange will only happen at initial load, though it SHOULD still
167
+ // work even if the slots are changed later (though note that the value of
168
+ // `this.currentStepIndex` will be applied to the new slotted elements; call `jumpToStep` to
169
+ // change it).
170
+ handleSlotChange(e: Event) {
171
+ const slot = e.target as HTMLSlotElement;
172
+ this.steps = slot.assignedElements() as HTMLElement[];
173
+ if (!this.animateTransitions) {
174
+ this.steps[this.currentStepIndex].className = "visible active-step";
175
+ } else {
176
+ // For transition animations to be visible, the container must have a height that will
177
+ // keep the components visible as they transition in and out. Currently this component
178
+ // will have at least the height of the "tallest" slotted element.
179
+ let minHeight = 0;
180
+ this.steps.forEach((step, index) => {
181
+ if (step.clientHeight > minHeight) {
182
+ minHeight = step.clientHeight;
183
+ }
184
+ this.initializeStepAnimationClasses(
185
+ this.currentStepIndex,
186
+ step,
187
+ index
188
+ );
189
+ });
190
+ if (minHeight > 0) {
191
+ this.template.querySelector(
192
+ ".step-sequence-container"
193
+ )!.style.minHeight = `${minHeight}px`;
194
+ }
195
+ }
196
+ }
197
+ }
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <slot onslotchange={handleSlotChange}></slot>
3
+ </template>
@@ -0,0 +1,60 @@
1
+ import { LightningElement } from "lwc";
2
+
3
+ // A UI-agnostic component meant to be used as a child of dx-step-sequence. The component
4
+ // automatically enables "go forward" and "go back" functionality for any slotted element's
5
+ // ".primary-action" child and ".secondary-action" child, respectively. If the
6
+ // dx-step-sequence has `animateTransitions` set to `true`, the transitions will auto-animate.
7
+ // Child component action buttons can still perform whatever actions they want before the
8
+ // step proceeds.
9
+ export default class StepSequenceStep extends LightningElement {
10
+ handleSlotChange(e: Event) {
11
+ const slot = e.target as HTMLSlotElement;
12
+ const rootElement = slot.assignedElements()[0];
13
+ const primaryActionElement = rootElement.querySelector(
14
+ ".primary-action"
15
+ ) as HTMLElement | undefined;
16
+ const secondaryActionElement = rootElement.querySelector(
17
+ ".secondary-action"
18
+ ) as HTMLElement | undefined;
19
+
20
+ if (primaryActionElement) {
21
+ const assignedOnClick = primaryActionElement.onclick;
22
+ primaryActionElement.onclick = (event: MouseEvent) => {
23
+ assignedOnClick?.call(primaryActionElement, event);
24
+ // Child elements can prevent the default "go forward" action.
25
+ if (!event.defaultPrevented) {
26
+ this.goForward();
27
+ }
28
+ };
29
+ }
30
+
31
+ if (secondaryActionElement) {
32
+ const assignedOnClick = secondaryActionElement.onclick;
33
+ secondaryActionElement.onclick = (event: MouseEvent) => {
34
+ assignedOnClick?.call(secondaryActionElement, event);
35
+ // Child elements can prevent the default "go back" action.
36
+ if (!event.defaultPrevented) {
37
+ this.goBack();
38
+ }
39
+ };
40
+ }
41
+ }
42
+
43
+ goForward() {
44
+ this.dispatchEvent(
45
+ new CustomEvent("stepincrement", {
46
+ bubbles: true,
47
+ composed: true
48
+ })
49
+ );
50
+ }
51
+
52
+ goBack() {
53
+ this.dispatchEvent(
54
+ new CustomEvent("stepdecrement", {
55
+ bubbles: true,
56
+ composed: true
57
+ })
58
+ );
59
+ }
60
+ }
@@ -53,7 +53,7 @@ export default class Toc extends LightningElement {
53
53
  sendGtm(e.currentTarget!, "custEv_tableOfContents", {
54
54
  click_text: text,
55
55
  clickAction: "click",
56
- click_url: href,
56
+ click_url: `${window.location.href}${href}`,
57
57
  element_title: this.title,
58
58
  element_type: "link",
59
59
  content_category: "cta"
@@ -174,7 +174,10 @@ export default class TreeItem extends LightningElement {
174
174
  private sendGtm(event: Event) {
175
175
  track(event.currentTarget!, "custEv_leftNavLinkClick", {
176
176
  click_text: this._treeNode.label,
177
- click_url: this.href,
177
+ click_url: this.href!.includes("/docs/")
178
+ ? `${window.location.origin}${this.href}`
179
+ : // TODO: this is a hack to get the correct url for the left nav
180
+ window.location.href.replace(/[^/]+$/, this.href!),
178
181
  nav_level: this._treeNode.level + 1,
179
182
  nav_item: this.treeLabels,
180
183
  nav_type: "left nav bar",
@@ -184,7 +187,10 @@ export default class TreeItem extends LightningElement {
184
187
  track(event.currentTarget!, "custEv_linkClick", {
185
188
  click_text: this._treeNode.label,
186
189
  element_title: this.rootParentLabel,
187
- click_url: this.href,
190
+ click_url: this.href!.includes("/docs/")
191
+ ? `${window.location.origin}${this.href}`
192
+ : // TODO: this is a hack to get the correct url for the left nav
193
+ window.location.href.replace(/[^/]+$/, this.href!),
188
194
  element_type: "link",
189
195
  content_category: "cta"
190
196
  });
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.