@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.
Files changed (68) hide show
  1. package/lwc.config.json +5 -1
  2. package/package.json +1 -1
  3. package/src/assets/icons/salesforcebrand-sprite/svg/symbols.svg +40 -0
  4. package/src/assets/svg/big-moon.svg +1 -0
  5. package/src/assets/svg/blue-circle.svg +3 -0
  6. package/src/assets/svg/trial-left.svg +6 -0
  7. package/src/assets/svg/trial-right.svg +26 -0
  8. package/src/modules/dx/banner/banner.ts +1 -1
  9. package/src/modules/dx/button/button.css +4 -8
  10. package/src/modules/dx/buttonToggle/buttonToggle.html +3 -2
  11. package/src/modules/dx/buttonToggle/buttonToggle.ts +25 -16
  12. package/src/modules/dx/cardEvent/cardEvent.html +1 -2
  13. package/src/modules/dx/cardEvent/cardEvent.ts +1 -1
  14. package/src/modules/dx/cardExpanded/cardExpanded.html +1 -6
  15. package/src/modules/dx/cardExpanded/cardExpanded.ts +2 -2
  16. package/src/modules/dx/cardMinimal/cardMinimal.html +1 -6
  17. package/src/modules/dx/cardTrial/cardTrial.css +9 -5
  18. package/src/modules/dx/cardTrial/cardTrial.ts +2 -1
  19. package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.css +10 -2
  20. package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.html +15 -2
  21. package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.ts +1 -1
  22. package/src/modules/dx/featuredContentHeader/featuredContentHeader.css +60 -2
  23. package/src/modules/dx/featuredContentHeader/featuredContentHeader.html +8 -0
  24. package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +13 -1
  25. package/src/modules/dx/featuresList/featuresList.css +1 -1
  26. package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.css +1 -0
  27. package/src/modules/dx/headerSearch/headerSearch.html +2 -0
  28. package/src/modules/dx/headerSearch/headerSearch.ts +1 -0
  29. package/src/modules/dx/hr/hr.css +2 -3
  30. package/src/modules/dx/imageAndLabel/imageAndLabel.css +0 -1
  31. package/src/modules/dx/input/input.ts +2 -0
  32. package/src/modules/dx/logo/logo.css +0 -1
  33. package/src/modules/dx/metadataBadge/metadataBadge.css +41 -0
  34. package/src/modules/dx/metadataBadge/metadataBadge.html +5 -0
  35. package/src/modules/dx/metadataBadge/metadataBadge.ts +24 -0
  36. package/src/modules/dx/modal/modal.css +6 -0
  37. package/src/modules/dx/modal/modal.html +2 -2
  38. package/src/modules/dx/modal/modal.ts +24 -1
  39. package/src/modules/dx/modalDrawer/modalDrawer.html +2 -2
  40. package/src/modules/dx/modalDrawer/modalDrawer.ts +7 -1
  41. package/src/modules/dx/pagination/pagination.css +1 -2
  42. package/src/modules/dx/section/section.css +10 -1
  43. package/src/modules/dx/section/section.ts +1 -1
  44. package/src/modules/dx/sidebarSearch/sidebarSearch.html +1 -0
  45. package/src/modules/dx/sidebarSearch/sidebarSearch.ts +1 -0
  46. package/src/modules/dx/tab/tab.css +0 -4
  47. package/src/modules/dx/tabPanel/tabPanel.css +1 -4
  48. package/src/modules/dx/tabPanelItem/tabPanelItem.css +0 -4
  49. package/src/modules/dx/tabPanelItem/tabPanelItem.html +1 -1
  50. package/src/modules/dx/tabPanelList/tabPanelList.css +5 -7
  51. package/src/modules/dx/treeItem/treeItem.html +1 -0
  52. package/src/modules/dx/treeTile/treeTile.css +17 -17
  53. package/src/modules/dx/treeTile/treeTile.html +5 -4
  54. package/src/modules/dx/treeTile/treeTile.ts +17 -3
  55. package/src/modules/dx/typeBadge/typeBadge.css +15 -56
  56. package/src/modules/dx/typeBadge/typeBadge.html +6 -0
  57. package/src/modules/dx/typeBadge/typeBadge.ts +142 -46
  58. package/src/modules/dxBaseElements/archiveCard/archiveCard.ts +2 -6
  59. package/src/modules/dxBaseElements/headerBase/headerBase.ts +1 -1
  60. package/src/modules/dxConstants/brands/brands.ts +14 -0
  61. package/src/modules/dxConstants/colors/colors.ts +14 -0
  62. package/src/modules/dxConstants/contentTypes/contentTypes.ts +10 -0
  63. package/src/modules/dxHelpers/card/card.css +1 -1
  64. package/src/modules/dxHelpers/commonHeader/commonHeader.css +0 -1
  65. package/src/modules/dxUtils/css/css.ts +10 -0
  66. package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.css +0 -12
  67. package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.html +0 -11
  68. 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
