@salesforcedevs/dx-components 1.3.167 → 1.3.170

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 (36) hide show
  1. package/package.json +2 -3
  2. package/src/modules/dx/banner/banner.ts +1 -1
  3. package/src/modules/dx/brandThemeProvider/brandThemeProvider.ts +1 -1
  4. package/src/modules/dx/button/button.ts +2 -3
  5. package/src/modules/dx/cardContent/cardContent.ts +3 -1
  6. package/src/modules/dx/cardExpanded/cardExpanded.ts +10 -7
  7. package/src/modules/dx/cardNews/cardNews.ts +2 -2
  8. package/src/modules/dx/checkboxNative/checkboxNative.ts +1 -1
  9. package/src/modules/dx/codeBlock/codeBlock.ts +8 -8
  10. package/src/modules/dx/dropdown/dropdown.ts +5 -5
  11. package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +7 -7
  12. package/src/modules/dx/footer/footer.css +4 -3
  13. package/src/modules/dx/footer/footer.ts +6 -4
  14. package/src/modules/dx/footer/links.ts +5 -2
  15. package/src/modules/dx/footerOption/footerOption.ts +1 -1
  16. package/src/modules/dx/formattedDateTime/formattedDateTime.ts +9 -5
  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 +3 -1
  20. package/src/modules/dx/modal/modal.ts +3 -3
  21. package/src/modules/dx/relativeDateTime/relativeDateTime.ts +7 -5
  22. package/src/modules/dx/searchResults/searchResults.ts +3 -1
  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 +1 -0
  26. package/src/modules/dx/tabPanelItem/tabPanelItem.ts +1 -1
  27. package/src/modules/dx/tabPanelList/tabPanelList.ts +14 -12
  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 +8 -6
  31. package/src/modules/dxConstants/brands/brands.ts +3 -1
  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 +9 -3
  35. package/src/modules/dxUtils/prismjs/prismjs.ts +288 -167
  36. package/LICENSE +0 -12
@@ -10,19 +10,19 @@ import {
10
10
  TypeBadgeSize
11
11
  } from "typings/custom";
12
12
  import { colorToDxColors, buildStyleColorVariables } from "dxUtils/css";
13
- import {
14
- isContentType,
15
- getContentTypeColorScope,
16
- getContentTypeColorVariables
17
- } from "dxUtils/contentTypes";
18
13
  import {
19
14
  CONTENT_TYPE_LABELS,
20
15
  CONTENT_TYPE_ICONS
21
16
  } from "dxConstants/contentTypes";
17
+ import {
18
+ getContentTypeColorScope,
19
+ isContentType,
20
+ getContentTypeColorVariables
21
+ } from "dxUtils/contentTypes";
22
22
 
23
23
  export default class TypeBadge extends LightningElement {
24
24
  @api size: TypeBadgeSize = "default";
25
- @api variant?: Brand | ContentType = "default";
25
+ @api variant: Brand | ContentType = "default";
26
26
  @api color?: Color;
27
27
  @api dark?: false;
28
28
 
@@ -103,7 +103,7 @@ export default class TypeBadge extends LightningElement {
103
103
  }
104
104
  if (this.color) {
105
105
  const variables = colorToDxColors(this.color as Color);
106
- return buildStyleColorVariables(variables);
106
+ return buildStyleColorVariables(variables!);
107
107
  }
108
108
  return "";
109
109
  }
