@salesforcedevs/dx-components 1.3.229 → 1.3.230-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/lwc.config.json +2 -0
- package/package.json +2 -3
- package/src/modules/dx/buttonThemeable/buttonThemeable.css +138 -0
- package/src/modules/dx/buttonThemeable/buttonThemeable.html +43 -0
- package/src/modules/dx/buttonThemeable/buttonThemeable.ts +82 -0
- package/src/modules/dx/cardNewsThemeable/cardNewsThemeable.css +203 -0
- package/src/modules/dx/cardNewsThemeable/cardNewsThemeable.html +42 -0
- package/src/modules/dx/cardNewsThemeable/cardNewsThemeable.ts +76 -0
- package/LICENSE +0 -12
package/lwc.config.json
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"dx/brandThemeProvider",
|
|
12
12
|
"dx/breadcrumbs",
|
|
13
13
|
"dx/button",
|
|
14
|
+
"dx/buttonThemeable",
|
|
14
15
|
"dx/buttonToggle",
|
|
15
16
|
"dx/cardBlogPost",
|
|
16
17
|
"dx/cardCallout",
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
"dx/cardGridDocs",
|
|
23
24
|
"dx/cardMinimal",
|
|
24
25
|
"dx/cardNews",
|
|
26
|
+
"dx/cardNewsThemeable",
|
|
25
27
|
"dx/cardPodcastEpisode",
|
|
26
28
|
"dx/cardSmall",
|
|
27
29
|
"dx/cardStep",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.230-canary.0",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -43,6 +43,5 @@
|
|
|
43
43
|
},
|
|
44
44
|
"volta": {
|
|
45
45
|
"node": "16.19.1"
|
|
46
|
-
}
|
|
47
|
-
"gitHead": "6d80d3e77458aacf814b097317f4a10ba22a1efe"
|
|
46
|
+
}
|
|
48
47
|
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
width: min-content;
|
|
5
|
+
font-size: inherit;
|
|
6
|
+
|
|
7
|
+
--dx-c-button-justify-content: center;
|
|
8
|
+
--dx-c-button-opacity: 1;
|
|
9
|
+
--dx-c-button-font-size: var(--dx-g-text-sm);
|
|
10
|
+
--dx-c-button-font-weight: var(--dx-g-font-normal);
|
|
11
|
+
--dx-c-button-display: flex;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.button {
|
|
15
|
+
background-color: var(--dx-button-themeable-background-color);
|
|
16
|
+
border: 1px solid var(--dx-button-themeable-border-color);
|
|
17
|
+
color: var(--dx-button-themeable-text-color);
|
|
18
|
+
opacity: var(--dx-c-button-opacity);
|
|
19
|
+
width: inherit;
|
|
20
|
+
display: var(--dx-c-button-display);
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: var(--dx-c-button-justify-content);
|
|
23
|
+
user-select: none;
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
font-size: var(--dx-c-button-font-size);
|
|
26
|
+
transition: var(--dx-g-transition-hue-1x);
|
|
27
|
+
padding: var(--dx-c-button-vertical-spacing, 0)
|
|
28
|
+
var(--dx-c-button-horizontal-spacing, var(--dx-g-spacing-md));
|
|
29
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
30
|
+
font-weight: var(--dx-c-button-font-weight);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.button:focus {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.button:focus:not(:focus-visible) {
|
|
38
|
+
outline: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.button:hover,
|
|
42
|
+
:host([aria-expanded="true"]) .button {
|
|
43
|
+
background-color: var(--dx-button-themeable-background-hover-color);
|
|
44
|
+
border-color: var(--dx-button-themeable-border-hover-color);
|
|
45
|
+
color: var(--dx-button-themeable-text-hover-color);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.button.variant_inline-inherit {
|
|
49
|
+
font-size: inherit;
|
|
50
|
+
text-transform: inherit;
|
|
51
|
+
user-select: inherit;
|
|
52
|
+
white-space: normal;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.button dx-icon {
|
|
56
|
+
display: inline;
|
|
57
|
+
vertical-align: var(--dx-c-button-icon-vertical-align, unset);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.button.variant_inline dx-icon,
|
|
61
|
+
.button.variant_inline-inherit dx-icon {
|
|
62
|
+
display: inline-block;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.button > span {
|
|
66
|
+
font-family: inherit;
|
|
67
|
+
font-size: inherit;
|
|
68
|
+
font-weight: inherit;
|
|
69
|
+
vertical-align: var(--dx-c-button-span-vertical-align, unset);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.button:not(.variant_inline-inherit).font-display {
|
|
73
|
+
font-family: var(--dx-g-font-display);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.button.font-sans {
|
|
77
|
+
font-family: var(--dx-g-font-sans);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.button.icon-right:not(.slot-empty) > *:nth-child(2) {
|
|
81
|
+
margin-left: var(--dx-g-spacing-sm);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.button.icon-left:not(.slot-empty) > *:nth-child(2) {
|
|
85
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.button.style-icon.slot-empty {
|
|
89
|
+
padding: 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.icon-right {
|
|
93
|
+
flex-direction: row;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.icon-left {
|
|
97
|
+
flex-direction: row-reverse;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* sizes */
|
|
101
|
+
|
|
102
|
+
.button.size-large {
|
|
103
|
+
height: var(--dx-g-spacing-3xl);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.button.size-large.style-icon.slot-empty {
|
|
107
|
+
width: var(--dx-c-slot-empty-width, var(--dx-g-spacing-3xl));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.button.size-small {
|
|
111
|
+
height: var(--dx-g-spacing-xl);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.button.size-small.style-icon.slot-empty {
|
|
115
|
+
width: var(--dx-c-slot-empty-width, var(--dx-g-spacing-xl));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.button.size-hero {
|
|
119
|
+
font-size: var(--dx-g-text-lg);
|
|
120
|
+
height: 52px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.button.size-hero.style-icon.slot-empty {
|
|
124
|
+
width: var(--dx-c-slot-empty-width, 52px);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* inline */
|
|
128
|
+
.button.variant_inline,
|
|
129
|
+
.button.variant_inline-inherit {
|
|
130
|
+
display: inline;
|
|
131
|
+
padding: 0;
|
|
132
|
+
height: unset; /* please leave this here, actually is having an effect */
|
|
133
|
+
width: unset; /* please leave this here, actually is having an effect */
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.button.state-disabled {
|
|
137
|
+
pointer-events: none;
|
|
138
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
if:false={href}
|
|
4
|
+
class={className}
|
|
5
|
+
disabled={disabled}
|
|
6
|
+
type={type}
|
|
7
|
+
aria-label={ariaLabel}
|
|
8
|
+
part="container"
|
|
9
|
+
>
|
|
10
|
+
<span if:false={loading}>
|
|
11
|
+
<slot onslotchange={onSlotChange}></slot>
|
|
12
|
+
</span>
|
|
13
|
+
<dx-icon
|
|
14
|
+
if:true={showIcon}
|
|
15
|
+
sprite={iconSprite}
|
|
16
|
+
size={iconSize}
|
|
17
|
+
symbol={iconSymbol}
|
|
18
|
+
></dx-icon>
|
|
19
|
+
<span class="temp-loading-message" if:true={loading}>Loading...</span>
|
|
20
|
+
</button>
|
|
21
|
+
<a
|
|
22
|
+
if:true={href}
|
|
23
|
+
href={href}
|
|
24
|
+
target={target}
|
|
25
|
+
rel={rel}
|
|
26
|
+
class={className}
|
|
27
|
+
disabled={disabled}
|
|
28
|
+
download={download}
|
|
29
|
+
aria-label={ariaLabel}
|
|
30
|
+
part="container"
|
|
31
|
+
>
|
|
32
|
+
<span if:false={loading}>
|
|
33
|
+
<slot onslotchange={onSlotChange}></slot>
|
|
34
|
+
</span>
|
|
35
|
+
<dx-icon
|
|
36
|
+
if:true={showIcon}
|
|
37
|
+
sprite={iconSprite}
|
|
38
|
+
size={iconSize}
|
|
39
|
+
symbol={iconSymbol}
|
|
40
|
+
></dx-icon>
|
|
41
|
+
<span class="temp-loading-message" if:true={loading}>Loading...</span>
|
|
42
|
+
</a>
|
|
43
|
+
</template>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import {
|
|
4
|
+
ButtonTarget,
|
|
5
|
+
ButtonVariant,
|
|
6
|
+
ButtonSize,
|
|
7
|
+
IconSprite,
|
|
8
|
+
IconSize,
|
|
9
|
+
IconSymbol,
|
|
10
|
+
LightningSlotElement
|
|
11
|
+
} from "typings/custom";
|
|
12
|
+
|
|
13
|
+
export default class ButtonThemeable extends LightningElement {
|
|
14
|
+
private _didSetFormAttribute = false;
|
|
15
|
+
@api ariaLabel: string = "";
|
|
16
|
+
@api disabled: boolean | null = null;
|
|
17
|
+
@api iconSize?: IconSize = "small";
|
|
18
|
+
@api iconSprite?: IconSprite = "utility";
|
|
19
|
+
@api iconSymbol?: IconSymbol;
|
|
20
|
+
@api iconPosition?: "right" | "left" = "right";
|
|
21
|
+
@api loading: boolean = false;
|
|
22
|
+
@api size: ButtonSize = "small";
|
|
23
|
+
@api variant: ButtonVariant = "primary";
|
|
24
|
+
@api font: "display" | "sans" = "display";
|
|
25
|
+
@api form: string | undefined;
|
|
26
|
+
@api name?: string;
|
|
27
|
+
@api value?: any;
|
|
28
|
+
|
|
29
|
+
// button props
|
|
30
|
+
@api type: "submit" | "reset" | "button" = "button";
|
|
31
|
+
|
|
32
|
+
// link props
|
|
33
|
+
@api href: string | null = null;
|
|
34
|
+
@api download: string | null = null;
|
|
35
|
+
@api target: ButtonTarget = null;
|
|
36
|
+
@api rel: string | null = null;
|
|
37
|
+
|
|
38
|
+
@api focus() {
|
|
39
|
+
const button = this.template.querySelector(".button");
|
|
40
|
+
if (button) {
|
|
41
|
+
button.focus();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private isSlotEmpty: boolean = true;
|
|
46
|
+
|
|
47
|
+
private get showIcon(): boolean {
|
|
48
|
+
return !!this.iconSymbol && !this.loading;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private get className(): string {
|
|
52
|
+
return cx(
|
|
53
|
+
"button",
|
|
54
|
+
this.disabled && "state-disabled",
|
|
55
|
+
`variant_${this.variant}`,
|
|
56
|
+
this.loading && "state-loading",
|
|
57
|
+
`size-${this.size}`,
|
|
58
|
+
!!this.iconSymbol && "style-icon",
|
|
59
|
+
this.isSlotEmpty && "slot-empty",
|
|
60
|
+
`font-${this.font}`,
|
|
61
|
+
this.iconPosition === "right" ? "icon-right" : "icon-left"
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
renderedCallback() {
|
|
66
|
+
if (
|
|
67
|
+
!this.href &&
|
|
68
|
+
typeof this.form !== "undefined" &&
|
|
69
|
+
!this._didSetFormAttribute
|
|
70
|
+
) {
|
|
71
|
+
this._didSetFormAttribute = true;
|
|
72
|
+
this.template
|
|
73
|
+
.querySelector("button")
|
|
74
|
+
?.setAttribute("form", this.form);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private onSlotChange(e: LightningSlotElement) {
|
|
79
|
+
const slot = e.target;
|
|
80
|
+
this.isSlotEmpty = slot.assignedElements().length !== 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
@import "dxHelpers/text";
|
|
3
|
+
@import "dxHelpers/card";
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
--dx-c-feature-img-padding-top: 0;
|
|
7
|
+
--dx-c-feature-img-padding-right: 0;
|
|
8
|
+
--dx-c-feature-img-padding-left: 0;
|
|
9
|
+
--dx-c-feature-img-padding-bottom: 0;
|
|
10
|
+
--dx-card-news-themeable-background-color: var(
|
|
11
|
+
--dx-g-background-color-tertiary,
|
|
12
|
+
var(--dx-g-indigo-vibrant-40)
|
|
13
|
+
);
|
|
14
|
+
--dx-card-news-themeable-text-color: var(
|
|
15
|
+
--dx-g-body-text-color-tertiary,
|
|
16
|
+
white
|
|
17
|
+
);
|
|
18
|
+
--dx-button-themeable-background-color: var(
|
|
19
|
+
--dx-g-button-background-color-tertiary,
|
|
20
|
+
transparent
|
|
21
|
+
);
|
|
22
|
+
--dx-button-themeable-text-color: var(
|
|
23
|
+
--dx-g-button-text-color-tertiary,
|
|
24
|
+
white
|
|
25
|
+
);
|
|
26
|
+
--dx-button-themeable-background-hover-color: var(
|
|
27
|
+
--dx-g-button-background-color-hover-tertiary,
|
|
28
|
+
var(--dx-button-themeable-background-color)
|
|
29
|
+
);
|
|
30
|
+
--dx-button-themeable-text-hover-color: var(
|
|
31
|
+
--dx-g-button-text-color-hover-tertiary,
|
|
32
|
+
var(--dx-button-themeable-text-color)
|
|
33
|
+
);
|
|
34
|
+
--dx-button-themeable-border-color: var(
|
|
35
|
+
--dx-g-button-border-color-tertiary,
|
|
36
|
+
var(--dx-button-themeable-background-color)
|
|
37
|
+
);
|
|
38
|
+
--dx-button-themeable-border-hover-color: var(
|
|
39
|
+
--dx-g-button-border-color-hover-tertiary,
|
|
40
|
+
var(--dx-button-themeable-background-hover-color)
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dx-card-base.dx-card-news {
|
|
45
|
+
background-color: var(--dx-card-news-themeable-background-color);
|
|
46
|
+
color: var(--dx-card-news-themeable-text-color);
|
|
47
|
+
position: relative;
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: stretch;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
justify-content: flex-start;
|
|
52
|
+
box-shadow: var(--dx-g-box-shadow-sm);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.text {
|
|
56
|
+
flex-grow: 1;
|
|
57
|
+
padding: var(--dx-g-card-padding) 24px 0 20px;
|
|
58
|
+
z-index: 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.dx-text-display-4 {
|
|
62
|
+
margin: 4px 0;
|
|
63
|
+
color: var(--dx-card-news-themeable-text-color, inherit);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
p {
|
|
67
|
+
font-size: 16px;
|
|
68
|
+
letter-spacing: 0.15px;
|
|
69
|
+
line-height: 24px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.cta {
|
|
73
|
+
margin: 16px 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
img {
|
|
77
|
+
display: none;
|
|
78
|
+
margin: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.dx-card-size-large .dx-text-display-4 {
|
|
82
|
+
font-size: 30px;
|
|
83
|
+
letter-spacing: 0.3px;
|
|
84
|
+
line-height: 40px;
|
|
85
|
+
margin: 4px 0 10px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.dx-card-size-large p {
|
|
89
|
+
letter-spacing: 0.2px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.dx-card-size-large .cta {
|
|
93
|
+
margin: var(--dx-g-spacing-lg) 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.dx-card-size-large img {
|
|
97
|
+
display: block;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@media screen and (min-width: 1024px) {
|
|
101
|
+
.text {
|
|
102
|
+
padding: var(--dx-g-spacing-lg);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.dx-card-news {
|
|
106
|
+
position: relative;
|
|
107
|
+
min-height: 380px;
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: stretch;
|
|
110
|
+
justify-content: flex-start;
|
|
111
|
+
box-shadow: var(--dx-g-box-shadow-sm);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.dx-text-display-4 {
|
|
115
|
+
letter-spacing: 0.1px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
img,
|
|
119
|
+
.text {
|
|
120
|
+
display: block;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.dx-card-news.dx-card-news-img-placement-top {
|
|
124
|
+
flex-direction: column-reverse;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.dx-card-news.dx-card-news-img-placement-bottom {
|
|
128
|
+
flex-direction: column;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.dx-card-news.dx-card-news-img-placement-right .text {
|
|
132
|
+
max-width: 50%;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.dx-card-news.dx-card-news-img-placement-right .text.large {
|
|
136
|
+
max-width: 75%;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Pushed to the right, centered vertically */
|
|
140
|
+
.dx-card-news.dx-card-news-img-placement-right img {
|
|
141
|
+
position: absolute;
|
|
142
|
+
width: 100%;
|
|
143
|
+
right: 0;
|
|
144
|
+
max-width: 50%;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.dx-card-size-normal .dx-text-display-4 {
|
|
148
|
+
font-size: var(--dx-g-text-xl);
|
|
149
|
+
line-height: 28px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.dx-card-size-normal p {
|
|
153
|
+
letter-spacing: 0.2px;
|
|
154
|
+
margin: 12px 0 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.dx-card-size-normal .cta {
|
|
158
|
+
margin: 14px 0 -2px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.dx-card-size-large .dx-text-display-4 {
|
|
162
|
+
font-size: var(--dx-g-text-2xl);
|
|
163
|
+
line-height: 40px;
|
|
164
|
+
letter-spacing: 0.6px;
|
|
165
|
+
margin: 10px 0 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.dx-card-size-large p {
|
|
169
|
+
font-size: 20px;
|
|
170
|
+
line-height: 32px;
|
|
171
|
+
margin: 10px 0 0;
|
|
172
|
+
letter-spacing: 0.72px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.dx-card-size-large .cta {
|
|
176
|
+
margin: 24px 0 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.dx-card-news-img-vertical-align-middle {
|
|
180
|
+
top: 50%;
|
|
181
|
+
transform: translate(0, -50%);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.dx-card-news-img-vertical-align-bottom {
|
|
185
|
+
bottom: 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.dx-card-news-img-vertical-align-top {
|
|
189
|
+
top: 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.dx-card-news-img-placement-right img.dx-card-news-img-small,
|
|
193
|
+
.dx-card-news-img-small {
|
|
194
|
+
max-width: 25%;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.dx-card-news-img-padding {
|
|
199
|
+
padding: var(--dx-c-feature-img-padding-top)
|
|
200
|
+
var(--dx-c-feature-img-padding-right)
|
|
201
|
+
var(--dx-c-feature-img-padding-bottom)
|
|
202
|
+
var(--dx-c-feature-img-padding-left);
|
|
203
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a
|
|
3
|
+
class={className}
|
|
4
|
+
href={href}
|
|
5
|
+
target={target}
|
|
6
|
+
onclick={trackClick}
|
|
7
|
+
part="container"
|
|
8
|
+
>
|
|
9
|
+
<div class={textContainerClassName}>
|
|
10
|
+
<h3 class="dx-text-display-4">
|
|
11
|
+
<dx-formatted-rich-text value={title}></dx-formatted-rich-text>
|
|
12
|
+
</h3>
|
|
13
|
+
<p>{body}</p>
|
|
14
|
+
<div class="cta" onclick={toggleTheme}>
|
|
15
|
+
<dx-button-themeable if:true={hasLargeButton} size="large">
|
|
16
|
+
{buttonText}
|
|
17
|
+
</dx-button-themeable>
|
|
18
|
+
|
|
19
|
+
<dx-button-themeable
|
|
20
|
+
class="inline-button"
|
|
21
|
+
if:false={hasLargeButton}
|
|
22
|
+
variant="inline"
|
|
23
|
+
icon-symbol="forward"
|
|
24
|
+
>
|
|
25
|
+
{buttonText}
|
|
26
|
+
</dx-button-themeable>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<img
|
|
31
|
+
if:true={imgSrc}
|
|
32
|
+
alt={imgAlt}
|
|
33
|
+
aria-label={imgAlt}
|
|
34
|
+
role="img"
|
|
35
|
+
src={imgSrc}
|
|
36
|
+
class={imgClassName}
|
|
37
|
+
style={imgStyle}
|
|
38
|
+
part="image"
|
|
39
|
+
loading="lazy"
|
|
40
|
+
/>
|
|
41
|
+
</a>
|
|
42
|
+
</template>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import {
|
|
4
|
+
CardNewsButtonType,
|
|
5
|
+
CardNewsImagePlacement,
|
|
6
|
+
CardNewsImageVerticalAlignment,
|
|
7
|
+
CardNewsSize,
|
|
8
|
+
CardNewsTextContainerSize
|
|
9
|
+
} from "typings/custom";
|
|
10
|
+
import { track } from "dxUtils/analytics";
|
|
11
|
+
|
|
12
|
+
export default class CardNewsThemeable extends LightningElement {
|
|
13
|
+
@api title!: string;
|
|
14
|
+
@api body!: string;
|
|
15
|
+
@api buttonText?: string = "";
|
|
16
|
+
@api buttonType!: CardNewsButtonType;
|
|
17
|
+
@api size?: CardNewsSize = "normal";
|
|
18
|
+
@api href!: string;
|
|
19
|
+
@api imgAlt?: string = "";
|
|
20
|
+
@api imgSrc?: string | null = null;
|
|
21
|
+
@api imgPlacement?: CardNewsImagePlacement = "top";
|
|
22
|
+
@api imgVerticalAlign?: CardNewsImageVerticalAlignment | null = null;
|
|
23
|
+
@api target?: string | null = null;
|
|
24
|
+
@api textContainerWidth?: CardNewsTextContainerSize = "small";
|
|
25
|
+
|
|
26
|
+
private get className(): string {
|
|
27
|
+
return cx(
|
|
28
|
+
"dx-card-news",
|
|
29
|
+
"dx-card-base",
|
|
30
|
+
`dx-card-size-${this.size}`,
|
|
31
|
+
this.imgSrc && `dx-card-news-img-placement-${this.imgPlacement}`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private get hasLargeButton(): boolean {
|
|
36
|
+
return this.buttonType === "large";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private get textContainerClassName(): string {
|
|
40
|
+
return cx("text", this.textContainerWidth);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private get imgClassName(): string {
|
|
44
|
+
return cx(
|
|
45
|
+
this.imgVerticalAlign &&
|
|
46
|
+
`dx-card-news-img-vertical-align-${this.imgVerticalAlign}`,
|
|
47
|
+
this.textContainerWidth === "large" && `dx-card-news-img-small`,
|
|
48
|
+
`dx-card-news-img-padding`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private trackClick(e: Event) {
|
|
53
|
+
const payload = {
|
|
54
|
+
click_text: this.buttonText,
|
|
55
|
+
click_url: this.href.includes("http")
|
|
56
|
+
? this.href
|
|
57
|
+
: `${window.location.origin}${this.href}`,
|
|
58
|
+
element_title: this.title,
|
|
59
|
+
element_type: "link",
|
|
60
|
+
content_category: "cta"
|
|
61
|
+
};
|
|
62
|
+
track(e.currentTarget!, "custEv_ctaLinkClick", payload);
|
|
63
|
+
track(e.currentTarget!, "custEv_linkClick", payload);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private toggleTheme(event: Event) {
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
event.stopPropagation();
|
|
69
|
+
const root = document.querySelector(":root");
|
|
70
|
+
if (root?.classList.contains("dark")) {
|
|
71
|
+
root.classList.remove("dark");
|
|
72
|
+
} else {
|
|
73
|
+
root?.classList.add("dark");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
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.
|