@salesforcedevs/dx-components 1.3.39-alpha → 1.3.42

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/LICENSE ADDED
@@ -0,0 +1,12 @@
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.3.39-alpha",
3
+ "version": "1.3.42",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -39,5 +39,6 @@
39
39
  "@types/vimeo__player": "^2.16.2",
40
40
  "eventsourcemock": "^2.0.0",
41
41
  "luxon": "^3.1.0"
42
- }
42
+ },
43
+ "gitHead": "a5ddc2bf9e25ef6d9c937086335387a23f647e91"
43
44
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div class="container">
3
- <div class="text-container" style={style}>
2
+ <div class="container" style={style}>
3
+ <div class="text-container">
4
4
  <h1 class="heading dx-text-heading-2">{title}</h1>
5
5
  <span class="body dx-text-body-1">{body}</span>
6
6
  <span if:true={subtitle} class="subtitle dx-text-heading-4b">
@@ -1,4 +1,5 @@
1
1
  import { LightningElement, api } from "lwc";
2
+ import cx from "classnames";
2
3
  import { track } from "dxUtils/analytics";
3
4
 
4
5
  export default class MainContentHeader extends LightningElement {
@@ -10,6 +11,14 @@ export default class MainContentHeader extends LightningElement {
10
11
  @api imgSrc!: string;
11
12
  @api imgSrcMobile!: string;
12
13
  @api ctaTarget?: string | null = null;
14
+ @api backgroundGradientColor?: string;
15
+
16
+ private get style() {
17
+ return cx(
18
+ this.backgroundGradientColor &&
19
+ `background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #ffff 100%), var(--dx-g-${this.backgroundGradientColor});`
20
+ );
21
+ }
13
22
 
14
23
  private onCtaClick(e: Event) {
15
24
  if (e.currentTarget) {
@@ -97,10 +97,18 @@ export default class TreeItem extends LightningElement {
97
97
  this.sendGtm(event);
98
98
  }
99
99
 
100
- private onLinkClick(event: Event): void {
101
- if (!(this._treeNode.link && this._treeNode.link.href)) {
100
+ private preventDefaultLinkBehavior(event: Event) {
101
+ // prevent page refresh if href isn't present or link is already active
102
+ if (
103
+ !this._treeNode.link?.href ||
104
+ this._treeNode.link?.href === window.location.pathname
105
+ ) {
102
106
  event.preventDefault();
103
107
  }
108
+ }
109
+
110
+ private onLinkClick(event: Event): void {
111
+ this.preventDefaultLinkBehavior(event);
104
112
 
105
113
  if (this.isParent) {
106
114
  const isSelectAction = true;