@salesforcedevs/dx-components 0.54.5 → 0.54.6-alpha-1
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 +5 -3
- package/src/assets/svg/login-widget-bg.png +0 -0
- package/src/modules/dx/avatarButton/avatarButton.css +128 -0
- package/src/modules/dx/avatarButton/avatarButton.html +145 -0
- package/src/modules/dx/avatarButton/avatarButton.ts +78 -0
- package/src/modules/dx/breadcrumbs/breadcrumbs.ts +18 -15
- package/src/modules/dx/button/button.css +9 -0
- package/src/modules/dx/button/button.ts +1 -1
- package/src/modules/dx/dropdown/dropdown.ts +2 -2
- package/src/modules/dx/dropdownOption/dropdownOption.ts +2 -2
- package/src/modules/dx/footer/footer.ts +2 -2
- package/src/modules/dx/header/header.html +1 -0
- package/src/modules/dx/header/header.ts +2 -2
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.ts +4 -4
- package/src/modules/dx/headerNav/headerNav.ts +5 -5
- package/src/modules/dx/headerSearch/headerSearch.ts +2 -2
- package/src/modules/dx/logo/logo.ts +1 -1
- package/src/modules/dx/select/select.css +181 -8
- package/src/modules/dx/select/select.html +51 -54
- package/src/modules/dx/select/select.ts +128 -10
- package/src/modules/dxBaseElements/headerBase/headerBase.ts +3 -3
- package/src/modules/dxUtils/options/options.ts +13 -9
- package/src/modules/dxHelpers/slds/slds.css +0 -191
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "0.54.
|
|
3
|
+
"version": "0.54.6-alpha-1",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -16,13 +16,15 @@
|
|
|
16
16
|
"@vimeo/player": "^2.16.4",
|
|
17
17
|
"classnames": "^2.2.6",
|
|
18
18
|
"debounce": "^1.2.0",
|
|
19
|
-
"
|
|
19
|
+
"js-cookie": "^3.0.1",
|
|
20
20
|
"lodash.get": "^4.4.2",
|
|
21
|
-
"microtip": "0.2.2"
|
|
21
|
+
"microtip": "0.2.2",
|
|
22
|
+
"salesforce-oauth2": "^0.2.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@types/classnames": "^2.2.10",
|
|
25
26
|
"@types/debounce": "^1.2.0",
|
|
27
|
+
"@types/js-cookie": "^3.0.2",
|
|
26
28
|
"@types/lodash.get": "^4.4.6",
|
|
27
29
|
"@types/vimeo__player": "^2.16.2"
|
|
28
30
|
}
|
|
Binary file
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--dx-c-button-custom-color: var(--dx-g-blue-vibrant-50);
|
|
3
|
+
--dx-c-button-custom-background: transparent;
|
|
4
|
+
--dx-c-button-custom-border: 1px solid transparent;
|
|
5
|
+
--dx-c-button-custom-color-hover: var(--dx-g-blue-vibrant-50);
|
|
6
|
+
--dx-c-button-custom-background-hover: var(--dx-g-cloud-blue-vibrant-90);
|
|
7
|
+
--dx-c-button-custom-border-hover: var(--dx-g-cloud-blue-vibrant-90);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.avatar {
|
|
11
|
+
border-radius: 100%;
|
|
12
|
+
border: 2px solid #0d9dda;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.avatar.avatar-small {
|
|
16
|
+
width: var(--dx-g-spacing-lg);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.avatar.avatar-medium {
|
|
20
|
+
margin-bottom: 14px;
|
|
21
|
+
width: var(--dx-g-spacing-2xl);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.login-control {
|
|
25
|
+
background: var(--dx-g-cloud-blue-vibrant-90);
|
|
26
|
+
border-color: var(--dx-g-cloud-blue-vibrant-90);
|
|
27
|
+
border-radius: 50%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.login-container {
|
|
31
|
+
padding: 16px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.login-container.logged-in {
|
|
35
|
+
padding-top: 68px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.header-img {
|
|
39
|
+
left: 0;
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 0;
|
|
42
|
+
width: 100%;
|
|
43
|
+
z-index: -1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.heading {
|
|
47
|
+
color: var(--dx-g-blue-vibrant-20);
|
|
48
|
+
display: block;
|
|
49
|
+
font-family: var(--dx-g-font-display);
|
|
50
|
+
font-size: var(--dx-g-text-lg);
|
|
51
|
+
line-height: 28px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.sub-heading {
|
|
55
|
+
color: var(--dx-g-blue-vibrant-20);
|
|
56
|
+
display: block;
|
|
57
|
+
font-family: var(--dx-g-font-sans);
|
|
58
|
+
font-size: 12px;
|
|
59
|
+
line-height: 18px;
|
|
60
|
+
padding: 8px 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
ul {
|
|
64
|
+
list-style: none;
|
|
65
|
+
margin: 0;
|
|
66
|
+
padding: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.login-list-item {
|
|
70
|
+
padding-bottom: 10px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.login-section ~ .login-section {
|
|
74
|
+
border-top: 1px solid var(--dx-g-gray-90);
|
|
75
|
+
margin-top: 12px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.login-section-title {
|
|
79
|
+
color: var(--dx-g-gray-30);
|
|
80
|
+
display: inline-block;
|
|
81
|
+
font-family: var(--dx-g-font-sans);
|
|
82
|
+
font-size: 14px;
|
|
83
|
+
line-height: 20px;
|
|
84
|
+
padding: 20px 0 12px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.login-link {
|
|
88
|
+
color: var(--dx-g-blue-vibrant-20);
|
|
89
|
+
display: block;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.login-link-label {
|
|
93
|
+
display: inline-block;
|
|
94
|
+
font-family: var(--dx-g-font-display);
|
|
95
|
+
font-size: 16px;
|
|
96
|
+
line-height: 24px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.login-link-img {
|
|
100
|
+
display: inline-block;
|
|
101
|
+
height: 16px;
|
|
102
|
+
margin-left: 6px;
|
|
103
|
+
vertical-align: middle;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.login-link-icon {
|
|
107
|
+
display: inline-block;
|
|
108
|
+
margin-left: 6px;
|
|
109
|
+
vertical-align: baseline;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.login-link-blurb {
|
|
113
|
+
font-family: var(--dx-g-font-sans);
|
|
114
|
+
font-size: 14px;
|
|
115
|
+
line-height: 20px;
|
|
116
|
+
padding-top: 4px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.heading-links {
|
|
120
|
+
color: var(--dx-g-gray-90);
|
|
121
|
+
font-family: var(--dx-g-font-sans);
|
|
122
|
+
font-size: 14px;
|
|
123
|
+
line-height: 20px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
a.inline-link {
|
|
127
|
+
color: var(--dx-g-blue-vibrant-50);
|
|
128
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div if:false={isLoggedIn}>
|
|
3
|
+
<dx-popover offset="small" width="320px" open-on-hover>
|
|
4
|
+
<img
|
|
5
|
+
slot="control"
|
|
6
|
+
src="https://placekitten.com/300/300"
|
|
7
|
+
class="avatar avatar-small"
|
|
8
|
+
/>
|
|
9
|
+
<div slot="content">
|
|
10
|
+
<div class="login-container logged-in">
|
|
11
|
+
<img src={userInfo.avatarImgSrc} class="header-img" />
|
|
12
|
+
<img
|
|
13
|
+
src="https://placekitten.com/300/300"
|
|
14
|
+
class="avatar avatar-medium"
|
|
15
|
+
/>
|
|
16
|
+
<span class="heading">Jasmine Young</span>
|
|
17
|
+
<span class="sub-heading">jyoung58</span>
|
|
18
|
+
<div class="heading-links">
|
|
19
|
+
<a href="#" class="inline-link">Switch account</a>
|
|
20
|
+
|
|
|
21
|
+
<a href="#" class="inline-link">Logout</a>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="login-section">
|
|
24
|
+
<span class="login-section-title">Trailblazer.me</span>
|
|
25
|
+
<ul>
|
|
26
|
+
<li class="login-list-item">
|
|
27
|
+
<a href="#" class="login-link">
|
|
28
|
+
<span class="login-link-label">
|
|
29
|
+
Settings
|
|
30
|
+
</span>
|
|
31
|
+
<dx-icon
|
|
32
|
+
class="login-link-icon"
|
|
33
|
+
symbol="new_window"
|
|
34
|
+
size="xsmall"
|
|
35
|
+
></dx-icon>
|
|
36
|
+
</a>
|
|
37
|
+
</li>
|
|
38
|
+
<li class="login-list-item">
|
|
39
|
+
<a href="#" class="login-link">
|
|
40
|
+
<span class="login-link-label">
|
|
41
|
+
Profile
|
|
42
|
+
</span>
|
|
43
|
+
<dx-icon
|
|
44
|
+
class="login-link-icon"
|
|
45
|
+
symbol="new_window"
|
|
46
|
+
size="xsmall"
|
|
47
|
+
></dx-icon>
|
|
48
|
+
</a>
|
|
49
|
+
</li>
|
|
50
|
+
<li class="login-list-item">
|
|
51
|
+
<a href="#" class="login-link">
|
|
52
|
+
<span class="login-link-label">
|
|
53
|
+
Developer Forums
|
|
54
|
+
</span>
|
|
55
|
+
<dx-icon
|
|
56
|
+
class="login-link-icon"
|
|
57
|
+
symbol="new_window"
|
|
58
|
+
size="xsmall"
|
|
59
|
+
></dx-icon>
|
|
60
|
+
</a>
|
|
61
|
+
<div class="login-link-blurb">
|
|
62
|
+
Our Developer Forums have a new home!
|
|
63
|
+
<a href="#" class="inline-link">
|
|
64
|
+
Learn more
|
|
65
|
+
</a>
|
|
66
|
+
</div>
|
|
67
|
+
</li>
|
|
68
|
+
</ul>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</dx-popover>
|
|
73
|
+
</div>
|
|
74
|
+
<div if:true={isLoggedIn}>
|
|
75
|
+
<dx-popover offset="small" width="320px" open-on-hover>
|
|
76
|
+
<dx-button
|
|
77
|
+
class="login-control"
|
|
78
|
+
slot="control"
|
|
79
|
+
icon-symbol="user"
|
|
80
|
+
icon-position="left"
|
|
81
|
+
variant="custom"
|
|
82
|
+
>
|
|
83
|
+
Login
|
|
84
|
+
</dx-button>
|
|
85
|
+
<div slot="content">
|
|
86
|
+
<div class="login-container">
|
|
87
|
+
<span class="heading">Login</span>
|
|
88
|
+
<div class="login-section">
|
|
89
|
+
<span class="login-section-title">Products</span>
|
|
90
|
+
<ul>
|
|
91
|
+
<li class="login-list-item">
|
|
92
|
+
<a href="#" class="login-link">
|
|
93
|
+
<span class="login-link-label">
|
|
94
|
+
Salesforce
|
|
95
|
+
</span>
|
|
96
|
+
<img
|
|
97
|
+
class="login-link-img"
|
|
98
|
+
src="/assets/svg/salesforce-cloud.svg"
|
|
99
|
+
alt="Salesforce logo"
|
|
100
|
+
/>
|
|
101
|
+
<dx-icon
|
|
102
|
+
class="login-link-icon"
|
|
103
|
+
symbol="new_window"
|
|
104
|
+
size="xsmall"
|
|
105
|
+
></dx-icon>
|
|
106
|
+
</a>
|
|
107
|
+
</li>
|
|
108
|
+
<li class="login-list-item">
|
|
109
|
+
<a href="#" class="login-link">
|
|
110
|
+
<span class="login-link-label">
|
|
111
|
+
Marketing Cloud
|
|
112
|
+
</span>
|
|
113
|
+
<dx-icon
|
|
114
|
+
class="login-link-icon"
|
|
115
|
+
symbol="new_window"
|
|
116
|
+
size="xsmall"
|
|
117
|
+
></dx-icon>
|
|
118
|
+
</a>
|
|
119
|
+
</li>
|
|
120
|
+
</ul>
|
|
121
|
+
</div>
|
|
122
|
+
<div class="login-section">
|
|
123
|
+
<span class="login-section-title">
|
|
124
|
+
Community & Resources
|
|
125
|
+
</span>
|
|
126
|
+
<ul>
|
|
127
|
+
<li class="login-list-item">
|
|
128
|
+
<a href="#" class="login-link">
|
|
129
|
+
<span class="login-link-label">
|
|
130
|
+
Trailblazer.me
|
|
131
|
+
</span>
|
|
132
|
+
</a>
|
|
133
|
+
<div class="login-link-blurb">
|
|
134
|
+
Login into access a rich community of
|
|
135
|
+
Salesforce Developers, get ideas, and find
|
|
136
|
+
solutions.
|
|
137
|
+
</div>
|
|
138
|
+
</li>
|
|
139
|
+
</ul>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</dx-popover>
|
|
144
|
+
</div>
|
|
145
|
+
</template>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { api, LightningElement, track } from "lwc";
|
|
2
|
+
import Cookie from "js-cookie";
|
|
3
|
+
// import oauth2 from "salesforce-oauth2";
|
|
4
|
+
|
|
5
|
+
// TODO: move to env vars
|
|
6
|
+
// const TBID_CLIENT_ID = '3MVG982oBBDdwyHh3OFdQJTLxbk1dWC8NhBSiKvAsu3gn9m6WhiDKT8iLn34y4w6xsLeIHTbMbhuPPnGfYoW.';
|
|
7
|
+
// const TBID_CLIENT_SECRET = 'FC1B4F3E83746CD6ED3A6356B2FCF671A0470C6ADB88BE1A9F288B2D58400BEA';
|
|
8
|
+
// const TBID_COMMUNITY_URL = 'https://dev1-trailblazer-identity.cs192.force.com';
|
|
9
|
+
const TBID_AUTH_URL = "https://tbid-auth-app-dev.herokuapp.com/tbid/dologin";
|
|
10
|
+
const TBID_USERINFO_URL =
|
|
11
|
+
"https://dev1-trailblazer-identity.cs192.force.com/services/oauth2/userinfo";
|
|
12
|
+
|
|
13
|
+
export interface UserInfo {
|
|
14
|
+
avatarImgSrc?: string;
|
|
15
|
+
firstName?: string;
|
|
16
|
+
lastName?: string;
|
|
17
|
+
username?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default class AvatarButton extends LightningElement {
|
|
21
|
+
@api size: "small" | "medium" | "large" = "medium";
|
|
22
|
+
|
|
23
|
+
@track
|
|
24
|
+
private userInfo: UserInfo = {};
|
|
25
|
+
private _isLoading = false;
|
|
26
|
+
private _tbidAccessToken: string | undefined;
|
|
27
|
+
|
|
28
|
+
private get isLoggedIn() {
|
|
29
|
+
return Boolean(this._tbidAccessToken);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
this._tbidAccessToken = Cookie.get("TBID");
|
|
34
|
+
|
|
35
|
+
if (this._tbidAccessToken) {
|
|
36
|
+
this.requestUserInfo(this._tbidAccessToken);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
onLoginClick() {
|
|
41
|
+
if (!this.isLoggedIn) {
|
|
42
|
+
window.location.assign(TBID_AUTH_URL);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private updateAvatarWithUserInfo(userInfo: any) {
|
|
47
|
+
this.userInfo.avatarImgSrc = userInfo?.photos?.thumbnail;
|
|
48
|
+
// TODO: Consider displaying initials if no photo. Is there always a photo?
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private async requestUserInfo(accessToken: string) {
|
|
52
|
+
this._isLoading = true;
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
// FIXME: The TBID userinfo currently only accepts the access token in the URL
|
|
56
|
+
// as a query parameter. This is bad, but they're aware of it, and when it is
|
|
57
|
+
// fixed, we should use a header or something instead.
|
|
58
|
+
const userInfoRes = await fetch(
|
|
59
|
+
TBID_USERINFO_URL + "?access_token=" + accessToken
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
if (userInfoRes.ok) {
|
|
63
|
+
const userInfo = await userInfoRes.json();
|
|
64
|
+
this.updateAvatarWithUserInfo(userInfo);
|
|
65
|
+
} else {
|
|
66
|
+
if (userInfoRes.status === 403) {
|
|
67
|
+
// Bad access token; try to refresh the token
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
} catch (ex) {
|
|
71
|
+
// TODO: Something not directly related to auth went wrong. Unsure what to do here.
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
this._isLoading = false;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private handleAuthFailure() {}
|
|
78
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import { Breadcrumb,
|
|
3
|
+
import { Breadcrumb, OptionWithNested } from "typings/custom";
|
|
4
4
|
import { toJson } from "dxUtils/normalizers";
|
|
5
5
|
|
|
6
6
|
type LabelMap = { [href: string]: string };
|
|
@@ -19,7 +19,7 @@ const toLabel = (val: string) => {
|
|
|
19
19
|
export default class Breadcrumbs extends LightningElement {
|
|
20
20
|
@api ariaLabel: string = "Navigation Breadcrumbs";
|
|
21
21
|
@api baseHref: string = "/";
|
|
22
|
-
@api navItems:
|
|
22
|
+
@api navItems: OptionWithNested[] = [];
|
|
23
23
|
@api pathname: string = window.location.pathname;
|
|
24
24
|
@api title: string = "Salesforce";
|
|
25
25
|
@api logo: boolean = false;
|
|
@@ -42,19 +42,22 @@ export default class Breadcrumbs extends LightningElement {
|
|
|
42
42
|
private _breadcrumbs!: Breadcrumb[];
|
|
43
43
|
|
|
44
44
|
private get labelMap(): LabelMap {
|
|
45
|
-
const deepReducer = (options:
|
|
46
|
-
options.reduce(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
const deepReducer = (options: OptionWithNested[]) =>
|
|
46
|
+
options.reduce(
|
|
47
|
+
(acc: LabelMap, item: OptionWithNested): LabelMap => {
|
|
48
|
+
if (item.options) {
|
|
49
|
+
return { ...acc, ...deepReducer(item.options) };
|
|
50
|
+
}
|
|
51
|
+
if (!item.link) {
|
|
52
|
+
return acc;
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
...acc,
|
|
56
|
+
[item.link.href]: item.label
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
{}
|
|
60
|
+
);
|
|
58
61
|
return this.navItems ? deepReducer(this.navItems) : {};
|
|
59
62
|
}
|
|
60
63
|
|
|
@@ -108,6 +108,15 @@
|
|
|
108
108
|
width: var(--dx-c-slot-empty-width, var(--dx-g-spacing-xl));
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
.button.size-hero {
|
|
112
|
+
font-size: var(--dx-g-text-lg);
|
|
113
|
+
height: 52px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.button.size-hero.style-icon.slot-empty {
|
|
117
|
+
width: var(--dx-c-slot-empty-width, 52px);
|
|
118
|
+
}
|
|
119
|
+
|
|
111
120
|
/* primary */
|
|
112
121
|
|
|
113
122
|
.button.variant_primary {
|
|
@@ -17,7 +17,7 @@ export default class Button extends LightningElement {
|
|
|
17
17
|
@api iconSymbol?: IconSymbol;
|
|
18
18
|
@api iconPosition?: "right" | "left" = "right";
|
|
19
19
|
@api loading: boolean = false;
|
|
20
|
-
@api size: "large" | "small" = "small";
|
|
20
|
+
@api size: "large" | "hero" | "small" = "small";
|
|
21
21
|
@api variant: ButtonVariant = "primary";
|
|
22
22
|
@api inlineTextColor: ButtonTextColor = "dark";
|
|
23
23
|
@api font: "display" | "sans" = "display";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OptionWithNested, PopperPlacement } from "typings/custom";
|
|
2
2
|
import { LightningElement, api, track } from "lwc";
|
|
3
3
|
import cx from "classnames";
|
|
4
4
|
import get from "lodash.get";
|
|
5
5
|
import { deepmapOptions } from "dxUtils/options";
|
|
6
6
|
import { toJson } from "dxUtils/normalizers";
|
|
7
7
|
|
|
8
|
-
interface DropdownOption extends
|
|
8
|
+
interface DropdownOption extends OptionWithNested {
|
|
9
9
|
// link that gets shown as a highlighted link at end of option group
|
|
10
10
|
calloutLink?: {
|
|
11
11
|
href: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import {
|
|
3
|
+
import { OptionWithNested } from "typings/custom";
|
|
4
4
|
import { track } from "dxUtils/analytics";
|
|
5
5
|
|
|
6
6
|
export default class DropdownOption extends LightningElement {
|
|
7
|
-
@api option!:
|
|
7
|
+
@api option!: OptionWithNested;
|
|
8
8
|
@api suppressGtmNavHeadings: boolean = false;
|
|
9
9
|
@api keyValue!: string;
|
|
10
10
|
@api active: boolean = false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
+
import { FooterVariant, OptionWithLink } from "typings/custom";
|
|
3
4
|
import { toJson } from "dxUtils/normalizers";
|
|
4
|
-
import { FooterVariant, Option } from "typings/custom";
|
|
5
5
|
import {
|
|
6
6
|
generalLinks,
|
|
7
7
|
termsLinks,
|
|
@@ -31,7 +31,7 @@ export default class Footer extends LightningElement {
|
|
|
31
31
|
this._locales = toJson(value);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
private _locales?:
|
|
34
|
+
private _locales?: OptionWithLink[] | null = null;
|
|
35
35
|
private termsLinks = termsLinks;
|
|
36
36
|
private generalLinks = generalLinks;
|
|
37
37
|
private socialLinks = socialLinks;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { api } from "lwc";
|
|
2
|
+
import type { OptionWithNested } from "typings/custom";
|
|
2
3
|
import { HeaderBase } from "dxBaseElements/headerBase";
|
|
3
4
|
import { toJson } from "dxUtils/normalizers";
|
|
4
|
-
import type { Option } from "typings/custom";
|
|
5
5
|
|
|
6
6
|
export default class Header extends HeaderBase {
|
|
7
|
-
private _breadcrumbs!:
|
|
7
|
+
private _breadcrumbs!: OptionWithNested[];
|
|
8
8
|
|
|
9
9
|
@api
|
|
10
10
|
get breadcrumbs() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import {
|
|
3
|
+
import { OptionWithNested } from "typings/custom";
|
|
4
4
|
import { deepmapOptions } from "dxUtils/options";
|
|
5
5
|
|
|
6
6
|
export default class HeaderMobileNavMenu extends LightningElement {
|
|
@@ -9,7 +9,7 @@ export default class HeaderMobileNavMenu extends LightningElement {
|
|
|
9
9
|
@api pathname: string | null = null;
|
|
10
10
|
|
|
11
11
|
@api
|
|
12
|
-
set navItems(_navItems:
|
|
12
|
+
set navItems(_navItems: OptionWithNested[]) {
|
|
13
13
|
this._navItems = _navItems;
|
|
14
14
|
}
|
|
15
15
|
get navItems() {
|
|
@@ -24,7 +24,7 @@ export default class HeaderMobileNavMenu extends LightningElement {
|
|
|
24
24
|
// then we use deepmapper to affect the actual root options (actual links)
|
|
25
25
|
return deepmapOptions(
|
|
26
26
|
navItems,
|
|
27
|
-
(app:
|
|
27
|
+
(app: OptionWithNested, index: number, level: number) => {
|
|
28
28
|
const active = app.link
|
|
29
29
|
? app.link.href === this.pathname
|
|
30
30
|
: false;
|
|
@@ -47,7 +47,7 @@ export default class HeaderMobileNavMenu extends LightningElement {
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
private _navItems:
|
|
50
|
+
private _navItems: OptionWithNested[] = [];
|
|
51
51
|
private navElement: HTMLElement | null = null;
|
|
52
52
|
private wasOpen: boolean = false;
|
|
53
53
|
private showScrollShadow: boolean = false;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
|
-
import { TabVariant,
|
|
2
|
+
import { TabVariant, OptionWithNested } from "typings/custom";
|
|
3
3
|
export default class HeaderNav extends LightningElement {
|
|
4
4
|
@api pathname: string | null = null;
|
|
5
5
|
@api variant: TabVariant = "default";
|
|
6
6
|
@api ariaLabel: string = "Primary Navigation";
|
|
7
7
|
|
|
8
8
|
@api
|
|
9
|
-
set navItems(_navItems:
|
|
9
|
+
set navItems(_navItems: OptionWithNested[]) {
|
|
10
10
|
this._navItems = _navItems;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
get navItems() {
|
|
14
14
|
const activeItem = this._navItems
|
|
15
|
-
.filter((navItem:
|
|
15
|
+
.filter((navItem: OptionWithNested) => {
|
|
16
16
|
if (!navItem.link || navItem.link.href === "/") {
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
@@ -31,7 +31,7 @@ export default class HeaderNav extends LightningElement {
|
|
|
31
31
|
(b.link?.href.length || 0) - (a.link?.href.length || 0)
|
|
32
32
|
)[0];
|
|
33
33
|
|
|
34
|
-
const items = this._navItems.map((navItem:
|
|
34
|
+
const items = this._navItems.map((navItem: OptionWithNested) =>
|
|
35
35
|
navItem.link
|
|
36
36
|
? {
|
|
37
37
|
...navItem,
|
|
@@ -45,7 +45,7 @@ export default class HeaderNav extends LightningElement {
|
|
|
45
45
|
return items;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
private _navItems:
|
|
48
|
+
private _navItems: OptionWithNested[] = [];
|
|
49
49
|
|
|
50
50
|
private requestOpenNavMenu(e: PointerEvent) {
|
|
51
51
|
const detail = (<HTMLButtonElement>e.currentTarget).getAttribute(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import { PopoverRequestCloseType,
|
|
3
|
+
import { PopoverRequestCloseType, OptionWithLink } from "typings/custom";
|
|
4
4
|
import { buildSearchEngine } from "dxUtils/coveo";
|
|
5
5
|
import {
|
|
6
6
|
StandaloneSearchBox as StandaloneSearchBoxType,
|
|
@@ -28,7 +28,7 @@ export default class HeaderSearch extends LightningElement {
|
|
|
28
28
|
return this.mobile ? null : "desktop_search-container";
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
private get suggestions():
|
|
31
|
+
private get suggestions(): OptionWithLink[] {
|
|
32
32
|
if (this.searchState) {
|
|
33
33
|
return this.searchState.suggestions.map(
|
|
34
34
|
({ highlightedValue }: { highlightedValue: string }) => ({
|
|
@@ -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
|
}
|