@salesforcedevs/dx-components 1.8.0-node-20-alpha → 1.8.1-canary.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,10 +1,10 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.8.0-node-20-alpha",
3
+ "version": "1.8.1-canary.0",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
7
- "node": "20.x"
7
+ "node": "18.x"
8
8
  },
9
9
  "publishConfig": {
10
10
  "access": "public"
@@ -44,6 +44,6 @@
44
44
  "luxon": "3.4.4"
45
45
  },
46
46
  "volta": {
47
- "node": "20.19.0"
47
+ "node": "18.18.0"
48
48
  }
49
49
  }
@@ -1,23 +1,22 @@
1
1
  <template>
2
2
  <div class={className}>
3
3
  <a
4
- if:true={hasImage}
4
+ lwc:if={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="image-link dx-card-base_borderless-image_link"
11
+ class={imgAnchorClassName}
12
12
  aria-label={imgLinkAriaLabel}
13
13
  style={backgroundStyle}
14
14
  >
15
15
  <slot name="image-badge"></slot>
16
-
17
16
  <img
18
- if:true={imgSrc}
17
+ lwc:if={imgSrc}
19
18
  alt={imgAlt}
20
- class="image dx-card-base_image dx-card-base_borderless-image"
19
+ class={imgClassName}
21
20
  src={imgSrc}
22
21
  loading="lazy"
23
22
  />
@@ -25,7 +24,7 @@
25
24
  <div
26
25
  class="dx-card-base_section-vertical dx-card-base_column card_section-text"
27
26
  >
28
- <span if:true={label} part="label" class="label dx-text-label-3">
27
+ <span lwc:if={label} part="label" class="label dx-text-label-3">
29
28
  {label}
30
29
  </span>
31
30
  <dx-card-title
@@ -38,12 +37,12 @@
38
37
  ></dx-card-title>
39
38
  <span
40
39
  class="subtitle dx-text-label-1-dark"
41
- if:true={subtitle}
40
+ lwc:if={subtitle}
42
41
  part="subtitle"
43
42
  >
44
43
  {subtitle}
45
44
  </span>
46
- <div class="authors" if:true={authors}>
45
+ <div class="authors" lwc:if={authors}>
47
46
  <template for:each={authors} for:item="author">
48
47
  <dx-image-and-label
49
48
  key={author.key}
@@ -53,9 +52,12 @@
53
52
  ></dx-image-and-label>
54
53
  </template>
55
54
  </div>
56
- <span if:true={body} class="body dx-text-body-2" part="body">
55
+ <span lwc:if={body} class="body dx-text-body-2" part="body">
57
56
  {body}
58
57
  </span>
58
+ <span lwc:else class="body dx-text-body-2" part="body">
59
+ <slot name="body"></slot>
60
+ </span>
59
61
  <span class="datetime dx-text-body-3" part="datetime">
60
62
  <slot
61
63
  name="datetime"
@@ -3,7 +3,7 @@ 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 { toJson } from "dxUtils/normalizers";
6
+ import { normalizeBoolean, toJson } from "dxUtils/normalizers";
7
7
  import ImageAndLabel from "dx/imageAndLabel";
8
8
 
9
9
  export default class CardContent extends LightningElement {
@@ -36,7 +36,6 @@ export default class CardContent extends LightningElement {
36
36
  }
37
37
  return undefined;
38
38
  }
39
-
40
39
  set authors(value: any) {
41
40
  if (value !== "undefined") {
42
41
  this._authors = (toJson(value) as Array<any>)?.filter(
@@ -46,6 +45,15 @@ export default class CardContent extends LightningElement {
46
45
  }
47
46
  private _authors?: Array<ImageAndLabel>;
48
47
 
48
+ @api
49
+ get borderless() {
50
+ return this._borderless;
51
+ }
52
+ set borderless(value: string | boolean) {
53
+ this._borderless = normalizeBoolean(value);
54
+ }
55
+ private _borderless = true;
56
+
49
57
  private isDatetimeEmpty: boolean = true;
50
58
  private isLinkHovered: boolean = false;
51
59
 
@@ -55,16 +63,12 @@ export default class CardContent extends LightningElement {
55
63
  : "";
56
64
  }
57
65
 
58
- private get imgLinkAriaLabel() {
59
- return `Read More About ${this.header}`;
60
- }
61
-
62
66
  private get className(): string {
63
67
  return cx(
64
68
  "card-content",
65
69
  "dx-card-base",
66
- "dx-card-base_borderless",
67
70
  `dx-card-base_layout-${this.layout}`,
71
+ this.borderless && "dx-card-base_borderless",
68
72
  this.featured && "dx-card-base_featured",
69
73
  this.isDatetimeEmpty && "hide-datetime",
70
74
  this.isLinkHovered && "dx-card-base_link-hovered",
@@ -72,6 +76,25 @@ export default class CardContent extends LightningElement {
72
76
  );
73
77
  }
74
78
 
79
+ private get imgAnchorClassName(): string {
80
+ return cx(
81
+ "image-link",
82
+ this.borderless && "dx-card-base_borderless-image_link"
83
+ );
84
+ }
85
+
86
+ private get imgClassName(): string {
87
+ return cx(
88
+ "image",
89
+ "dx-card-base_image",
90
+ this.borderless && "dx-card-base_borderless-image"
91
+ );
92
+ }
93
+
94
+ private get imgLinkAriaLabel() {
95
+ return `Read More About ${this.header}`;
96
+ }
97
+
75
98
  private get hasImage() {
76
99
  return this.imgSrc || this.backgroundColor;
77
100
  }