@salesforcedevs/dx-components 0.0.0-alpha.3 → 0.0.0-alpha.30
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/lwc.config.json +5 -1
- package/package.json +1 -1
- package/src/assets/icons/salesforcebrand-sprite/svg/symbols.svg +40 -0
- package/src/assets/svg/big-moon.svg +1 -0
- package/src/assets/svg/blue-circle.svg +3 -0
- package/src/assets/svg/trial-left.svg +6 -0
- package/src/assets/svg/trial-right.svg +26 -0
- package/src/modules/dx/banner/banner.ts +1 -1
- package/src/modules/dx/button/button.css +4 -8
- package/src/modules/dx/buttonToggle/buttonToggle.html +3 -2
- package/src/modules/dx/buttonToggle/buttonToggle.ts +25 -16
- package/src/modules/dx/cardEvent/cardEvent.html +1 -2
- package/src/modules/dx/cardEvent/cardEvent.ts +1 -1
- package/src/modules/dx/cardExpanded/cardExpanded.html +1 -6
- package/src/modules/dx/cardExpanded/cardExpanded.ts +2 -2
- package/src/modules/dx/cardMinimal/cardMinimal.html +1 -6
- package/src/modules/dx/cardTrial/cardTrial.css +9 -5
- package/src/modules/dx/cardTrial/cardTrial.ts +2 -1
- package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.css +10 -2
- package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.html +15 -2
- package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.ts +1 -1
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.css +60 -2
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.html +8 -0
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +13 -1
- package/src/modules/dx/featuresList/featuresList.css +1 -1
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.css +1 -0
- package/src/modules/dx/headerSearch/headerSearch.html +2 -0
- package/src/modules/dx/headerSearch/headerSearch.ts +1 -0
- package/src/modules/dx/hr/hr.css +2 -3
- package/src/modules/dx/imageAndLabel/imageAndLabel.css +0 -1
- package/src/modules/dx/input/input.ts +2 -0
- package/src/modules/dx/logo/logo.css +0 -1
- package/src/modules/dx/metadataBadge/metadataBadge.css +41 -0
- package/src/modules/dx/metadataBadge/metadataBadge.html +5 -0
- package/src/modules/dx/metadataBadge/metadataBadge.ts +24 -0
- package/src/modules/dx/modal/modal.css +6 -0
- package/src/modules/dx/modal/modal.html +2 -2
- package/src/modules/dx/modal/modal.ts +24 -1
- package/src/modules/dx/modalDrawer/modalDrawer.html +2 -2
- package/src/modules/dx/modalDrawer/modalDrawer.ts +7 -1
- package/src/modules/dx/pagination/pagination.css +1 -2
- package/src/modules/dx/section/section.css +10 -1
- package/src/modules/dx/section/section.ts +1 -1
- package/src/modules/dx/sidebarSearch/sidebarSearch.html +1 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +1 -0
- package/src/modules/dx/tab/tab.css +0 -4
- package/src/modules/dx/tabPanel/tabPanel.css +1 -4
- package/src/modules/dx/tabPanelItem/tabPanelItem.css +0 -4
- package/src/modules/dx/tabPanelItem/tabPanelItem.html +1 -1
- package/src/modules/dx/tabPanelList/tabPanelList.css +5 -7
- package/src/modules/dx/treeItem/treeItem.html +1 -0
- package/src/modules/dx/treeTile/treeTile.css +17 -17
- package/src/modules/dx/treeTile/treeTile.html +5 -4
- package/src/modules/dx/treeTile/treeTile.ts +17 -3
- package/src/modules/dx/typeBadge/typeBadge.css +15 -56
- package/src/modules/dx/typeBadge/typeBadge.html +6 -0
- package/src/modules/dx/typeBadge/typeBadge.ts +142 -46
- package/src/modules/dxBaseElements/archiveCard/archiveCard.ts +2 -6
- package/src/modules/dxBaseElements/headerBase/headerBase.ts +1 -1
- package/src/modules/dxConstants/brands/brands.ts +14 -0
- package/src/modules/dxConstants/colors/colors.ts +14 -0
- package/src/modules/dxConstants/contentTypes/contentTypes.ts +10 -0
- package/src/modules/dxHelpers/card/card.css +1 -1
- package/src/modules/dxHelpers/commonHeader/commonHeader.css +0 -1
- package/src/modules/dxUtils/css/css.ts +10 -0
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.css +0 -12
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.html +0 -11
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.ts +0 -18
|
@@ -1,65 +1,161 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
Brand,
|
|
5
5
|
Color,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
ContentType,
|
|
7
|
+
IconSprite,
|
|
8
|
+
IconSymbol,
|
|
9
|
+
TypeBadgeSize
|
|
9
10
|
} from "typings/custom";
|
|
10
|
-
import { colorToDxColors } from "dxUtils/css";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
import { colorToDxColors, buildStyleColorVariables } from "dxUtils/css";
|
|
12
|
+
import { BRANDS } from "dxConstants/brands";
|
|
13
|
+
import { CONTENT_TYPES } from "dxConstants/contentTypes";
|
|
14
|
+
|
|
15
|
+
const contentTypeLabels = {
|
|
16
|
+
documentation: "Documentation",
|
|
17
|
+
trailhead: "Trailhead",
|
|
18
|
+
blog: "Blog",
|
|
19
|
+
forum: "Forum",
|
|
20
|
+
api: "API",
|
|
21
|
+
event: "Event",
|
|
22
|
+
website: "Website",
|
|
23
|
+
podcast: "Podcast"
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type IconData = {
|
|
27
|
+
iconSymbol: IconSymbol;
|
|
28
|
+
iconSprite: IconSprite;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const contentTypeIcons: {
|
|
32
|
+
[K in ContentType]: IconData;
|
|
33
|
+
} = {
|
|
34
|
+
documentation: {
|
|
35
|
+
iconSprite: "utility",
|
|
36
|
+
iconSymbol: "knowledge_base"
|
|
37
|
+
},
|
|
38
|
+
trailhead: {
|
|
39
|
+
iconSprite: "salesforcebrand",
|
|
40
|
+
iconSymbol: "learning"
|
|
41
|
+
},
|
|
42
|
+
blog: {
|
|
43
|
+
iconSprite: "utility",
|
|
44
|
+
iconSymbol: "comments"
|
|
45
|
+
},
|
|
46
|
+
forum: {
|
|
47
|
+
iconSprite: "general",
|
|
48
|
+
iconSymbol: "question-circle"
|
|
49
|
+
},
|
|
50
|
+
api: {
|
|
51
|
+
iconSprite: "utility",
|
|
52
|
+
iconSymbol: "settings"
|
|
53
|
+
},
|
|
54
|
+
event: {
|
|
55
|
+
iconSprite: "utility",
|
|
56
|
+
iconSymbol: "event"
|
|
57
|
+
},
|
|
58
|
+
website: {
|
|
59
|
+
iconSprite: "utility",
|
|
60
|
+
iconSymbol: "home"
|
|
61
|
+
},
|
|
62
|
+
podcast: {
|
|
63
|
+
iconSprite: "utility",
|
|
64
|
+
iconSymbol: "unmuted"
|
|
65
|
+
}
|
|
66
|
+
};
|
|
27
67
|
|
|
28
68
|
export default class TypeBadge extends LightningElement {
|
|
29
69
|
@api size: TypeBadgeSize = "default";
|
|
30
|
-
@api
|
|
31
|
-
@api color?:
|
|
32
|
-
|
|
70
|
+
@api variant?: Brand | ContentType = "default";
|
|
71
|
+
@api color?: Color;
|
|
72
|
+
|
|
73
|
+
@api
|
|
74
|
+
get iconSymbol(): IconSymbol | undefined {
|
|
75
|
+
return this.variantIconData
|
|
76
|
+
? this.variantIconData.iconSymbol
|
|
77
|
+
: this._iconSymbol;
|
|
78
|
+
}
|
|
79
|
+
set iconSymbol(value: IconSymbol | undefined) {
|
|
80
|
+
if (value) {
|
|
81
|
+
this._iconSymbol = value;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@api
|
|
86
|
+
get iconSprite(): IconSprite | undefined {
|
|
87
|
+
return this.variantIconData
|
|
88
|
+
? this.variantIconData.iconSprite
|
|
89
|
+
: this._iconSprite;
|
|
90
|
+
}
|
|
91
|
+
set iconSprite(value: IconSprite | undefined) {
|
|
92
|
+
if (value) {
|
|
93
|
+
this._iconSprite = value;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@api
|
|
98
|
+
get value(): string {
|
|
99
|
+
return this._value || this.variantLabel || "";
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
set value(value) {
|
|
103
|
+
if (value) {
|
|
104
|
+
this._value = value;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private _value?: string;
|
|
109
|
+
private _iconSprite?: IconSprite;
|
|
110
|
+
private _iconSymbol?: IconSymbol;
|
|
111
|
+
|
|
112
|
+
private get variantIconData(): IconData | null {
|
|
113
|
+
if (this.variant && this.variant in contentTypeIcons) {
|
|
114
|
+
return contentTypeIcons[this.variant as ContentType];
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private get variantLabel(): string | null {
|
|
120
|
+
if (this.isContentType) {
|
|
121
|
+
return contentTypeLabels[this.variant as ContentType];
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private get variantColorScope(): string | null {
|
|
127
|
+
if (this.isContentType) {
|
|
128
|
+
return "content-type";
|
|
129
|
+
}
|
|
130
|
+
if (this.isBrand) {
|
|
131
|
+
return "brand";
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private get isContentType(): boolean {
|
|
137
|
+
return CONTENT_TYPES.includes(this.variant as ContentType);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
private get isBrand(): boolean {
|
|
141
|
+
return BRANDS.includes(this.variant as ContentType);
|
|
142
|
+
}
|
|
33
143
|
|
|
34
144
|
private get className(): string {
|
|
35
|
-
return cx(
|
|
36
|
-
"typebadge",
|
|
37
|
-
`size-${this.size}`,
|
|
38
|
-
(this.type && `typebadge_${this.type}`) || DEFAULT_TYPE
|
|
39
|
-
);
|
|
145
|
+
return cx("badge", `size-${this.size}`);
|
|
40
146
|
}
|
|
41
147
|
|
|
42
148
|
private get style(): string {
|
|
43
|
-
if (
|
|
44
|
-
return
|
|
45
|
-
background: `--dx-g
|
|
46
|
-
color: `--dx-g
|
|
149
|
+
if (this.variantColorScope) {
|
|
150
|
+
return buildStyleColorVariables({
|
|
151
|
+
background: `--dx-g-${this.variantColorScope}-${this.variant}-color-background`,
|
|
152
|
+
color: `--dx-g-${this.variantColorScope}-${this.variant}-color`
|
|
47
153
|
});
|
|
48
154
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return
|
|
155
|
+
if (this.color) {
|
|
156
|
+
const variables = colorToDxColors(this.color as Color);
|
|
157
|
+
return buildStyleColorVariables(variables);
|
|
52
158
|
}
|
|
53
159
|
return "";
|
|
54
160
|
}
|
|
55
|
-
|
|
56
|
-
private buildStyleString({
|
|
57
|
-
background,
|
|
58
|
-
color
|
|
59
|
-
}: {
|
|
60
|
-
background: string;
|
|
61
|
-
color: string;
|
|
62
|
-
}): string {
|
|
63
|
-
return `--color: var(${color}); --background: var(${background})`;
|
|
64
|
-
}
|
|
65
161
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
|
-
import { LinkTarget,
|
|
2
|
+
import { LinkTarget, ContentType } from "typings/custom";
|
|
3
3
|
|
|
4
4
|
const MOBILE_QUERY = "(max-width: 640px)";
|
|
5
5
|
|
|
6
6
|
export abstract class ArchiveCard extends LightningElement {
|
|
7
|
-
@api contentType
|
|
7
|
+
@api contentType!: ContentType;
|
|
8
8
|
@api href!: string;
|
|
9
9
|
@api title!: string;
|
|
10
10
|
@api target: LinkTarget = "_self";
|
|
@@ -12,10 +12,6 @@ export abstract class ArchiveCard extends LightningElement {
|
|
|
12
12
|
private matchMedia!: MediaQueryList;
|
|
13
13
|
protected mobile = false;
|
|
14
14
|
|
|
15
|
-
protected get badgeColor(): Color {
|
|
16
|
-
return this.contentType === "Blog" ? "teal" : "blue";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
15
|
connectedCallback(): void {
|
|
20
16
|
this.matchMedia = window.matchMedia(MOBILE_QUERY);
|
|
21
17
|
this.onMediaChange(this.matchMedia);
|
|
@@ -42,7 +42,7 @@ export abstract class HeaderBase extends LightningElement {
|
|
|
42
42
|
@api title: string = "Salesforce";
|
|
43
43
|
@api version?: string | null = null;
|
|
44
44
|
@api bannerMarkup =
|
|
45
|
-
'<span><a href="https://forms.gle/oWYTbH9RvGyt9uxx7" target="blank">
|
|
45
|
+
'Thank you for visiting the Salesforce Developers website! <span><a href="https://forms.gle/oWYTbH9RvGyt9uxx7" target="blank">We value your feedback</a></span>';
|
|
46
46
|
|
|
47
47
|
@api
|
|
48
48
|
get navItems() {
|
|
@@ -170,7 +170,7 @@ a.dx-card-base:hover a.dx-card-base_borderless-image_link {
|
|
|
170
170
|
dx-card-title:hover,
|
|
171
171
|
.dx-card-base_link-hovered dx-card-title,
|
|
172
172
|
a.dx-card-base:hover dx-card-title {
|
|
173
|
-
--dx-c-card-title-color: var(--dx-g-
|
|
173
|
+
--dx-c-card-title-color: var(--dx-g-blue-vibrant-50);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
/* Line Limits */
|
|
@@ -41,3 +41,13 @@ export const colorToDxColors = (
|
|
|
41
41
|
|
|
42
42
|
export const toDxColor = (color: string) =>
|
|
43
43
|
["white", "transparent"].includes(color) ? color : `var(--dx-g-${color})`;
|
|
44
|
+
|
|
45
|
+
export const buildStyleColorVariables = ({
|
|
46
|
+
background,
|
|
47
|
+
color
|
|
48
|
+
}: {
|
|
49
|
+
background: string;
|
|
50
|
+
color: string;
|
|
51
|
+
}): string => {
|
|
52
|
+
return `--color: var(${color}); --background: var(${background})`;
|
|
53
|
+
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { LightningElement, api } from "lwc";
|
|
2
|
-
import { normalizeToArray } from "dxUtils/normalizers";
|
|
3
|
-
import { TypeBadgeSize } from "typings/custom";
|
|
4
|
-
|
|
5
|
-
export default class TypeBadgeGroup extends LightningElement {
|
|
6
|
-
@api size: TypeBadgeSize = "medium";
|
|
7
|
-
|
|
8
|
-
@api
|
|
9
|
-
get badges() {
|
|
10
|
-
return this._badges;
|
|
11
|
-
}
|
|
12
|
-
set badges(value: string[] | string | null) {
|
|
13
|
-
this._badges = normalizeToArray(value);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// can be an array of strings or a comma delimited string
|
|
17
|
-
private _badges!: string | string[] | null;
|
|
18
|
-
}
|