@salesforcedevs/dx-components 0.55.2 → 0.55.3-alpha-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
@@ -12,6 +12,7 @@
12
12
  "dx/cardDocs",
13
13
  "dx/cardEvent",
14
14
  "dx/cardExpanded",
15
+ "dx/cardGridDocs",
15
16
  "dx/cardMinimal",
16
17
  "dx/cardNews",
17
18
  "dx/cardPodcastEpisode",
@@ -26,6 +27,7 @@
26
27
  "dx/dropdown",
27
28
  "dx/emptyState",
28
29
  "dx/feature",
30
+ "dx/featureGrid",
29
31
  "dx/featuredContentHeader",
30
32
  "dx/featuresList",
31
33
  "dx/filterMenu",
@@ -75,6 +77,7 @@
75
77
  "dxHelpers/code",
76
78
  "dxHelpers/commonHeader",
77
79
  "dxHelpers/reset",
80
+ "dxHelpers/scrollbar",
78
81
  "dxHelpers/table",
79
82
  "dxHelpers/text",
80
83
  "dxUtils/analytics",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "0.55.2",
3
+ "version": "0.55.3-alpha-3",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -16,12 +16,15 @@
16
16
  "@vimeo/player": "^2.16.4",
17
17
  "classnames": "^2.2.6",
18
18
  "debounce": "^1.2.0",
19
+ "js-cookie": "^3.0.1",
19
20
  "lodash.get": "^4.4.2",
20
- "microtip": "0.2.2"
21
+ "microtip": "0.2.2",
22
+ "salesforce-oauth2": "^0.2.0"
21
23
  },
22
24
  "devDependencies": {
23
25
  "@types/classnames": "^2.2.10",
24
26
  "@types/debounce": "^1.2.0",
27
+ "@types/js-cookie": "^3.0.2",
25
28
  "@types/lodash.get": "^4.4.6",
26
29
  "@types/vimeo__player": "^2.16.2"
27
30
  }