- TypeBadgeColor,
4
+ Brand,
5
5
  Color,
6
- TypeBadgeSize,
7
- BadgeType,
8
- Brand
6
+ ContentType,
7
+ IconSprite,
8
+ IconSymbol,
9
+ TypeBadgeSize
9
10
  } from "typings/custom";
10
- import { colorToDxColors } from "dxUtils/css";
11
-
12
- const DEFAULT_TYPE = "typebadge_metadata";
13
- const VALID_BRANDS: Array<Brand> = [
14
- "employees",
15
- "marketing",
16
- "partners",
17
- "commerce",
18
- "sales",
19
- "success",
20
- "integration",
21
- "platform",
22
- "industries",
23
- "learning",
24
- "service",
25
- "analytics"
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 value: string = "";
31
- @api color?: TypeBadgeColor = "default";
32
- @api type?: BadgeType = "metadata";
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 (VALID_BRANDS.includes(this.color as Brand)) {
44
- return this.buildStyleString({
45
- background: `--dx-g-brand-${this.color}-color-background`,
46
- color: `--dx-g-brand-${this.color}-color`
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
- const variables = colorToDxColors(this.color as Color);
50
- if (variables) {
51
- return this.buildStyleString(variables);
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, Color } from "typings/custom";
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: "Blog" | "Podcast" = "Blog";
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">Share your feedback</a>about our new site.</span>';
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() {
@@ -0,0 +1,14 @@
1
+ export const BRANDS = [
2
+ "employees",
3
+ "marketing",
4
+ "partners",
5
+ "commerce",
6
+ "sales",
7
+ "success",
8
+ "integration",
9
+ "platform",
10
+ "industries",
11
+ "learning",
12
+ "service",
13
+ "analytics"
14
+ ];
@@ -0,0 +1,14 @@
1
+ export const COLORS = [
2
+ "hot-orange",
3
+ "orange",
4
+ "yellow",
5
+ "green",
6
+ "teal",
7
+ "cloud-blue",
8
+ "blue",
9
+ "indigo",
10
+ "purple",
11
+ "violet",
12
+ "pink",
13
+ "red"
14
+ ];
@@ -0,0 +1,10 @@
1
+ export const CONTENT_TYPES = [
2
+ "documentation",
3
+ "trailhead",
4
+ "blog",
5
+ "forum",
6
+ "api",
7
+ "event",
8
+ "website",
9
+ "podcast"
10
+ ];
@@ -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-button-heading-color-hover);
173
+ --dx-c-card-title-color: var(--dx-g-blue-vibrant-50);
174
174
  }
175
175
 
176
176
  /* Line Limits */
@@ -83,7 +83,6 @@ header.state-show-mobile-nav .header_l2_group-nav_overflow {
83
83
  }
84
84
 
85
85
  .header_l2_group-title .subtitle {
86
- transform: translateY(4px); /* ghost padding */
87
86
  margin-right: var(--dx-g-spacing-md);
88
87
  }
89
88
 
@@ -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,12 +0,0 @@
1
- .badges-group {
2
- display: flex;
3
- flex-wrap: wrap;
4
- }
5
-
6
- .badges-group > dx-type-badge {
7
- margin-bottom: var(--dx-g-spacing-sm);
8
- }
9
-
10
- .badges-group > dx-type-badge:not(:last-child) {
11
- margin-right: var(--dx-g-spacing-sm);
12
- }
@@ -1,11 +0,0 @@
1
- <template>
2
- <div class="badges-group">
3
- <template for:each={badges} for:item="badge">
4
- <dx-type-badge
5
- key={badge}
6
- size={size}
7
- value={badge}
8
- ></dx-type-badge>
9
- </template>
10
- </div>
11
- </template>
@@ -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
- }