@salesforcedevs/dx-components 1.2.16 → 1.2.18-canary.0
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 +2 -0
- package/package.json +12 -5
- package/src/assets/svg/login-widget-bg.png +0 -0
- package/src/modules/dx/header/header.html +5 -2
- package/src/modules/dx/header/header.ts +4 -0
- package/src/modules/dx/logo/logo.ts +1 -1
- package/src/modules/dx/popover/popover.css +19 -0
- package/src/modules/dx/popover/popover.html +1 -0
- package/src/modules/dx/popover/popover.ts +76 -30
- package/src/modules/dx/tbidAvatarButton/tbidAvatarButton.css +33 -0
- package/src/modules/dx/tbidAvatarButton/tbidAvatarButton.html +31 -0
- package/src/modules/dx/tbidAvatarButton/tbidAvatarButton.ts +438 -0
- package/src/modules/dxHelpers/commonHeader/commonHeader.css +4 -2
- package/src/modules/dxUtils/async/async.ts +41 -0
- package/yarn-error.log +18466 -0
- package/LICENSE +0 -12
package/lwc.config.json
CHANGED
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"dx/spinner",
|
|
70
70
|
"dx/tabPanel",
|
|
71
71
|
"dx/tabPanelList",
|
|
72
|
+
"dx/tbidAvatarButton",
|
|
72
73
|
"dx/toc",
|
|
73
74
|
"dx/tooltip",
|
|
74
75
|
"dx/tree",
|
|
@@ -89,6 +90,7 @@
|
|
|
89
90
|
"dxHelpers/table",
|
|
90
91
|
"dxHelpers/text",
|
|
91
92
|
"dxUtils/analytics",
|
|
93
|
+
"dxUtils/async",
|
|
92
94
|
"dxUtils/constants",
|
|
93
95
|
"dxUtils/coveo",
|
|
94
96
|
"dxUtils/dates",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.18-canary.0",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -17,16 +17,23 @@
|
|
|
17
17
|
"classnames": "^2.2.6",
|
|
18
18
|
"coveo-search-ui": "^2.10082.5",
|
|
19
19
|
"debounce": "^1.2.0",
|
|
20
|
+
"js-cookie": "^3.0.1",
|
|
21
|
+
"lodash.defaults": "^4.2.0",
|
|
20
22
|
"lodash.get": "^4.4.2",
|
|
21
23
|
"lodash.kebabcase": "^4.1.1",
|
|
22
|
-
"microtip": "0.2.2"
|
|
24
|
+
"microtip": "0.2.2",
|
|
25
|
+
"salesforce-oauth2": "^0.2.0",
|
|
26
|
+
"uuid": "^9.0.0"
|
|
23
27
|
},
|
|
24
28
|
"devDependencies": {
|
|
25
29
|
"@types/classnames": "^2.2.10",
|
|
26
30
|
"@types/debounce": "^1.2.0",
|
|
31
|
+
"@types/js-cookie": "^3.0.2",
|
|
32
|
+
"@types/lodash.defaults": "^4.2.7",
|
|
27
33
|
"@types/lodash.get": "^4.4.6",
|
|
28
34
|
"@types/lodash.kebabcase": "^4.1.7",
|
|
29
|
-
"@types/
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
"@types/uuid": "^8.3.4",
|
|
36
|
+
"@types/vimeo__player": "^2.16.2",
|
|
37
|
+
"eventsourcemock": "^2.0.0"
|
|
38
|
+
}
|
|
32
39
|
}
|
|
Binary file
|
|
@@ -19,14 +19,17 @@
|
|
|
19
19
|
onstatechange={handleStateChange}
|
|
20
20
|
></dx-header-search>
|
|
21
21
|
</div>
|
|
22
|
+
<div if:true={showTbidLogin} class="header-tbid-login">
|
|
23
|
+
<dw-tbid-login-menu></dw-tbid-login-menu>
|
|
24
|
+
</div>
|
|
22
25
|
<div if:true={showSignup} class="header-login-signup">
|
|
23
26
|
<dx-button
|
|
24
|
-
aria-label="
|
|
27
|
+
aria-label="Browse Trials"
|
|
25
28
|
size="small"
|
|
26
29
|
href={signupLink}
|
|
27
30
|
onclick={handleSignUpClick}
|
|
28
31
|
>
|
|
29
|
-
|
|
32
|
+
Browse Trials
|
|
30
33
|
</dx-button>
|
|
31
34
|
</div>
|
|
32
35
|
</div>
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { HeaderBase } from "dxBaseElements/headerBase";
|
|
2
2
|
|
|
3
3
|
export default class Header extends HeaderBase {
|
|
4
|
+
private get showTbidLogin(): boolean {
|
|
5
|
+
return this.showSignup;
|
|
6
|
+
}
|
|
7
|
+
|
|
4
8
|
private get showSignup(): boolean {
|
|
5
9
|
return this.signupLink
|
|
6
10
|
? (this.mobile && !this.isSearchOpen) || !this.mobile
|
|
@@ -3,6 +3,6 @@ import { LightningElement, api } from "lwc";
|
|
|
3
3
|
export default class Logo extends LightningElement {
|
|
4
4
|
@api href: string = "/";
|
|
5
5
|
@api imgSrc: string = "/assets/svg/salesforce-cloud.svg";
|
|
6
|
-
@api imgAlt: string = "Salesforce
|
|
6
|
+
@api imgAlt: string = "Salesforce logo";
|
|
7
7
|
@api label!: string;
|
|
8
8
|
}
|
|
@@ -64,3 +64,22 @@
|
|
|
64
64
|
.popover-small {
|
|
65
65
|
width: 136px;
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
.popover-arrow {
|
|
69
|
+
position: absolute;
|
|
70
|
+
background: linear-gradient(
|
|
71
|
+
315deg,
|
|
72
|
+
transparent 4px,
|
|
73
|
+
white 4px
|
|
74
|
+
); /* make only top half of rotated square visible */
|
|
75
|
+
width: 8px;
|
|
76
|
+
height: 8px;
|
|
77
|
+
transform: rotate(45deg);
|
|
78
|
+
border: var(--popover-border);
|
|
79
|
+
border-bottom: transparent;
|
|
80
|
+
border-right: transparent;
|
|
81
|
+
box-shadow: var(--dx-g-box-shadow-lg);
|
|
82
|
+
transition: opacity 0.2s linear, transform 0.2s linear;
|
|
83
|
+
transition-delay: 0.02s;
|
|
84
|
+
z-index: var(--dx-c-popover-z-index, var(--dx-g-z-index-max));
|
|
85
|
+
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
PopperPlacement
|
|
6
6
|
} from "typings/custom";
|
|
7
7
|
|
|
8
|
-
import { computePosition, flip, size, shift } from "@floating-ui/dom";
|
|
8
|
+
import { computePosition, flip, size, shift, arrow } from "@floating-ui/dom";
|
|
9
9
|
import cx from "classnames";
|
|
10
10
|
import debounce from "debounce";
|
|
11
11
|
import { isPrerender } from "dxUtils/seo";
|
|
@@ -31,6 +31,7 @@ export default class Popover extends LightningElement {
|
|
|
31
31
|
@api openOnHover?: boolean = false; // dropdown opens/closes with hover
|
|
32
32
|
@api width?: string | null = null;
|
|
33
33
|
@api fullWidth?: boolean | null;
|
|
34
|
+
@api showArrow?: boolean | null;
|
|
34
35
|
|
|
35
36
|
@api
|
|
36
37
|
get open() {
|
|
@@ -103,9 +104,11 @@ export default class Popover extends LightningElement {
|
|
|
103
104
|
private _open: boolean = false;
|
|
104
105
|
private _rendered: boolean = isPrerender();
|
|
105
106
|
private _role: string | null = null;
|
|
107
|
+
private arrow: HTMLElement | null = null;
|
|
106
108
|
private control: (HTMLElement & { disabled?: boolean }) | null = null;
|
|
107
109
|
private focusedValue: string | null = null;
|
|
108
110
|
private popover: HTMLElement | null = null;
|
|
111
|
+
private popoverContent: HTMLElement | null = null;
|
|
109
112
|
|
|
110
113
|
// LIFECYCLE METHODS
|
|
111
114
|
|
|
@@ -120,6 +123,12 @@ export default class Popover extends LightningElement {
|
|
|
120
123
|
if (!this.popover) {
|
|
121
124
|
this.popover = this.template.querySelector(".popover-container");
|
|
122
125
|
}
|
|
126
|
+
if (!this.popoverContent) {
|
|
127
|
+
this.popoverContent = this.template.querySelector(".popover");
|
|
128
|
+
}
|
|
129
|
+
if (!this.arrow && this.showArrow) {
|
|
130
|
+
this.arrow = this.template.querySelector(".popover-arrow");
|
|
131
|
+
}
|
|
123
132
|
}
|
|
124
133
|
|
|
125
134
|
// GETTERS
|
|
@@ -232,23 +241,27 @@ export default class Popover extends LightningElement {
|
|
|
232
241
|
this.openPopover();
|
|
233
242
|
};
|
|
234
243
|
|
|
235
|
-
private onSlotChange(e:
|
|
236
|
-
const slot = e.target;
|
|
244
|
+
private onSlotChange(e: Event) {
|
|
245
|
+
const slot = e.target as LightningSlotElement;
|
|
237
246
|
const elements = slot.assignedElements();
|
|
238
247
|
const slotted = elements.length === 0 ? null : elements[0];
|
|
239
248
|
// allows dropdown/select to compose popover
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
this.addControlListeners();
|
|
250
|
-
this.setPosition();
|
|
249
|
+
const slotElement = (slotted?.tagName === "SLOT"
|
|
250
|
+
? slotted.firstChild
|
|
251
|
+
: slotted) as HTMLElement | null;
|
|
252
|
+
const isWorkToDo =
|
|
253
|
+
slotElement &&
|
|
254
|
+
(!this.control || !slotElement.isSameNode(this.control));
|
|
255
|
+
|
|
256
|
+
if (!isWorkToDo) {
|
|
257
|
+
return;
|
|
251
258
|
}
|
|
259
|
+
|
|
260
|
+
slotElement.setAttribute("aria-haspopup", "true");
|
|
261
|
+
slotElement.style.cursor = this.openOnHover ? "default" : "cursor";
|
|
262
|
+
this.control = slotElement;
|
|
263
|
+
this.addControlListeners();
|
|
264
|
+
this.setPosition();
|
|
252
265
|
}
|
|
253
266
|
|
|
254
267
|
private onKeyDown(e: KeyboardEvent): void {
|
|
@@ -277,29 +290,62 @@ export default class Popover extends LightningElement {
|
|
|
277
290
|
if (this.popover && this.control) {
|
|
278
291
|
await Promise.resolve();
|
|
279
292
|
const popoverEl = this.popover;
|
|
293
|
+
const middleware = [flip(), shift({ padding: this.pagePadding })];
|
|
294
|
+
|
|
295
|
+
if (this.fullWidth) {
|
|
296
|
+
middleware.unshift(
|
|
297
|
+
size({
|
|
298
|
+
apply({ rects }) {
|
|
299
|
+
Object.assign(popoverEl.style, {
|
|
300
|
+
width: `${rects.reference.width}px`
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
})
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (this.arrow) {
|
|
308
|
+
middleware.push(arrow({ element: this.arrow, padding: 24 }));
|
|
309
|
+
}
|
|
280
310
|
|
|
281
311
|
computePosition(this.control, popoverEl, {
|
|
282
312
|
placement: this.placement,
|
|
283
|
-
middleware
|
|
284
|
-
|
|
285
|
-
? [
|
|
286
|
-
size({
|
|
287
|
-
apply({ rects }) {
|
|
288
|
-
Object.assign(popoverEl.style, {
|
|
289
|
-
width: `${rects.reference.width}px`
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
})
|
|
293
|
-
]
|
|
294
|
-
: []),
|
|
295
|
-
flip(),
|
|
296
|
-
shift({ padding: this.pagePadding })
|
|
297
|
-
]
|
|
298
|
-
}).then(({ x, y }) => {
|
|
313
|
+
middleware
|
|
314
|
+
}).then(({ x, y, placement, middlewareData }) => {
|
|
299
315
|
Object.assign(popoverEl.style, {
|
|
300
316
|
left: `${x}px`,
|
|
301
317
|
top: `${y}px`
|
|
302
318
|
});
|
|
319
|
+
|
|
320
|
+
if (this.arrow && middlewareData.arrow) {
|
|
321
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
322
|
+
const popoverPlacementSide = placement.split("-")[0] as
|
|
323
|
+
| "top"
|
|
324
|
+
| "bottom"
|
|
325
|
+
| "left"
|
|
326
|
+
| "right";
|
|
327
|
+
const staticSide = {
|
|
328
|
+
top: "bottom",
|
|
329
|
+
right: "left",
|
|
330
|
+
bottom: "top",
|
|
331
|
+
left: "right"
|
|
332
|
+
}[popoverPlacementSide];
|
|
333
|
+
const arrowStyles = {
|
|
334
|
+
left: arrowX != null ? `${arrowX}px` : "",
|
|
335
|
+
top: arrowY != null ? `${arrowY}px` : "",
|
|
336
|
+
right: "",
|
|
337
|
+
bottom: "",
|
|
338
|
+
[staticSide]: "-4px"
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
if (this.offset && this.popoverContent) {
|
|
342
|
+
arrowStyles.marginTop = getComputedStyle(
|
|
343
|
+
this.popoverContent
|
|
344
|
+
).marginTop;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
Object.assign(this.arrow.style, arrowStyles);
|
|
348
|
+
}
|
|
303
349
|
});
|
|
304
350
|
}
|
|
305
351
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
--dx-c-button-custom-color: var(--dx-g-blue-vibrant-50);
|
|
5
|
+
--dx-c-button-custom-background: transparent;
|
|
6
|
+
--dx-c-button-custom-border: 1px solid transparent;
|
|
7
|
+
--dx-c-button-custom-color-hover: var(--dx-g-blue-vibrant-50);
|
|
8
|
+
--dx-c-button-custom-background-hover: var(--dx-g-cloud-blue-vibrant-90);
|
|
9
|
+
--dx-c-button-custom-border-hover: var(--dx-g-cloud-blue-vibrant-90);
|
|
10
|
+
--dx-c-slot-empty-width: max-content;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.avatar-control {
|
|
14
|
+
height: var(--dx-g-spacing-xl);
|
|
15
|
+
width: calc(var(--dx-g-spacing-lg) + 4px);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.avatar-small-container {
|
|
19
|
+
align-items: center;
|
|
20
|
+
display: flex;
|
|
21
|
+
padding: 2px 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.avatar {
|
|
25
|
+
border-radius: 100%;
|
|
26
|
+
border: 2px solid #0d9dda;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.avatar.avatar-small {
|
|
30
|
+
display: block;
|
|
31
|
+
height: calc(var(--dx-g-spacing-lg) + 4px);
|
|
32
|
+
width: calc(var(--dx-g-spacing-lg) + 4px);
|
|
33
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div if:true={isLoggedIn}>
|
|
3
|
+
<dx-popover offset="small" width="320px" open-on-hover show-arrow>
|
|
4
|
+
<div slot="control" class="avatar-small-container login-control">
|
|
5
|
+
<button class="avatar-control">
|
|
6
|
+
<img src={userInfo.avatarImgSrc} class="avatar avatar-small" />
|
|
7
|
+
</button>
|
|
8
|
+
</div>
|
|
9
|
+
<div slot="content">
|
|
10
|
+
<slot name="popover-content"></slot>
|
|
11
|
+
</div>
|
|
12
|
+
</dx-popover>
|
|
13
|
+
</div>
|
|
14
|
+
<div if:false={isLoggedIn}>
|
|
15
|
+
<dx-popover offset="small" width="320px" open-on-hover show-arrow>
|
|
16
|
+
<dx-button
|
|
17
|
+
slot="control"
|
|
18
|
+
class="login-control"
|
|
19
|
+
icon-symbol="user"
|
|
20
|
+
icon-position="left"
|
|
21
|
+
loading={isLoading}
|
|
22
|
+
variant="custom"
|
|
23
|
+
>
|
|
24
|
+
Login
|
|
25
|
+
</dx-button>
|
|
26
|
+
<div slot="content">
|
|
27
|
+
<slot name="popover-content"></slot>
|
|
28
|
+
</div>
|
|
29
|
+
</dx-popover>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|