@salesforcedevs/dx-components 1.37.1 → 1.37.2-llms-txt-2
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 +1 -0
- package/package.json +47 -47
- package/src/modules/dx/button/button.css +7 -2
- package/src/modules/dx/dropdownOption/dropdownOption.css +55 -3
- package/src/modules/dx/dropdownOption/dropdownOption.html +198 -56
- package/src/modules/dx/dropdownOption/dropdownOption.ts +34 -0
- package/src/modules/dx/popover/popover.css +2 -2
- package/src/modules/dx/popover/popover.ts +1 -0
- package/src/modules/dx/splitButton/splitButton.css +44 -0
- package/src/modules/dx/splitButton/splitButton.html +36 -0
- package/src/modules/dx/splitButton/splitButton.ts +54 -0
- package/LICENSE +0 -12
package/lwc.config.json
CHANGED
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
}
|
|
2
|
+
"name": "@salesforcedevs/dx-components",
|
|
3
|
+
"version": "1.37.2-llms-txt-2",
|
|
4
|
+
"description": "DX Lightning web components",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": "22.x"
|
|
8
|
+
},
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@coveo/headless": "3.22.2",
|
|
14
|
+
"@floating-ui/dom": "1.5.1",
|
|
15
|
+
"@optimizely/optimizely-sdk": "5.3.0",
|
|
16
|
+
"@shikijs/colorized-brackets": "^3.12.2",
|
|
17
|
+
"@types/throttle-debounce": "5.0.2",
|
|
18
|
+
"@vimeo/player": "2.22.0",
|
|
19
|
+
"classnames": "2.5.1",
|
|
20
|
+
"composed-offset-position": "0.0.4",
|
|
21
|
+
"coveo-search-ui": "2.10113.0",
|
|
22
|
+
"debounce": "1.2.1",
|
|
23
|
+
"js-cookie": "3.0.5",
|
|
24
|
+
"lodash.defaults": "4.2.0",
|
|
25
|
+
"lodash.get": "4.4.2",
|
|
26
|
+
"lodash.kebabcase": "4.1.1",
|
|
27
|
+
"memoize-one": "6.0.0",
|
|
28
|
+
"microtip": "0.2.2",
|
|
29
|
+
"shiki": "^3.12.2",
|
|
30
|
+
"throttle-debounce": "5.0.0",
|
|
31
|
+
"uuid": "9.0.1"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/classnames": "2.3.1",
|
|
35
|
+
"@types/debounce": "1.2.4",
|
|
36
|
+
"@types/js-cookie": "3.0.6",
|
|
37
|
+
"@types/lodash.defaults": "4.2.9",
|
|
38
|
+
"@types/lodash.get": "4.4.9",
|
|
39
|
+
"@types/lodash.kebabcase": "4.1.9",
|
|
40
|
+
"@types/luxon": "3.4.2",
|
|
41
|
+
"@types/uuid": "8.3.4",
|
|
42
|
+
"@types/vimeo__player": "2.18.3",
|
|
43
|
+
"eventsourcemock": "2.0.0",
|
|
44
|
+
"luxon": "3.4.4",
|
|
45
|
+
"msw": "^2.12.4"
|
|
46
|
+
},
|
|
47
|
+
"stableVersion": "1.37.1"
|
|
48
|
+
}
|
|
@@ -150,21 +150,26 @@
|
|
|
150
150
|
|
|
151
151
|
.button.variant_secondary {
|
|
152
152
|
background: var(--dx-c-button-background-color);
|
|
153
|
+
border: 2px solid var(--dx-c-button-secondary-color);
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
.button.variant_quaternary {
|
|
156
157
|
background: white;
|
|
158
|
+
border: 1px solid var(--dx-c-button-secondary-color);
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
.button.variant_secondary,
|
|
160
162
|
.button.variant_quaternary {
|
|
161
163
|
color: var(--dx-c-button-secondary-color);
|
|
162
|
-
border: 1px solid var(--dx-c-button-secondary-color);
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
.button.variant_secondary:hover,
|
|
167
|
+
:host([aria-expanded="true"]) .button.variant_secondary {
|
|
168
|
+
color: var(--dx-g-blue-vibrant-40);
|
|
169
|
+
border-color: var(--dx-g-blue-vibrant-40);
|
|
170
|
+
}
|
|
171
|
+
|
|
166
172
|
.button.variant_quaternary:hover,
|
|
167
|
-
:host([aria-expanded="true"]) .button.variant_secondary,
|
|
168
173
|
:host([aria-expanded="true"]) .button.variant_quaternary {
|
|
169
174
|
background: var(--dx-c-button-secondary-color-hover);
|
|
170
175
|
}
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
@import "dxHelpers/reset";
|
|
2
2
|
|
|
3
|
+
.divider {
|
|
4
|
+
height: 1px;
|
|
5
|
+
background-color: var(--dx-g-gray-80);
|
|
6
|
+
margin: var(--dx-g-spacing-sm) 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.subheader {
|
|
10
|
+
padding: var(--dx-g-spacing-smd)
|
|
11
|
+
var(--dx-c-dropdown-option-padding-horizontal, var(--dx-g-spacing-sm));
|
|
12
|
+
font-family: var(--dx-g-font-sans);
|
|
13
|
+
font-size: var(--dx-g-text-sm);
|
|
14
|
+
font-weight: var(--dx-g-font-bold);
|
|
15
|
+
color: var(--dx-g-gray-10);
|
|
16
|
+
margin-top: var(--dx-g-spacing-xs);
|
|
17
|
+
cursor: default;
|
|
18
|
+
user-select: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.subheader:first-child {
|
|
22
|
+
margin-top: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
3
25
|
.indented-shape {
|
|
4
26
|
--background: rgb(170 203 255);
|
|
5
27
|
--wide: 2px;
|
|
@@ -22,10 +44,13 @@
|
|
|
22
44
|
}
|
|
23
45
|
|
|
24
46
|
.option {
|
|
25
|
-
display:
|
|
47
|
+
display: grid;
|
|
48
|
+
grid-template-columns: auto 1fr auto;
|
|
49
|
+
column-gap: 0;
|
|
26
50
|
font-family: var(--dx-g-font-sans);
|
|
27
51
|
width: 100%;
|
|
28
|
-
padding: var(--dx-g-spacing-sm)
|
|
52
|
+
padding: var(--dx-g-spacing-sm)
|
|
53
|
+
var(--dx-c-dropdown-option-padding-horizontal, var(--dx-g-spacing-sm));
|
|
29
54
|
font-size: var(--dx-g-text-sm);
|
|
30
55
|
border-radius: var(--dx-g-spacing-xs);
|
|
31
56
|
transition: var(--dx-g-transition-hue-1x);
|
|
@@ -58,6 +83,8 @@
|
|
|
58
83
|
font-family: var(--dx-g-font-sans);
|
|
59
84
|
font-size: var(--dx-g-text-sm);
|
|
60
85
|
text-align: left;
|
|
86
|
+
min-width: 0;
|
|
87
|
+
overflow: hidden;
|
|
61
88
|
}
|
|
62
89
|
|
|
63
90
|
.option-indented .option_details {
|
|
@@ -71,6 +98,8 @@
|
|
|
71
98
|
align-items: center;
|
|
72
99
|
font-weight: var(--dx-c-dropdown-option-font-weight, var(--dx-g-font-bold));
|
|
73
100
|
font-size: var(--dx-c-dropdown-option-font-size, var(--dx-g-text-base));
|
|
101
|
+
overflow-wrap: break-word;
|
|
102
|
+
word-break: break-word;
|
|
74
103
|
}
|
|
75
104
|
|
|
76
105
|
.option-indented .option_label {
|
|
@@ -89,11 +118,28 @@
|
|
|
89
118
|
color: var(--dx-g-gray-30);
|
|
90
119
|
margin-top: var(--dx-g-spacing-xs);
|
|
91
120
|
line-height: 18px;
|
|
121
|
+
overflow-wrap: break-word;
|
|
122
|
+
word-break: break-word;
|
|
92
123
|
}
|
|
93
124
|
|
|
94
125
|
.option_icon {
|
|
126
|
+
flex-shrink: 0;
|
|
95
127
|
margin-right: var(--dx-g-spacing-md);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.option_icon_right {
|
|
96
131
|
flex-shrink: 0;
|
|
132
|
+
justify-self: end;
|
|
133
|
+
margin-left: var(--dx-g-spacing-md);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* When an option carries a tooltip the whole interactive row is wrapped in
|
|
137
|
+
dx-tooltip (whose :host is inline-block). Make the wrapper span the full
|
|
138
|
+
width so the entire option is the hover target and the row still lays out
|
|
139
|
+
at full width inside the menu. */
|
|
140
|
+
.option_tooltip {
|
|
141
|
+
display: block;
|
|
142
|
+
width: 100%;
|
|
97
143
|
}
|
|
98
144
|
|
|
99
145
|
.option-indented {
|
|
@@ -105,7 +151,13 @@
|
|
|
105
151
|
--base-indentation: calc(var(--dx-g-spacing-md) + var(--shape-width));
|
|
106
152
|
--shape-width: 8px;
|
|
107
153
|
|
|
108
|
-
padding-left: calc(
|
|
154
|
+
padding-left: calc(
|
|
155
|
+
var(--indentation, 0px) +
|
|
156
|
+
var(
|
|
157
|
+
--dx-c-dropdown-option-padding-horizontal,
|
|
158
|
+
var(--dx-g-spacing-md)
|
|
159
|
+
)
|
|
160
|
+
);
|
|
109
161
|
}
|
|
110
162
|
|
|
111
163
|
[data-index="2"] {
|
|
@@ -1,58 +1,200 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
2
|
+
<template if:true={option.divider}>
|
|
3
|
+
<div class="divider"></div>
|
|
4
|
+
</template>
|
|
5
|
+
<template if:true={option.subheader}>
|
|
6
|
+
<div class="subheader">{option.label}</div>
|
|
7
|
+
</template>
|
|
8
|
+
<template if:false={option.divider}>
|
|
9
|
+
<template if:false={option.subheader}>
|
|
10
|
+
<!-- Link option -->
|
|
11
|
+
<template if:true={option.link}>
|
|
12
|
+
<dx-tooltip
|
|
13
|
+
if:true={option.tooltip}
|
|
14
|
+
class="option_tooltip"
|
|
15
|
+
label={option.tooltip}
|
|
16
|
+
placement="top"
|
|
17
|
+
>
|
|
18
|
+
<a
|
|
19
|
+
class={className}
|
|
20
|
+
href={option.link.href}
|
|
21
|
+
target={option.link.target}
|
|
22
|
+
key={option.id}
|
|
23
|
+
role="menuitem"
|
|
24
|
+
tabindex="0"
|
|
25
|
+
data-index={indexPosition}
|
|
26
|
+
onclick={onClick}
|
|
27
|
+
>
|
|
28
|
+
<dx-icon
|
|
29
|
+
class="option_icon"
|
|
30
|
+
symbol={leftIconSymbol}
|
|
31
|
+
sprite={leftIconSprite}
|
|
32
|
+
color={leftIconColor}
|
|
33
|
+
if:true={leftIconSymbol}
|
|
34
|
+
size={leftIconSize}
|
|
35
|
+
></dx-icon>
|
|
36
|
+
<div class="option_details">
|
|
37
|
+
<div
|
|
38
|
+
if:true={renderIndentedShape}
|
|
39
|
+
class="indented-shape"
|
|
40
|
+
></div>
|
|
41
|
+
<div class="option_label">
|
|
42
|
+
{option.label}
|
|
43
|
+
<dx-icon
|
|
44
|
+
symbol="new_window"
|
|
45
|
+
if:true={option.link.target}
|
|
46
|
+
></dx-icon>
|
|
47
|
+
</div>
|
|
48
|
+
<div
|
|
49
|
+
if:true={option.description}
|
|
50
|
+
class="option_description"
|
|
51
|
+
>
|
|
52
|
+
{option.description}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
<dx-icon
|
|
56
|
+
if:true={rightIconSymbol}
|
|
57
|
+
class="option_icon_right"
|
|
58
|
+
symbol={rightIconSymbol}
|
|
59
|
+
sprite={rightIconSprite}
|
|
60
|
+
color={rightIconColor}
|
|
61
|
+
size={rightIconSize}
|
|
62
|
+
></dx-icon>
|
|
63
|
+
</a>
|
|
64
|
+
</dx-tooltip>
|
|
65
|
+
<a
|
|
66
|
+
if:false={option.tooltip}
|
|
67
|
+
class={className}
|
|
68
|
+
href={option.link.href}
|
|
69
|
+
target={option.link.target}
|
|
70
|
+
key={option.id}
|
|
71
|
+
role="menuitem"
|
|
72
|
+
tabindex="0"
|
|
73
|
+
data-index={indexPosition}
|
|
74
|
+
onclick={onClick}
|
|
75
|
+
>
|
|
76
|
+
<dx-icon
|
|
77
|
+
class="option_icon"
|
|
78
|
+
symbol={leftIconSymbol}
|
|
79
|
+
sprite={leftIconSprite}
|
|
80
|
+
color={leftIconColor}
|
|
81
|
+
if:true={leftIconSymbol}
|
|
82
|
+
size={leftIconSize}
|
|
83
|
+
></dx-icon>
|
|
84
|
+
<div class="option_details">
|
|
85
|
+
<div
|
|
86
|
+
if:true={renderIndentedShape}
|
|
87
|
+
class="indented-shape"
|
|
88
|
+
></div>
|
|
89
|
+
<div class="option_label">
|
|
90
|
+
{option.label}
|
|
91
|
+
<dx-icon
|
|
92
|
+
symbol="new_window"
|
|
93
|
+
if:true={option.link.target}
|
|
94
|
+
></dx-icon>
|
|
95
|
+
</div>
|
|
96
|
+
<div
|
|
97
|
+
if:true={option.description}
|
|
98
|
+
class="option_description"
|
|
99
|
+
>
|
|
100
|
+
{option.description}
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
<dx-icon
|
|
104
|
+
if:true={rightIconSymbol}
|
|
105
|
+
class="option_icon_right"
|
|
106
|
+
symbol={rightIconSymbol}
|
|
107
|
+
sprite={rightIconSprite}
|
|
108
|
+
color={rightIconColor}
|
|
109
|
+
size={rightIconSize}
|
|
110
|
+
></dx-icon>
|
|
111
|
+
</a>
|
|
112
|
+
</template>
|
|
113
|
+
<!-- Button option -->
|
|
114
|
+
<template if:false={option.link}>
|
|
115
|
+
<dx-tooltip
|
|
116
|
+
if:true={option.tooltip}
|
|
117
|
+
class="option_tooltip"
|
|
118
|
+
label={option.tooltip}
|
|
119
|
+
placement="top"
|
|
120
|
+
>
|
|
121
|
+
<button
|
|
122
|
+
class={className}
|
|
123
|
+
role="menuitem"
|
|
124
|
+
tabindex="0"
|
|
125
|
+
data-index={indexPosition}
|
|
126
|
+
onclick={onClick}
|
|
127
|
+
>
|
|
128
|
+
<dx-icon
|
|
129
|
+
class="option_icon"
|
|
130
|
+
symbol={leftIconSymbol}
|
|
131
|
+
sprite={leftIconSprite}
|
|
132
|
+
color={leftIconColor}
|
|
133
|
+
if:true={leftIconSymbol}
|
|
134
|
+
size={leftIconSize}
|
|
135
|
+
></dx-icon>
|
|
136
|
+
<div class="option_details">
|
|
137
|
+
<div
|
|
138
|
+
if:true={renderIndentedShape}
|
|
139
|
+
class="indented-shape"
|
|
140
|
+
></div>
|
|
141
|
+
<div class="option_label">{option.label}</div>
|
|
142
|
+
<div
|
|
143
|
+
if:true={option.description}
|
|
144
|
+
class="option_description"
|
|
145
|
+
>
|
|
146
|
+
{option.description}
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
<dx-icon
|
|
150
|
+
if:true={rightIconSymbol}
|
|
151
|
+
class="option_icon_right"
|
|
152
|
+
symbol={rightIconSymbol}
|
|
153
|
+
sprite={rightIconSprite}
|
|
154
|
+
color={rightIconColor}
|
|
155
|
+
size={rightIconSize}
|
|
156
|
+
></dx-icon>
|
|
157
|
+
</button>
|
|
158
|
+
</dx-tooltip>
|
|
159
|
+
<button
|
|
160
|
+
if:false={option.tooltip}
|
|
161
|
+
class={className}
|
|
162
|
+
role="menuitem"
|
|
163
|
+
tabindex="0"
|
|
164
|
+
data-index={indexPosition}
|
|
165
|
+
onclick={onClick}
|
|
166
|
+
>
|
|
167
|
+
<dx-icon
|
|
168
|
+
class="option_icon"
|
|
169
|
+
symbol={leftIconSymbol}
|
|
170
|
+
sprite={leftIconSprite}
|
|
171
|
+
color={leftIconColor}
|
|
172
|
+
if:true={leftIconSymbol}
|
|
173
|
+
size={leftIconSize}
|
|
174
|
+
></dx-icon>
|
|
175
|
+
<div class="option_details">
|
|
176
|
+
<div
|
|
177
|
+
if:true={renderIndentedShape}
|
|
178
|
+
class="indented-shape"
|
|
179
|
+
></div>
|
|
180
|
+
<div class="option_label">{option.label}</div>
|
|
181
|
+
<div
|
|
182
|
+
if:true={option.description}
|
|
183
|
+
class="option_description"
|
|
184
|
+
>
|
|
185
|
+
{option.description}
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
<dx-icon
|
|
189
|
+
if:true={rightIconSymbol}
|
|
190
|
+
class="option_icon_right"
|
|
191
|
+
symbol={rightIconSymbol}
|
|
192
|
+
sprite={rightIconSprite}
|
|
193
|
+
color={rightIconColor}
|
|
194
|
+
size={rightIconSize}
|
|
195
|
+
></dx-icon>
|
|
196
|
+
</button>
|
|
197
|
+
</template>
|
|
198
|
+
</template>
|
|
199
|
+
</template>
|
|
58
200
|
</template>
|
|
@@ -37,6 +37,40 @@ export default class DropdownOption extends LightningElement {
|
|
|
37
37
|
return this.variant === "indented" && this.indexPosition >= 1;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
// Left icon getters with backward compatibility
|
|
41
|
+
private get leftIconSymbol(): string | undefined {
|
|
42
|
+
return this.option.leftIconData?.iconSymbol || this.option.iconSymbol;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private get leftIconSprite(): string | undefined {
|
|
46
|
+
return this.option.leftIconData?.iconSprite || this.option.iconSprite;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private get leftIconColor(): string | undefined {
|
|
50
|
+
return this.option.leftIconData?.iconColor;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private get leftIconSize(): string | undefined {
|
|
54
|
+
return this.option.leftIconData?.iconSize || "large";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Right icon getters
|
|
58
|
+
private get rightIconSymbol(): string | undefined {
|
|
59
|
+
return this.option.rightIconData?.iconSymbol;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private get rightIconSprite(): string | undefined {
|
|
63
|
+
return this.option.rightIconData?.iconSprite;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private get rightIconColor(): string | undefined {
|
|
67
|
+
return this.option.rightIconData?.iconColor;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private get rightIconSize(): string | undefined {
|
|
71
|
+
return this.option.rightIconData?.iconSize || "large";
|
|
72
|
+
}
|
|
73
|
+
|
|
40
74
|
private onClick(e: PointerEvent) {
|
|
41
75
|
this.dispatchEvent(
|
|
42
76
|
new CustomEvent("select", { detail: this.keyValue })
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.popover-container {
|
|
13
|
-
position:
|
|
13
|
+
position: fixed;
|
|
14
14
|
top: 0;
|
|
15
15
|
left: 0;
|
|
16
16
|
z-index: var(--dx-c-popover-z-index, var(--dx-g-z-index-max));
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
border: var(--popover-border);
|
|
24
24
|
box-shadow: var(--dx-g-box-shadow-lg);
|
|
25
25
|
border-radius: var(--popover-border-radius);
|
|
26
|
-
width: 168px;
|
|
26
|
+
width: var(--dx-c-popover-width, 168px);
|
|
27
27
|
max-width: calc(100vw - var(--dx-g-spacing-lg));
|
|
28
28
|
max-height: 65vh;
|
|
29
29
|
padding: var(--popover-padding);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
font-size: inherit;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.split-button {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
align-items: stretch;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Flatten the corners where the two buttons meet so they read as one control.
|
|
14
|
+
dx-button exposes its clickable element as part="container". */
|
|
15
|
+
.primary::part(container) {
|
|
16
|
+
border-top-right-radius: 0;
|
|
17
|
+
border-bottom-right-radius: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.trigger::part(container) {
|
|
21
|
+
border-top-left-radius: 0;
|
|
22
|
+
border-bottom-left-radius: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Pull the trigger over the primary button by one full border width so the two
|
|
26
|
+
2px borders sit exactly on top of each other, leaving a single 2px seam
|
|
27
|
+
instead of a doubled 4px line. */
|
|
28
|
+
.menu {
|
|
29
|
+
margin-left: -2px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* At the shared seam the two borders overlap, so only one can be visible.
|
|
33
|
+
By default the trigger (later in the DOM) wins, which means hovering the
|
|
34
|
+
primary button wouldn't update the seam. Lifting whichever button is
|
|
35
|
+
hovered makes its hover-colored border win. z-index needs positioning. */
|
|
36
|
+
.primary,
|
|
37
|
+
.menu {
|
|
38
|
+
position: relative;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.primary:hover,
|
|
42
|
+
.menu:hover {
|
|
43
|
+
z-index: 1;
|
|
44
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="split-button">
|
|
3
|
+
<dx-button
|
|
4
|
+
class="primary"
|
|
5
|
+
variant={variant}
|
|
6
|
+
size={size}
|
|
7
|
+
disabled={disabled}
|
|
8
|
+
icon-symbol={iconSymbol}
|
|
9
|
+
icon-sprite={iconSprite}
|
|
10
|
+
icon-position={iconPosition}
|
|
11
|
+
href={href}
|
|
12
|
+
target={target}
|
|
13
|
+
rel={rel}
|
|
14
|
+
onclick={onPrimaryClick}
|
|
15
|
+
>
|
|
16
|
+
{label}
|
|
17
|
+
</dx-button>
|
|
18
|
+
|
|
19
|
+
<dx-dropdown
|
|
20
|
+
class="menu"
|
|
21
|
+
options={options}
|
|
22
|
+
placement={menuPlacement}
|
|
23
|
+
stay-open-after-change={stayOpenAfterChange}
|
|
24
|
+
onchange={onMenuChange}
|
|
25
|
+
>
|
|
26
|
+
<dx-button
|
|
27
|
+
class="trigger"
|
|
28
|
+
variant={variant}
|
|
29
|
+
size={size}
|
|
30
|
+
disabled={disabled}
|
|
31
|
+
icon-symbol={menuIconSymbol}
|
|
32
|
+
aria-label={menuAriaLabel}
|
|
33
|
+
></dx-button>
|
|
34
|
+
</dx-dropdown>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import {
|
|
3
|
+
ButtonSize,
|
|
4
|
+
ButtonTarget,
|
|
5
|
+
IconSprite,
|
|
6
|
+
IconSymbol,
|
|
7
|
+
OptionWithNested,
|
|
8
|
+
PopperPlacement
|
|
9
|
+
} from "typings/custom";
|
|
10
|
+
|
|
11
|
+
type SplitButtonVariant = "primary" | "secondary";
|
|
12
|
+
|
|
13
|
+
export default class SplitButton extends LightningElement {
|
|
14
|
+
// primary action button
|
|
15
|
+
@api label: string = "";
|
|
16
|
+
@api iconSymbol?: IconSymbol;
|
|
17
|
+
@api iconSprite?: IconSprite = "utility";
|
|
18
|
+
@api iconPosition?: "right" | "left" = "left";
|
|
19
|
+
|
|
20
|
+
// shared styling forwarded to both buttons
|
|
21
|
+
@api variant: SplitButtonVariant = "secondary";
|
|
22
|
+
@api size: ButtonSize = "small";
|
|
23
|
+
@api disabled: boolean = false;
|
|
24
|
+
|
|
25
|
+
// link mode for the primary action (optional)
|
|
26
|
+
@api href: string | null = null;
|
|
27
|
+
@api target: ButtonTarget = null;
|
|
28
|
+
@api rel: string | null = null;
|
|
29
|
+
|
|
30
|
+
// menu (secondary icon-only button + popover)
|
|
31
|
+
@api options: OptionWithNested[] = [];
|
|
32
|
+
@api menuIconSymbol: IconSymbol = "chevrondown";
|
|
33
|
+
@api menuAriaLabel: string = "More actions";
|
|
34
|
+
@api menuPlacement: PopperPlacement = "bottom-end";
|
|
35
|
+
@api stayOpenAfterChange: boolean = false;
|
|
36
|
+
|
|
37
|
+
// class functions
|
|
38
|
+
|
|
39
|
+
private onPrimaryClick() {
|
|
40
|
+
this.dispatchEvent(
|
|
41
|
+
new CustomEvent("actionclick", { bubbles: true, composed: true })
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private onMenuChange(e: CustomEvent) {
|
|
46
|
+
this.dispatchEvent(
|
|
47
|
+
new CustomEvent("select", {
|
|
48
|
+
detail: e.detail,
|
|
49
|
+
bubbles: true,
|
|
50
|
+
composed: true
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2020, Salesforce.com, Inc.
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
-
|
|
6
|
-
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
-
|
|
8
|
-
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
-
|
|
10
|
-
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
-
|
|
12
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|