@salesforcedevs/dx-components 1.3.179 → 1.3.180-alpha

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.
Files changed (33) hide show
  1. package/lwc.config.json +1 -4
  2. package/package.json +2 -3
  3. package/src/modules/dx/button/button.css +1 -4
  4. package/src/modules/dx/button/button.ts +2 -18
  5. package/src/modules/dx/checkbox/checkbox.ts +2 -26
  6. package/src/modules/dx/featuresListHeader/featuresListHeader.css +1 -6
  7. package/src/modules/dx/featuresListHeader/featuresListHeader.html +1 -3
  8. package/src/modules/dx/featuresListHeader/featuresListHeader.ts +1 -14
  9. package/src/modules/dx/input/input.css +0 -4
  10. package/src/modules/dx/input/input.html +0 -1
  11. package/src/modules/dx/input/input.ts +7 -56
  12. package/src/modules/dx/scrollManager/scrollManager.ts +0 -1
  13. package/src/modules/dx/sectionBanner/sectionBanner.css +1 -57
  14. package/src/modules/dx/sectionBanner/sectionBanner.html +4 -18
  15. package/src/modules/dx/sectionBanner/sectionBanner.ts +3 -96
  16. package/src/modules/dx/select/select.ts +5 -28
  17. package/src/modules/dx/stepSequence/stepSequence.css +4 -0
  18. package/src/modules/dx/stepSequence/stepSequence.html +1 -2
  19. package/src/modules/dx/stepSequence/stepSequence.ts +34 -139
  20. package/src/modules/dx/trafficLabeler/trafficLabeler.html +1 -0
  21. package/src/modules/dx/trafficLabeler/trafficLabeler.ts +66 -0
  22. package/src/modules/dxUtils/css/css.ts +1 -4
  23. package/src/modules/dxUtils/lwc/lwc.ts +0 -15
  24. package/LICENSE +0 -12
  25. package/src/modules/dx/alert/alert.css +0 -108
  26. package/src/modules/dx/alert/alert.html +0 -36
  27. package/src/modules/dx/alert/alert.ts +0 -137
  28. package/src/modules/dx/cardStep/cardStep.css +0 -128
  29. package/src/modules/dx/cardStep/cardStep.html +0 -31
  30. package/src/modules/dx/cardStep/cardStep.ts +0 -55
  31. package/src/modules/dx/cardStep/mockProps.ts +0 -60
  32. package/src/modules/dxBaseElements/lightningElementWithState/lightningElementWithState.ts +0 -93
  33. package/src/modules/dxUtils/list/list.ts +0 -11
package/lwc.config.json CHANGED
@@ -4,7 +4,6 @@
4
4
  { "npm": "@salesforcedevs/dw-components" }
5
5
  ],
6
6
  "expose": [
7
- "dx/alert",
8
7
  "dx/audio",
9
8
  "dx/banner",
10
9
  "dx/brandThemeProvider",
@@ -23,7 +22,6 @@
23
22
  "dx/cardNews",
24
23
  "dx/cardPodcastEpisode",
25
24
  "dx/cardSmall",
26
- "dx/cardStep",
27
25
  "dx/cardTrailheadModule",
28
26
  "dx/cardTrial",
29
27
  "dx/cardTrialExpanded",
@@ -88,11 +86,11 @@
88
86
  "dx/toast",
89
87
  "dx/toc",
90
88
  "dx/tooltip",
89
+ "dx/trafficLabeler",
91
90
  "dx/tree",
92
91
  "dx/typeBadge",
93
92
  "dx/vimeoPlayer",
94
93
  "dxBaseElements/headerBase",
95
- "dxBaseElements/lightningElementWithState",
96
94
  "dxBaseElements/matchMediaElement",
97
95
  "dxConstants/brands",
98
96
  "dxConstants/colors",
@@ -114,7 +112,6 @@
114
112
  "dxUtils/dates",
115
113
  "dxUtils/highlight",
116
114
  "dxUtils/language",
117
- "dxUtils/list",
118
115
  "dxUtils/lwc",
119
116
  "dxUtils/normalizers",
120
117
  "dxUtils/queryCoordinator",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.3.179",
3
+ "version": "1.3.180-alpha",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -40,6 +40,5 @@
40
40
  "@types/vimeo__player": "^2.16.2",
41
41
  "eventsourcemock": "^2.0.0",
42
42
  "luxon": "^3.1.0"
43
- },
44
- "gitHead": "ef5efd7169e688009ba79bd74e69c42adb277e09"
43
+ }
45
44
  }
