@salesforcedevs/dx-components 0.79.2-alpha.0 → 0.79.3

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 CHANGED
@@ -46,6 +46,7 @@
46
46
  "dx/imageAndLabel",
47
47
  "dx/input",
48
48
  "dx/logo",
49
+ "dx/metadataBadge",
49
50
  "dx/modalDrawer",
50
51
  "dx/pagination",
51
52
  "dx/podcastHost",
@@ -68,10 +69,12 @@
68
69
  "dx/tooltip",
69
70
  "dx/tree",
70
71
  "dx/typeBadge",
71
- "dx/typeBadgeGroup",
72
72
  "dx/vimeoPlayer",
73
73
  "dxBaseElements/headerBase",
74
74
  "dxBaseElements/matchMediaElement",
75
+ "dxConstants/brands",
76
+ "dxConstants/colors",
77
+ "dxConstants/contentTypes",
75
78
  "dxHelpers/animations",
76
79
  "dxHelpers/button",
77
80
  "dxHelpers/card",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "0.79.2-alpha.0",
3
+ "version": "0.79.3",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -28,5 +28,5 @@
28
28
  "@types/lodash.kebabcase": "^4.1.7",
29
29
  "@types/vimeo__player": "^2.16.2"
30
30
  },
31
- "gitHead": "1968be492da3999898cb9229e05f6c00e1d70283"
31
+ "gitHead": "1ac28eaeb46528d77fbaabad4471b9e87e39d08e"
32
32
  }
@@ -12,6 +12,7 @@
12
12
  card_section-text
13
13
  "
14
14
  >
15
+ <span class="dx-text-label-3">{label}</span>
15
16
  <dx-card-title title={title} target={target}></dx-card-title>
16
17
  <span class="dx-text-body-2">{body}</span>
17
18
  </div>
@@ -44,8 +44,7 @@
44
44
  {location}
45
45
  </span>
46
46
  <dx-type-badge
47
- color={brandType}
48
- type="content-type"
47
+ color={typeBadgeColor}
49
48
  value={type}
50
49
  if:true={type}
51
50
  ></dx-type-badge>
@@ -36,7 +36,7 @@ export default class CardEvent extends LightningElement {
36
36
  this.isLinkHovered = false;
37
37
  }
38
38
 
39
- private get brandType() {
39
+ private get typeBadgeColor() {
40
40
  return this.type === "Webinar" ? "green" : "red";
41
41
  }
42
42
  }
@@ -1,11 +1,6 @@
1
1
  <template>
2
2
  <div class={containerClass}>
3
- <dx-type-badge
4
- color={badgeColor}
5
- type="content-type"
6
- value={contentType}
7
- size={badgeSize}
8
- ></dx-type-badge>
3
+ <dx-type-badge variant={contentType} size={badgeSize}></dx-type-badge>
9
4
  <dx-card-title
10
5
  if:true={title}
11
6
  href={href}