@@ -0,0 +1,133 @@
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
+ --dx-c-slot-empty-width: max-content;
9
+ }
10
+
11
+ .avatar-small-container {
12
+ padding: 2px 0;
13
+ }
14
+
15
+ .avatar {
16
+ border-radius: 100%;
17
+ border: 2px solid #0d9dda;
18
+ }
19
+
20
+ .avatar.avatar-small {
21
+ display: block;
22
+ height: var(--dx-g-spacing-lg);
23
+ width: var(--dx-g-spacing-lg);
24
+ }
25
+
26
+ .avatar.avatar-medium {
27
+ margin-bottom: 14px;
28
+ width: var(--dx-g-spacing-2xl);
29
+ }
30
+
31
+ .login-control {
32
+ margin-left: var(--dx-g-spacing-smd);
33
+ }
34
+
35
+ .login-container {
36
+ padding: 16px;
37
+ }
38
+
39
+ .login-container.logged-in {
40
+ padding-top: 68px;
41
+ }
42
+
43
+ .header-img {
44
+ left: 0;
45
+ position: absolute;
46
+ top: 0;
47
+ width: 100%;
48
+ z-index: -1;
49
+ }
50
+
51
+ .heading {
52
+ color: var(--dx-g-blue-vibrant-20);
53
+ display: block;
54
+ font-family: var(--dx-g-font-display);
55
+ font-size: var(--dx-g-text-lg);
56
+ line-height: 28px;
57
+ }
58
+
59
+ .sub-heading {
60
+ color: var(--dx-g-blue-vibrant-20);
61
+ display: block;
62
+ font-family: var(--dx-g-font-sans);
63
+ font-size: 12px;
64
+ line-height: 18px;
65
+ padding: 8px 0;
66
+ }
67
+
68
+ ul {
69
+ list-style: none;
70
+ margin: 0;
71
+ padding: 0;
72
+ }
73
+
74
+ .login-list-item {
75
+ padding-bottom: 10px;
76
+ }
77
+
78
+ .login-section ~ .login-section {
79
+ border-top: 1px solid var(--dx-g-gray-90);
80
+ margin-top: 12px;
81
+ }
82
+
83
+ .login-section-title {
84
+ color: var(--dx-g-gray-30);
85
+ display: inline-block;
86
+ font-family: var(--dx-g-font-sans);
87
+ font-size: 14px;
88
+ line-height: 20px;
89
+ padding: 20px 0 12px;
90
+ }
91
+
92
+ .login-link {
93
+ color: var(--dx-g-blue-vibrant-20);
94
+ display: block;
95
+ }
96
+
97
+ .login-link-label {
98
+ display: inline-block;
99
+ font-family: var(--dx-g-font-display);
100
+ font-size: 16px;
101
+ line-height: 24px;
102
+ }
103
+
104
+ .login-link-img {
105
+ display: inline-block;
106
+ height: 16px;
107
+ margin-left: 6px;
108
+ vertical-align: middle;
109
+ }
110
+
111
+ .login-link-icon {
112
+ display: inline-block;
113
+ margin-left: 6px;
114
+ vertical-align: baseline;
115
+ }
116
+
117
+ .login-link-blurb {
118
+ font-family: var(--dx-g-font-sans);
119
+ font-size: 14px;
120
+ line-height: 20px;
121
+ padding-top: 4px;
122
+ }
123
+
124
+ .heading-links {
125
+ color: var(--dx-g-gray-90);
126
+ font-family: var(--dx-g-font-sans);
127
+ font-size: 14px;
128
+ line-height: 20px;
129
+ }
130
+
131
+ a.inline-link {
132
+ color: var(--dx-g-blue-vibrant-50);
133
+ }
@@ -0,0 +1,149 @@
1
+ <template>
2
+ <div if:true={isLoggedIn}>
3
+ <dx-popover offset="small" width="320px" open-on-hover>
4
+ <div slot="control" class="avatar-small-container login-control">
5
+ <img src={userInfo.avatarImgSrc} class="avatar avatar-small" />
6
+ </div>
7
+ <div slot="content">
8
+ <div class="login-container logged-in">
9
+ <img
10
+ src="/assets/svg/login-widget-bg.png"
11
+ class="header-img"
12
+ />
13
+ <img
14
+ src={userInfo.avatarImgSrc}
15
+ class="avatar avatar-medium"
16
+ />
17
+ <span class="heading">{userInfo.fullName}</span>
18
+ <span class="sub-heading">{userInfo.username}</span>
19
+ <div class="heading-links">
20
+ <!--
21
+ <a href="#" class="inline-link">Switch account</a>
22
+ &nbsp;&nbsp;|&nbsp;&nbsp;
23
+ -->
24
+ <a href={logoutUrl} class="inline-link">Logout</a>
25
+ </div>
26
+ <div class="login-section">
27
+ <span class="login-section-title">Trailblazer.me</span>
28
+ <ul>
29
+ <li class="login-list-item">
30
+ <a href={settingsUrl} class="login-link">
31
+ <span class="login-link-label">
32
+ Settings
33
+ </span>
34
+ <dx-icon
35
+ class="login-link-icon"
36
+ symbol="new_window"
37
+ size="xsmall"
38
+ ></dx-icon>
39
+ </a>
40
+ </li>
41
+ <li class="login-list-item">
42
+ <a href={profileUrl} class="login-link">
43
+ <span class="login-link-label">
44
+ Profile
45
+ </span>
46
+ <dx-icon
47
+ class="login-link-icon"
48
+ symbol="new_window"
49
+ size="xsmall"
50
+ ></dx-icon>
51
+ </a>
52
+ </li>
53
+ <li class="login-list-item">
54
+ <a href="#" class="login-link">
55
+ <span class="login-link-label">
56
+ Developer Forums
57
+ </span>
58
+ <dx-icon
59
+ class="login-link-icon"
60
+ symbol="new_window"
61
+ size="xsmall"
62
+ ></dx-icon>
63
+ </a>
64
+ <div class="login-link-blurb">
65
+ Our Developer Forums have a new home!&nbsp;
66
+ <a href="#" class="inline-link">
67
+ Learn more
68
+ </a>
69
+ </div>
70
+ </li>
71
+ </ul>
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </dx-popover>
76
+ </div>
77
+ <div if:false={isLoggedIn}>
78
+ <dx-popover offset="small" width="320px" open-on-hover>
79
+ <dx-button
80
+ slot="control"
81
+ class="login-control"
82
+ icon-symbol="user"
83
+ icon-position="left"
84
+ loading={isLoading}
85
+ variant="custom"
86
+ >
87
+ Login
88
+ </dx-button>
89
+ <div slot="content">
90
+ <div class="login-container">
91
+ <span class="heading">Login</span>
92
+ <div class="login-section">
93
+ <span class="login-section-title">Products</span>
94
+ <ul>
95
+ <li class="login-list-item">
96
+ <a href="#" class="login-link">
97
+ <span class="login-link-label">
98
+ Salesforce
99
+ </span>
100
+ <img
101
+ class="login-link-img"
102
+ src="/assets/svg/salesforce-cloud.svg"
103
+ alt="Salesforce logo"
104
+ />
105
+ <dx-icon
106
+ class="login-link-icon"
107
+ symbol="new_window"
108
+ size="xsmall"
109
+ ></dx-icon>
110
+ </a>
111
+ </li>
112
+ <li class="login-list-item">
113
+ <a href="#" class="login-link">
114
+ <span class="login-link-label">
115
+ Marketing Cloud
116
+ </span>
117
+ <dx-icon
118
+ class="login-link-icon"
119
+ symbol="new_window"
120
+ size="xsmall"
121
+ ></dx-icon>
122
+ </a>
123
+ </li>
124
+ </ul>
125
+ </div>
126
+ <div class="login-section">
127
+ <span class="login-section-title">
128
+ Community & Resources
129
+ </span>
130
+ <ul>
131
+ <li class="login-list-item">
132
+ <a href={loginUrl} class="login-link">
133
+ <span class="login-link-label">
134
+ Trailblazer.me
135
+ </span>
136
+ </a>
137
+ <div class="login-link-blurb">
138
+ Login into access a rich community of
139
+ Salesforce Developers, get ideas, and find
140
+ solutions.
141
+ </div>
142
+ </li>
143
+ </ul>
144
+ </div>
145
+ </div>
146
+ </div>
147
+ </dx-popover>
148
+ </div>
149
+ </template>
@@ -0,0 +1,100 @@
1
+ import { api, LightningElement } from "lwc";
2
+ import Cookie from "js-cookie";
3
+
4
+ const TBID_BASE_URL = "https://dev1-trailblazer-identity.cs192.force.com";
5
+ const TBID_LOGIN_URL =
6
+ "https://development.developer.salesforce.com/tbid/dologin";
7
+ const TBID_LOGOUT_URL = `${TBID_BASE_URL}/services/auth/idp/oidc/logout`;
8
+ const TBID_USERINFO_URL = `${TBID_BASE_URL}/services/oauth2/userinfo`;
9
+
10
+ export interface UserInfo {
11
+ avatarImgSrc?: string;
12
+ firstName?: string;
13
+ lastName?: string;
14
+ username?: string;
15
+ readonly fullName: string;
16
+ }
17
+
18
+ export default class AvatarButton extends LightningElement {
19
+ @api size: "small" | "medium" | "large" = "medium";
20
+
21
+ private userInfo: UserInfo = {
22
+ get fullName() {
23
+ if (this.firstName && this.lastName) {
24
+ return `${this.firstName} ${this.lastName}`;
25
+ }
26
+ return this.firstName || this.lastName || "";
27
+ }
28
+ };
29
+ private isLoading = false;
30
+ private settingsUrl = `${TBID_BASE_URL}/settings`;
31
+ private profileUrl = `${TBID_BASE_URL}/id`;
32
+ private loginUrl = TBID_LOGIN_URL;
33
+ private logoutUrl = TBID_LOGOUT_URL;
34
+
35
+ // A user only counts as logged in for our purposes if they have an access token
36
+ // and we have successfully used it to get their info.
37
+ private get isLoggedIn() {
38
+ return Boolean(this._tbidAccessToken) && this._didReceiveUserInfo;
39
+ }
40
+
41
+ private _didReceiveUserInfo = false;
42
+ private _tbidAccessToken: string | undefined;
43
+
44
+ connectedCallback() {
45
+ this._tbidAccessToken = Cookie.get("TBID");
46
+
47
+ if (this._tbidAccessToken) {
48
+ this.requestUserInfo(this._tbidAccessToken);
49
+ }
50
+ }
51
+
52
+ private updateAvatarWithUserInfo(userInfo: any) {
53
+ if (!userInfo) {
54
+ return;
55
+ }
56
+
57
+ this.userInfo.avatarImgSrc = userInfo.photos?.thumbnail;
58
+ this.userInfo.firstName = userInfo.given_name;
59
+ this.userInfo.lastName = userInfo.family_name;
60
+ this.userInfo.username = userInfo.preferred_username;
61
+ // TODO: Consider displaying initials if no photo. Is there always a photo?
62
+ }
63
+
64
+ private async requestUserInfo(accessToken: string) {
65
+ this.isLoading = true;
66
+
67
+ try {
68
+ // FIXME: The TBID userinfo currently only accepts the access token in the URL
69
+ // as a query parameter. This is bad, but they're aware of it, and when it is
70
+ // fixed, we should use a header or something instead.
71
+ const userInfoRes = await fetch(
72
+ TBID_USERINFO_URL +
73
+ "?access_token=" +
74
+ encodeURIComponent(accessToken)
75
+ );
76
+
77
+ if (userInfoRes.ok) {
78
+ const userInfo = await userInfoRes.json();
79
+ this.updateAvatarWithUserInfo(userInfo);
80
+ this._didReceiveUserInfo = true;
81
+ } else {
82
+ if (userInfoRes.status === 403) {
83
+ const refreshToken = Cookie.get("TBID_REFRESH");
84
+ if (refreshToken) {
85
+ console.log("Would use refresh token");
86
+ }
87
+ }
88
+ // TODO: Do we want a "something went wrong" state here?
89
+ }
90
+ } catch (ex) {
91
+ // TODO: Something not directly related to auth went wrong. Unsure what to do here.
92
+ }
93
+
94
+ this.isLoading = false;
95
+ }
96
+
97
+ // private refreshAccessToken(refreshToken);
98
+
99
+ // private handleAuthFailure() {}
100
+ }
@@ -0,0 +1,74 @@
1
+ .docs-action-bar {
2
+ display: flex;
3
+ justify-content: space-between;
4
+ align-items: flex-end;
5
+ padding: var(--dx-g-spacing-md) 0 var(--dx-g-spacing-lg);
6
+ }
7
+
8
+ .docs-action-bar > .records-container {
9
+ margin-right: auto;
10
+ }
11
+
12
+ .docs-action-bar .filters-container {
13
+ display: flex;
14
+ }
15
+
16
+ .docs-action-bar .filters-container > *:not(:first-child),
17
+ dx-input {
18
+ margin-left: var(--dx-g-spacing-sm);
19
+ }
20
+
21
+ dx-input {
22
+ --dx-c-input-width: 285px;
23
+ }
24
+
25
+ .pagination-container {
26
+ max-width: fit-content;
27
+ max-width: -moz-fit-content;
28
+ margin: var(--dx-g-spacing-lg) auto;
29
+ }
30
+
31
+ @media screen and (max-width: 1024px) {
32
+ dx-card-docs {
33
+ --dx-c-body-max-lines: 3;
34
+ }
35
+ }
36
+
37
+ @media screen and (max-width: 768px) {
38
+ .docs-action-bar {
39
+ flex-direction: column-reverse;
40
+ width: 100%;
41
+ padding: 0;
42
+ }
43
+
44
+ .records-container {
45
+ margin-bottom: var(--dx-g-spacing-md);
46
+ }
47
+
48
+ dx-input {
49
+ --dx-c-input-width: 100%;
50
+
51
+ width: 100%;
52
+ margin-bottom: var(--dx-g-spacing-md);
53
+ }
54
+ }
55
+
56
+ @media screen and (max-width: 600px) {
57
+ .pagination-container {
58
+ width: 100%;
59
+ overflow: hidden;
60
+ }
61
+
62
+ .pagination-container > * {
63
+ position: absolute;
64
+ left: 50%;
65
+ transform: translateX(-50%);
66
+ }
67
+ }
68
+
69
+ @media screen and (max-width: 460px) {
70
+ .docs-action-bar .records-container {
71
+ transform: initial;
72
+ padding: var(--dx-g-spacing-md) 0;
73
+ }
74
+ }
@@ -0,0 +1,67 @@
1
+ <template>
2
+ <div class="card-grid">
3
+ <div class="docs-action-bar">
4
+ <div class="records-container">
5
+ <span if:true={endingRecord}>
6
+ Showing { startingRecord } to { endingRecord } of {
7
+ cards.length }
8
+ </span>
9
+ </div>
10
+ <div class="filters-container">
11
+ <slot name="filters"></slot>
12
+ </div>
13
+ <dx-input
14
+ size="small"
15
+ placeholder="Search..."
16
+ icon-symbol="search"
17
+ shortcut-key="j"
18
+ class="docs-search-input"
19
+ onchange={onSearchChange}
20
+ value={value}
21
+ ></dx-input>
22
+ </div>
23
+ <dx-grid columns="four">
24
+ <template for:each={currentPageCards} for:item="card">
25
+ <dx-card-docs
26
+ key={card.title}
27
+ body={card.body}
28
+ href={card.href}
29
+ img-alt={card.imgAlt}
30
+ img-src={card.imgSrc}
31
+ label={card.label}
32
+ title={card.title}
33
+ target={card.target}
34
+ show-mobile-img={card.showMobileImg}
35
+ >
36
+ <template
37
+ if:true={card.links}
38
+ for:each={card.links}
39
+ for:item="link"
40
+ >
41
+ <dx-button
42
+ key={link.title}
43
+ href={link.href}
44
+ variant="inline"
45
+ >
46
+ { link.title }
47
+ </dx-button>
48
+ </template>
49
+ </dx-card-docs>
50
+ </template>
51
+ </dx-grid>
52
+ <div class="pagination-container" if:false={showEmptyState}>
53
+ <dx-pagination
54
+ current-page={page}
55
+ total-pages={totalPages}
56
+ pages-to-show="5"
57
+ onpagechange={goToPage}
58
+ if:false={hidePagination}
59
+ ></dx-pagination>
60
+ </div>
61
+ </div>
62
+ <dx-empty-state
63
+ title="Beep boop. That did not compute."
64
+ subtitle={emptyStateSubtitle}
65
+ if:true={showEmptyState}
66
+ ></dx-empty-state>
67
+ </template>
@@ -0,0 +1,86 @@
1
+ import { LightningElement, api, track } from "lwc";
2
+ import { toJson } from "dxUtils/normalizers";
3
+ import { DocsCard } from "typings/custom";
4
+
5
+ const stringsMatch = (val1?: string, val2?: string): boolean => {
6
+ return (
7
+ typeof val1 === "string" &&
8
+ typeof val2 === "string" &&
9
+ val1.toLowerCase().includes(val2.toLowerCase())
10
+ );
11
+ };
12
+
13
+ export default class CardGridDocs extends LightningElement {
14
+ @api pageSize = 24;
15
+ @api
16
+ get cards(): DocsCard[] {
17
+ return this._cards;
18
+ }
19
+ set cards(value) {
20
+ this._cards = toJson(value);
21
+ }
22
+
23
+ private page: number = 1;
24
+ private _cards: DocsCard[] = [];
25
+ @track
26
+ private value?: string;
27
+
28
+ private get filteredCards(): DocsCard[] {
29
+ return this.value
30
+ ? this.cards.filter(({ title, body, label }) =>
31
+ [title, body, label].some((val) =>
32
+ stringsMatch(val, this.value)
33
+ )
34
+ )
35
+ : this.cards;
36
+ }
37
+
38
+ private get currentPageCards() {
39
+ return this.filteredCards.slice(
40
+ this.startingRecord - 1,
41
+ this.endingRecord
42
+ );
43
+ }
44
+
45
+ private get startingRecord() {
46
+ return this.page === 1
47
+ ? this.page
48
+ : (this.page - 1) * this.pageSize + 1;
49
+ }
50
+
51
+ private get endingRecord() {
52
+ const defaultEndingRecord = this.pageSize * this.page;
53
+ return defaultEndingRecord > this.filteredCards.length
54
+ ? this.filteredCards.length
55
+ : defaultEndingRecord;
56
+ }
57
+
58
+ private get totalPages() {
59
+ return Math.ceil(this.filteredCards.length / this.pageSize);
60
+ }
61
+
62
+ private get hidePagination() {
63
+ return this.totalPages < 2;
64
+ }
65
+
66
+ private get emptyStateSubtitle() {
67
+ return "No results" + (this.value !== "" ? ` for "${this.value}"` : "");
68
+ }
69
+
70
+ private get showEmptyState() {
71
+ return !this.filteredCards.length;
72
+ }
73
+
74
+ private onSearchChange(e: InputEvent): void {
75
+ const detail = `${e.detail}`;
76
+ this.value = detail === "" ? undefined : detail;
77
+
78
+ if (this.startingRecord > this.cards.length) {
79
+ this.page = 1;
80
+ }
81
+ }
82
+
83
+ private goToPage(e: CustomEvent) {
84
+ this.page = e.detail;
85
+ }
86
+ }
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <slot onslotchange={onSlotChange}></slot>
3
+ </template>
@@ -0,0 +1,15 @@
1
+ import { LightningElement } from "lwc";
2
+ import { LightningSlotElement } from "typings/custom";
3
+
4
+ export default class FeatureGrid extends LightningElement {
5
+ private onSlotChange(e: LightningSlotElement) {
6
+ // @ts-ignore
7
+ const slot = e.target;
8
+ slot.assignedElements().forEach(
9
+ (featureElement: any, index: number) => {
10
+ featureElement.descriptionPosition =
11
+ index % 2 === 0 ? "left" : "right";
12
+ }
13
+ );
14
+ }
15
+ }
@@ -1,4 +1,5 @@
1
1
  @import "dxHelpers/reset";
