@salesforcedevs/dw-components 1.1.2-alpha.0 → 1.1.2-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/package.json
CHANGED
|
@@ -1,33 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
--
|
|
6
|
-
--
|
|
7
|
-
|
|
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);
|
|
8
24
|
}
|
|
9
25
|
|
|
10
26
|
dx-tab-panel-list {
|
|
11
27
|
--dx-c-tab-panel-list-horizontal-padding: 0;
|
|
12
28
|
}
|
|
13
29
|
|
|
14
|
-
|
|
15
|
-
--dx-c-section-padding-vertical: 0;
|
|
16
|
-
--dx-c-section-padding-horizontal: 0;
|
|
30
|
+
.category-title {
|
|
17
31
|
width: 100%;
|
|
18
32
|
}
|
|
19
33
|
|
|
20
|
-
dx-section.section-container:not(:first-of-type) {
|
|
21
|
-
margin-top: var(--dx-g-spacing-4xl);
|
|
22
|
-
z-index: 1;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
34
|
.button-toggle-container {
|
|
26
|
-
|
|
35
|
+
display: flex;
|
|
36
|
+
gap: var(--dx-g-spacing-md);
|
|
37
|
+
margin-top: var(--dx-g-spacing-3xl);
|
|
27
38
|
}
|
|
28
39
|
|
|
29
|
-
.
|
|
40
|
+
.category-container {
|
|
30
41
|
display: flex;
|
|
31
42
|
flex-wrap: wrap;
|
|
32
43
|
gap: 40px;
|
|
33
44
|
}
|
|
45
|
+
|
|
46
|
+
.category-container {
|
|
47
|
+
margin-top: var(--dx-g-spacing-4xl);
|
|
48
|
+
}
|
|
@@ -1,72 +1,69 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
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={_trialsCopy} for:item="trial">
|
|
5
6
|
<dx-tab-panel key={trial.label}>
|
|
6
7
|
<div
|
|
7
8
|
key={trial.label}
|
|
8
9
|
class="button-toggle-container"
|
|
9
10
|
if:false={trial.hideFilters}
|
|
10
|
-
for:each={buttonLabels}
|
|
11
|
-
for:item="buttonLabel"
|
|
12
11
|
>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
<template
|
|
13
|
+
for:each={buttonLabelsForActiveTab}
|
|
14
|
+
for:item="buttonLabel"
|
|
15
|
+
>
|
|
16
|
+
<dx-button-toggle
|
|
17
|
+
label={buttonLabel}
|
|
18
|
+
key={buttonLabel}
|
|
19
|
+
ontoggle={handleFilters}
|
|
20
|
+
></dx-button-toggle>
|
|
21
|
+
</template>
|
|
18
22
|
</div>
|
|
19
23
|
<template for:each={trial.categories} for:item="category">
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
terms={card.terms}
|
|
58
|
-
title={card.title}
|
|
59
|
-
button-one-cta={card.buttonOneCta}
|
|
60
|
-
button-one-href={card.buttonOneHref}
|
|
61
|
-
button-one-icon={card.buttonOneIcon}
|
|
62
|
-
></dx-card-trial>
|
|
63
|
-
</template>
|
|
24
|
+
<div key={category.title} class="category-container">
|
|
25
|
+
<h2 class="dx-text-heading-4 category-title">
|
|
26
|
+
{category.title}
|
|
27
|
+
</h2>
|
|
28
|
+
<template for:each={category.cards} for:item="card">
|
|
29
|
+
<template if:true={card.hasModal}>
|
|
30
|
+
<dx-card-trial
|
|
31
|
+
key={card.title}
|
|
32
|
+
badge-symbol={card.badgeSymbol}
|
|
33
|
+
body={card.body}
|
|
34
|
+
details={card.details}
|
|
35
|
+
modal-title={card.modalTitle}
|
|
36
|
+
modal-details={card.modalDetails}
|
|
37
|
+
href={card.href}
|
|
38
|
+
label={card.label}
|
|
39
|
+
terms={card.terms}
|
|
40
|
+
title={card.title}
|
|
41
|
+
button-one-cta={card.buttonOneCta}
|
|
42
|
+
button-one-href={card.buttonOneHref}
|
|
43
|
+
button-one-icon={card.buttonOneIcon}
|
|
44
|
+
button-two-cta={card.buttonTwoCta}
|
|
45
|
+
hide-card-details="true"
|
|
46
|
+
></dx-card-trial>
|
|
47
|
+
</template>
|
|
48
|
+
<template if:false={card.hasModal}>
|
|
49
|
+
<dx-card-trial
|
|
50
|
+
key={card.title}
|
|
51
|
+
badge-symbol={card.badgeSymbol}
|
|
52
|
+
body={card.body}
|
|
53
|
+
href={card.href}
|
|
54
|
+
label={card.label}
|
|
55
|
+
terms={card.terms}
|
|
56
|
+
title={card.title}
|
|
57
|
+
button-one-cta={card.buttonOneCta}
|
|
58
|
+
button-one-href={card.buttonOneHref}
|
|
59
|
+
button-one-icon={card.buttonOneIcon}
|
|
60
|
+
></dx-card-trial>
|
|
64
61
|
</template>
|
|
65
|
-
</
|
|
66
|
-
</
|
|
62
|
+
</template>
|
|
63
|
+
</div>
|
|
67
64
|
</template>
|
|
68
65
|
</dx-tab-panel>
|
|
69
66
|
</template>
|
|
70
67
|
</dx-tab-panel-list>
|
|
71
|
-
</
|
|
68
|
+
</div>
|
|
72
69
|
</template>
|
|
@@ -2,44 +2,81 @@ import { LightningElement, api, track } from "lwc";
|
|
|
2
2
|
import { toJson } from "dxUtils/normalizers";
|
|
3
3
|
|
|
4
4
|
export default class BrowseTrials extends LightningElement {
|
|
5
|
+
@api title = "Browse Trials";
|
|
6
|
+
|
|
5
7
|
@api
|
|
6
8
|
get trials() {
|
|
7
9
|
return this._trials;
|
|
8
10
|
}
|
|
9
11
|
set trials(value: [{ label: string }]) {
|
|
10
12
|
this._trials = toJson(value);
|
|
11
|
-
this.
|
|
13
|
+
this._trialsCopy = toJson(value);
|
|
14
|
+
this.tabLabels = this._trials.map((trial) => ({ label: trial.label }));
|
|
15
|
+
this.buttonLabels = this._trials.map((trial) =>
|
|
16
|
+
trial.categories.map((category) => category.title)
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get buttonLabelsForActiveTab() {
|
|
21
|
+
return this.buttonLabels[this.activeTabIndex];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get activeCategories() {
|
|
25
|
+
return this._trials[this.activeTabIndex].categories;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// we manipulate the copy of the trials to show the active tab's categories
|
|
29
|
+
get activeCategoriesCopy() {
|
|
30
|
+
return this._trialsCopy[this.activeTabIndex].categories;
|
|
31
|
+
}
|
|
32
|
+
set activeCategoriesCopy(value) {
|
|
33
|
+
this._trialsCopy[this.activeTabIndex].categories = value;
|
|
12
34
|
}
|
|
13
35
|
|
|
14
36
|
@track
|
|
15
|
-
private
|
|
16
|
-
|
|
37
|
+
private _trialsCopy!: [
|
|
38
|
+
{ label: string; categories: Array<{ title: string }> }
|
|
39
|
+
];
|
|
17
40
|
|
|
18
|
-
private
|
|
19
|
-
private
|
|
41
|
+
private buttonLabels!: string[][];
|
|
42
|
+
private tabLabels!: Array<{ label: string }>;
|
|
43
|
+
private _trials!: [{ label: string; categories: Array<{ title: string }> }];
|
|
20
44
|
private activeTabIndex = 0;
|
|
21
45
|
|
|
22
46
|
handleTabChange(e: CustomEvent) {
|
|
23
47
|
this.activeTabIndex = e.detail;
|
|
24
48
|
}
|
|
25
49
|
|
|
50
|
+
addFilter(label: string) {
|
|
51
|
+
this.activeCategoriesCopy =
|
|
52
|
+
this.activeCategories.length ===
|
|
53
|
+
this.activeCategoriesCopy.length + 1
|
|
54
|
+
? [...this.activeCategories]
|
|
55
|
+
: [
|
|
56
|
+
...this.activeCategories.filter(
|
|
57
|
+
(category) => category.title === label
|
|
58
|
+
)
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
removeFilter(label: string) {
|
|
63
|
+
this.activeCategoriesCopy =
|
|
64
|
+
this.activeCategoriesCopy.length - 1 === 0
|
|
65
|
+
? [...this.activeCategories]
|
|
66
|
+
: [
|
|
67
|
+
...this.activeCategories.filter(
|
|
68
|
+
(category) => category.title !== label
|
|
69
|
+
)
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
|
|
26
73
|
handleFilters(e: CustomEvent) {
|
|
27
74
|
const { label, value } = e.detail;
|
|
28
75
|
|
|
29
76
|
if (value) {
|
|
30
|
-
this.
|
|
31
|
-
this._trials[this.activeTabIndex].categories = this._trials[
|
|
32
|
-
this.activeTabIndex
|
|
33
|
-
].categories.filter((category) =>
|
|
34
|
-
this.filters.includes(category.title)
|
|
35
|
-
);
|
|
77
|
+
this.addFilter(label);
|
|
36
78
|
} else {
|
|
37
|
-
this.
|
|
38
|
-
this._trials[this.activeTabIndex].categories = this._trials[
|
|
39
|
-
this.activeTabIndex
|
|
40
|
-
].categories.filter(
|
|
41
|
-
(category) => !this.filters.includes(category.title)
|
|
42
|
-
);
|
|
79
|
+
this.removeFilter(label);
|
|
43
80
|
}
|
|
44
81
|
}
|
|
45
82
|
}
|