@salesforcedevs/dw-components 1.2.14 → 1.2.16
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dw-components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.16",
|
|
4
4
|
"description": "Lightning web components for https://developer.salesforce.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"@types/lodash.orderby": "^4.6.7",
|
|
23
23
|
"@types/lodash.uniqby": "^4.7.7"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "bd151c2d46039c53ca0d9dd818e7f8dbab65e08c"
|
|
26
26
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
@import "dxHelpers/text";
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
--dw-browse-trials-padding-top: 0;
|
|
6
|
+
--dw-browse-trials-padding-bottom: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.title {
|
|
10
|
+
color: var(--dx-g-blue-vibrant-20);
|
|
11
|
+
font-family: var(--dx-g-font-display);
|
|
12
|
+
font-weight: var(--dx-g-font-weight-demi);
|
|
13
|
+
font-size: 32px;
|
|
14
|
+
letter-spacing: -0.4px;
|
|
15
|
+
line-height: 40px;
|
|
16
|
+
margin-bottom: var(--dx-g-spacing-md);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.panel-list-container {
|
|
20
|
+
padding: var(--dw-browse-trials-padding-top)
|
|
21
|
+
var(--dx-g-page-padding-horizontal)
|
|
22
|
+
var(--dw-browse-trials-padding-bottom)
|
|
23
|
+
var(--dx-g-page-padding-horizontal);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
dx-tab-panel-list {
|
|
27
|
+
--dx-c-tab-panel-list-horizontal-padding: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
dx-card-trial {
|
|
31
|
+
width: 400px;
|
|
32
|
+
max-width: 100%;
|
|
33
|
+
min-width: 240px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.category-text-container {
|
|
37
|
+
width: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.category-subtitle {
|
|
41
|
+
color: var(--dx-g-font-sans);
|
|
42
|
+
margin-top: var(--dx-g-spacing-smd);
|
|
43
|
+
max-width: 560px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.button-toggle-container {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-wrap: wrap;
|
|
49
|
+
gap: var(--dx-g-spacing-md);
|
|
50
|
+
margin-top: var(--dx-g-spacing-3xl);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.category-container {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-wrap: wrap;
|
|
56
|
+
gap: 40px;
|
|
57
|
+
margin-top: var(--dx-g-spacing-4xl);
|
|
58
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="panel-list-container">
|
|
3
|
+
<h2 class="title">{title}</h2>
|
|
4
|
+
<dx-tab-panel-list tabs={tabLabels} onchange={handleTabChange}>
|
|
5
|
+
<template for:each={trials} for:item="trial">
|
|
6
|
+
<dx-tab-panel key={trial.label}>
|
|
7
|
+
<div
|
|
8
|
+
key={trial.label}
|
|
9
|
+
class="button-toggle-container"
|
|
10
|
+
if:false={trial.hideFilters}
|
|
11
|
+
>
|
|
12
|
+
<template
|
|
13
|
+
for:each={buttonToggleStates}
|
|
14
|
+
for:item="buttonToggleState"
|
|
15
|
+
>
|
|
16
|
+
<dx-button-toggle
|
|
17
|
+
label={buttonToggleState.label}
|
|
18
|
+
key={buttonToggleState.label}
|
|
19
|
+
value={buttonToggleState.value}
|
|
20
|
+
ontoggle={handleFilters}
|
|
21
|
+
></dx-button-toggle>
|
|
22
|
+
</template>
|
|
23
|
+
</div>
|
|
24
|
+
<template for:each={filteredCategories} for:item="category">
|
|
25
|
+
<div key={category.title} class="category-container">
|
|
26
|
+
<div
|
|
27
|
+
if:true={category.title}
|
|
28
|
+
class="category-text-container"
|
|
29
|
+
>
|
|
30
|
+
<h2 class="dx-text-heading-4 category-title">
|
|
31
|
+
{category.title}
|
|
32
|
+
</h2>
|
|
33
|
+
<p
|
|
34
|
+
if:true={category.subtitle}
|
|
35
|
+
class="category-subtitle"
|
|
36
|
+
>
|
|
37
|
+
{category.subtitle}
|
|
38
|
+
</p>
|
|
39
|
+
</div>
|
|
40
|
+
<template for:each={category.cards} for:item="card">
|
|
41
|
+
<template if:true={card.hasModal}>
|
|
42
|
+
<dx-card-trial
|
|
43
|
+
key={card.title}
|
|
44
|
+
badge-background-color={card.badgeBackgroundColor}
|
|
45
|
+
badge-symbol={card.badgeSymbol}
|
|
46
|
+
body={card.body}
|
|
47
|
+
details={card.details}
|
|
48
|
+
modal-title={card.modalTitle}
|
|
49
|
+
modal-details={card.modalDetails}
|
|
50
|
+
href={card.href}
|
|
51
|
+
label={card.label}
|
|
52
|
+
terms={card.terms}
|
|
53
|
+
title={card.title}
|
|
54
|
+
button-one-cta={card.buttonOneCta}
|
|
55
|
+
button-one-href={card.buttonOneHref}
|
|
56
|
+
button-one-icon={card.buttonOneIcon}
|
|
57
|
+
button-two-cta={card.buttonTwoCta}
|
|
58
|
+
hide-card-details="true"
|
|
59
|
+
></dx-card-trial>
|
|
60
|
+
</template>
|
|
61
|
+
<template if:false={card.hasModal}>
|
|
62
|
+
<dx-card-trial
|
|
63
|
+
key={card.title}
|
|
64
|
+
badge-background-color={card.badgeBackgroundColor}
|
|
65
|
+
badge-symbol={card.badgeSymbol}
|
|
66
|
+
body={card.body}
|
|
67
|
+
href={card.href}
|
|
68
|
+
label={card.label}
|
|
69
|
+
terms={card.terms}
|
|
70
|
+
title={card.title}
|
|
71
|
+
button-one-cta={card.buttonOneCta}
|
|
72
|
+
button-one-href={card.buttonOneHref}
|
|
73
|
+
button-one-icon={card.buttonOneIcon}
|
|
74
|
+
></dx-card-trial>
|
|
75
|
+
</template>
|
|
76
|
+
</template>
|
|
77
|
+
</div>
|
|
78
|
+
</template>
|
|
79
|
+
</dx-tab-panel>
|
|
80
|
+
</template>
|
|
81
|
+
</dx-tab-panel-list>
|
|
82
|
+
</div>
|
|
83
|
+
</template>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { LightningElement, api, track } from "lwc";
|
|
2
|
+
import { toJson } from "dxUtils/normalizers";
|
|
3
|
+
|
|
4
|
+
export default class BrowseTrials extends LightningElement {
|
|
5
|
+
@api title = "Browse Trials";
|
|
6
|
+
|
|
7
|
+
@api
|
|
8
|
+
get trials() {
|
|
9
|
+
return this._trials;
|
|
10
|
+
}
|
|
11
|
+
set trials(
|
|
12
|
+
value: [{ label: string; hideFilters: boolean; buttonLabels: string[] }]
|
|
13
|
+
) {
|
|
14
|
+
this._trials = toJson(value);
|
|
15
|
+
this.tabLabels = this._trials.map((trial) => ({ label: trial.label }));
|
|
16
|
+
this.buttonLabels = this._trials.map((trial) =>
|
|
17
|
+
!trial.hideFilters ? trial.buttonLabels : []
|
|
18
|
+
);
|
|
19
|
+
this._filteredTitles = this._trials.map(() => []);
|
|
20
|
+
this._filteredCategories = this._trials.map(
|
|
21
|
+
(trial) => trial.categories
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get buttonToggleStates() {
|
|
26
|
+
return this.buttonLabels[this.activeTabIndex].map((label) => ({
|
|
27
|
+
label,
|
|
28
|
+
value: this.activeFilteredTitles.includes(label)
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get activeFilteredTitles() {
|
|
33
|
+
return this._filteredTitles[this.activeTabIndex];
|
|
34
|
+
}
|
|
35
|
+
set activeFilteredTitles(value: string[]) {
|
|
36
|
+
this._filteredTitles[this.activeTabIndex] = value;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
get activeCategories() {
|
|
40
|
+
return this._trials[this.activeTabIndex].categories;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get filteredCategories() {
|
|
44
|
+
return this._filteredCategories[this.activeTabIndex];
|
|
45
|
+
}
|
|
46
|
+
set filteredCategories(value: any) {
|
|
47
|
+
this._filteredCategories[this.activeTabIndex] = value;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@track
|
|
51
|
+
private _filteredCategories!: Array<any>;
|
|
52
|
+
|
|
53
|
+
private activeTabIndex = 0;
|
|
54
|
+
private buttonLabels!: string[][];
|
|
55
|
+
private _filteredTitles!: string[][];
|
|
56
|
+
private tabLabels!: Array<{ label: string }>;
|
|
57
|
+
private _trials!: [
|
|
58
|
+
{
|
|
59
|
+
label: string;
|
|
60
|
+
hideFilters: boolean;
|
|
61
|
+
buttonLabels: string[];
|
|
62
|
+
categories: Array<{ title: string }>;
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
handleTabChange(e: CustomEvent) {
|
|
67
|
+
this.activeTabIndex = e.detail;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
filterCategories() {
|
|
71
|
+
this.filteredCategories = this.activeCategories.filter((category) =>
|
|
72
|
+
this.activeFilteredTitles.includes(category.title)
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
addLabelToFilter(label: string) {
|
|
77
|
+
this.activeFilteredTitles.push(label);
|
|
78
|
+
this.filterCategories();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
removeLabelFromFilter(label: string) {
|
|
82
|
+
this.activeFilteredTitles = this.activeFilteredTitles.filter(
|
|
83
|
+
(filterTitle) => filterTitle !== label
|
|
84
|
+
);
|
|
85
|
+
this.filterCategories();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
resetFilters() {
|
|
89
|
+
this.activeFilteredTitles = [];
|
|
90
|
+
this.filteredCategories = this.activeCategories;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
handleFilters(e: CustomEvent) {
|
|
94
|
+
const { label, value } = e.detail;
|
|
95
|
+
|
|
96
|
+
if (value) {
|
|
97
|
+
this.addLabelToFilter(label);
|
|
98
|
+
} else if (this.activeFilteredTitles.length !== 1) {
|
|
99
|
+
this.removeLabelFromFilter(label);
|
|
100
|
+
} else {
|
|
101
|
+
this.resetFilters();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|