@salesforcedevs/dx-components 1.3.4 → 1.3.5-lightdom-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.3.4",
3
+ "version": "1.3.5-lightdom-2",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -35,6 +35,5 @@
35
35
  "@types/uuid": "^8.3.4",
36
36
  "@types/vimeo__player": "^2.16.2",
37
37
  "eventsourcemock": "^2.0.0"
38
- },
39
- "gitHead": "fcd28123dc3734ee192fd4c8b2fa50a43f38fa91"
38
+ }
40
39
  }
@@ -1,3 +1,4 @@
1
- <template>
1
+ <template lwc:render-mode="light">
2
2
  <slot></slot>
3
+ <div id="extra_brand_styles"></div>
3
4
  </template>
@@ -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
- :host {
6
+ body, header, dx-card-small {
7
7
  ${brandCssVars.reduce(
8
8
  (acc, v) => `
9
9
  ${acc}
@@ -15,6 +15,8 @@ export const toCss = (brand: Brand | null) => `
15
15
  `;
16
16
 
17
17
  export default class BrandThemeProvider extends LightningElement {
18
+ static renderMode = "light";
19
+
18
20
  @api brand: Brand | null = null;
19
21
 
20
22
  private get css() {
@@ -30,17 +32,18 @@ export default class BrandThemeProvider extends LightningElement {
30
32
  }
31
33
 
32
34
  setBrandVars() {
33
- let style = this.template.querySelector("style");
35
+ let style = this.querySelector("style");
36
+
34
37
  if (!style) {
35
38
  style = document.createElement("style");
36
- this.template.appendChild(style);
39
+ this.querySelector("#extra_brand_styles")?.appendChild(style);
37
40
  }
38
41
 
39
- if (style.firstChild) {
42
+ if (style?.firstChild) {
40
43
  style.removeChild(style.firstChild);
41
44
  }
42
45
 
43
46
  const css = document.createTextNode(this.css);
44
- style.appendChild(css);
47
+ style?.appendChild(css);
45
48
  }
46
49
  }
@@ -1,4 +1,4 @@
1
- <template>
1
+ <template lwc:render-mode="light">
2
2
  <button
3
3
  if:false={href}
4
4
  class={className}
@@ -7,8 +7,9 @@
7
7
  aria-label={ariaLabel}
8
8
  part="container"
9
9
  >
10
- <span if:false={loading}>
11
- <slot onslotchange={onSlotChange}></slot>
10
+ <span if:false={loading} class="button-content">
11
+ {buttonText}
12
+ <slot></slot>
12
13
  </span>
13
14
  <dx-icon
14
15
  if:true={showIcon}
@@ -29,8 +30,9 @@
29
30
  aria-label={ariaLabel}
30
31
  part="container"
31
32
  >
32
- <span if:false={loading}>
33
- <slot onslotchange={onSlotChange}></slot>
33
+ <span if:false={loading} class="button-content">
34
+ {buttonText}
35
+ <slot></slot>
34
36
  </span>
35
37
  <dx-icon
36
38
  if:true={showIcon}
@@ -1,5 +1,3 @@
1
- @import "dxHelpers/reset";
2
-
3
1
  :host {
4
2
  width: min-content;
5
3
  font-size: inherit;
@@ -5,11 +5,12 @@ import {
5
5
  ButtonVariant,
6
6
  IconSprite,
7
7
  IconSize,
8
- IconSymbol,
9
- LightningSlotElement
8
+ IconSymbol
10
9
  } from "typings/custom";
11
10
 
12
11
  export default class Button extends LightningElement {
12
+ static renderMode = "light";
13
+
13
14
  @api ariaLabel: string = "";
14
15
  @api disabled: boolean | null = null;
15
16
  @api iconSize?: IconSize = "small";
@@ -23,6 +24,7 @@ export default class Button extends LightningElement {
23
24
  @api font: "display" | "sans" = "display";
24
25
  @api name?: string;
25
26
  @api value?: any;
27
+ @api buttonText?: string;
26
28
 
27
29
  // button props
28
30
  @api type: "submit" | "reset" | "button" = "button";
@@ -34,13 +36,17 @@ export default class Button extends LightningElement {
34
36
  @api rel: string | null = null;
35
37
 
36
38
  @api focus() {
37
- const button = this.template.querySelector(".button");
39
+ const button = this.querySelector(".button");
38
40
  if (button) {
39
41
  button.focus();
40
42
  }
41
43
  }
42
44
 
43
- private isSlotEmpty: boolean = true;
45
+ _isSlotEmpty: boolean = true;
46
+
47
+ renderedCallback(): void {
48
+ this._isSlotEmpty = this.isSlotEmpty();
49
+ }
44
50
 
45
51
  private get showIcon(): boolean {
46
52
  return !!this.iconSymbol && !this.loading;
@@ -55,14 +61,16 @@ export default class Button extends LightningElement {
55
61
  this.loading && "state-loading",
56
62
  `size-${this.size}`,
57
63
  !!this.iconSymbol && "style-icon",
58
- this.isSlotEmpty && "slot-empty",
64
+ this._isSlotEmpty && "slot-empty",
59
65
  `font-${this.font}`,
60
66
  this.iconPosition === "right" ? "icon-right" : "icon-left"
61
67
  );
62
68
  }
63
69
 
64
- private onSlotChange(e: LightningSlotElement) {
65
- const slot = e.target;
66
- this.isSlotEmpty = slot.assignedElements().length !== 0;
70
+ private isSlotEmpty() {
71
+ return (
72
+ !this.querySelector(".button-content")?.childElementCount &&
73
+ !this.querySelector(".button-content")?.textContent
74
+ );
67
75
  }
68
76
  }
@@ -50,6 +50,8 @@
50
50
  value={typeBadgeValue}
51
51
  color={typeBadgeColor}
52
52
  size={typeBadgeSize}
53
+ dark={typeBadgeDark}
54
+ variant={typeBadgeVariant}
53
55
  ></dx-type-badge>
54
56
  </div>
55
57
  <dx-card-title
@@ -30,8 +30,10 @@ export default class CardTrial extends LightningElement {
30
30
  @api twoColTarget?: string;
31
31
  @api twoColHref!: string;
32
32
  @api typeBadgeValue?: string;
33
+ @api typeBadgeVariant?: string;
33
34
  @api typeBadgeColor?: string;
34
35
  @api typeBadgeSize?: string = "default";
36
+ @api typeBadgeDark?: boolean = false;
35
37
 
36
38
  @api
37
39
  get details() {
@@ -1,6 +1,5 @@
1
- @import "dxHelpers/reset";
2
-
3
- .menu-nested::part(content) {
1
+ .menu-nested::part(content),
2
+ .menu-nested .popover.popover-content {
4
3
  padding-top: var(--dx-g-spacing-sm);
5
4
  width: 354px;
6
5
  }
@@ -11,7 +10,8 @@
11
10
  flex-wrap: nowrap;
12
11
  }
13
12
 
14
- .menu-hidden::part(content) {
13
+ .menu-hidden::part(content),
14
+ .menu-hidden .popover.popover-content {
15
15
  display: none;
16
16
  }
17
17
 
@@ -24,7 +24,8 @@
24
24
  }
25
25
 
26
26
  @media screen and (min-width: 1000px) {
27
- .menu-nested-2-col::part(content) {
27
+ .menu-nested-2-col::part(content),
28
+ .menu-nested-2-col .popover.popover-content {
28
29
  width: 592px;
29
30
  }
30
31
 
@@ -1,4 +1,4 @@
1
- <template>
1
+ <template lwc:render-mode="light">
2
2
  <dx-popover
3
3
  aria-label={ariaLabel}
4
4
  class={className}
@@ -12,7 +12,10 @@
12
12
  small={small}
13
13
  width={width}
14
14
  >
15
- <slot slot="control"></slot>
15
+ <div slot="control">
16
+ <slot></slot>
17
+ </div>
18
+
16
19
  <div
17
20
  class="menu_list"
18
21
  if:false={areOptionsEmpty}
@@ -20,6 +20,8 @@ interface DropdownOption extends OptionWithNested {
20
20
  }
21
21
 
22
22
  export default class Dropdown extends LightningElement {
23
+ static renderMode = "light";
24
+
23
25
  @api value: string | null = null; // "active option" id
24
26
  @api valuePath: string = "id"; // path to match for the active value (useful for url matching)
25
27
  @api stayOpenAfterChange?: boolean = false;
@@ -98,7 +100,7 @@ export default class Dropdown extends LightningElement {
98
100
  }
99
101
 
100
102
  private get optionsElements() {
101
- return this.template.querySelectorAll("dx-dropdown-option");
103
+ return this.querySelectorAll("dx-dropdown-option");
102
104
  }
103
105
 
104
106
  private get areOptionsEmpty() {
@@ -187,7 +189,7 @@ export default class Dropdown extends LightningElement {
187
189
 
188
190
  renderedCallback() {
189
191
  if (!this.popoverEl) {
190
- this.popoverEl = this.template.querySelector("dx-popover");
192
+ this.popoverEl = this.querySelector("dx-popover");
191
193
  }
192
194
  }
193
195
  }
@@ -1,99 +1 @@
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,4 +1,4 @@
1
- <template>
1
+ <template lwc:render-mode="light">
2
2
  <dx-brand-theme-provider brand={brand}>
3
3
  <header class={className}>
4
4
  <dx-skip-nav-link></dx-skip-nav-link>
@@ -0,0 +1,97 @@
1
+ :host {
2
+ --dx-c-header-search-width: 316px;
3
+ --dx-g-text-xs: 14px;
4
+ }
5
+
6
+ dx-header-mobile-nav-menu {
7
+ --dx-c-color-background: var(--dx-g-brand-current-color-background);
8
+ --dx-c-button-color-background-inactive: var(
9
+ --dx-g-brand-current-button-color-background-inactive
10
+ );
11
+ --dx-c-button-color-background-active: var(
12
+ --dx-g-brand-current-button-color-background-active
13
+ );
14
+ --dx-c-color: var(--dx-g-brand-current-color);
15
+ --dx-c-color-border: var(--dx-g-brand-current-color-border);
16
+ --dx-c-color-background-2: var(--dx-g-brand-current-color-background-2);
17
+ --dx-c-button-color-background-inactive-hover: var(
18
+ --dx-g-brand-current-button-color-background-inactive-hover
19
+ );
20
+ --dx-c-color-border-2: var(--dx-g-brand-current-color-border-2);
21
+ }
22
+
23
+ .header_l2_group-title {
24
+ margin-right: var(--dx-g-spacing-4xl);
25
+ }
26
+
27
+ .header_l2_group-nav_menu-ctas {
28
+ display: none;
29
+ position: relative;
30
+ justify-content: center;
31
+ align-items: center;
32
+ padding-right: var(--dx-g-spacing-sm);
33
+ height: 100%;
34
+ }
35
+
36
+ .header_l2_group-nav_menu-ctas::after {
37
+ content: "";
38
+ position: absolute;
39
+ right: 0;
40
+ top: var(--dx-g-spacing-sm);
41
+ height: calc(100% - var(--dx-g-spacing-md));
42
+ width: 1px;
43
+ background: transparent;
44
+ transition: var(--dx-g-transition-hue-1x);
45
+ }
46
+
47
+ header.has-navscrollshadow .header_l2_group-nav_menu-ctas::after {
48
+ background: var(--dx-g-brand-current-color-border);
49
+ }
50
+
51
+ .header_l2_group-nav_menu-button {
52
+ --dx-c-button-primary-color: var(--dx-g-blue-vibrant-20);
53
+ --dx-c-button-secondary-color-hover: var(
54
+ --dx-g-brand-current-button-color-background-inactive
55
+ );
56
+ }
57
+
58
+ @media (max-width: 1024px) {
59
+ .header_l2 {
60
+ flex-wrap: wrap;
61
+ height: unset;
62
+ padding: 0;
63
+ }
64
+
65
+ .header_l2_group-title {
66
+ margin-right: 0;
67
+ padding: 12px var(--dx-g-page-padding-horizontal);
68
+ }
69
+
70
+ .header_l2_group {
71
+ width: 100%;
72
+ }
73
+
74
+ .header_l2_group-nav {
75
+ height: var(--dx-g-spacing-3xl);
76
+ padding: 0;
77
+ padding-left: var(--dx-g-spacing-sm);
78
+ }
79
+
80
+ .header_l2_group-nav_overflow {
81
+ margin-right: var(--dx-g-spacing-sm);
82
+ }
83
+
84
+ .header_version-dropdown {
85
+ margin-left: auto;
86
+ }
87
+
88
+ .has-nav-items .header_l2_group-title {
89
+ border-bottom: 1px solid var(--dx-g-brand-current-color-border-2);
90
+ }
91
+ }
92
+
93
+ @media (max-width: 768px) {
94
+ .header_l2_group-nav > .header_l2_group-nav_menu-ctas {
95
+ display: flex;
96
+ }
97
+ }
@@ -1,6 +1,8 @@
1
1
  import { HeaderBase } from "dxBaseElements/headerBase";
2
2
 
3
3
  export default class Header extends HeaderBase {
4
+ static renderMode = "light";
5
+
4
6
  private get showTbidLogin(): boolean {
5
7
  return this.showSignup;
6
8
  }
@@ -0,0 +1,5 @@
1
+ :host {
2
+ display: block;
3
+
4
+ --dx-c-icon-color: currentColor;
5
+ }
@@ -1,5 +1,5 @@
1
- <template>
2
- <slot name="control" onslotchange={onSlotChange}></slot>
1
+ <template lwc:render-mode="light">
2
+ <slot name="control"></slot>
3
3
  <div class={containerClassName}>
4
4
  <div class="popover-arrow" if:true={showArrow}></div>
5
5
  <div
@@ -1,5 +1,3 @@
1
- @import "dxHelpers/reset";
2
-
3
1
  :host {
4
2
  --popover-border-radius: var(
5
3
  --dx-c-popover-border-radius,
@@ -1,9 +1,5 @@
1
1
  import { LightningElement, api } from "lwc";
2
- import {
3
- LightningSlotElement,
4
- PopoverRequestCloseType,
5
- PopperPlacement
6
- } from "typings/custom";
2
+ import { PopoverRequestCloseType, PopperPlacement } from "typings/custom";
7
3
 
8
4
  import { computePosition, flip, size, shift, arrow } from "@floating-ui/dom";
9
5
  import cx from "classnames";
@@ -23,6 +19,8 @@ const isEventOutsideElements = (
23
19
  );
24
20
 
25
21
  export default class Popover extends LightningElement {
22
+ static renderMode = "light";
23
+
26
24
  @api ariaLabel: string | null = null;
27
25
  @api offset?: "small" | "medium";
28
26
  @api pagePadding?: number = 16; // padding between dropdown and the edge of the page
@@ -121,14 +119,17 @@ export default class Popover extends LightningElement {
121
119
 
122
120
  renderedCallback() {
123
121
  if (!this.popover) {
124
- this.popover = this.template.querySelector(".popover-container");
122
+ this.popover = this.querySelector(".popover-container");
125
123
  }
124
+
126
125
  if (!this.popoverContent) {
127
- this.popoverContent = this.template.querySelector(".popover");
126
+ this.popoverContent = this.querySelector(".popover");
128
127
  }
129
128
  if (!this.arrow && this.showArrow) {
130
- this.arrow = this.template.querySelector(".popover-arrow");
129
+ this.arrow = this.querySelector(".popover-arrow");
131
130
  }
131
+
132
+ this.doWeirdControlStuff();
132
133
  }
133
134
 
134
135
  // GETTERS
@@ -136,6 +137,7 @@ export default class Popover extends LightningElement {
136
137
  private get className() {
137
138
  return cx(
138
139
  "popover",
140
+ "popover-content",
139
141
  this.offset && `popover-offset-${this.offset}`,
140
142
  this.small && "popover-small",
141
143
  this.width && "popover-overridewidth",
@@ -241,25 +243,15 @@ export default class Popover extends LightningElement {
241
243
  this.openPopover();
242
244
  };
243
245
 
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;
246
+ private doWeirdControlStuff() {
247
+ const control = this.querySelector('[slot="control"]');
248
+
249
+ if (control) {
250
+ control.setAttribute("aria-haspopup", "true");
251
+ control.style.cursor = this.openOnHover ? "default" : "cursor";
252
+ this.control = control;
258
253
  }
259
254
 
260
- slotElement.setAttribute("aria-haspopup", "true");
261
- slotElement.style.cursor = this.openOnHover ? "default" : "cursor";
262
- this.control = slotElement;
263
255
  this.addControlListeners();
264
256
  this.setPosition();
265
257
  }
@@ -33,7 +33,7 @@ dx-tree:not(:last-child) {
33
33
  line-height: inherit;
34
34
  }
35
35
 
36
- .header-toggle-button {
36
+ dx-button.header-toggle-button {
37
37
  position: absolute;
38
38
  right: calc((-1 * (var(--dx-g-spacing-xl) / 2)) - 1px);
39
39
 
@@ -488,7 +488,6 @@ h4,
488
488
  h5,
489
489
  h6 {
490
490
  font-size: inherit;
491
- font-weight: inherit;
492
491
  }
493
492
 
494
493
  /**
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.