@salesforcedevs/dx-components 1.3.170 → 1.3.171

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