2
+ @import "dxHelpers/scrollbar";
2
3
 
3
4
  :host {
4
5
  --dx-c-filter-menu-margin: 0;
@@ -37,8 +38,14 @@
37
38
  }
38
39
 
39
40
  .title-group {
41
+ display: flex;
42
+ }
43
+
44
+ .title-group-main {
40
45
  position: relative;
46
+ justify-content: space-between;
41
47
  margin: 0 var(--horizontal-padding);
48
+ width: calc(100% - 2 * var(--horizontal-padding));
42
49
  }
43
50
 
44
51
  .filter-menu-title {
@@ -77,9 +84,6 @@ label {
77
84
  }
78
85
 
79
86
  svg {
80
- position: absolute;
81
- right: 0;
82
- top: 0;
83
87
  background: transparent;
84
88
  stroke: var(--dx-g-blue-vibrant-50);
85
89
  }
@@ -105,6 +109,8 @@ svg,
105
109
 
106
110
  .checkbox-year {
107
111
  --dx-c-filter-menu-font-weight: bold;
112
+
113
+ width: 130px;
108
114
  }
109
115
 
110
116
  .view-more-btn {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <form class="container">
3
- <span class="title-group" onclick={dropdownToggle}>
3
+ <span class="title-group-main title-group" onclick={dropdownToggle}>
4
4
  <p class="filter-menu-title">{title}</p>
5
5
  <svg
6
6
  xmlns="http://www.w3.org/2000/svg"
@@ -16,7 +16,7 @@
16
16
  <polyline points="6 9 12 15 18 9"></polyline>
17
17
  </svg>
18
18
  </span>
19
- <ul class="nested first-layer">
19
+ <ul class="nested first-layer always-visible-scrollbar">
20
20
  <li>
21
21
  <template if:true={isBaseVariant}>
22
22
  <template for:each={filterMenuOptions} for:item="option">
@@ -37,33 +37,36 @@
37
37
  for:item="option"
38
38
  >
39
39
  <li key={option.id}>
40
- <dx-checkbox-native
41
- class="checkbox-year"
42
- value={option}
43
- onchange={onChange}
44
- >
45
- {option.name} ({option.totalNumberOfPosts})
46
- </dx-checkbox-native>
47
- <span onclick={dropdownToggle}>
48
- <svg
49
- xmlns="http://www.w3.org/2000/svg"
50
- width="24"
51
- height="24"
52
- viewBox="0 0 24 24"
53
- fill="none"
54
- stroke-width="2"
55
- stroke-linecap="round"
56
- stroke-linejoin="round"
57
- class="
58
- feather feather-chevron-down
59
- year-svg
60
- "
40
+ <div class="title-group">
41
+ <dx-checkbox-native
42
+ class="checkbox-year"
43
+ value={option}
44
+ onchange={onChange}
61
45
  >
62
- <polyline
63
- points="6 9 12 15 18 9"
64
- ></polyline>
65
- </svg>
66
- </span>
46
+ {option.name}
47
+ ({option.totalNumberOfPosts})
48
+ </dx-checkbox-native>
49
+ <span onclick={dropdownToggle}>
50
+ <svg
51
+ xmlns="http://www.w3.org/2000/svg"
52
+ width="24"
53
+ height="24"
54
+ viewBox="0 0 24 24"
55
+ fill="none"
56
+ stroke-width="2"
57
+ stroke-linecap="round"
58
+ stroke-linejoin="round"
59
+ class="
60
+ feather feather-chevron-down
61
+ year-svg
62
+ "
63
+ >
64
+ <polyline
65
+ points="6 9 12 15 18 9"
66
+ ></polyline>
67
+ </svg>
68
+ </span>
69
+ </div>
67
70
  <ul class="nested second-layer">
68
71
  <template
69
72
  for:each={option.months}
@@ -1,4 +1,5 @@
1
1
  import { LightningElement, api } from "lwc";
2
+ import { toJson } from "dxUtils/normalizers";
2
3
 
3
4
  interface Option {
4
5
  id: number;
@@ -8,9 +9,17 @@ interface Option {
8
9
  export default class FilterMenu extends LightningElement {
9
10
  @api name: string = "";
10
11
  @api title: string = "Filter Menu";
11
- @api options: Option[] = [];
12
12
  @api variant: string = "base";
13
13
 
14
+ @api
15
+ get options(): Option[] {
16
+ return this._options;
17
+ }
18
+ set options(value: any) {
19
+ this._options = toJson(value);
20
+ }
21
+
22
+ private _options: Option[] = [];
14
23
  private showMore: boolean = false;
15
24
 
16
25
  get isBaseVariant() {
@@ -99,9 +108,10 @@ export default class FilterMenu extends LightningElement {
99
108
  }
100
109
 
101
110
  private dropdownToggle(e: any) {
102
- e.currentTarget.parentElement
103
- .querySelector(".nested")
104
- .classList.toggle("active");
111
+ (
112
+ e.currentTarget.parentElement.querySelector(".nested") ||
113
+ e.currentTarget.parentElement.parentElement.querySelector(".nested")
114
+ ).classList.toggle("active");
105
115
 
106
116
  e.currentTarget.querySelector("svg").classList.toggle("caret-down");
107
117
  }
@@ -67,6 +67,8 @@ export default class Grid extends LightningElement {
67
67
  }
68
68
 
69
69
  onSlotChange(e: Event) {
70
- this._itemCount = (e.target as LightningSlotElement).assignedElements().length;
70
+ this._itemCount = (
71
+ e.target as LightningSlotElement
72
+ ).assignedElements().length;
71
73
  }
72
74
  }
@@ -26,6 +26,7 @@
26
26
  onstatechange={handleStateChange}
27
27
  ></dx-header-search>
28
28
  </div>
29
+ <dx-avatar-button></dx-avatar-button>
29
30
  <div if:true={showSignup} class="header-login-signup">
30
31
  <dx-button
31
32
  aria-label="Sign Up For Salesforce Developer Edition"
@@ -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 log";
6
+ @api imgAlt: string = "Salesforce logo";
7
7
  @api label!: string;
8
8
  }
@@ -0,0 +1,31 @@
1
+ /* a truly always visible scrollbar is only possible on webkit --
2
+ on firefox we are only able to sync the styling
3
+ but cannot force the scrollbar to appear for users */
4
+
5
+ /* mozilla styles */
6
+ .always-visible-scrollbar {
7
+ scrollbar-color: #757575 transparent;
8
+ scrollbar-width: thin;
9
+ }
10
+
11
+ /* webkit styles */
12
+ .always-visible-scrollbar::-webkit-scrollbar {
13
+ width: 14px;
14
+ }
15
+
16
+ .always-visible-scrollbar::-webkit-scrollbar-thumb {
17
+ background-clip: content-box;
18
+ border: 5px solid transparent;
19
+ border-radius: 10px;
20
+ box-shadow: #757575 inset 0 0 0 10px;
21
+ }
22
+
23
+ .always-visible-scrollbar::-webkit-scrollbar-corner {
24
+ background-color: transparent;
25
+ }
26
+
27
+ .always-visible-scrollbar::-webkit-scrollbar-button {
28
+ width: 0;
29
+ height: 0;
30
+ display: none;
31
+ }