@salesforcedevs/dx-components 0.56.2 → 0.58.1-alpha.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/package.json +2 -2
- package/src/assets/svg/subscribe-background-left.svg +14 -0
- package/src/assets/svg/subscribe-background-right.svg +11 -0
- package/src/modules/dx/dropdown/dropdown.html +5 -1
- package/src/modules/dx/dropdown/dropdown.ts +13 -3
- package/src/modules/dx/dropdownOption/dropdownOption.css +119 -1
- package/src/modules/dx/dropdownOption/dropdownOption.html +4 -0
- package/src/modules/dx/dropdownOption/dropdownOption.ts +20 -7
- package/src/modules/dx/iconBadge/iconBadge.css +12 -0
- package/src/modules/dx/iconBadge/iconBadge.html +1 -1
- package/src/modules/dx/iconBadge/iconBadge.ts +7 -1
- package/src/modules/dxUtils/queryCoordinator/queryCoordinator.ts +17 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.1-alpha.0+ba23c283",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"@types/lodash.get": "^4.4.6",
|
|
26
26
|
"@types/vimeo__player": "^2.16.2"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "ba23c2834f6fdb8d222e308013b3f0cd92440f77"
|
|
29
29
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="45px" height="34px" viewBox="0 0 45 34" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>blog-cta-graphic-left</title>
|
|
4
|
+
<g id="Slack-App-CTA" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="Blog---v1" transform="translate(-424.000000, -2216.000000)" stroke-width="2">
|
|
6
|
+
<g id="CTA-signup" transform="translate(52.000000, 2169.000000)">
|
|
7
|
+
<g id="blog-cta-graphic-left" transform="translate(373.000000, 47.500000)">
|
|
8
|
+
<circle id="Oval-Copy-12" stroke="#90D1FF" cx="39.5" cy="4.5" r="3.5"></circle>
|
|
9
|
+
<path d="M7.42619649,16.2472709 L5.80463043,20.6293714 C5.68941141,20.9429183 5.44197383,21.1894114 5.12842699,21.3046304 L0.747270909,22.9271409 C-0.249090303,23.295464 -0.249090303,24.704536 0.747270909,25.0738035 L5.12842699,26.6953696 C5.44197383,26.8105886 5.68941141,27.0570817 5.80463043,27.3706286 L7.42619649,31.7527291 C7.79546401,32.7490903 9.20453599,32.7490903 9.57285909,31.7527291 L11.1944252,27.3706286 C11.3096442,27.0570817 11.5570817,26.8105886 11.8706286,26.6953696 L16.2527291,25.0738035 C17.2481459,24.704536 17.2481459,23.295464 16.2527291,22.9271409 L11.8706286,21.3046304 C11.5570817,21.1894114 11.3096442,20.9429183 11.1944252,20.6293714 L9.57285909,16.2472709 C9.20453599,15.2509097 7.79546401,15.2509097 7.42619649,16.2472709 Z" id="Stroke-7-Copy-2" stroke="#8FD0FE" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
10
|
+
</g>
|
|
11
|
+
</g>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="23px" height="22px" viewBox="0 0 23 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>blog-cta-graphic-right</title>
|
|
4
|
+
<g id="Slack-App-CTA" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
|
|
5
|
+
<g id="Blog---v1" transform="translate(-936.000000, -2378.000000)" stroke="#8FD0FE" stroke-width="2">
|
|
6
|
+
<g id="CTA-signup" transform="translate(52.000000, 2169.000000)">
|
|
7
|
+
<path d="M894.236764,210.879142 L892.329039,216.034555 C892.193488,216.403433 891.902385,216.693425 891.533506,216.828977 L886.379205,218.737813 C885.207015,219.171134 885.207015,220.828866 886.379205,221.263298 L891.533506,223.171023 C891.902385,223.306575 892.193488,223.596567 892.329039,223.965445 L894.236764,229.120858 C894.671197,230.293047 896.328928,230.293047 896.76225,229.120858 L898.669974,223.965445 C898.805526,223.596567 899.096629,223.306575 899.465508,223.171023 L904.62092,221.263298 C905.791999,220.828866 905.791999,219.171134 904.62092,218.737813 L899.465508,216.828977 C899.096629,216.693425 898.805526,216.403433 898.669974,216.034555 L896.76225,210.879142 C896.328928,209.706953 894.671197,209.706953 894.236764,210.879142 Z" id="blog-cta-graphic-right"></path>
|
|
8
|
+
</g>
|
|
9
|
+
</g>
|
|
10
|
+
</g>
|
|
11
|
+
</svg>
|
|
@@ -19,18 +19,21 @@
|
|
|
19
19
|
role={role}
|
|
20
20
|
slot="content"
|
|
21
21
|
>
|
|
22
|
-
<template for:each={options} for:item="option">
|
|
22
|
+
<template for:each={options} for:item="option" for:index="index">
|
|
23
23
|
<dx-dropdown-option
|
|
24
24
|
suppress-gtm-nav-headings={suppressGtmNavHeadings}
|
|
25
25
|
analytics-event={analyticsEvent}
|
|
26
|
+
analytics-base-payload={analyticsBasePayload}
|
|
26
27
|
active={option.active}
|
|
27
28
|
key-value={option.keyValue}
|
|
28
29
|
if:false={option.options}
|
|
29
30
|
key={option.id}
|
|
31
|
+
index-position={index}
|
|
30
32
|
onfocus={onOptionFocus}
|
|
31
33
|
onselect={onOptionClick}
|
|
32
34
|
option={option}
|
|
33
35
|
nav-item-label={navItemLabel}
|
|
36
|
+
variant={variant}
|
|
34
37
|
></dx-dropdown-option>
|
|
35
38
|
<div
|
|
36
39
|
key={option.id}
|
|
@@ -43,6 +46,7 @@
|
|
|
43
46
|
<dx-dropdown-option
|
|
44
47
|
suppress-gtm-nav-headings={suppressGTMNavHeadings}
|
|
45
48
|
analytics-event={analyticsEvent}
|
|
49
|
+
analytics-base-payload={analyticsBasePayload}
|
|
46
50
|
active={suboption.active}
|
|
47
51
|
key={suboption.id}
|
|
48
52
|
key-value={suboption.keyValue}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AnalyticsPayload,
|
|
3
|
+
OptionWithNested,
|
|
4
|
+
PopperPlacement,
|
|
5
|
+
DropdownVariant
|
|
6
|
+
} from "typings/custom";
|
|
2
7
|
import { LightningElement, api, track } from "lwc";
|
|
3
8
|
import cx from "classnames";
|
|
4
9
|
import get from "lodash.get";
|
|
@@ -18,8 +23,6 @@ export default class Dropdown extends LightningElement {
|
|
|
18
23
|
@api value: string | null = null; // "active option" id
|
|
19
24
|
@api valuePath: string = "id"; // path to match for the active value (useful for url matching)
|
|
20
25
|
@api stayOpenAfterChange?: boolean = false;
|
|
21
|
-
@api suppressGtmNavHeadings?: boolean = false;
|
|
22
|
-
|
|
23
26
|
// props forwarded to popover:
|
|
24
27
|
@api ariaLabel: string | null = null;
|
|
25
28
|
@api tempId: string | null = null;
|
|
@@ -32,9 +35,16 @@ export default class Dropdown extends LightningElement {
|
|
|
32
35
|
@api width?: string | null = null;
|
|
33
36
|
@api fullWidth?: boolean | null;
|
|
34
37
|
@api navItemLabel: string | null = null;
|
|
38
|
+
@api variant: DropdownVariant = "base";
|
|
35
39
|
|
|
36
40
|
// props forwarded to dropdown option
|
|
37
41
|
@api analyticsEvent: string | null = null;
|
|
42
|
+
@api analyticsBasePayload: AnalyticsPayload = {
|
|
43
|
+
elementType: "dropdown",
|
|
44
|
+
destinationType: "internal",
|
|
45
|
+
ctaClick: true
|
|
46
|
+
};
|
|
47
|
+
@api suppressGtmNavHeadings?: boolean = false;
|
|
38
48
|
|
|
39
49
|
@api
|
|
40
50
|
get options() {
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
@import "dxHelpers/reset";
|
|
2
2
|
|
|
3
|
+
.indented-shape {
|
|
4
|
+
--background: rgb(170, 203, 255);
|
|
5
|
+
--wide: 2px;
|
|
6
|
+
|
|
7
|
+
background-color: var(--background);
|
|
8
|
+
height: var(--wide);
|
|
9
|
+
margin-bottom: var(--dx-g-spacing-xs);
|
|
10
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
11
|
+
position: relative;
|
|
12
|
+
width: var(--shape-width);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.indented-shape::after {
|
|
16
|
+
background-color: var(--background);
|
|
17
|
+
bottom: 0;
|
|
18
|
+
content: "";
|
|
19
|
+
height: 15px;
|
|
20
|
+
position: absolute;
|
|
21
|
+
width: var(--wide);
|
|
22
|
+
}
|
|
23
|
+
|
|
3
24
|
.option {
|
|
4
25
|
display: flex;
|
|
5
26
|
font-family: var(--dx-g-font-sans);
|
|
@@ -37,14 +58,27 @@
|
|
|
37
58
|
text-align: left;
|
|
38
59
|
}
|
|
39
60
|
|
|
61
|
+
.option-indented .option_details {
|
|
62
|
+
align-items: center;
|
|
63
|
+
flex-direction: row;
|
|
64
|
+
}
|
|
65
|
+
|
|
40
66
|
.option_label {
|
|
41
|
-
color: var(--dx-g-blue-vibrant-50);
|
|
67
|
+
color: var(--dx-c-dropdown-option-label-color, var(--dx-g-blue-vibrant-50));
|
|
42
68
|
display: flex;
|
|
43
69
|
align-items: center;
|
|
44
70
|
font-weight: var(--dx-g-font-bold);
|
|
45
71
|
font-size: var(--dx-c-dropdown-option-font-size, var(--dx-g-text-base));
|
|
46
72
|
}
|
|
47
73
|
|
|
74
|
+
.option-indented .option_label {
|
|
75
|
+
display: -webkit-box;
|
|
76
|
+
max-width: 300px;
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
-webkit-line-clamp: 1;
|
|
79
|
+
-webkit-box-orient: vertical;
|
|
80
|
+
}
|
|
81
|
+
|
|
48
82
|
.option_label > *:last-child {
|
|
49
83
|
margin-left: var(--dx-g-spacing-sm);
|
|
50
84
|
}
|
|
@@ -59,3 +93,87 @@
|
|
|
59
93
|
margin-right: var(--dx-g-spacing-md);
|
|
60
94
|
flex-shrink: 0;
|
|
61
95
|
}
|
|
96
|
+
|
|
97
|
+
.option-indented {
|
|
98
|
+
padding-top: var(--dx-g-spacing-xs);
|
|
99
|
+
padding-bottom: var(--dx-g-spacing-xs);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.option-indented:not([data-index="0"]) {
|
|
103
|
+
--base-indentation: calc(var(--dx-g-spacing-md) + var(--shape-width));
|
|
104
|
+
--shape-width: 8px;
|
|
105
|
+
|
|
106
|
+
padding-left: calc(var(--indentation, 0px) + var(--dx-g-spacing-md));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[data-index="2"] {
|
|
110
|
+
--indentation: var(--base-indentation);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
[data-index="3"] {
|
|
114
|
+
--indentation: calc(2 * var(--base-indentation));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
[data-index="4"] {
|
|
118
|
+
--indentation: calc(3 * var(--base-indentation));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
[data-index="5"] {
|
|
122
|
+
--indentation: calc(4 * var(--base-indentation));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
[data-index="6"] {
|
|
126
|
+
--indentation: calc(5 * var(--base-indentation));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
[data-index="7"] {
|
|
130
|
+
--indentation: calc(6 * var(--base-indentation));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
[data-index="8"] {
|
|
134
|
+
--indentation: calc(7 * var(--base-indentation));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
[data-index="9"] {
|
|
138
|
+
--indentation: calc(8 * var(--base-indentation));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
[data-index="10"] {
|
|
142
|
+
--indentation: calc(9 * var(--base-indentation));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
[data-index="11"] {
|
|
146
|
+
--indentation: calc(10 * var(--base-indentation));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
[data-index="12"] {
|
|
150
|
+
--indentation: calc(11 * var(--base-indentation));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
[data-index="13"] {
|
|
154
|
+
--indentation: calc(12 * var(--base-indentation));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
[data-index="14"] {
|
|
158
|
+
--indentation: calc(13 * var(--base-indentation));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
[data-index="15"] {
|
|
162
|
+
--indentation: calc(14 * var(--base-indentation));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
[data-index="16"] {
|
|
166
|
+
--indentation: calc(15 * var(--base-indentation));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
[data-index="17"] {
|
|
170
|
+
--indentation: calc(16 * var(--base-indentation));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
[data-index="18"] {
|
|
174
|
+
--indentation: calc(17 * var(--base-indentation));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
[data-index="19"] {
|
|
178
|
+
--indentation: calc(18 * var(--base-indentation));
|
|
179
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
key={option.id}
|
|
8
8
|
role="menuitem"
|
|
9
9
|
tabindex="-1"
|
|
10
|
+
data-index={indexPosition}
|
|
10
11
|
onclick={onClick}
|
|
11
12
|
>
|
|
12
13
|
<dx-icon
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
size="large"
|
|
18
19
|
></dx-icon>
|
|
19
20
|
<div class="option_details">
|
|
21
|
+
<div if:true={renderIndentedShape} class="indented-shape"></div>
|
|
20
22
|
<div class="option_label">
|
|
21
23
|
{option.label}
|
|
22
24
|
<dx-icon
|
|
@@ -34,6 +36,7 @@
|
|
|
34
36
|
class={className}
|
|
35
37
|
role="menuitem"
|
|
36
38
|
tabindex="-1"
|
|
39
|
+
data-index={indexPosition}
|
|
37
40
|
onclick={onClick}
|
|
38
41
|
>
|
|
39
42
|
<dx-icon
|
|
@@ -44,6 +47,7 @@
|
|
|
44
47
|
size="large"
|
|
45
48
|
></dx-icon>
|
|
46
49
|
<div class="option_details">
|
|
50
|
+
<div if:true={renderIndentedShape} class="indented-shape"></div>
|
|
47
51
|
<div class="option_label">{option.label}</div>
|
|
48
52
|
<div if:true={option.description} class="option_description">
|
|
49
53
|
{option.description}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
OptionWithNested,
|
|
5
|
+
AnalyticsPayload,
|
|
6
|
+
DropdownVariant
|
|
7
|
+
} from "typings/custom";
|
|
4
8
|
import { track } from "dxUtils/analytics";
|
|
5
9
|
|
|
6
10
|
export default class DropdownOption extends LightningElement {
|
|
@@ -10,6 +14,9 @@ export default class DropdownOption extends LightningElement {
|
|
|
10
14
|
@api active: boolean = false;
|
|
11
15
|
@api navItemLabel: String | null = null;
|
|
12
16
|
@api analyticsEvent: string | null = null;
|
|
17
|
+
@api analyticsBasePayload!: AnalyticsPayload;
|
|
18
|
+
@api indexPosition: number = 0;
|
|
19
|
+
@api variant: DropdownVariant = "base";
|
|
13
20
|
|
|
14
21
|
@api focus() {
|
|
15
22
|
const option = this.template.querySelector(".option");
|
|
@@ -20,7 +27,15 @@ export default class DropdownOption extends LightningElement {
|
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
private get className(): string {
|
|
23
|
-
return cx(
|
|
30
|
+
return cx(
|
|
31
|
+
"option",
|
|
32
|
+
this.active && "option-active",
|
|
33
|
+
this.variant && `option-${this.variant}`
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private get renderIndentedShape() {
|
|
38
|
+
return this.variant === "indented" && this.indexPosition >= 1;
|
|
24
39
|
}
|
|
25
40
|
|
|
26
41
|
private onClick(e: PointerEvent) {
|
|
@@ -29,13 +44,11 @@ export default class DropdownOption extends LightningElement {
|
|
|
29
44
|
);
|
|
30
45
|
|
|
31
46
|
const payload: any = {
|
|
47
|
+
...this.analyticsBasePayload,
|
|
32
48
|
clickText: this.keyValue || undefined,
|
|
33
|
-
pageLocation: window.location.pathname || undefined,
|
|
34
|
-
elementType: "dropdown",
|
|
35
|
-
destinationType: "internal",
|
|
36
|
-
ctaClick: true,
|
|
37
49
|
itemTitle: this.option.label || undefined,
|
|
38
|
-
|
|
50
|
+
pageLocation: window.location.pathname,
|
|
51
|
+
clickUrl: this.option.link?.href || undefined
|
|
39
52
|
};
|
|
40
53
|
|
|
41
54
|
const navHeading = this.navItemLabel || this.option.label || undefined;
|
|
@@ -38,3 +38,15 @@ dx-icon {
|
|
|
38
38
|
.shape-square {
|
|
39
39
|
border-radius: var(--dx-g-spacing-sm);
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
.background-small {
|
|
43
|
+
--dx-c-icon-badge-size: 24px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.background-medium {
|
|
47
|
+
--dx-c-icon-badge-size: 32px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.background-large {
|
|
51
|
+
--dx-c-icon-badge-size: 48px;
|
|
52
|
+
}
|
|
@@ -10,6 +10,8 @@ export default class IconBadge extends LightningElement {
|
|
|
10
10
|
@api symbol!: IconSymbol;
|
|
11
11
|
@api color?: string | null = null;
|
|
12
12
|
@api backgroundColor?: string;
|
|
13
|
+
@api backgroundSize?: string;
|
|
14
|
+
@api iconSize?: string = "override";
|
|
13
15
|
|
|
14
16
|
_shape: IconBadgeShape = "circle";
|
|
15
17
|
@api
|
|
@@ -30,7 +32,11 @@ export default class IconBadge extends LightningElement {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
get className() {
|
|
33
|
-
return cx(
|
|
35
|
+
return cx(
|
|
36
|
+
"icon-badge",
|
|
37
|
+
`shape-${this.shape}`,
|
|
38
|
+
this.backgroundSize && `background-${this.backgroundSize}`
|
|
39
|
+
);
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
get style() {
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
);
|
|
6
|
-
}
|
|
1
|
+
import qs from "query-string";
|
|
2
|
+
|
|
3
|
+
export function getUrlParamValue(key: string) {
|
|
4
|
+
const urlParams = qs.parse(window.location.search);
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
return urlParams[key] ? urlParams[key]?.split(",") : [];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function setUrlParamValue(key: string, value: any) {
|
|
10
|
+
const newUrl = new URL(window.location.href);
|
|
11
|
+
if (value) {
|
|
12
|
+
newUrl.search = qs.stringify(
|
|
13
|
+
{ [key]: value },
|
|
14
|
+
{ arrayFormat: "comma" }
|
|
15
|
+
);
|
|
16
|
+
} else {
|
|
17
|
+
newUrl.searchParams.delete(key);
|
|
16
18
|
}
|
|
19
|
+
window.history.replaceState(null, "", newUrl.href);
|
|
17
20
|
}
|