@salesforcedevs/dx-components 1.3.171 → 1.3.174
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 +2 -2
- package/src/modules/dx/banner/banner.ts +1 -1
- package/src/modules/dx/brandThemeProvider/brandThemeProvider.ts +1 -1
- package/src/modules/dx/button/button.ts +2 -3
- package/src/modules/dx/cardContent/cardContent.ts +3 -1
- package/src/modules/dx/cardExpanded/cardExpanded.ts +10 -7
- package/src/modules/dx/cardNews/cardNews.ts +2 -2
- package/src/modules/dx/cardSmall/cardSmall.css +0 -4
- package/src/modules/dx/checkboxNative/checkboxNative.ts +1 -1
- package/src/modules/dx/codeBlock/codeBlock.ts +8 -8
- package/src/modules/dx/dropdown/dropdown.ts +5 -5
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +7 -7
- package/src/modules/dx/footer/footer.ts +6 -4
- package/src/modules/dx/footer/links.ts +5 -2
- package/src/modules/dx/footerOption/footerOption.ts +1 -1
- package/src/modules/dx/formattedDateTime/formattedDateTime.ts +9 -5
- package/src/modules/dx/groupText/groupText.ts +1 -1
- package/src/modules/dx/headerMobileNavMenuOption/headerMobileNavMenuOption.ts +1 -1
- package/src/modules/dx/input/input.ts +3 -1
- package/src/modules/dx/modal/modal.ts +3 -3
- package/src/modules/dx/relativeDateTime/relativeDateTime.ts +7 -5
- package/src/modules/dx/searchResults/searchResults.ts +3 -1
- package/src/modules/dx/section/section.ts +1 -1
- package/src/modules/dx/sidebar/sidebar.ts +3 -3
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.ts +1 -0
- package/src/modules/dx/tabPanelItem/tabPanelItem.ts +1 -1
- package/src/modules/dx/tabPanelList/tabPanelList.ts +14 -12
- package/src/modules/dx/treeItem/treeItem.ts +3 -3
- package/src/modules/dx/typeBadge/typeBadge.ts +7 -7
- package/src/modules/dxBaseElements/matchMediaElement/matchMediaElement.ts +8 -6
- package/src/modules/dxConstants/brands/brands.ts +3 -1
- package/src/modules/dxConstants/contentTypes/contentTypes.ts +1 -1
- package/src/modules/dxUtils/contentTypes/contentTypes.ts +2 -2
- package/src/modules/dxUtils/dates/dates.ts +9 -3
- package/src/modules/dxUtils/prismjs/prismjs.ts +288 -167
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.174",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"eventsourcemock": "^2.0.0",
|
|
42
42
|
"luxon": "^3.1.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "4a3d0298cddcc57274c4d01158fe0696037b9cfa"
|
|
45
45
|
}
|
|
@@ -7,6 +7,6 @@ export default class Banner extends LightningElement {
|
|
|
7
7
|
|
|
8
8
|
renderedCallback() {
|
|
9
9
|
const container = this.template.querySelector(".info-container");
|
|
10
|
-
setContainerInnerHtml(container
|
|
10
|
+
setContainerInnerHtml(container!, this.bannerMarkup);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -33,7 +33,7 @@ export default class BrandThemeProvider extends LightningElement {
|
|
|
33
33
|
let style = this.template.querySelector("style");
|
|
34
34
|
if (!style) {
|
|
35
35
|
style = document.createElement("style");
|
|
36
|
-
this.template.appendChild(style);
|
|
36
|
+
(this.template as any).appendChild(style);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
if (style.firstChild) {
|
|
@@ -7,8 +7,7 @@ import {
|
|
|
7
7
|
ButtonSize,
|
|
8
8
|
IconSprite,
|
|
9
9
|
IconSize,
|
|
10
|
-
IconSymbol
|
|
11
|
-
LightningSlotElement
|
|
10
|
+
IconSymbol
|
|
12
11
|
} from "typings/custom";
|
|
13
12
|
|
|
14
13
|
export default class Button extends LightningElement {
|
|
@@ -63,7 +62,7 @@ export default class Button extends LightningElement {
|
|
|
63
62
|
);
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
private onSlotChange(e:
|
|
65
|
+
private onSlotChange(e: any) {
|
|
67
66
|
const slot = e.target;
|
|
68
67
|
this.isSlotEmpty = slot.assignedElements().length !== 0;
|
|
69
68
|
}
|
|
@@ -4,7 +4,7 @@ import { LightningSlotElement } from "typings/custom";
|
|
|
4
4
|
import { isSlotEmpty } from "dxUtils/slot";
|
|
5
5
|
import { toDxColor } from "dxUtils/css";
|
|
6
6
|
import { toJson } from "dxUtils/normalizers";
|
|
7
|
-
import
|
|
7
|
+
import ImageAndLabel from "dx/imageAndLabel";
|
|
8
8
|
|
|
9
9
|
export default class CardContent extends LightningElement {
|
|
10
10
|
@api backgroundColor?: string | null = null;
|
|
@@ -26,8 +26,10 @@ export default class CardContent extends LightningElement {
|
|
|
26
26
|
return this._authors!.map((author, index) => ({
|
|
27
27
|
...{
|
|
28
28
|
...author,
|
|
29
|
+
// @ts-ignore we're doing some hacky stuff to get at LWC internals here
|
|
29
30
|
href: author.href || this.getAuthorLink(author.name)
|
|
30
31
|
},
|
|
32
|
+
// @ts-ignore we're doing some hacky stuff to get at LWC internals here
|
|
31
33
|
imgSrc: author.image_src,
|
|
32
34
|
key: index
|
|
33
35
|
}));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { api } from "lwc";
|
|
2
2
|
import { ArchiveCard } from "dxBaseElements/archiveCard";
|
|
3
3
|
import cx from "classnames";
|
|
4
|
-
import ImageAndLabel from "../imageAndLabel";
|
|
5
4
|
import { toJson } from "dxUtils/normalizers";
|
|
5
|
+
import ImageAndLabel from "dx/imageAndLabel";
|
|
6
6
|
|
|
7
7
|
export default class ExpandedCard extends ArchiveCard {
|
|
8
8
|
@api body!: string;
|
|
@@ -12,11 +12,14 @@ export default class ExpandedCard extends ArchiveCard {
|
|
|
12
12
|
@api
|
|
13
13
|
get authors() {
|
|
14
14
|
if (this._authors && this._authors.length) {
|
|
15
|
-
return this._authors!.map(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
return this._authors!.map(
|
|
16
|
+
(author: ImageAndLabel, index: number) => ({
|
|
17
|
+
...author,
|
|
18
|
+
// @ts-ignore we're doing some hacky stuff to get at LWC internals here
|
|
19
|
+
imgSrc: !this.mobile ? author.image_src : "",
|
|
20
|
+
key: index
|
|
21
|
+
})
|
|
22
|
+
);
|
|
20
23
|
}
|
|
21
24
|
return undefined;
|
|
22
25
|
}
|
|
@@ -28,7 +31,7 @@ export default class ExpandedCard extends ArchiveCard {
|
|
|
28
31
|
);
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
|
-
private _authors?:
|
|
34
|
+
private _authors?: any;
|
|
32
35
|
|
|
33
36
|
private get isBlog(): boolean {
|
|
34
37
|
return this.contentType === "blog";
|
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
import { track } from "dxUtils/analytics";
|
|
13
13
|
|
|
14
14
|
export default class CardNews extends LightningElement {
|
|
15
|
-
@api backgroundColor
|
|
15
|
+
@api backgroundColor: string = "indigo-vibrant-40";
|
|
16
16
|
@api title!: string;
|
|
17
17
|
@api body!: string;
|
|
18
18
|
@api buttonText?: string = "";
|
|
19
19
|
@api buttonType!: CardNewsButtonType;
|
|
20
|
-
@api color
|
|
20
|
+
@api color: string = "white";
|
|
21
21
|
@api buttonColor?: ButtonTextColor = "dark";
|
|
22
22
|
@api dark?: boolean = false;
|
|
23
23
|
@api size?: CardNewsSize = "normal";
|
|
@@ -20,7 +20,7 @@ export default class CheckboxNative extends LightningElement {
|
|
|
20
20
|
return this._indeterminate;
|
|
21
21
|
}
|
|
22
22
|
set indeterminate(value: boolean) {
|
|
23
|
-
this.template.querySelector("input").indeterminate = value;
|
|
23
|
+
(this.template.querySelector("input")! as any).indeterminate = value;
|
|
24
24
|
this._indeterminate = value;
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { LightningElement, api, wire, track } from "lwc";
|
|
2
2
|
import { CodeBlockTheme, CodeBlockLanguage } from "typings/custom";
|
|
3
3
|
import cx from "classnames";
|
|
4
|
-
import Prism from "dxUtils/prismjs";
|
|
5
4
|
import {
|
|
6
5
|
getLocalStorageData,
|
|
7
6
|
setLocalStorageData
|
|
8
7
|
} from "@sfdocs-internal/wires";
|
|
9
8
|
import { track as gtmTrack } from "dxUtils/analytics";
|
|
9
|
+
import prism from "dxUtils/prismjs";
|
|
10
10
|
|
|
11
11
|
// Used por remove enclosing <pre> tag's (if occurs)
|
|
12
12
|
const preTagRegexp: RegExp = /^<pre.*?>(.*)<\/pre>$/is;
|
|
@@ -68,9 +68,10 @@ export default class CodeBlock extends LightningElement {
|
|
|
68
68
|
set codeBlock(value: string) {
|
|
69
69
|
this._codeBlockRendered = false;
|
|
70
70
|
let match;
|
|
71
|
-
this._codeBlock = (
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
this._codeBlock = (
|
|
72
|
+
(match = preTagRegexp.exec(value.trim())) === null
|
|
73
|
+
? value.trim()
|
|
74
|
+
: match[1]
|
|
74
75
|
).trim();
|
|
75
76
|
}
|
|
76
77
|
|
|
@@ -158,7 +159,7 @@ export default class CodeBlock extends LightningElement {
|
|
|
158
159
|
// eslint-disable-next-line
|
|
159
160
|
codeBlockEl.innerHTML = "";
|
|
160
161
|
codeBlockEl.appendChild(codeEl);
|
|
161
|
-
|
|
162
|
+
prism.highlightAllUnder(codeBlockEl);
|
|
162
163
|
// Italicize anything marked as a "variable" by the docs team
|
|
163
164
|
// eslint-disable-next-line
|
|
164
165
|
codeBlockEl.innerHTML = codeBlockEl.innerHTML.replace(
|
|
@@ -217,9 +218,8 @@ export default class CodeBlock extends LightningElement {
|
|
|
217
218
|
});
|
|
218
219
|
|
|
219
220
|
try {
|
|
220
|
-
const snippetContainer: HTMLElement | null =
|
|
221
|
-
".code-block-content"
|
|
222
|
-
);
|
|
221
|
+
const snippetContainer: HTMLElement | null =
|
|
222
|
+
this.template.querySelector(".code-block-content");
|
|
223
223
|
if (snippetContainer && snippetContainer.textContent) {
|
|
224
224
|
await navigator.clipboard.writeText(
|
|
225
225
|
snippetContainer.textContent
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
import { LightningElement, api, track } from "lwc";
|
|
8
8
|
import cx from "classnames";
|
|
9
9
|
import get from "lodash.get";
|
|
10
|
-
import { deepmapOptions } from "dxUtils/options";
|
|
11
10
|
import { toJson } from "dxUtils/normalizers";
|
|
11
|
+
import { deepmapOptions } from "dxUtils/options";
|
|
12
12
|
|
|
13
13
|
interface DropdownOption extends OptionWithNested {
|
|
14
14
|
// link that gets shown as a highlighted link at end of option group
|
|
@@ -19,6 +19,7 @@ interface DropdownOption extends OptionWithNested {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// @ts-ignore Dark Magic (TM) we are adding a custom getter to the 'role' property and tsc doesn't like that
|
|
22
23
|
export default class Dropdown extends LightningElement {
|
|
23
24
|
@api value: string | null = null; // "active option" id
|
|
24
25
|
@api valuePath: string = "id"; // path to match for the active value (useful for url matching)
|
|
@@ -121,7 +122,7 @@ export default class Dropdown extends LightningElement {
|
|
|
121
122
|
this.dispatchEvent(new CustomEvent("change", { detail: e.detail }));
|
|
122
123
|
}
|
|
123
124
|
if (!this.stayOpenAfterChange && this.popoverEl) {
|
|
124
|
-
this.popoverEl.closePopover();
|
|
125
|
+
(this.popoverEl as any).closePopover();
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
|
|
@@ -172,9 +173,8 @@ export default class Dropdown extends LightningElement {
|
|
|
172
173
|
? this.findOptionElementIndex(this.value)
|
|
173
174
|
: 0;
|
|
174
175
|
|
|
175
|
-
const optionToFocus: any =
|
|
176
|
-
defaultIndex < 0 ? 0 : defaultIndex
|
|
177
|
-
];
|
|
176
|
+
const optionToFocus: any =
|
|
177
|
+
this.optionsElements[defaultIndex < 0 ? 0 : defaultIndex];
|
|
178
178
|
if (optionToFocus) {
|
|
179
179
|
optionToFocus.focus();
|
|
180
180
|
this._focusedValue = optionToFocus.option.id;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import { LightningSlotElement } from "typings/custom";
|
|
4
3
|
import { isSlotEmpty } from "dxUtils/slot";
|
|
5
4
|
import { toJson } from "dxUtils/normalizers";
|
|
6
|
-
import { ImageAndLabel } from "../imageAndLabel";
|
|
7
5
|
import { track } from "dxUtils/analytics";
|
|
8
6
|
import svgs from "./svgs";
|
|
7
|
+
import ImageAndLabel from "dx/imageAndLabel";
|
|
9
8
|
|
|
10
9
|
export default class FeaturedContentHeader extends LightningElement {
|
|
11
10
|
@api label?: string | null = null;
|
|
@@ -27,7 +26,7 @@ export default class FeaturedContentHeader extends LightningElement {
|
|
|
27
26
|
@api target?: string | null = null;
|
|
28
27
|
@api title!: string;
|
|
29
28
|
@api backgroundImg?: string;
|
|
30
|
-
@api backgroundImgId
|
|
29
|
+
@api backgroundImgId:
|
|
31
30
|
| "trees"
|
|
32
31
|
| "codey"
|
|
33
32
|
| "blog"
|
|
@@ -53,6 +52,7 @@ export default class FeaturedContentHeader extends LightningElement {
|
|
|
53
52
|
if (this._authors && this._authors.length) {
|
|
54
53
|
return this._authors!.map((author, index) => ({
|
|
55
54
|
...author,
|
|
55
|
+
// @ts-ignore we're doing some hacky stuff to get at LWC internals here
|
|
56
56
|
imgSrc: author.image_src,
|
|
57
57
|
key: index
|
|
58
58
|
}));
|
|
@@ -119,7 +119,7 @@ export default class FeaturedContentHeader extends LightningElement {
|
|
|
119
119
|
this.isLinkHovered = false;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
private onSlotChange(e:
|
|
122
|
+
private onSlotChange(e: any): void {
|
|
123
123
|
this.isSlotEmpty = isSlotEmpty(e);
|
|
124
124
|
const slot = e.target;
|
|
125
125
|
const slotElements = slot.assignedElements();
|
|
@@ -177,13 +177,13 @@ export default class FeaturedContentHeader extends LightningElement {
|
|
|
177
177
|
renderedCallback(): void {
|
|
178
178
|
// Setting the svgs with innerHTML prevents their IDs from being rewritten
|
|
179
179
|
// which is necessary to preserve the svg masking and other effects
|
|
180
|
-
if (this.backgroundImgId &&
|
|
180
|
+
if (this.backgroundImgId && this.backgroundImgId in svgs) {
|
|
181
181
|
const bgSvg = this.template.querySelector(".bg-image-container");
|
|
182
182
|
if (bgSvg) {
|
|
183
183
|
// eslint-disable-next-line @lwc/lwc/no-inner-html
|
|
184
184
|
bgSvg.innerHTML = `
|
|
185
|
-
${svgs[this.backgroundImgId].desktop}
|
|
186
|
-
${svgs[this.backgroundImgId].mobile}
|
|
185
|
+
${svgs[this.backgroundImgId as keyof typeof svgs].desktop}
|
|
186
|
+
${svgs[this.backgroundImgId as keyof typeof svgs].mobile}
|
|
187
187
|
`;
|
|
188
188
|
}
|
|
189
189
|
}
|
|
@@ -16,7 +16,7 @@ export default class Footer extends LightningElement {
|
|
|
16
16
|
get locales() {
|
|
17
17
|
return this._locales;
|
|
18
18
|
}
|
|
19
|
-
set locales(value) {
|
|
19
|
+
set locales(value: OptionWithLink[] | string | null) {
|
|
20
20
|
this._locales = toJson(value);
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -31,7 +31,7 @@ export default class Footer extends LightningElement {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
private _generalLinks = defaultGeneralLinks;
|
|
34
|
-
private _locales
|
|
34
|
+
private _locales: OptionWithLink[] | null = null;
|
|
35
35
|
private _variant: FooterVariant = "small-signup";
|
|
36
36
|
private intellectualHref = intellectualHref;
|
|
37
37
|
private socialLinks = socialLinks;
|
|
@@ -71,7 +71,9 @@ export default class Footer extends LightningElement {
|
|
|
71
71
|
get localeLabel(): string | null {
|
|
72
72
|
let label = null;
|
|
73
73
|
if (this.locale && this.locales) {
|
|
74
|
-
const locale = this.locales.find(
|
|
74
|
+
const locale = (this.locales as OptionWithLink[]).find(
|
|
75
|
+
(l) => l.id === this.locale
|
|
76
|
+
);
|
|
75
77
|
label = locale ? locale.label : null;
|
|
76
78
|
}
|
|
77
79
|
return label;
|
|
@@ -107,7 +109,7 @@ export default class Footer extends LightningElement {
|
|
|
107
109
|
].includes(value);
|
|
108
110
|
}
|
|
109
111
|
|
|
110
|
-
private handleSignup(e:
|
|
112
|
+
private handleSignup(e: any) {
|
|
111
113
|
track(e.currentTarget, "custEv_ctaButtonClick", {
|
|
112
114
|
click_text: this.signupLabel,
|
|
113
115
|
click_url: `${window.location.origin}${this.signupPath}`,
|
|
@@ -142,8 +142,11 @@ export const intellectualHref =
|
|
|
142
142
|
"https://www.salesforce.com/company/legal/intellectual/";
|
|
143
143
|
|
|
144
144
|
const openOneTrustInfoDisplay = () => {
|
|
145
|
-
if (
|
|
146
|
-
window.OneTrust
|
|
145
|
+
if (
|
|
146
|
+
(window as any).OneTrust &&
|
|
147
|
+
(window as any).OneTrust.ToggleInfoDisplay
|
|
148
|
+
) {
|
|
149
|
+
(window as any).OneTrust.ToggleInfoDisplay();
|
|
147
150
|
}
|
|
148
151
|
};
|
|
149
152
|
|
|
@@ -8,7 +8,7 @@ export default class FooterOption extends LightningElement {
|
|
|
8
8
|
@api iconSymbol: string | null = null;
|
|
9
9
|
@api target: string | null = null;
|
|
10
10
|
|
|
11
|
-
sendGtm(e:
|
|
11
|
+
sendGtm(e: any) {
|
|
12
12
|
track(e.currentTarget, "custEv_bottomNavLinkClick", {
|
|
13
13
|
click_text: this.label || undefined,
|
|
14
14
|
click_url:
|
|
@@ -37,7 +37,10 @@ export default class FormattedDateTime extends LightningElement {
|
|
|
37
37
|
}
|
|
38
38
|
get value() {
|
|
39
39
|
const options = this.getOptions();
|
|
40
|
-
this._formattedDate = this.formatDate(
|
|
40
|
+
this._formattedDate = this.formatDate(
|
|
41
|
+
this._unformattedDate,
|
|
42
|
+
options as any
|
|
43
|
+
);
|
|
41
44
|
return this._formattedDate;
|
|
42
45
|
}
|
|
43
46
|
|
|
@@ -46,14 +49,15 @@ export default class FormattedDateTime extends LightningElement {
|
|
|
46
49
|
|
|
47
50
|
formatDate(unformattedDate: Date, options: formattedDateOptions) {
|
|
48
51
|
const locale = navigator.language;
|
|
49
|
-
let formattedDateTime = Intl.DateTimeFormat(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
let formattedDateTime = Intl.DateTimeFormat(
|
|
53
|
+
locale,
|
|
54
|
+
options as any
|
|
55
|
+
).format(unformattedDate) as string;
|
|
52
56
|
formattedDateTime = this.updateDayPeriodFormatting(formattedDateTime);
|
|
53
57
|
return formattedDateTime;
|
|
54
58
|
}
|
|
55
59
|
|
|
56
|
-
updateDayPeriodFormatting(formattedDateTime:
|
|
60
|
+
updateDayPeriodFormatting(formattedDateTime: string) {
|
|
57
61
|
if (formattedDateTime.includes("AM")) {
|
|
58
62
|
formattedDateTime = formattedDateTime.replace(" AM", "am");
|
|
59
63
|
} else if (formattedDateTime.includes("PM")) {
|
|
@@ -83,7 +83,7 @@ export default class GroupText extends LightningElement {
|
|
|
83
83
|
this.isSlotEmpty = isSlotEmpty(e);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
private trackClick(event:
|
|
86
|
+
private trackClick(event: any) {
|
|
87
87
|
track(event.target!, "custEv_ctaButtonClick", {
|
|
88
88
|
click_text: event.currentTarget.innerText,
|
|
89
89
|
item_title: event.currentTarget.innerText,
|
|
@@ -9,7 +9,7 @@ export default class HeaderMobileNavMenuOption extends LightningElement {
|
|
|
9
9
|
@api menuLabel: string | null = null;
|
|
10
10
|
@api itemLabel: string | null = null;
|
|
11
11
|
|
|
12
|
-
private sendGtm(e:
|
|
12
|
+
private sendGtm(e: any) {
|
|
13
13
|
track(e.currentTarget, "custEv_topNavLinkClick", {
|
|
14
14
|
navHeading: this.menuLabel || undefined,
|
|
15
15
|
navSubHeading: this.itemLabel || undefined,
|
|
@@ -18,6 +18,8 @@ const typeValidatorMap: ValidatorMap = {
|
|
|
18
18
|
errorMessage: "Enter valid email"
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
+
|
|
22
|
+
// @ts-ignore Dark Magic (TM): we have custom getters on aria-keyshortcuts that cause problems for typescript
|
|
21
23
|
export default class Input extends LightningElement {
|
|
22
24
|
@api ariaLabel!: string;
|
|
23
25
|
@api autocomplete: string | null = null;
|
|
@@ -173,7 +175,7 @@ export default class Input extends LightningElement {
|
|
|
173
175
|
this.input = <HTMLInputElement>this.template.querySelector("input");
|
|
174
176
|
}
|
|
175
177
|
const container = this.template.querySelector(".description");
|
|
176
|
-
setContainerInnerHtml(container
|
|
178
|
+
setContainerInnerHtml(container!, this.descriptionMarkup!);
|
|
177
179
|
}
|
|
178
180
|
|
|
179
181
|
onClick() {
|
|
@@ -43,11 +43,11 @@ export default class Modal extends LightningElement {
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
connectedCallback(): void {
|
|
47
47
|
document.addEventListener("keydown", this.handleKeyDown.bind(this));
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
disconnectedCallback(): void {
|
|
51
51
|
window.removeEventListener("keydown", this.handleKeyDown.bind(this));
|
|
52
52
|
this.modal?.remove();
|
|
53
53
|
this.overlay?.remove();
|
|
@@ -74,7 +74,7 @@ export default class Modal extends LightningElement {
|
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
private onClickModal(e) {
|
|
77
|
+
private onClickModal(e: any) {
|
|
78
78
|
if (e?.target?.className === OVERLAY_CLASS) {
|
|
79
79
|
this.closeModal();
|
|
80
80
|
}
|
|
@@ -17,9 +17,11 @@ export default class RelativeDateTime extends LightningElement {
|
|
|
17
17
|
this._selectedDateTime = new Date(value);
|
|
18
18
|
}
|
|
19
19
|
get value() {
|
|
20
|
-
const relativeDateTimeInHours = this.formatDate(
|
|
20
|
+
const relativeDateTimeInHours = this.formatDate(
|
|
21
|
+
this._selectedDateTime!
|
|
22
|
+
);
|
|
21
23
|
this._relativeDateTime = this.getRelativeDateTimeAsString(
|
|
22
|
-
this._selectedDateTime
|
|
24
|
+
this._selectedDateTime!,
|
|
23
25
|
relativeDateTimeInHours
|
|
24
26
|
);
|
|
25
27
|
return this._relativeDateTime;
|
|
@@ -28,8 +30,8 @@ export default class RelativeDateTime extends LightningElement {
|
|
|
28
30
|
return this._selectedDateTime;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
private _relativeDateTime
|
|
32
|
-
private _selectedDateTime
|
|
33
|
+
private _relativeDateTime?: string;
|
|
34
|
+
private _selectedDateTime?: Date;
|
|
33
35
|
|
|
34
36
|
formatDate(selectedDateTime: Date) {
|
|
35
37
|
const currentDateTime = new Date();
|
|
@@ -48,7 +50,7 @@ export default class RelativeDateTime extends LightningElement {
|
|
|
48
50
|
|
|
49
51
|
getRelativeDateTimeAsString(
|
|
50
52
|
selectedDateTime: Date,
|
|
51
|
-
relativeDateTimeInHours:
|
|
53
|
+
relativeDateTimeInHours: number
|
|
52
54
|
) {
|
|
53
55
|
const daysPast = Math.floor(+relativeDateTimeInHours / 24);
|
|
54
56
|
const weeksPast = Math.floor(+daysPast / 7);
|
|
@@ -18,6 +18,7 @@ interface CoveoSearch {
|
|
|
18
18
|
UnderscoreTemplate: typeof CoveoSDK.UnderscoreTemplate;
|
|
19
19
|
init: typeof CoveoSDK.init;
|
|
20
20
|
IQuerySuccessEventArgs: CoveoSDK.IQuerySuccessEventArgs;
|
|
21
|
+
TemplateHelpers: any;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
declare const Coveo: CoveoSearch;
|
|
@@ -68,7 +69,7 @@ const resultsTemplatesInnerHtml = `
|
|
|
68
69
|
</script>
|
|
69
70
|
`;
|
|
70
71
|
|
|
71
|
-
const buildTemplateHelperBadge = (value:
|
|
72
|
+
const buildTemplateHelperBadge = (value: keyof typeof CONTENT_TYPE_LABELS) => {
|
|
72
73
|
const style = getContentTypeColorVariables(value);
|
|
73
74
|
const label = CONTENT_TYPE_LABELS[value];
|
|
74
75
|
const { iconSprite, iconSymbol } = CONTENT_TYPE_ICONS[value];
|
|
@@ -87,6 +88,7 @@ const buildTemplateHelperBadge = (value: string) => {
|
|
|
87
88
|
`;
|
|
88
89
|
};
|
|
89
90
|
|
|
91
|
+
// @ts-ignore Dark Magic (TM) we are overriding the 'title' field with a custom getter. We should really stop doing this.
|
|
90
92
|
export default class SearchResults extends LightningElement {
|
|
91
93
|
@api coveoOrganizationId!: string;
|
|
92
94
|
@api coveoPublicAccessToken!: string;
|
|
@@ -11,7 +11,7 @@ export default class Section extends LightningElement {
|
|
|
11
11
|
@api subtitle?: string;
|
|
12
12
|
@api subtitleLevel?: "1" | "2" | "3" | "4" = "1";
|
|
13
13
|
@api textAlign: "center" | "left" = "left";
|
|
14
|
-
@api title
|
|
14
|
+
@api title!: string;
|
|
15
15
|
@api ctaLabel?: string;
|
|
16
16
|
@api ctaHref?: string;
|
|
17
17
|
@api ctaBtnVariant?: string;
|
|
@@ -252,8 +252,8 @@ export default class Sidebar extends SidebarBase {
|
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
private onItemsFocused(): void {
|
|
255
|
-
|
|
256
|
-
.querySelector("dx-sidebar-search")
|
|
257
|
-
|
|
255
|
+
(
|
|
256
|
+
this.template.querySelector("dx-sidebar-search") as any
|
|
257
|
+
)?.requestOpenDropdown(false);
|
|
258
258
|
}
|
|
259
259
|
}
|
|
@@ -13,6 +13,7 @@ const toChunks = (value: string, highlights: CoveoHighlights) => {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
let endIndex = 0;
|
|
16
|
+
// @ts-ignore Dark Magic (TM)
|
|
16
17
|
return highlights.reduce((acc, { length, offset }, i) => {
|
|
17
18
|
const plainValue = value.slice(endIndex, offset);
|
|
18
19
|
const plainChunk = {
|
|
@@ -70,8 +70,8 @@ export default class TabPanelList extends LightningElement {
|
|
|
70
70
|
this.activeIndex = e.detail;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
private onDropdownItemClick(e:
|
|
74
|
-
this.onTabClick({ detail: +e.currentTarget
|
|
73
|
+
private onDropdownItemClick(e: any) {
|
|
74
|
+
this.onTabClick({ detail: +e.currentTarget.dataset.value });
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
private onSlotChange(e: Event) {
|
|
@@ -81,13 +81,15 @@ export default class TabPanelList extends LightningElement {
|
|
|
81
81
|
|
|
82
82
|
private updateTabs() {
|
|
83
83
|
if (this.tabSlotPanels) {
|
|
84
|
-
this.tabSlotPanels
|
|
85
|
-
|
|
86
|
-
tabPanel
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
this.tabSlotPanels
|
|
85
|
+
.assignedElements()
|
|
86
|
+
.forEach((tabPanel: any, index) => {
|
|
87
|
+
tabPanel.index = index;
|
|
88
|
+
tabPanel.groupId = this.groupId;
|
|
89
|
+
tabPanel.active = this.activeIndex === index;
|
|
90
|
+
});
|
|
89
91
|
}
|
|
90
|
-
this.tabElements.forEach((tab, index) => {
|
|
92
|
+
this.tabElements.forEach((tab: any, index) => {
|
|
91
93
|
tab.active = this.activeIndex === index;
|
|
92
94
|
});
|
|
93
95
|
}
|
|
@@ -123,8 +125,8 @@ export default class TabPanelList extends LightningElement {
|
|
|
123
125
|
"dx-tab-panel-item:not(.more-btn-container)"
|
|
124
126
|
);
|
|
125
127
|
const moreBtn = this.template.querySelector(".more-btn-container")!;
|
|
126
|
-
const containerWidth =
|
|
127
|
-
.offsetWidth;
|
|
128
|
+
const containerWidth =
|
|
129
|
+
this.template.querySelector(".tablist")!.offsetWidth;
|
|
128
130
|
let stopWidth = this.template.querySelector(
|
|
129
131
|
"dx-tab-panel-item.more-btn-container"
|
|
130
132
|
)!.offsetWidth;
|
|
@@ -153,12 +155,12 @@ export default class TabPanelList extends LightningElement {
|
|
|
153
155
|
};
|
|
154
156
|
|
|
155
157
|
private addListeners() {
|
|
156
|
-
this.template.addEventListener("keydown", this.onKeydown);
|
|
158
|
+
this.template.addEventListener("keydown", this.onKeydown as any);
|
|
157
159
|
window.addEventListener("resize", this.onResize.bind(this));
|
|
158
160
|
}
|
|
159
161
|
|
|
160
162
|
private removeListeners() {
|
|
161
|
-
this.template.removeEventListener("keydown", this.onKeydown);
|
|
163
|
+
this.template.removeEventListener("keydown", this.onKeydown as any);
|
|
162
164
|
window.removeEventListener("resize", this.onResize.bind(this));
|
|
163
165
|
}
|
|
164
166
|
}
|
|
@@ -50,9 +50,9 @@ export default class TreeItem extends LightningElement {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
private get treeLabels(): string {
|
|
53
|
-
let parentEl =
|
|
54
|
-
.querySelector("dx-tree-tile")
|
|
55
|
-
|
|
53
|
+
let parentEl = (
|
|
54
|
+
this.template.querySelector("dx-tree-tile")?.getRootNode() as any
|
|
55
|
+
).host;
|
|
56
56
|
|
|
57
57
|
if (!parentEl) {
|
|
58
58
|
return "";
|