@salesforcedevs/dx-components 1.3.5-lightdom-3 → 1.3.6-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/modules/dx/brandThemeProvider/brandThemeProvider.html +1 -2
- package/src/modules/dx/brandThemeProvider/brandThemeProvider.ts +5 -8
- package/src/modules/dx/button/{button.scoped.css → button.css} +2 -0
- package/src/modules/dx/button/button.html +5 -7
- package/src/modules/dx/button/button.ts +8 -16
- package/src/modules/dx/dropdown/dropdown.css +5 -6
- package/src/modules/dx/dropdown/dropdown.html +2 -5
- package/src/modules/dx/dropdown/dropdown.ts +2 -4
- package/src/modules/dx/header/header.css +98 -0
- package/src/modules/dx/header/header.html +1 -1
- package/src/modules/dx/header/header.ts +0 -2
- package/src/modules/dx/popover/{popover.scoped.css → popover.css} +2 -0
- package/src/modules/dx/popover/popover.html +2 -2
- package/src/modules/dx/popover/popover.ts +25 -17
- package/src/modules/dx/typeBadge/typeBadge.ts +2 -2
- package/src/modules/dxHelpers/commonSidebar/commonSidebar.css +1 -1
- package/src/modules/dxHelpers/reset/reset.css +1 -0
- package/yarn-error.log +18471 -0
- package/src/modules/dx/header/header.scoped.css +0 -97
- package/src/modules/dx/icon/icon.scoped.css +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6-alpha.0",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@coveo/headless": "^1.32.0",
|
|
14
|
-
"@floating-ui/dom": "^0.
|
|
14
|
+
"@floating-ui/dom": "^1.0.4",
|
|
15
15
|
"@sfdocs-internal/wires": "^0.6.3",
|
|
16
16
|
"@vimeo/player": "^2.16.4",
|
|
17
17
|
"classnames": "^2.2.6",
|
|
@@ -3,7 +3,7 @@ import brandCssVars from "./brandCssVars";
|
|
|
3
3
|
import { Brand } from "typings/custom";
|
|
4
4
|
|
|
5
5
|
export const toCss = (brand: Brand | null) => `
|
|
6
|
-
|
|
6
|
+
:host {
|
|
7
7
|
${brandCssVars.reduce(
|
|
8
8
|
(acc, v) => `
|
|
9
9
|
${acc}
|
|
@@ -15,8 +15,6 @@ export const toCss = (brand: Brand | null) => `
|
|
|
15
15
|
`;
|
|
16
16
|
|
|
17
17
|
export default class BrandThemeProvider extends LightningElement {
|
|
18
|
-
static renderMode = "light";
|
|
19
|
-
|
|
20
18
|
@api brand: Brand | null = null;
|
|
21
19
|
|
|
22
20
|
private get css() {
|
|
@@ -32,18 +30,17 @@ export default class BrandThemeProvider extends LightningElement {
|
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
setBrandVars() {
|
|
35
|
-
let style = this.querySelector("style");
|
|
36
|
-
|
|
33
|
+
let style = this.template.querySelector("style");
|
|
37
34
|
if (!style) {
|
|
38
35
|
style = document.createElement("style");
|
|
39
|
-
this.
|
|
36
|
+
this.template.appendChild(style);
|
|
40
37
|
}
|
|
41
38
|
|
|
42
|
-
if (style
|
|
39
|
+
if (style.firstChild) {
|
|
43
40
|
style.removeChild(style.firstChild);
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
const css = document.createTextNode(this.css);
|
|
47
|
-
style
|
|
44
|
+
style.appendChild(css);
|
|
48
45
|
}
|
|
49
46
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<template
|
|
1
|
+
<template>
|
|
2
2
|
<button
|
|
3
3
|
if:false={href}
|
|
4
4
|
class={className}
|
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
aria-label={ariaLabel}
|
|
8
8
|
part="container"
|
|
9
9
|
>
|
|
10
|
-
<span if:false={loading}
|
|
11
|
-
{
|
|
12
|
-
<slot></slot>
|
|
10
|
+
<span if:false={loading}>
|
|
11
|
+
<slot onslotchange={onSlotChange}></slot>
|
|
13
12
|
</span>
|
|
14
13
|
<dx-icon
|
|
15
14
|
if:true={showIcon}
|
|
@@ -30,9 +29,8 @@
|
|
|
30
29
|
aria-label={ariaLabel}
|
|
31
30
|
part="container"
|
|
32
31
|
>
|
|
33
|
-
<span if:false={loading}
|
|
34
|
-
{
|
|
35
|
-
<slot></slot>
|
|
32
|
+
<span if:false={loading}>
|
|
33
|
+
<slot onslotchange={onSlotChange}></slot>
|
|
36
34
|
</span>
|
|
37
35
|
<dx-icon
|
|
38
36
|
if:true={showIcon}
|
|
@@ -5,12 +5,11 @@ import {
|
|
|
5
5
|
ButtonVariant,
|
|
6
6
|
IconSprite,
|
|
7
7
|
IconSize,
|
|
8
|
-
IconSymbol
|
|
8
|
+
IconSymbol,
|
|
9
|
+
LightningSlotElement
|
|
9
10
|
} from "typings/custom";
|
|
10
11
|
|
|
11
12
|
export default class Button extends LightningElement {
|
|
12
|
-
static renderMode = "light";
|
|
13
|
-
|
|
14
13
|
@api ariaLabel: string = "";
|
|
15
14
|
@api disabled: boolean | null = null;
|
|
16
15
|
@api iconSize?: IconSize = "small";
|
|
@@ -24,7 +23,6 @@ export default class Button extends LightningElement {
|
|
|
24
23
|
@api font: "display" | "sans" = "display";
|
|
25
24
|
@api name?: string;
|
|
26
25
|
@api value?: any;
|
|
27
|
-
@api buttonText?: string;
|
|
28
26
|
|
|
29
27
|
// button props
|
|
30
28
|
@api type: "submit" | "reset" | "button" = "button";
|
|
@@ -36,17 +34,13 @@ export default class Button extends LightningElement {
|
|
|
36
34
|
@api rel: string | null = null;
|
|
37
35
|
|
|
38
36
|
@api focus() {
|
|
39
|
-
const button = this.querySelector(".button");
|
|
37
|
+
const button = this.template.querySelector(".button");
|
|
40
38
|
if (button) {
|
|
41
39
|
button.focus();
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
renderedCallback(): void {
|
|
48
|
-
this._isSlotEmpty = this.isSlotEmpty();
|
|
49
|
-
}
|
|
43
|
+
private isSlotEmpty: boolean = true;
|
|
50
44
|
|
|
51
45
|
private get showIcon(): boolean {
|
|
52
46
|
return !!this.iconSymbol && !this.loading;
|
|
@@ -61,16 +55,14 @@ export default class Button extends LightningElement {
|
|
|
61
55
|
this.loading && "state-loading",
|
|
62
56
|
`size-${this.size}`,
|
|
63
57
|
!!this.iconSymbol && "style-icon",
|
|
64
|
-
this.
|
|
58
|
+
this.isSlotEmpty && "slot-empty",
|
|
65
59
|
`font-${this.font}`,
|
|
66
60
|
this.iconPosition === "right" ? "icon-right" : "icon-left"
|
|
67
61
|
);
|
|
68
62
|
}
|
|
69
63
|
|
|
70
|
-
private
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
!this.querySelector(".button-content")?.textContent
|
|
74
|
-
);
|
|
64
|
+
private onSlotChange(e: LightningSlotElement) {
|
|
65
|
+
const slot = e.target;
|
|
66
|
+
this.isSlotEmpty = slot.assignedElements().length !== 0;
|
|
75
67
|
}
|
|
76
68
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
|
|
3
|
+
.menu-nested::part(content) {
|
|
3
4
|
padding-top: var(--dx-g-spacing-sm);
|
|
4
5
|
width: 354px;
|
|
5
6
|
}
|
|
@@ -10,8 +11,7 @@
|
|
|
10
11
|
flex-wrap: nowrap;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
.menu-hidden::part(content)
|
|
14
|
-
.menu-hidden .popover.popover-content {
|
|
14
|
+
.menu-hidden::part(content) {
|
|
15
15
|
display: none;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
@media screen and (min-width: 1000px) {
|
|
27
|
-
.menu-nested-2-col::part(content)
|
|
28
|
-
.menu-nested-2-col .popover.popover-content {
|
|
27
|
+
.menu-nested-2-col::part(content) {
|
|
29
28
|
width: 592px;
|
|
30
29
|
}
|
|
31
30
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<template
|
|
1
|
+
<template>
|
|
2
2
|
<dx-popover
|
|
3
3
|
aria-label={ariaLabel}
|
|
4
4
|
class={className}
|
|
@@ -12,10 +12,7 @@
|
|
|
12
12
|
small={small}
|
|
13
13
|
width={width}
|
|
14
14
|
>
|
|
15
|
-
<
|
|
16
|
-
<slot></slot>
|
|
17
|
-
</div>
|
|
18
|
-
|
|
15
|
+
<slot slot="control"></slot>
|
|
19
16
|
<div
|
|
20
17
|
class="menu_list"
|
|
21
18
|
if:false={areOptionsEmpty}
|
|
@@ -20,8 +20,6 @@ interface DropdownOption extends OptionWithNested {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export default class Dropdown extends LightningElement {
|
|
23
|
-
static renderMode = "light";
|
|
24
|
-
|
|
25
23
|
@api value: string | null = null; // "active option" id
|
|
26
24
|
@api valuePath: string = "id"; // path to match for the active value (useful for url matching)
|
|
27
25
|
@api stayOpenAfterChange?: boolean = false;
|
|
@@ -100,7 +98,7 @@ export default class Dropdown extends LightningElement {
|
|
|
100
98
|
}
|
|
101
99
|
|
|
102
100
|
private get optionsElements() {
|
|
103
|
-
return this.querySelectorAll("dx-dropdown-option");
|
|
101
|
+
return this.template.querySelectorAll("dx-dropdown-option");
|
|
104
102
|
}
|
|
105
103
|
|
|
106
104
|
private get areOptionsEmpty() {
|
|
@@ -189,7 +187,7 @@ export default class Dropdown extends LightningElement {
|
|
|
189
187
|
|
|
190
188
|
renderedCallback() {
|
|
191
189
|
if (!this.popoverEl) {
|
|
192
|
-
this.popoverEl = this.querySelector("dx-popover");
|
|
190
|
+
this.popoverEl = this.template.querySelector("dx-popover");
|
|
193
191
|
}
|
|
194
192
|
}
|
|
195
193
|
}
|
|
@@ -1 +1,99 @@
|
|
|
1
1
|
@import "dxHelpers/commonHeader";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
--dx-c-header-search-width: 316px;
|
|
5
|
+
--dx-g-text-xs: 14px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
dx-header-mobile-nav-menu {
|
|
9
|
+
--dx-c-color-background: var(--dx-g-brand-current-color-background);
|
|
10
|
+
--dx-c-button-color-background-inactive: var(
|
|
11
|
+
--dx-g-brand-current-button-color-background-inactive
|
|
12
|
+
);
|
|
13
|
+
--dx-c-button-color-background-active: var(
|
|
14
|
+
--dx-g-brand-current-button-color-background-active
|
|
15
|
+
);
|
|
16
|
+
--dx-c-color: var(--dx-g-brand-current-color);
|
|
17
|
+
--dx-c-color-border: var(--dx-g-brand-current-color-border);
|
|
18
|
+
--dx-c-color-background-2: var(--dx-g-brand-current-color-background-2);
|
|
19
|
+
--dx-c-button-color-background-inactive-hover: var(
|
|
20
|
+
--dx-g-brand-current-button-color-background-inactive-hover
|
|
21
|
+
);
|
|
22
|
+
--dx-c-color-border-2: var(--dx-g-brand-current-color-border-2);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.header_l2_group-title {
|
|
26
|
+
margin-right: var(--dx-g-spacing-4xl);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.header_l2_group-nav_menu-ctas {
|
|
30
|
+
display: none;
|
|
31
|
+
position: relative;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
align-items: center;
|
|
34
|
+
padding-right: var(--dx-g-spacing-sm);
|
|
35
|
+
height: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.header_l2_group-nav_menu-ctas::after {
|
|
39
|
+
content: "";
|
|
40
|
+
position: absolute;
|
|
41
|
+
right: 0;
|
|
42
|
+
top: var(--dx-g-spacing-sm);
|
|
43
|
+
height: calc(100% - var(--dx-g-spacing-md));
|
|
44
|
+
width: 1px;
|
|
45
|
+
background: transparent;
|
|
46
|
+
transition: var(--dx-g-transition-hue-1x);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
header.has-navscrollshadow .header_l2_group-nav_menu-ctas::after {
|
|
50
|
+
background: var(--dx-g-brand-current-color-border);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.header_l2_group-nav_menu-button {
|
|
54
|
+
--dx-c-button-primary-color: var(--dx-g-blue-vibrant-20);
|
|
55
|
+
--dx-c-button-secondary-color-hover: var(
|
|
56
|
+
--dx-g-brand-current-button-color-background-inactive
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media (max-width: 1024px) {
|
|
61
|
+
.header_l2 {
|
|
62
|
+
flex-wrap: wrap;
|
|
63
|
+
height: unset;
|
|
64
|
+
padding: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.header_l2_group-title {
|
|
68
|
+
margin-right: 0;
|
|
69
|
+
padding: 12px var(--dx-g-page-padding-horizontal);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.header_l2_group {
|
|
73
|
+
width: 100%;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.header_l2_group-nav {
|
|
77
|
+
height: var(--dx-g-spacing-3xl);
|
|
78
|
+
padding: 0;
|
|
79
|
+
padding-left: var(--dx-g-spacing-sm);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.header_l2_group-nav_overflow {
|
|
83
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.header_version-dropdown {
|
|
87
|
+
margin-left: auto;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.has-nav-items .header_l2_group-title {
|
|
91
|
+
border-bottom: 1px solid var(--dx-g-brand-current-color-border-2);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@media (max-width: 768px) {
|
|
96
|
+
.header_l2_group-nav > .header_l2_group-nav_menu-ctas {
|
|
97
|
+
display: flex;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
LightningSlotElement,
|
|
4
|
+
PopoverRequestCloseType,
|
|
5
|
+
PopperPlacement
|
|
6
|
+
} from "typings/custom";
|
|
3
7
|
|
|
4
8
|
import { computePosition, flip, size, shift, arrow } from "@floating-ui/dom";
|
|
5
9
|
import cx from "classnames";
|
|
@@ -19,8 +23,6 @@ const isEventOutsideElements = (
|
|
|
19
23
|
);
|
|
20
24
|
|
|
21
25
|
export default class Popover extends LightningElement {
|
|
22
|
-
static renderMode = "light";
|
|
23
|
-
|
|
24
26
|
@api ariaLabel: string | null = null;
|
|
25
27
|
@api offset?: "small" | "medium";
|
|
26
28
|
@api pagePadding?: number = 16; // padding between dropdown and the edge of the page
|
|
@@ -119,17 +121,14 @@ export default class Popover extends LightningElement {
|
|
|
119
121
|
|
|
120
122
|
renderedCallback() {
|
|
121
123
|
if (!this.popover) {
|
|
122
|
-
this.popover = this.querySelector(".popover-container");
|
|
124
|
+
this.popover = this.template.querySelector(".popover-container");
|
|
123
125
|
}
|
|
124
|
-
|
|
125
126
|
if (!this.popoverContent) {
|
|
126
|
-
this.popoverContent = this.querySelector(".popover");
|
|
127
|
+
this.popoverContent = this.template.querySelector(".popover");
|
|
127
128
|
}
|
|
128
129
|
if (!this.arrow && this.showArrow) {
|
|
129
|
-
this.arrow = this.querySelector(".popover-arrow");
|
|
130
|
+
this.arrow = this.template.querySelector(".popover-arrow");
|
|
130
131
|
}
|
|
131
|
-
|
|
132
|
-
this.doWeirdControlStuff();
|
|
133
132
|
}
|
|
134
133
|
|
|
135
134
|
// GETTERS
|
|
@@ -137,7 +136,6 @@ export default class Popover extends LightningElement {
|
|
|
137
136
|
private get className() {
|
|
138
137
|
return cx(
|
|
139
138
|
"popover",
|
|
140
|
-
"popover-content",
|
|
141
139
|
this.offset && `popover-offset-${this.offset}`,
|
|
142
140
|
this.small && "popover-small",
|
|
143
141
|
this.width && "popover-overridewidth",
|
|
@@ -243,15 +241,25 @@ export default class Popover extends LightningElement {
|
|
|
243
241
|
this.openPopover();
|
|
244
242
|
};
|
|
245
243
|
|
|
246
|
-
private
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
244
|
+
private onSlotChange(e: Event) {
|
|
245
|
+
const slot = e.target as LightningSlotElement;
|
|
246
|
+
const elements = slot.assignedElements();
|
|
247
|
+
const slotted = elements.length === 0 ? null : elements[0];
|
|
248
|
+
// allows dropdown/select to compose popover
|
|
249
|
+
const slotElement = (
|
|
250
|
+
slotted?.tagName === "SLOT" ? slotted.firstChild : slotted
|
|
251
|
+
) as HTMLElement | null;
|
|
252
|
+
const isWorkToDo =
|
|
253
|
+
slotElement &&
|
|
254
|
+
(!this.control || !slotElement.isSameNode(this.control));
|
|
255
|
+
|
|
256
|
+
if (!isWorkToDo) {
|
|
257
|
+
return;
|
|
253
258
|
}
|
|
254
259
|
|
|
260
|
+
slotElement.setAttribute("aria-haspopup", "true");
|
|
261
|
+
slotElement.style.cursor = this.openOnHover ? "default" : "cursor";
|
|
262
|
+
this.control = slotElement;
|
|
255
263
|
this.addControlListeners();
|
|
256
264
|
this.setPosition();
|
|
257
265
|
}
|
|
@@ -149,8 +149,8 @@ export default class TypeBadge extends LightningElement {
|
|
|
149
149
|
private get style(): string {
|
|
150
150
|
if (this.dark) {
|
|
151
151
|
return buildStyleColorVariables({
|
|
152
|
-
background:
|
|
153
|
-
color:
|
|
152
|
+
background: "--dx-g-purple-vibrant-40",
|
|
153
|
+
color: "--dx-g-brand-default-color-background"
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
if (this.variantColorScope) {
|