@salesforcedevs/dx-components 1.3.223 → 1.3.224-alpha.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/dx-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.224-alpha.2",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -43,6 +43,5 @@
|
|
|
43
43
|
},
|
|
44
44
|
"volta": {
|
|
45
45
|
"node": "16.19.1"
|
|
46
|
-
}
|
|
47
|
-
"gitHead": "0a4fd810f3803ee837ebdb36dd194e973ce2f34e"
|
|
46
|
+
}
|
|
48
47
|
}
|
|
@@ -14,19 +14,25 @@ export default class MainContentHeader extends LightningElement {
|
|
|
14
14
|
@api imgSrcMobile!: string;
|
|
15
15
|
@api ctaTarget?: string | null = null;
|
|
16
16
|
@api ctaTargetSecondary?: string | null = null;
|
|
17
|
-
@api
|
|
18
|
-
@api
|
|
17
|
+
@api backgroundGradientColor?: string;
|
|
18
|
+
@api backgroundGradientDark: boolean = false;
|
|
19
19
|
@api hasSwoop: boolean = false;
|
|
20
20
|
|
|
21
21
|
private get style() {
|
|
22
22
|
return cx(
|
|
23
|
-
this.
|
|
24
|
-
|
|
23
|
+
this.backgroundGradientColor &&
|
|
24
|
+
!this.backgroundGradientDark &&
|
|
25
|
+
`background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #ffff 100%), var(--dx-g-${this.backgroundGradientColor});`,
|
|
26
|
+
this.backgroundGradientDark &&
|
|
27
|
+
`background: linear-gradient(90deg, var(--dx-g-indigo-vibrant-20) 0%, var(--dx-g-indigo-vibrant-30) 100%);`
|
|
25
28
|
);
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
private get textStyle() {
|
|
29
|
-
return cx(
|
|
32
|
+
return cx(
|
|
33
|
+
"text-container",
|
|
34
|
+
this.backgroundGradientDark && "light-text"
|
|
35
|
+
);
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
private onCtaClick(e: Event) {
|
|
@@ -8,6 +8,9 @@ import {
|
|
|
8
8
|
import { getContentTypeColorVariables } from "dxUtils/contentTypes";
|
|
9
9
|
import { pollUntil } from "dxUtils/async";
|
|
10
10
|
|
|
11
|
+
// Max height for breadcrumb without wrapping
|
|
12
|
+
const MAX_BREADCRUMB_HEIGHT = 16;
|
|
13
|
+
|
|
11
14
|
interface CoveoSearch {
|
|
12
15
|
state: typeof CoveoSDK.state;
|
|
13
16
|
get: typeof CoveoSDK.get;
|
|
@@ -141,10 +144,10 @@ const processParts = (parts: string[], internalFlag = false) => {
|
|
|
141
144
|
return parts.filter(filterFn).map((part) => {
|
|
142
145
|
// Remove special characters & .htm/.xml extension
|
|
143
146
|
part = part
|
|
144
|
-
.replace(/_/g, "
|
|
145
|
-
.replace(/-/g, "
|
|
146
|
-
.replace(/.html*/g, "
|
|
147
|
-
.replace(/.xml/g, "
|
|
147
|
+
.replace(/_/g, "")
|
|
148
|
+
.replace(/-/g, "")
|
|
149
|
+
.replace(/.html*/g, "")
|
|
150
|
+
.replace(/.xml/g, "")
|
|
148
151
|
.replace(/b2c/g, "B2C");
|
|
149
152
|
|
|
150
153
|
// Capitalize first letter of each word
|
|
@@ -367,17 +370,16 @@ export default class SearchResults extends LightningElement {
|
|
|
367
370
|
1000
|
|
368
371
|
);
|
|
369
372
|
|
|
370
|
-
this.processBreadcrumbs(
|
|
373
|
+
this.processBreadcrumbs(root);
|
|
371
374
|
|
|
372
375
|
window.onresize = () => this.processBreadcrumbs(root);
|
|
373
376
|
});
|
|
374
377
|
}
|
|
375
378
|
|
|
376
|
-
//
|
|
377
|
-
private isTextWrapping = (
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
) => elementOne.offsetHeight > elementTwo.offsetHeight;
|
|
379
|
+
// check if the breadcrumb is overflowing or not based on the height of a single character in the text element
|
|
380
|
+
private isTextWrapping = (element: HTMLElement) => {
|
|
381
|
+
return element.offsetHeight > MAX_BREADCRUMB_HEIGHT;
|
|
382
|
+
};
|
|
381
383
|
|
|
382
384
|
private truncateBreadcrumbText = (breadcrumbItems: HTMLElement[]) => {
|
|
383
385
|
breadcrumbItems.forEach((breadcrumbItem: HTMLElement) => {
|
|
@@ -396,12 +398,29 @@ export default class SearchResults extends LightningElement {
|
|
|
396
398
|
breadcrumb: HTMLElement
|
|
397
399
|
) => {
|
|
398
400
|
for (let i = 1; i < breadcrumbItems.length; i++) {
|
|
399
|
-
if (this.isTextWrapping(breadcrumb
|
|
400
|
-
|
|
401
|
+
if (this.isTextWrapping(breadcrumb)) {
|
|
402
|
+
// if the previous element is an ellipsis, make it empty (in order to avoid multiple grouped ellipsis)
|
|
403
|
+
if (breadcrumbItems[i - 1]?.textContent === "...") {
|
|
404
|
+
breadcrumbItems[i].innerHTML = "";
|
|
405
|
+
} else {
|
|
406
|
+
breadcrumbItems[i].textContent = "...";
|
|
407
|
+
}
|
|
401
408
|
} else {
|
|
402
409
|
break; // Exit the loop if the breadcrumb is no longer overflowing
|
|
403
410
|
}
|
|
404
411
|
}
|
|
412
|
+
|
|
413
|
+
// remove any empty breadcrumb items
|
|
414
|
+
breadcrumb.innerHTML = breadcrumb.innerHTML
|
|
415
|
+
.replace(
|
|
416
|
+
/ ?\/ +<span class="breadcrumb-item"><\/span> +\/ ?/g,
|
|
417
|
+
" / "
|
|
418
|
+
)
|
|
419
|
+
// when first loading the page on mobile, the breadcrumb items are not grouped correctly
|
|
420
|
+
.replace(
|
|
421
|
+
`<span class="breadcrumb-item">...</span> / <span class="breadcrumb-item">...</span>`,
|
|
422
|
+
`<span class="breadcrumb-item">...</span>`
|
|
423
|
+
);
|
|
405
424
|
};
|
|
406
425
|
|
|
407
426
|
private formatBreadcrumbs = (breadcrumbs: HTMLElement[]) => {
|
|
@@ -411,7 +430,7 @@ export default class SearchResults extends LightningElement {
|
|
|
411
430
|
breadcrumb.querySelectorAll(".breadcrumb-item");
|
|
412
431
|
|
|
413
432
|
// Check if the breadcrumb is overflowing by comparing it's height to the height of the first breadcrumb item
|
|
414
|
-
if (this.isTextWrapping(breadcrumb
|
|
433
|
+
if (this.isTextWrapping(breadcrumb)) {
|
|
415
434
|
// it is overflowing, so we need to truncate long titles to 30 characters
|
|
416
435
|
this.truncateBreadcrumbText(breadcrumbItems);
|
|
417
436
|
|
|
@@ -419,7 +438,7 @@ export default class SearchResults extends LightningElement {
|
|
|
419
438
|
this.addBreadcrumbEllipsis(breadcrumbItems, breadcrumb);
|
|
420
439
|
|
|
421
440
|
// After processing all breadcrumb items, if it's still overflowing, hide the breadcrumb element
|
|
422
|
-
if (this.isTextWrapping(breadcrumb
|
|
441
|
+
if (this.isTextWrapping(breadcrumb)) {
|
|
423
442
|
breadcrumb.style.display = "none";
|
|
424
443
|
}
|
|
425
444
|
}
|
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.
|