@@ -12,17 +12,19 @@ const BREAKPOINT_QUERY_MOBILE = `${boilerplate}(max-width: ${BREAKPOINT_MOBILE})
12
12
  const BREAKPOINT_QUERY_TABLET = `${boilerplate}(min-width: ${BREAKPOINT_MOBILE}) and (max-width: ${BREAKPOINT_TABLET})`;
13
13
  const BREAKPOINT_QUERY_DESKTOP = `${boilerplate}(min-width: ${BREAKPOINT_TABLET})`;
14
14
 
15
+ type DeviceType =
16
+ | typeof DEVICE_MOBILE
17
+ | typeof DEVICE_TABLET
18
+ | typeof DEVICE_DESKTOP;
19
+
15
20
  const breakpointConfigs = [
16
21
  { name: DEVICE_MOBILE, query: BREAKPOINT_QUERY_MOBILE },
17
22
  { name: DEVICE_TABLET, query: BREAKPOINT_QUERY_TABLET },
18
23
  { name: DEVICE_DESKTOP, query: BREAKPOINT_QUERY_DESKTOP }
19
- ];
24
+ ] as { name: DeviceType; query: string }[];
20
25
 
21
26
  export abstract class MatchMediaElement extends LightningElement {
22
- private deviceType:
23
- | DEVICE_MOBILE
24
- | DEVICE_TABLET
25
- | DEVICE_DESKTOP = DEVICE_DESKTOP;
27
+ private deviceType: DeviceType = DEVICE_DESKTOP;
26
28
  private matches: {
27
29
  match: MediaQueryList;
28
30
  callback: (e: MediaQueryListEvent | MediaQueryList) => void;
@@ -40,7 +42,7 @@ export abstract class MatchMediaElement extends LightningElement {
40
42
 
41
43
  connectedCallback() {
42
44
  this.matches = breakpointConfigs.map(
43
- ({ name, query }: { name: string; query: string }) => {
45
+ ({ name, query }: { name: DeviceType; query: string }) => {
44
46
  const match = window.matchMedia(query);
45
47
  const callback = (e: MediaQueryListEvent | MediaQueryList) => {
46
48
  if (e.matches) {
@@ -1,3 +1,5 @@
1
+ import { Brand } from "typings/custom";
2
+
1
3
  export const BRANDS = [
2
4
  "employees",
3
5
  "marketing",
@@ -11,4 +13,4 @@ export const BRANDS = [
11
13
  "learning",
12
14
  "service",
13
15
  "analytics"
14
- ];
16
+ ] as Brand[];
@@ -57,4 +57,4 @@ export const CONTENT_TYPES = [
57
57
  "event",
58
58
  "website",
59
59
  "podcast"
60
- ];
60
+ ] as ContentType[];
@@ -1,10 +1,10 @@
1
1
  import { CONTENT_TYPES } from "dxConstants/contentTypes";
2
2
  import { BRANDS } from "dxConstants/brands";
3
- import { ContentType } from "typings/custom";
3
+ import { Brand, ContentType } from "typings/custom";
4
4
  import { buildStyleColorVariables } from "dxUtils/css";
5
5
 
6
6
  export const isBrand = (id: string): boolean => {
7
- return BRANDS.includes(id as ContentType);
7
+ return BRANDS.includes(id as Brand);
8
8
  };
9
9
 
10
10
  export const isContentType = (id: string): boolean => {
@@ -34,16 +34,22 @@ export function sortSplittedPostsByMonth(postsByMonth: any) {
34
34
  return 1;
35
35
  } else if (aYear > bYear) {
36
36
  return -1;
37
- } else if (MONTHS[aMonth] < MONTHS[bMonth]) {
37
+ } else if (
38
+ MONTHS[aMonth as keyof typeof MONTHS] <
39
+ MONTHS[bMonth as keyof typeof MONTHS]
40
+ ) {
38
41
  return 1;
39
- } else if (MONTHS[aMonth] > MONTHS[bMonth]) {
42
+ } else if (
43
+ MONTHS[aMonth as keyof typeof MONTHS] >
44
+ MONTHS[bMonth as keyof typeof MONTHS]
45
+ ) {
40
46
  return -1;
41
47
  }
42
48
  return 0;
43
49
  })
44
50
  .forEach((key) => {
45
51
  sortedPostsByMonth[key] = [
46
- ...postsByMonth[key].sort((a, b) => {
52
+ ...postsByMonth[key].sort((a: any, b: any) => {
47
53
  const aDate = new Date(a.date);
48
54
  const bDate = new Date(b.date);
49
55