@salesforcedevs/dx-components 1.8.1-canary.2 → 1.10.3-fix-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.8.1-canary.2",
3
+ "version": "1.10.3-fix-alpha",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -1,9 +1,16 @@
1
1
  :host {
2
- --dx-c-track-before-color: var(--dx-g-indigo-vibrant-30);
2
+ --dx-c-track-before-color: var(
3
+ --dx-g-audio-track-before-color,
4
+ var(--dx-g-indigo-vibrant-30)
5
+ );
3
6
  --dx-c-track-custom-dark-gray: rgba(62 62 62 / 100%);
4
7
  --dx-c-track-custom-medium-gray: rgba(195 195 195 / 100%);
5
8
  --dx-c-track-custom-light-gray: rgba(235 235 236 / 100%);
6
9
  --dx-c-track-thumb-size: 10px;
10
+ --dx-c-track-thumb-color: var(
11
+ --dx-g-audio-track-thumb-color,
12
+ var(--dx-g-indigo-vibrant-30)
13
+ );
7
14
  --dx-c-threedot-menu-item-padding: 14px;
8
15
  --dx-c-audio-player-padding: 6px 13px 13px;
9
16
  --dx-c-audio-background-color: var(--dx-g-audio-background-color, #e0e5f8);
@@ -97,7 +104,7 @@ dx-icon {
97
104
  .player-volume-slider::-webkit-slider-thumb,
98
105
  .player-seek-slider::-webkit-slider-thumb {
99
106
  appearance: none;
100
- background-color: var(--dx-g-indigo-vibrant-30);
107
+ background-color: var(--dx-c-track-thumb-color);
101
108
  border: none;
102
109
  border-radius: 50%;
103
110
  height: var(--dx-c-track-thumb-size);
@@ -108,7 +115,7 @@ dx-icon {
108
115
 
109
116
  .player-volume-slider::-moz-range-thumb,
110
117
  .player-seek-slider::-moz-range-thumb {
111
- background-color: var(--dx-g-indigo-vibrant-30);
118
+ background-color: var(--dx-c-track-thumb-color);
112
119
  border: none;
113
120
  border-radius: 50%;
114
121
  height: var(--dx-c-track-thumb-size);
@@ -20,7 +20,7 @@ type PlaybackSpeed = (typeof formattedPlaybackSpeeds)[number];
20
20
  const uiConfig = {
21
21
  seekSlider: {
22
22
  trackColors: {
23
- before: "var(--dx-g-indigo-vibrant-30)",
23
+ before: "var(--dx-c-track-before-color)",
24
24
  buffer: "var(--dx-c-track-custom-medium-gray)",
25
25
  after: "var(--dx-c-track-custom-light-gray)"
26
26
  } as TrackColors
@@ -15,7 +15,6 @@
15
15
  .card-content {
16
16
  display: flex;
17
17
  justify-content: flex-start;
18
- position: relative;
19
18
  }
20
19
 
21
20
  .card-content:not(.dx-card-base_layout-horizontal) {
@@ -33,12 +32,11 @@
33
32
  /* mobile responsiveness */
34
33
 
35
34
  @media screen and (max-width: 768px) {
36
- .card-content:not(.dx-card-base_featured, .dx-card-base_fix-orientation) {
35
+ .card-content:not(.dx-card-base_featured) {
37
36
  flex-direction: row;
38
37
  }
39
38
 
40
- .card-content:not(.dx-card-base_featured, .dx-card-base_fix-orientation)
41
- .image-link {
39
+ .card-content:not(.dx-card-base_featured) .image-link {
42
40
  margin-right: var(--dx-g-card-img-spacing);
43
41
  margin-bottom: unset;
44
42
  flex-shrink: 0;
@@ -47,18 +45,13 @@
47
45
  padding-top: unset;
48
46
  }
49
47
 
50
- .card-content.has-image:not(
51
- .dx-card-base_featured,
52
- .dx-card-base_fix-orientation
53
- )
48
+ .card-content.has-image:not(.dx-card-base_featured)
54
49
  dx-image-and-label::part(image) {
55
50
  display: none;
56
51
  }
57
52
 
58
- .card-content:not(.dx-card-base_featured, .dx-card-base_fix-orientation)
59
- .label,
60
- .card-content:not(.dx-card-base_featured, .dx-card-base_fix-orientation)
61
- .datetime {
53
+ .card-content:not(.dx-card-base_featured) .label,
54
+ .card-content:not(.dx-card-base_featured) .datetime {
62
55
  display: none;
63
56
  }
64
57
  }
@@ -1,22 +1,23 @@
1
1
  <template>
2
2
  <div class={className}>
3
3
  <a
4
- lwc:if={hasImage}
4
+ if:true={hasImage}
5
5
  href={href}
6
6
  onclick={handleClick}
7
7
  onmouseenter={setLinkHovered}
8
8
  onmouseleave={setLinkInactive}
9
9
  target={target}
10
10
  part="image"
11
- class={imgAnchorClassName}
11
+ class="image-link dx-card-base_borderless-image_link"
12
12
  aria-label={imgLinkAriaLabel}
13
13
  style={backgroundStyle}
14
14
  >
15
15
  <slot name="image-badge"></slot>
16
+
16
17
  <img
17
- lwc:if={imgSrc}
18
+ if:true={imgSrc}
18
19
  alt={imgAlt}
19
- class={imgClassName}
20
+ class="image dx-card-base_image dx-card-base_borderless-image"
20
21
  src={imgSrc}
21
22
  loading="lazy"
22
23
  />
@@ -24,12 +25,10 @@
24
25
  <div
25
26
  class="dx-card-base_section-vertical dx-card-base_column card_section-text"
26
27
  >
27
- <span lwc:if={label} part="label" class="label dx-text-label-3">
28
+ <span if:true={label} part="label" class="label dx-text-label-3">
28
29
  {label}
29
30
  </span>
30
-
31
31
  <dx-card-title
32
- lwc:if={header}
33
32
  href={href}
34
33
  target={target}
35
34
  onclick={handleClick}
@@ -37,19 +36,14 @@
37
36
  onmouseleave={setLinkInactive}
38
37
  header={header}
39
38
  ></dx-card-title>
40
- <div lwc:else>
41
- <slot name="title"></slot>
42
- </div>
43
-
44
39
  <span
45
40
  class="subtitle dx-text-label-1-dark"
46
- lwc:if={subtitle}
41
+ if:true={subtitle}
47
42
  part="subtitle"
48
43
  >
49
44
  {subtitle}
50
45
  </span>
51
-
52
- <div class="authors" lwc:if={authors}>
46
+ <div class="authors" if:true={authors}>
53
47
  <template for:each={authors} for:item="author">
54
48
  <dx-image-and-label
55
49
  key={author.key}
@@ -59,14 +53,9 @@
59
53
  ></dx-image-and-label>
60
54
  </template>
61
55
  </div>
62
-
63
- <span lwc:if={body} class="body dx-text-body-2" part="body">
56
+ <span if:true={body} class="body dx-text-body-2" part="body">
64
57
  {body}
65
58
  </span>
66
- <span lwc:else class="body dx-text-body-2" part="body">
67
- <slot name="body"></slot>
68
- </span>
69
-
70
59
  <span class="datetime dx-text-body-3" part="datetime">
71
60
  <slot
72
61
  name="datetime"
@@ -3,14 +3,13 @@ import cx from "classnames";
3
3
  import { LightningSlotElement } from "typings/custom";
4
4
  import { isSlotEmpty } from "dxUtils/slot";
5
5
  import { toDxColor } from "dxUtils/css";
6
- import { normalizeBoolean, toJson } from "dxUtils/normalizers";
6
+ import { toJson } from "dxUtils/normalizers";
7
7
  import ImageAndLabel from "dx/imageAndLabel";
8
8
 
9
9
  export default class CardContent extends LightningElement {
10
10
  @api backgroundColor?: string | null = null;
11
11
  @api body?: string | null = null;
12
12
  @api featured?: boolean = false;
13
- @api fixOrientation: boolean = false;
14
13
  @api href!: string;
15
14
  @api imgAlt?: string = "";
16
15
  @api imgSrc?: string | null = null;
@@ -21,7 +20,6 @@ export default class CardContent extends LightningElement {
21
20
  @api header!: string;
22
21
  @api hrefClick: any = null;
23
22
  @api contentType: string | null = null;
24
-
25
23
  @api
26
24
  get authors() {
27
25
  if (this._authors && this._authors.length) {
@@ -38,6 +36,7 @@ export default class CardContent extends LightningElement {
38
36
  }
39
37
  return undefined;
40
38
  }
39
+
41
40
  set authors(value: any) {
42
41
  if (value !== "undefined") {
43
42
  this._authors = (toJson(value) as Array<any>)?.filter(
@@ -47,24 +46,6 @@ export default class CardContent extends LightningElement {
47
46
  }
48
47
  private _authors?: Array<ImageAndLabel>;
49
48
 
50
- @api
51
- get borderless() {
52
- return this._borderless;
53
- }
54
- set borderless(value: string | boolean) {
55
- this._borderless = normalizeBoolean(value);
56
- }
57
- private _borderless = true;
58
-
59
- @api
60
- get imgLinkAriaLabel() {
61
- return this._imgLinkAriaLabel;
62
- }
63
- set imgLinkAriaLabel(value: string) {
64
- this._imgLinkAriaLabel = value;
65
- }
66
- private _imgLinkAriaLabel = `Read More About ${this.header}`;
67
-
68
49
  private isDatetimeEmpty: boolean = true;
69
50
  private isLinkHovered: boolean = false;
70
51
 
@@ -74,35 +55,23 @@ export default class CardContent extends LightningElement {
74
55
  : "";
75
56
  }
76
57
 
58
+ private get imgLinkAriaLabel() {
59
+ return `Read More About ${this.header}`;
60
+ }
61
+
77
62
  private get className(): string {
78
63
  return cx(
79
64
  "card-content",
80
65
  "dx-card-base",
66
+ "dx-card-base_borderless",
81
67
  `dx-card-base_layout-${this.layout}`,
82
- this.borderless && "dx-card-base_borderless",
83
68
  this.featured && "dx-card-base_featured",
84
- this.fixOrientation && "dx-card-base_fix-orientation",
85
69
  this.isDatetimeEmpty && "hide-datetime",
86
70
  this.isLinkHovered && "dx-card-base_link-hovered",
87
71
  this.hasImage && "has-image"
88
72
  );
89
73
  }
90
74
 
91
- private get imgAnchorClassName(): string {
92
- return cx(
93
- "image-link",
94
- this.borderless && "dx-card-base_borderless-image_link"
95
- );
96
- }
97
-
98
- private get imgClassName(): string {
99
- return cx(
100
- "image",
101
- "dx-card-base_image",
102
- this.borderless && "dx-card-base_borderless-image"
103
- );
104
- }
105
-
106
75
  private get hasImage() {
107
76
  return this.imgSrc || this.backgroundColor;
108
77
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <dx-tab-panel-list tabs={tabs}>
2
+ <dx-tab-panel-list tabs={tabs} initial-index={defaultActiveTabIndex}>
3
3
  <template for:each={_codeBlocks} for:item="codeBlockItem">
4
4
  <dx-tab-panel key={codeBlockItem.header}>
5
5
  <!-- The header attribute is not passed intentionally because the tab title uses the header value. -->
@@ -41,4 +41,16 @@ export default class TabbedCodeBlock extends LightningElement {
41
41
  get codeBlocks(): CodeBlockItem[] {
42
42
  return this._codeBlocks;
43
43
  }
44
+
45
+ // Logic to select html tab by default
46
+ get defaultActiveTabIndex() {
47
+ return JSON.stringify(
48
+ Math.max(
49
+ this.codeBlocks.findIndex((codeBlock) =>
50
+ codeBlock.header?.endsWith("html")
51
+ ),
52
+ 0
53
+ )
54
+ );
55
+ }
44
56
  }