@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.3.5-lightdom-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.5.3",
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",
@@ -1,4 +1,3 @@
1
- <template lwc:render-mode="light">
1
+ <template>
2
2
  <slot></slot>
3
- <div id="extra_brand_styles"></div>
4
3
  </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
- body, header, dx-card-small {
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.querySelector("#extra_brand_styles")?.appendChild(style);
36
+ this.template.appendChild(style);
40
37
  }
41
38
 
42
- if (style?.firstChild) {
39
+ if (style.firstChild) {
43
40
  style.removeChild(style.firstChild);
44
41
  }
45
42
 
46
43
  const css = document.createTextNode(this.css);
47
- style?.appendChild(css);
44
+ style.appendChild(css);
48
45
  }
49
46
  }
@@ -1,3 +1,5 @@
1
+ @import "dxHelpers/reset";
2
+
1
3
  :host {
2
4
  width: min-content;
3
5
  font-size: inherit;
@@ -1,4 +1,4 @@
1
- <template lwc:render-mode="light">
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} class="button-content">
11
- {buttonText}
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} class="button-content">
34
- {buttonText}
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
- _isSlotEmpty: boolean = true;
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._isSlotEmpty && "slot-empty",
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 isSlotEmpty() {
71
- return (
72
- !this.querySelector(".button-content")?.childElementCount &&
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
- .menu-nested::part(content),
2
- .menu-nested .popover.popover-content {
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 lwc:render-mode="light">
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
- <div slot="control">
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,4 +1,4 @@
1
- <template lwc:render-mode="light">
1
+ <template>
2
2
  <dx-brand-theme-provider brand={brand}>
3
3
  <header class={className}>
4
4
  <dx-skip-nav-link></dx-skip-nav-link>
@@ -1,8 +1,6 @@
1
1
  import { HeaderBase } from "dxBaseElements/headerBase";
2
2
 
3
3
  export default class Header extends HeaderBase {
4
- static renderMode = "light";
5
-
6
4
  private get showTbidLogin(): boolean {
7
5
  return this.showSignup;
8
6
  }
@@ -1,3 +1,5 @@
1
+ @import "dxHelpers/reset";
2
+
1
3
  :host {
2
4
  --popover-border-radius: var(
3
5
  --dx-c-popover-border-radius,
@@ -1,5 +1,5 @@
1
- <template lwc:render-mode="light">
2
- <slot name="control"></slot>
1
+ <template>
2
+ <slot name="control" onslotchange={onSlotChange}></slot>
3
3
  <div class={containerClassName}>
4
4
  <div class="popover-arrow" if:true={showArrow}></div>
5
5
  <div
@@ -1,5 +1,9 @@
1
1
  import { LightningElement, api } from "lwc";
2
- import { PopoverRequestCloseType, PopperPlacement } from "typings/custom";
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 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;
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: `--dx-g-${this.variantColorScope}-${this.variant}-color`,
153
- color: `--dx-g-brand-default-color-background`
152
+ background: "--dx-g-purple-vibrant-40",
153
+ color: "--dx-g-brand-default-color-background"
154
154
  });
155
155
  }
156
156
  if (this.variantColorScope) {
@@ -33,7 +33,7 @@ dx-tree:not(:last-child) {
33
33
  line-height: inherit;
34
34
  }
35
35
 
36
- dx-button.header-toggle-button {
36
+ .header-toggle-button {
37
37
  position: absolute;
38
38
  right: calc((-1 * (var(--dx-g-spacing-xl) / 2)) - 1px);
39
39
 
@@ -488,6 +488,7 @@ h4,
488
488
  h5,
489
489
  h6 {
490
490
  font-size: inherit;
491
+ font-weight: inherit;
491
492
  }
492
493
 
493
494
  /**