@@ -10,8 +10,8 @@ export default class ExpandedCard extends ArchiveCard {
10
10
  @api authorImgSrc?: string | null = null;
11
11
  @api length?: string;
12
12
 
13
- private get isBlog() {
14
- return this.contentType === "Blog";
13
+ private get isBlog(): boolean {
14
+ return this.contentType === "blog";
15
15
  }
16
16
 
17
17
  private get hasAuthor(): boolean {
@@ -3,11 +3,6 @@
3
3
  <a class="dx-text-truncate" href={href} target={target}>
4
4
  <h4>{title}</h4>
5
5
  </a>
6
- <dx-type-badge
7
- color={badgeColor}
8
- size={badgeSize}
9
- type="content-type"
10
- value={contentType}
11
- ></dx-type-badge>
6
+ <dx-type-badge variant={contentType} size={badgeSize}></dx-type-badge>
12
7
  </div>
13
8
  </template>
@@ -0,0 +1,49 @@
1
+ @import "dxHelpers/reset";
2
+
3
+ .badge {
4
+ --background: var(--dx-g-cloud-blue-natural-90);
5
+ --border-radius: var(--dx-g-spacing-xs);
6
+ --color: var(--dx-g-blue-vibrant-20);
7
+ --height: var(--dx-g-spacing-lg);
8
+ --horizontal-spacing: var(--dx-g-spacing-sm);
9
+
10
+ color: var(--dx-c-metadata-badge-color, var(--color));
11
+ background: var(--dx-c-metadata-badge-background, var(--background));
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ height: var(--height);
16
+ width: min-content;
17
+ padding: 0 var(--horizontal-spacing);
18
+ border-radius: var(--border-radius);
19
+ font-family: var(--dx-g-font-display);
20
+ font-size: 10px;
21
+ text-align: center;
22
+ letter-spacing: 0.6px;
23
+ text-transform: uppercase;
24
+ white-space: nowrap;
25
+ }
26
+
27
+ .badge.size-small {
28
+ --height: var(--dx-g-spacing-md);
29
+ --horizontal-spacing: var(--dx-g-spacing-xs);
30
+
31
+ font-size: 8px;
32
+ letter-spacing: 0.5px;
33
+ }
34
+
35
+ .badge span {
36
+ transform: translateY(2px);
37
+ }
38
+
39
+ .badge.size-small span {
40
+ transform: translateY(1px);
41
+ }
42
+
43
+ @media screen and (max-width: 768px) {
44
+ .badge:not(.size-small) {
45
+ height: var(--dx-g-spacing-lg);
46
+ padding: 0 var(--dx-g-spacing-sm);
47
+ font-size: var(--dx-g-text-2xs);
48
+ }
49
+ }
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class={className} style={style}>
3
+ <span>{value}</span>
4
+ </div>
5
+ </template>
@@ -0,0 +1,24 @@
1
+ import { LightningElement, api } from "lwc";
2
+ import cx from "classnames";
3
+ import { Color, TypeBadgeSize } from "typings/custom";
4
+ import { colorToDxColors, buildStyleColorVariables } from "dxUtils/css";
5
+
6
+ export default class MetadataBadge extends LightningElement {
7
+ @api size: TypeBadgeSize = "default";
8
+ @api color?: Color;
9
+ @api value!: string;
10
+
11
+ private get className(): string {
12
+ return cx("badge", `size-${this.size}`);
13
+ }
14
+
15
+ private get style(): string {
16
+ if (this.color) {
17
+ const variables = colorToDxColors(this.color as Color);
18
+ if (variables) {
19
+ return buildStyleColorVariables(variables);
20
+ }
21
+ }
22
+ return "";
23
+ }
24
+ }
@@ -1,5 +1,6 @@
1
1
  /* Code generated by scripts/postinstall.js DO NOT EDIT*/
2
2
 
3
+
3
4
  /* -------------------------------------------------------------------
4
5
  Microtip
5
6
 
@@ -15,251 +16,254 @@
15
16
  3. Position Modifiers
16
17
  --------------------------------------------------------------------*/
17
18
 
19
+
18
20
  /* ------------------------------------------------
19
21
  [1] Base Styles
20
22
  -------------------------------------------------*/
21
23
 
22
24
  [aria-label][role~="tooltip"] {
23
- position: relative;
25
+ position: relative;
24
26
  }
25
27
 
26
28
  [aria-label][role~="tooltip"]::before,
27
29
  [aria-label][role~="tooltip"]::after {
28
- transform: translate3d(0, 0, 0);
29
- -webkit-backface-visibility: hidden;
30
- backface-visibility: hidden;
31
- will-change: transform;
32
- opacity: 0;
33
- pointer-events: none;
34
- transition: all var(--microtip-transition-duration, 0.18s)
35
- var(--microtip-transition-easing, ease-in-out)
36
- var(--microtip-transition-delay, 0s);
37
- position: absolute;
38
- box-sizing: border-box;
39
- z-index: 10;
40
- transform-origin: top;
30
+ transform: translate3d(0, 0, 0);
31
+ -webkit-backface-visibility: hidden;
32
+ backface-visibility: hidden;
33
+ will-change: transform;
34
+ opacity: 0;
35
+ pointer-events: none;
36
+ transition: all var(--microtip-transition-duration, .18s) var(--microtip-transition-easing, ease-in-out) var(--microtip-transition-delay, 0s);
37
+ position: absolute;
38
+ box-sizing: border-box;
39
+ z-index: 10;
40
+ transform-origin: top;
41
41
  }
42
42
 
43
43
  [aria-label][role~="tooltip"]::before {
44
- background-size: 100% auto !important;
45
- content: "";
44
+ background-size: 100% auto !important;
45
+ content: "";
46
46
  }
47
47
 
48
48
  [aria-label][role~="tooltip"]::after {
49
- background: rgba(17, 17, 17, 0.9);
50
- border-radius: 4px;
51
- color: #ffffff;
52
- content: attr(aria-label);
53
- font-size: var(--microtip-font-size, 13px);
54
- font-weight: var(--microtip-font-weight, normal);
55
- text-transform: var(--microtip-text-transform, none);
56
- padding: 0.5em 1em;
57
- white-space: nowrap;
58
- box-sizing: content-box;
49
+ background: rgba(17, 17, 17, .9);
50
+ border-radius: 4px;
51
+ color: #ffffff;
52
+ content: attr(aria-label);
53
+ font-size: var(--microtip-font-size, 13px);
54
+ font-weight: var(--microtip-font-weight, normal);
55
+ text-transform: var(--microtip-text-transform, none);
56
+ padding: .5em 1em;
57
+ white-space: nowrap;
58
+ box-sizing: content-box;
59
59
  }
60
60
 
61
61
  [aria-label][role~="tooltip"]:hover::before,
62
62
  [aria-label][role~="tooltip"]:hover::after,
63
63
  [aria-label][role~="tooltip"]:focus::before,
64
64
  [aria-label][role~="tooltip"]:focus::after {
65
- opacity: 1;
66
- pointer-events: auto;
65
+ opacity: 1;
66
+ pointer-events: auto;
67
67
  }
68
68
 
69
+
70
+
69
71
  /* ------------------------------------------------
70
72
  [2] Position Modifiers
71
73
  -------------------------------------------------*/
72
74
 
73
75
  [role~="tooltip"][data-microtip-position|="top"]::before {
74
- background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%280%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E")
75
- no-repeat;
76
- height: 6px;
77
- width: 18px;
78
- margin-bottom: 5px;
76
+ background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%280%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
77
+ height: 6px;
78
+ width: 18px;
79
+ margin-bottom: 5px;
79
80
  }
80
81
 
81
82
  [role~="tooltip"][data-microtip-position|="top"]::after {
82
- margin-bottom: 11px;
83
+ margin-bottom: 11px;
83
84
  }
84
85
 
85
86
  [role~="tooltip"][data-microtip-position|="top"]::before {
86
- transform: translate3d(-50%, 0, 0);
87
- bottom: 100%;
88
- left: 50%;
87
+ transform: translate3d(-50%, 0, 0);
88
+ bottom: 100%;
89
+ left: 50%;
89
90
  }
90
91
 
91
92
  [role~="tooltip"][data-microtip-position|="top"]:hover::before {
92
- transform: translate3d(-50%, -5px, 0);
93
+ transform: translate3d(-50%, -5px, 0);
93
94
  }
94
95
 
95
96
  [role~="tooltip"][data-microtip-position|="top"]::after {
96
- transform: translate3d(-50%, 0, 0);
97
- bottom: 100%;
98
- left: 50%;
97
+ transform: translate3d(-50%, 0, 0);
98
+ bottom: 100%;
99
+ left: 50%;
99
100
  }
100
101
 
101
102
  [role~="tooltip"][data-microtip-position="top"]:hover::after {
102
- transform: translate3d(-50%, -5px, 0);
103
+ transform: translate3d(-50%, -5px, 0);
103
104
  }
104
105
 
105
106
  /* ------------------------------------------------
106
107
  [2.1] Top Left
107
108
  -------------------------------------------------*/
108
109
  [role~="tooltip"][data-microtip-position="top-left"]::after {
109
- transform: translate3d(calc(-100% + 16px), 0, 0);
110
- bottom: 100%;
110
+ transform: translate3d(calc(-100% + 16px), 0, 0);
111
+ bottom: 100%;
111
112
  }
112
113
 
113
114
  [role~="tooltip"][data-microtip-position="top-left"]:hover::after {
114
- transform: translate3d(calc(-100% + 16px), -5px, 0);
115
+ transform: translate3d(calc(-100% + 16px), -5px, 0);
115
116
  }
116
117
 
118
+
117
119
  /* ------------------------------------------------
118
120
  [2.2] Top Right
119
121
  -------------------------------------------------*/
120
122
  [role~="tooltip"][data-microtip-position="top-right"]::after {
121
- transform: translate3d(calc(0% + -16px), 0, 0);
122
- bottom: 100%;
123
+ transform: translate3d(calc(0% + -16px), 0, 0);
124
+ bottom: 100%;
123
125
  }
124
126
 
125
127
  [role~="tooltip"][data-microtip-position="top-right"]:hover::after {
126
- transform: translate3d(calc(0% + -16px), -5px, 0);
128
+ transform: translate3d(calc(0% + -16px), -5px, 0);
127
129
  }
128
130
 
131
+
129
132
  /* ------------------------------------------------
130
133
  [2.3] Bottom
131
134
  -------------------------------------------------*/
132
135
  [role~="tooltip"][data-microtip-position|="bottom"]::before {
133
- background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28180%2018%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E")
134
- no-repeat;
135
- height: 6px;
136
- width: 18px;
137
- margin-top: 5px;
138
- margin-bottom: 0;
136
+ background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28180%2018%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
137
+ height: 6px;
138
+ width: 18px;
139
+ margin-top: 5px;
140
+ margin-bottom: 0;
139
141
  }
140
142
 
141
143
  [role~="tooltip"][data-microtip-position|="bottom"]::after {
142
- margin-top: 11px;
144
+ margin-top: 11px;
143
145
  }
144
146
 
145
147
  [role~="tooltip"][data-microtip-position|="bottom"]::before {
146
- transform: translate3d(-50%, -10px, 0);
147
- bottom: auto;
148
- left: 50%;
149
- top: 100%;
148
+ transform: translate3d(-50%, -10px, 0);
149
+ bottom: auto;
150
+ left: 50%;
151
+ top: 100%;
150
152
  }
151
153
 
152
154
  [role~="tooltip"][data-microtip-position|="bottom"]:hover::before {
153
- transform: translate3d(-50%, 0, 0);
155
+ transform: translate3d(-50%, 0, 0);
154
156
  }
155
157
 
156
158
  [role~="tooltip"][data-microtip-position|="bottom"]::after {
157
- transform: translate3d(-50%, -10px, 0);
158
- top: 100%;
159
- left: 50%;
159
+ transform: translate3d(-50%, -10px, 0);
160
+ top: 100%;
161
+ left: 50%;
160
162
  }
161
163
 
162
164
  [role~="tooltip"][data-microtip-position="bottom"]:hover::after {
163
- transform: translate3d(-50%, 0, 0);
165
+ transform: translate3d(-50%, 0, 0);
164
166
  }
165
167
 
168
+
166
169
  /* ------------------------------------------------
167
170
  [2.4] Bottom Left
168
171
  -------------------------------------------------*/
169
172
  [role~="tooltip"][data-microtip-position="bottom-left"]::after {
170
- transform: translate3d(calc(-100% + 16px), -10px, 0);
171
- top: 100%;
173
+ transform: translate3d(calc(-100% + 16px), -10px, 0);
174
+ top: 100%;
172
175
  }
173
176
 
174
177
  [role~="tooltip"][data-microtip-position="bottom-left"]:hover::after {
175
- transform: translate3d(calc(-100% + 16px), 0, 0);
178
+ transform: translate3d(calc(-100% + 16px), 0, 0);
176
179
  }
177
180
 
181
+
178
182
  /* ------------------------------------------------
179
183
  [2.5] Bottom Right
180
184
  -------------------------------------------------*/
181
185
  [role~="tooltip"][data-microtip-position="bottom-right"]::after {
182
- transform: translate3d(calc(0% + -16px), -10px, 0);
183
- top: 100%;
186
+ transform: translate3d(calc(0% + -16px), -10px, 0);
187
+ top: 100%;
184
188
  }
185
189
 
186
190
  [role~="tooltip"][data-microtip-position="bottom-right"]:hover::after {
187
- transform: translate3d(calc(0% + -16px), 0, 0);
191
+ transform: translate3d(calc(0% + -16px), 0, 0);
188
192
  }
189
193
 
194
+
190
195
  /* ------------------------------------------------
191
196
  [2.6] Left
192
197
  -------------------------------------------------*/
193
198
  [role~="tooltip"][data-microtip-position="left"]::before,
194
199
  [role~="tooltip"][data-microtip-position="left"]::after {
195
- bottom: auto;
196
- left: auto;
197
- right: 100%;
198
- top: 50%;
199
- transform: translate3d(10px, -50%, 0);
200
+ bottom: auto;
201
+ left: auto;
202
+ right: 100%;
203
+ top: 50%;
204
+ transform: translate3d(10px, -50%, 0);
200
205
  }
201
206
 
202
207
  [role~="tooltip"][data-microtip-position="left"]::before {
203
- background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28-90%2018%2018%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E")
204
- no-repeat;
205
- height: 18px;
206
- width: 6px;
207
- margin-right: 5px;
208
- margin-bottom: 0;
208
+ background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28-90%2018%2018%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
209
+ height: 18px;
210
+ width: 6px;
211
+ margin-right: 5px;
212
+ margin-bottom: 0;
209
213
  }
210
214
 
211
215
  [role~="tooltip"][data-microtip-position="left"]::after {
212
- margin-right: 11px;
216
+ margin-right: 11px;
213
217
  }
214
218
 
215
219
  [role~="tooltip"][data-microtip-position="left"]:hover::before,
216
220
  [role~="tooltip"][data-microtip-position="left"]:hover::after {
217
- transform: translate3d(0, -50%, 0);
221
+ transform: translate3d(0, -50%, 0);
218
222
  }
219
223
 
224
+
220
225
  /* ------------------------------------------------
221
226
  [2.7] Right
222
227
  -------------------------------------------------*/
223
228
  [role~="tooltip"][data-microtip-position="right"]::before,
224
229
  [role~="tooltip"][data-microtip-position="right"]::after {
225
- bottom: auto;
226
- left: 100%;
227
- top: 50%;
228
- transform: translate3d(-10px, -50%, 0);
230
+ bottom: auto;
231
+ left: 100%;
232
+ top: 50%;
233
+ transform: translate3d(-10px, -50%, 0);
229
234
  }
230
235
 
231
236
  [role~="tooltip"][data-microtip-position="right"]::before {
232
- background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%2890%206%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E")
233
- no-repeat;
234
- height: 18px;
235
- width: 6px;
236
- margin-bottom: 0;
237
- margin-left: 5px;
237
+ background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%2890%206%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
238
+ height: 18px;
239
+ width: 6px;
240
+ margin-bottom: 0;
241
+ margin-left: 5px;
238
242
  }
239
243
 
240
244
  [role~="tooltip"][data-microtip-position="right"]::after {
241
- margin-left: 11px;
245
+ margin-left: 11px;
242
246
  }
243
247
 
244
248
  [role~="tooltip"][data-microtip-position="right"]:hover::before,
245
249
  [role~="tooltip"][data-microtip-position="right"]:hover::after {
246
- transform: translate3d(0, -50%, 0);
250
+ transform: translate3d(0, -50%, 0);
247
251
  }
248
252
 
249
253
  /* ------------------------------------------------
250
254
  [3] Size
251
255
  -------------------------------------------------*/
252
256
  [role~="tooltip"][data-microtip-size="small"]::after {
253
- white-space: initial;
254
- width: 80px;
257
+ white-space: initial;
258
+ width: 80px;
255
259
  }
256
260
 
257
261
  [role~="tooltip"][data-microtip-size="medium"]::after {
258
- white-space: initial;
259
- width: 150px;
262
+ white-space: initial;
263
+ width: 150px;
260
264
  }
261
265
 
262
266
  [role~="tooltip"][data-microtip-size="large"]::after {
263
- white-space: initial;
264
- width: 260px;
267
+ white-space: initial;
268
+ width: 260px;
265
269
  }
@@ -145,33 +145,33 @@
145
145
  --indentation: calc(20 * var(--base-indentation));
146
146
  }
147
147
 
148
- dx-type-badge {
149
- --dx-c-type-badge-text-width: 21px;
148
+ dx-metadata-badge {
149
+ --dx-c-metadata-badge-text-width: 21px;
150
150
  }
151
151
 
152
- dx-type-badge.get {
153
- --dx-c-type-badge-color: var(--dx-g-blue-vibrant-50);
154
- --dx-c-type-badge-background: var(--dx-g-blue-vibrant-90);
152
+ dx-metadata-badge.get {
153
+ --dx-c-metadata-badge-color: var(--dx-g-blue-vibrant-50);
154
+ --dx-c-metadata-badge-background: var(--dx-g-blue-vibrant-90);
155
155
  }
156
156
 
157
- dx-type-badge.put {
158
- --dx-c-type-badge-color: var(--dx-g-yellow-vibrant-40);
159
- --dx-c-type-badge-background: var(--dx-g-yellow-vibrant-90);
157
+ dx-metadata-badge.put {
158
+ --dx-c-metadata-badge-color: var(--dx-g-yellow-vibrant-40);
159
+ --dx-c-metadata-badge-background: var(--dx-g-yellow-vibrant-90);
160
160
  }
161
161
 
162
- dx-type-badge.post {
163
- --dx-c-type-badge-color: var(--dx-g-green-vibrant-40);
164
- --dx-c-type-badge-background: var(--dx-g-green-vibrant-90);
162
+ dx-metadata-badge.post {
163
+ --dx-c-metadata-badge-color: var(--dx-g-green-vibrant-40);
164
+ --dx-c-metadata-badge-background: var(--dx-g-green-vibrant-90);
165
165
  }
166
166
 
167
- dx-type-badge.patch {
168
- --dx-c-type-badge-color: var(--dx-g-teal-vibrant-40);
169
- --dx-c-type-badge-background: var(--dx-g-teal-vibrant-90);
167
+ dx-metadata-badge.patch {
168
+ --dx-c-metadata-badge-color: var(--dx-g-teal-vibrant-40);
169
+ --dx-c-metadata-badge-background: var(--dx-g-teal-vibrant-90);
170
170
  }
171
171
 
172
- dx-type-badge.delete {
173
- --dx-c-type-badge-color: var(--dx-g-red-vibrant-40);
174
- --dx-c-type-badge-background: var(--dx-g-hot-orange-vibrant-90);
172
+ dx-metadata-badge.delete {
173
+ --dx-c-metadata-badge-color: var(--dx-g-red-vibrant-40);
174
+ --dx-c-metadata-badge-background: var(--dx-g-hot-orange-vibrant-90);
175
175
  }
176
176
 
177
177
  a {
@@ -16,12 +16,13 @@
16
16
  onclick={onClickIcon}
17
17
  ></dx-icon>
18
18
  </div>
19
- <dx-type-badge
19
+ <dx-metadata-badge
20
20
  if:true={showMethod}
21
- class={badgeClass}
21
+ class="flex tile-icon"
22
22
  size="small"
23
23
  value={methodText}
24
- ></dx-type-badge>
24
+ color={metadataBadgeColor}
25
+ ></dx-metadata-badge>
25
26
  </div>
26
27
  </a>
27
28
  </template>
@@ -1,6 +1,6 @@
1
1
  import { LightningElement, api } from "lwc";
2
2
  import cx from "classnames";
3
- import { InternalTreeNode } from "typings/custom";
3
+ import { Color, InternalTreeNode } from "typings/custom";
4
4
 
5
5
  const methodTextMap: {
6
6
  [key: string]: string;
@@ -12,6 +12,16 @@ const methodTextMap: {
12
12
  delete: "DELE"
13
13
  };
14
14
 
15
+ const metadataBadgeColorMap: {
16
+ [key: string]: Color;
17
+ } = {
18
+ get: "blue",
19
+ put: "yellow",
20
+ post: "green",
21
+ patch: "teal",
22
+ delete: "red"
23
+ };
24
+
15
25
  export default class TreeTile extends LightningElement {
16
26
  @api isRoot = false;
17
27
  @api treeNode!: InternalTreeNode;
@@ -29,8 +39,11 @@ export default class TreeTile extends LightningElement {
29
39
  return this.isRoot ? "small" : "xsmall";
30
40
  }
31
41
 
32
- private get badgeClass() {
33
- return cx("flex", "tile-icon", this.treeNode.method);
42
+ private get metadataBadgeColor(): string | undefined {
43
+ if (this.treeNode.method) {
44
+ return metadataBadgeColorMap[this.treeNode.method];
45
+ }
46
+ return undefined;
34
47
  }
35
48
 
36
49
  private get showMethod() {
@@ -1,33 +1,6 @@
1
1
  @import "dxHelpers/reset";
2
2
 
3
- .typebadge {
4
- align-items: center;
5
- background: var(--dx-c-type-badge-background, var(--background));
6
- border-radius: var(--dx-c-type-badge-border-radius, var(--border-radius));
7
- color: var(--dx-c-type-badge-color, var(--color));
8
- display: flex;
9
- justify-content: center;
10
- height: var(--dx-c-type-badge-height, var(--height));
11
- text-align: center;
12
- white-space: nowrap;
13
- width: min-content;
14
- }
15
-
16
- .typebadge.typebadge_metadata {
17
- --background: var(--dx-g-cloud-blue-natural-90);
18
- --border-radius: var(--dx-g-spacing-xs);
19
- --color: var(--dx-g-blue-vibrant-20);
20
- --height: var(--dx-g-spacing-md);
21
- --horizontal-spacing: var(--dx-g-spacing-sm);
22
-
23
- font-family: var(--dx-g-font-display);
24
- font-size: 10px;
25
- letter-spacing: 0.6px;
26
- text-transform: var(--dx-c-type-badge-text-transform, uppercase);
27
- padding: 0 var(--horizontal-spacing);
28
- }
29
-
30
- .typebadge.typebadge_content-type {
3
+ .badge {
31
4
  --background: var(--sds-g-gray-3);
32
5
  --border-radius: var(--dx-g-spacing-smd);
33
6
  --color: var(--sds-g-gray-10);
@@ -35,40 +8,26 @@
35
8
  --horizontal-spacing: var(--dx-g-spacing-smd);
36
9
  --vertical-spacing: var(--dx-g-spacing-xs);
37
10
 
11
+ color: var(--dx-c-type-badge-color, var(--color));
12
+ background: var(--dx-c-type-badge-background, var(--background));
13
+ border-radius: var(--border-radius);
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: center;
17
+ height: var(--height);
18
+ width: min-content;
19
+ text-align: center;
20
+ white-space: nowrap;
38
21
  font-family: var(--dx-g-font-sans);
39
- font-size: var(--dx-g-text-xs);
22
+ font-size: 10px;
40
23
  font-weight: var(--dx-g-font-bold);
41
24
  padding: var(--vertical-spacing) var(--horizontal-spacing);
42
25
  }
43
26
 
44
- .typebadge.typebadge_content-type.size-small {
27
+ .badge.size-small {
45
28
  --height: var(--dx-g-spacing-mlg);
46
- --horizontal-spacing: var(--dx-g-spacing-sm);
47
-
48
- font-size: 10px;
49
- }
50
-
51
- .typebadge.typebadge_metadata.size-small {
52
- --height: var(--dx-g-spacing-md);
53
- --horizontal-spacing: var(--dx-g-spacing-xs);
54
-
55
- font-size: 8px;
56
- letter-spacing: 0.5px;
57
- }
58
-
59
- .typebadge.typebadge_metadata span {
60
- transform: translateY(2px);
61
- width: var(--dx-c-type-badge-text-width, unset);
62
- }
63
-
64
- .typebadge.typebadge_metadata.size-small span {
65
- transform: translateY(1px);
66
29
  }
67
30
 
68
- @media screen and (max-width: 768px) {
69
- .typebadge.typebadge_metadata:not(.size-small) {
70
- height: var(--dx-g-spacing-lg);
71
- padding: 0 var(--dx-g-spacing-sm);
72
- font-size: var(--dx-g-text-2xs);
73
- }
31
+ dx-icon {
32
+ margin-right: var(--dx-g-spacing-sm);
74
33
  }
@@ -1,5 +1,11 @@
1
1
  <template>
2
2
  <div class={className} style={style}>
3
+ <dx-icon
4
+ if:true={iconSymbol}
5
+ symbol={iconSymbol}
6
+ sprite={iconSprite}
7
+ size="xsmall"
8
+ ></dx-icon>
3
9
  <span>{value}</span>
4
10
  </div>
5
11
  </template>
@@ -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);
@@ -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
+ ];
@@ -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
- }