@@ -50,7 +50,6 @@
50
50
 
51
51
  .button dx-icon {
52
52
  display: inline;
53
- vertical-align: var(--dx-c-button-icon-vertical-align, unset);
54
53
  }
55
54
 
56
55
  .button.variant_inline dx-icon,
@@ -62,7 +61,6 @@
62
61
  font-family: inherit;
63
62
  font-size: inherit;
64
63
  font-weight: inherit;
65
- vertical-align: var(--dx-c-button-span-vertical-align, unset);
66
64
  }
67
65
 
68
66
  .button:not(.variant_inline-inherit).font-display {
@@ -197,8 +195,7 @@
197
195
  }
198
196
 
199
197
  /* custom */
200
- .button.variant_custom,
201
- .button.variant_custom:hover.state-disabled {
198
+ .button.variant_custom {
202
199
  color: var(--dx-c-button-custom-color);
203
200
  background: var(--dx-c-button-custom-background);
204
201
  border: 1px solid var(--dx-c-button-custom-border);
@@ -7,12 +7,10 @@ import {
7
7
  ButtonSize,
8
8
  IconSprite,
9
9
  IconSize,
10
- IconSymbol,
11
- LightningSlotElement
10
+ IconSymbol
12
11
  } from "typings/custom";
13
12
 
14
13
  export default class Button extends LightningElement {
15
- private _didSetFormAttribute = false;
16
14
  @api ariaLabel: string = "";
17
15
  @api disabled: boolean | null = null;
18
16
  @api iconSize?: IconSize = "small";
@@ -24,7 +22,6 @@ export default class Button extends LightningElement {
24
22
  @api variant: ButtonVariant = "primary";
25
23
  @api inlineTextColor: ButtonTextColor = "dark";
26
24
  @api font: "display" | "sans" = "display";
27
- @api form: string | undefined;
28
25
  @api name?: string;
29
26
  @api value?: any;
30
27
 
@@ -65,20 +62,7 @@ export default class Button extends LightningElement {
65
62
  );
66
63
  }
67
64
 
68
- renderedCallback() {
69
- if (
70
- !this.href &&
71
- typeof this.form !== "undefined" &&
72
- !this._didSetFormAttribute
73
- ) {
74
- this._didSetFormAttribute = true;
75
- this.template
76
- .querySelector("button")
77
- ?.setAttribute("form", this.form);
78
- }
79
- }
80
-
81
- private onSlotChange(e: LightningSlotElement) {
65
+ private onSlotChange(e: any) {
82
66
  const slot = e.target;
83
67
  this.isSlotEmpty = slot.assignedElements().length !== 0;
84
68
  }
@@ -1,17 +1,16 @@
1
1
  import { LightningElement, api } from "lwc";
2
2
  import cx from "classnames";
3
- import { reflectBooleanAttribute } from "dxUtils/lwc";
4
3
 
5
4
  export default class Checkbox extends LightningElement {
6
5
  @api disabled: boolean = false;
7
6
  @api errorMessage?: string = "Please check this box if you want to proceed";
8
7
  @api label?: string;
8
+ @api name: string | null = null;
9
+ @api required: boolean = false;
9
10
  @api type: "checkbox" | "radio" = "checkbox";
10
11
  @api value!: string;
11
12
 
12
13
  private _checked: boolean = false;
13
- private _required: boolean = false;
14
- private _name: string | null = null;
15
14
 
16
15
  @api
17
16
  get checked(): boolean {
@@ -21,24 +20,6 @@ export default class Checkbox extends LightningElement {
21
20
  this._checked = value;
22
21
  }
23
22
 
24
- @api
25
- get name(): string | null {
26
- return this._name;
27
- }
28
- set name(value: string | null) {
29
- this._name = value;
30
- this.setAttribute("name", value); // reflect to HTML
31
- }
32
-
33
- @api
34
- get required(): boolean {
35
- return this._required;
36
- }
37
- set required(value: boolean) {
38
- this._required = value;
39
- reflectBooleanAttribute(this, "required", value);
40
- }
41
-
42
23
  private showValidity = false;
43
24
 
44
25
  private get valid(): boolean {
@@ -59,11 +40,6 @@ export default class Checkbox extends LightningElement {
59
40
  return this.valid;
60
41
  }
61
42
 
62
- @api
63
- checkValidity(): boolean {
64
- return this.valid;
65
- }
66
-
67
43
  private onChange(e: InputEvent) {
68
44
  this._checked = ((e.currentTarget as HTMLInputElement) || {}).checked;
69
45
  this.dispatchEvent(
@@ -14,7 +14,7 @@
14
14
  flex-direction: column;
15
15
  justify-content: center;
16
16
  align-items: flex-start;
17
- padding: var(--dx-g-spacing-2xl) 0 var(--dx-g-spacing-3xl) 0;
17
+ padding: var(--dx-g-spacing-4xl) 0;
18
18
  min-height: 460px;
19
19
  text-align: left;
20
20
  background-position: center;
@@ -62,11 +62,6 @@ dx-button {
62
62
  margin-top: var(--dx-g-spacing-smd);
63
63
  }
64
64
 
65
- img.desktop {
66
- padding-left: 20px;
67
- max-width: 50%; /* assumes desktop images are high-res */
68
- }
69
-
70
65
  img.mobile {
71
66
  display: none;
72
67
  }
@@ -2,9 +2,7 @@
2
2
  <div class="container" style={style}>
3
3
  <div class={textStyle}>
4
4
  <h1 class="heading dx-text-display-2">
5
- <dx-formatted-rich-text
6
- value={displayTitle}
7
- ></dx-formatted-rich-text>
5
+ <dx-formatted-rich-text value={title}></dx-formatted-rich-text>
8
6
  </h1>
9
7
  <span if:true={subtitle} class="dx-text-display-5">{subtitle}</span>
10
8
  <div class="features-list">
@@ -2,10 +2,8 @@ import { LightningElement, api } from "lwc";
2
2
  import cx from "classnames";
3
3
  import { track } from "dxUtils/analytics";
4
4
  import { toJson } from "dxUtils/normalizers";
5
- import { toDxColor } from "dxUtils/css";
6
5
 
7
6
  export default class FeaturesListHeader extends LightningElement {
8
- private _displayTitle: string | null = null;
9
7
  @api title!: string;
10
8
  @api subtitle?: string;
11
9
  @api ctaLabel!: string;
@@ -27,21 +25,10 @@ export default class FeaturesListHeader extends LightningElement {
27
25
  this._featuresList = toJson(value);
28
26
  }
29
27
 
30
- // For use when displayed title will have embed HTML, i.e., is "rich text"
31
- @api
32
- get displayTitle() {
33
- return typeof this._displayTitle === "string"
34
- ? this._displayTitle
35
- : this.title;
36
- }
37
- set displayTitle(value: string | null) {
38
- this._displayTitle = value;
39
- }
40
-
41
28
  private get style() {
42
29
  return cx(
43
30
  this.backgroundColor &&
44
- `background-color: ${toDxColor(this.backgroundColor)};`
31
+ `background-color: var(--dx-g-${this.backgroundColor});`
45
32
  );
46
33
  }
47
34
 
@@ -87,10 +87,6 @@ input {
87
87
  text-overflow: ellipsis;
88
88
  transition: var(--dx-g-transition-hue-1x);
89
89
  outline: none;
90
- }
91
-
92
- /* Show the default system disabled background if disabled; otherwise show container background */
93
- input:not([disabled]) {
94
90
  background: none;
95
91
  }
96
92
 
@@ -22,7 +22,6 @@
22
22
  oninput={onInputChange}
23
23
  onkeydown={onKeyDown}
24
24
  placeholder={placeholder}
25
- readonly={readOnly}
26
25
  type={type}
27
26
  value={value}
28
27
  aria-labelledby="label description"
@@ -2,7 +2,7 @@ import { LightningElement, api } from "lwc";
2
2
  import cx from "classnames";
3
3
  import { IconSize, IconSymbol } from "typings/custom";
4
4
  import { isMac } from "dxUtils/devices";
5
- import { reflectBooleanAttribute, setContainerInnerHtml } from "dxUtils/lwc";
5
+ import { setContainerInnerHtml } from "dxUtils/lwc";
6
6
  import { isValidEmail } from "./validators";
7
7
 
8
8
  type ValidatorMap = {
@@ -24,6 +24,7 @@ export default class Input extends LightningElement {
24
24
  @api ariaLabel!: string;
25
25
  @api autocomplete: string | null = null;
26
26
  @api clearable: boolean = false;
27
+ @api disabled: boolean = false;
27
28
  @api iconSize: IconSize = "medium";
28
29
  @api iconSymbol: IconSymbol | null = null;
29
30
  @api label?: string;
@@ -31,8 +32,9 @@ export default class Input extends LightningElement {
31
32
  @api loading: boolean = false;
32
33
  @api missingErrorMessage: string = "Complete this field";
33
34
  @api formatErrorMessage?: string;
35
+ @api name?: string;
34
36
  @api placeholder!: string;
35
- @api readOnly: boolean = false;
37
+ @api required = false;
36
38
  @api role: string | null = null;
37
39
  @api shortcutKey: string | null = null;
38
40
  @api size: "small" | "large" | "override" = "small";
@@ -48,41 +50,6 @@ export default class Input extends LightningElement {
48
50
  this._value = value || "";
49
51
  }
50
52
 
51
- @api
52
- get disabled() {
53
- return this._disabled;
54
- }
55
- set disabled(value: boolean) {
56
- this._disabled = value;
57
- reflectBooleanAttribute(
58
- this as unknown as LightningElement,
59
- "disabled",
60
- value
61
- );
62
- }
63
-
64
- @api
65
- get name() {
66
- return this._name;
67
- }
68
- set name(name: string | undefined) {
69
- this._name = name;
70
- this.setAttribute("name", name); // reflect to HTML
71
- }
72
-
73
- @api
74
- get required(): boolean {
75
- return this._required;
76
- }
77
- set required(value: boolean) {
78
- this._required = value;
79
- reflectBooleanAttribute(
80
- this as unknown as LightningElement,
81
- "required",
82
- value
83
- );
84
- }
85
-
86
53
  @api
87
54
  get errorMessage() {
88
55
  return this._errorMessage;
@@ -100,7 +67,7 @@ export default class Input extends LightningElement {
100
67
 
101
68
  @api
102
69
  reportValidity(): boolean {
103
- if (this.isRequiredButEmpty) {
70
+ if (this.isRequiredAndFilled) {
104
71
  this._errorMessage = this.missingErrorMessage;
105
72
  return false;
106
73
  }
@@ -116,26 +83,10 @@ export default class Input extends LightningElement {
116
83
  return true;
117
84
  }
118
85
 
119
- @api checkValidity(): boolean {
120
- if (this.isRequiredButEmpty) {
121
- return false;
122
- }
123
-
124
- const typeValidator = typeValidatorMap[this.type];
125
- if (typeValidator && !typeValidator.validator(this.value)) {
126
- return false;
127
- }
128
-
129
- return true;
130
- }
131
-
132
86
  private _errorMessage: string = "";
133
87
  private focused: boolean = false;
134
88
  private input: HTMLInputElement | null = null;
135
89
  private _value: string | null = null;
136
- private _disabled: boolean = false;
137
- private _name?: string;
138
- private _required: boolean = false;
139
90
  private _loading: boolean = false;
140
91
  private isMac: boolean = false;
141
92
 
@@ -158,7 +109,7 @@ export default class Input extends LightningElement {
158
109
  private get inputInvalid() {
159
110
  const typeValidator = typeValidatorMap[this.type];
160
111
  return (
161
- this.isRequiredButEmpty &&
112
+ this.isRequiredAndFilled &&
162
113
  typeValidator &&
163
114
  !typeValidator.validator(this.value)
164
115
  );
@@ -202,7 +153,7 @@ export default class Input extends LightningElement {
202
153
  return `${this.commandKey}-${this.shortcutKey} is the search shortcut`;
203
154
  }
204
155
 
205
- private get isRequiredButEmpty() {
156
+ private get isRequiredAndFilled() {
206
157
  return this.required && (!this.value || !this.value.trim());
207
158
  }
208
159
 
@@ -166,7 +166,6 @@ export default class ScrollManager extends LightningElement {
166
166
  saveScroll = throttle(100, () => {
167
167
  window.history.replaceState(
168
168
  {
169
- ...window.history.state,
170
169
  scroll: {
171
170
  value: document.body.scrollTop,
172
171
  docSize: document.body.scrollHeight
@@ -6,14 +6,12 @@
6
6
  --padding-top: var(--dx-g-spacing-4xl);
7
7
  --margin-top: 80px;
8
8
  --dx-c-section-banner-content-align: flex-end;
9
- --dx-c-section-banner-image-transform: none;
10
9
  }
11
10
 
12
11
  .container {
13
12
  position: relative;
14
13
  display: flex;
15
14
  justify-content: space-between;
16
- overflow-x: hidden;
17
15
  padding-top: var(--padding-top);
18
16
  padding-left: var(--dx-g-page-padding-horizontal);
19
17
  }
@@ -48,23 +46,8 @@
48
46
  margin-top: var(--dx-g-spacing-md);
49
47
  }
50
48
 
51
- .quote-attribution {
49
+ .foot-note {
52
50
  margin-top: var(--dx-g-spacing-md);
53
- position: relative;
54
- }
55
-
56
- .quote-attribution-character {
57
- display: inline-block;
58
- }
59
-
60
- .quote-attribution-text {
61
- left: 24px;
62
- position: absolute;
63
- }
64
-
65
- .quote-attribution-subtext {
66
- left: 24px;
67
- position: relative;
68
51
  }
69
52
 
70
53
  .image {
@@ -72,7 +55,6 @@
72
55
  flex-shrink: 0;
73
56
  height: fit-content;
74
57
  align-self: flex-end;
75
- transform: var(--dx-c-section-banner-image-transform);
76
58
  }
77
59
 
78
60
  .graphic {
@@ -115,41 +97,3 @@
115
97
  margin: 0 var(--dx-g-page-padding-horizontal) var(--dx-g-spacing-3xl) 0;
116
98
  }
117
99
  }
118
-
119
- @media screen and (max-width: 480px) {
120
- .content-body-container {
121
- display: block;
122
- }
123
-
124
- .quote-content p {
125
- font-size: var(--dx-g-text-lg);
126
- line-height: 28px;
127
- }
128
-
129
- .quote-content p.quote-attribution {
130
- font-size: var(--dx-g-text-md);
131
- letter-spacing: unset;
132
- line-height: 24px;
133
- }
134
-
135
- .quote-attribution-text {
136
- left: 20px;
137
- position: absolute;
138
- }
139
-
140
- .quote-attribution-subtext {
141
- font-size: 12px;
142
- left: 20px;
143
- line-height: 20px;
144
- position: relative;
145
- }
146
- }
147
-
148
- @media screen and (max-width: 320px) {
149
- .image {
150
- /* Force the image to take the full width and be centered. Image max size is 320px, hence the media query. */
151
- align-self: center;
152
- transform: translateX(calc(var(--dx-g-page-padding-horizontal) / -2));
153
- width: calc(100% + var(--dx-g-page-padding-horizontal));
154
- }
155
- }
@@ -14,24 +14,10 @@
14
14
  <img if:true={hasQuote} src={quoteGraphicSrc} alt="" />
15
15
  <div class={quoteContentStyle}>
16
16
  <p class={contentBodyStyle}>{body}</p>
17
- <p
18
- if:true={quoteAttributionText}
19
- class={quoteAttributionStyle}
20
- >
21
- <span class="quote-attribution-character">&#8212;</span>
22
- <span class="quote-attribution-text">
23
- <dx-formatted-rich-text
24
- value={quoteAttributionText}
25
- ></dx-formatted-rich-text>
26
- </span>
27
- <span
28
- if:true={quoteAttributionSubtext}
29
- class={quoteAttributionSubtextStyle}
30
- >
31
- <dx-formatted-rich-text
32
- value={quoteAttributionSubtext}
33
- ></dx-formatted-rich-text>
34
- </span>
17
+ <p if:true={footNote} class="foot-note dx-text-display-7">
18
+ <dx-formatted-rich-text
19
+ value={footNote}
20
+ ></dx-formatted-rich-text>
35
21
  </p>
36
22
  </div>
37
23
  </div>
@@ -1,76 +1,18 @@
1
1
  import { api, LightningElement } from "lwc";
2
2
  import cx from "classnames";
3
- import debounce from "debounce";
4
- import { toJson } from "dxUtils/normalizers";
5
3
  import { toDxColor } from "dxUtils/css";
6
4
 
7
5
  export default class SectionBanner extends LightningElement {
8
- private _images?: {
9
- desktop: {
10
- alt: string;
11
- src: string;
12
- };
13
- mobile: {
14
- alt: string;
15
- src: string;
16
- };
17
- };
18
- private _quoteAttribution?: {
19
- desktop: {
20
- text: string;
21
- subtext?: string;
22
- };
23
- mobile: {
24
- text: string;
25
- subtext?: string;
26
- };
27
- };
28
6
  @api title!: string;
29
7
  @api body!: string;
8
+ @api footNote?: string;
9
+ @api imgSrc!: string;
10
+ @api imgAlt!: string;
30
11
  @api hideTopGraphic = false;
31
12
  @api backgroundColor = "indigo-vibrant-20";
32
13
  @api hasQuote = false;
33
14
  @api quoteGraphicSrc?: string;
34
15
 
35
- private isMobile = false;
36
- private mediaQueryList?: MediaQueryList;
37
-
38
- @api
39
- get images() {
40
- return this._images;
41
- }
42
- set images(value) {
43
- this._images = value && toJson(value);
44
- }
45
-
46
- @api
47
- get quoteAttribution() {
48
- return this._quoteAttribution;
49
- }
50
- set quoteAttribution(value) {
51
- this._quoteAttribution = value && toJson(value);
52
- }
53
-
54
- get environment() {
55
- return this.isMobile ? "mobile" : "desktop";
56
- }
57
-
58
- get imgSrc() {
59
- return this.images?.[this.environment]?.src || "";
60
- }
61
-
62
- get imgAlt() {
63
- return this.images?.[this.environment]?.alt || "";
64
- }
65
-
66
- get quoteAttributionText() {
67
- return this.quoteAttribution?.[this.environment]?.text || "";
68
- }
69
-
70
- get quoteAttributionSubtext() {
71
- return this.quoteAttribution?.[this.environment]?.subtext || "";
72
- }
73
-
74
16
  get containerStyle() {
75
17
  return cx("container", !this.hideTopGraphic && "top-margin");
76
18
  }
@@ -79,19 +21,6 @@ export default class SectionBanner extends LightningElement {
79
21
  return cx(this.hasQuote && "quote-content");
80
22
  }
81
23
 
82
- get quoteAttributionStyle() {
83
- return cx("quote-attribution", {
84
- "dx-text-display-7": !this.isMobile,
85
- "dx-text-display-8": this.isMobile
86
- });
87
- }
88
-
89
- get quoteAttributionSubtextStyle() {
90
- return cx("quote-attribution-subtext", {
91
- "is-mobile": this.isMobile
92
- });
93
- }
94
-
95
24
  get contentBodyStyle() {
96
25
  return cx(this.title ? "content-body" : "dx-text-display-6");
97
26
  }
@@ -103,26 +32,4 @@ export default class SectionBanner extends LightningElement {
103
32
 
104
33
  return `${backgroundColor}`;
105
34
  }
106
-
107
- private handleMediaQueryChange = debounce((evt: MediaQueryListEvent) => {
108
- this.isMobile = evt.matches;
109
- }, 64);
110
-
111
- connectedCallback() {
112
- this.mediaQueryList = window.matchMedia(
113
- "screen and (max-width: 480px)"
114
- );
115
- this.isMobile = this.mediaQueryList.matches;
116
- this.mediaQueryList.addEventListener(
117
- "change",
118
- this.handleMediaQueryChange
119
- );
120
- }
121
-
122
- disconnectedCallback() {
123
- this.mediaQueryList?.removeEventListener(
124
- "change",
125
- this.handleMediaQueryChange
126
- );
127
- }
128
35
  }