@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
@@ -11,18 +11,18 @@ import {
11
11
  } from "typings/custom";
12
12
  import { colorToDxColors, buildStyleColorVariables } from "dxUtils/css";
13
13
  import {
14
- CONTENT_TYPE_LABELS,
15
- CONTENT_TYPE_ICONS
16
- } from "dxConstants/contentTypes";
17
- import {
18
- getContentTypeColorScope,
19
14
  isContentType,
15
+ getContentTypeColorScope,
20
16
  getContentTypeColorVariables
21
17
  } from "dxUtils/contentTypes";
18
+ import {
19
+ CONTENT_TYPE_LABELS,
20
+ CONTENT_TYPE_ICONS
21
+ } from "dxConstants/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,19 +12,17 @@ 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
-
20
15
  const breakpointConfigs = [
21
16
  { name: DEVICE_MOBILE, query: BREAKPOINT_QUERY_MOBILE },
22
17
  { name: DEVICE_TABLET, query: BREAKPOINT_QUERY_TABLET },
23
18
  { name: DEVICE_DESKTOP, query: BREAKPOINT_QUERY_DESKTOP }
24
- ] as { name: DeviceType; query: string }[];
19
+ ];
25
20
 
26
21
  export abstract class MatchMediaElement extends LightningElement {
27
- private deviceType: DeviceType = DEVICE_DESKTOP;
22
+ private deviceType:
23
+ | DEVICE_MOBILE
24
+ | DEVICE_TABLET
25
+ | DEVICE_DESKTOP = DEVICE_DESKTOP;
28
26
  private matches: {
29
27
  match: MediaQueryList;
30
28
  callback: (e: MediaQueryListEvent | MediaQueryList) => void;
@@ -42,7 +40,7 @@ export abstract class MatchMediaElement extends LightningElement {
42
40
 
43
41
  connectedCallback() {
44
42
  this.matches = breakpointConfigs.map(
45
- ({ name, query }: { name: DeviceType; query: string }) => {
43
+ ({ name, query }: { name: string; query: string }) => {
46
44
  const match = window.matchMedia(query);
47
45
  const callback = (e: MediaQueryListEvent | MediaQueryList) => {
48
46
  if (e.matches) {
@@ -1,5 +1,3 @@
1
- import { Brand } from "typings/custom";
2
-
3
1
  export const BRANDS = [
4
2
  "employees",
5
3
  "marketing",
@@ -13,4 +11,4 @@ export const BRANDS = [
13
11
  "learning",
14
12
  "service",
15
13
  "analytics"
16
- ] as Brand[];
14
+ ];
@@ -57,4 +57,4 @@ export const CONTENT_TYPES = [
57
57
  "event",
58
58
  "website",
59
59
  "podcast"
60
- ] as ContentType[];
60
+ ];
@@ -1,10 +1,10 @@
1
1
  import { CONTENT_TYPES } from "dxConstants/contentTypes";
2
2
  import { BRANDS } from "dxConstants/brands";
3
- import { Brand, ContentType } from "typings/custom";
3
+ import { 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 Brand);
7
+ return BRANDS.includes(id as ContentType);
8
8
  };
9
9
 
10
10
  export const isContentType = (id: string): boolean => {
@@ -34,22 +34,16 @@ export function sortSplittedPostsByMonth(postsByMonth: any) {
34
34
  return 1;
35
35
  } else if (aYear > bYear) {
36
36
  return -1;
37
- } else if (
38
- MONTHS[aMonth as keyof typeof MONTHS] <
39
- MONTHS[bMonth as keyof typeof MONTHS]
40
- ) {
37
+ } else if (MONTHS[aMonth] < MONTHS[bMonth]) {
41
38
  return 1;
42
- } else if (
43
- MONTHS[aMonth as keyof typeof MONTHS] >
44
- MONTHS[bMonth as keyof typeof MONTHS]
45
- ) {
39
+ } else if (MONTHS[aMonth] > MONTHS[bMonth]) {
46
40
  return -1;
47
41
  }
48
42
  return 0;
49
43
  })
50
44
  .forEach((key) => {
51
45
  sortedPostsByMonth[key] = [
52
- ...postsByMonth[key].sort((a: any, b: any) => {
46
+ ...postsByMonth[key].sort((a, b) => {
53
47
  const aDate = new Date(a.date);
54
48
  const bDate = new Date(b.date);
55
49