@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.
- package/package.json +2 -3
- 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/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.css +4 -3
- 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/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
|
|
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:
|
|
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,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
|
|
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 (
|
|
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 (
|
|
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
|
|