@salesforcedevs/dx-components 0.0.0-alpha.8 → 0.0.0-alpha.9
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
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<button
|
|
3
3
|
class={className}
|
|
4
|
-
onclick={
|
|
4
|
+
onclick={handleMouseEvent}
|
|
5
5
|
onmouseenter={handleMouseEvent}
|
|
6
6
|
onmouseleave={handleMouseEvent}
|
|
7
7
|
onfocus={handleMouseEvent}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
disabled={disabled}
|
|
10
10
|
>
|
|
11
11
|
<div class="label-container">
|
|
12
|
-
<
|
|
12
|
+
<span>{label}</span>
|
|
13
13
|
<dx-icon sprite="utility" symbol={symbol} size="small"></dx-icon>
|
|
14
14
|
</div>
|
|
15
15
|
</button>
|
|
@@ -3,12 +3,14 @@ import cx from "classnames";
|
|
|
3
3
|
import { normalizeBoolean } from "dxUtils/normalizers";
|
|
4
4
|
|
|
5
5
|
export default class ButtonToggle extends LightningElement {
|
|
6
|
+
@api label!: string;
|
|
7
|
+
|
|
6
8
|
@api
|
|
7
|
-
get
|
|
8
|
-
return this.
|
|
9
|
+
get value() {
|
|
10
|
+
return this._value;
|
|
9
11
|
}
|
|
10
|
-
set
|
|
11
|
-
this.
|
|
12
|
+
set value(value: boolean) {
|
|
13
|
+
this._value = normalizeBoolean(value);
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
@api
|
|
@@ -19,34 +21,41 @@ export default class ButtonToggle extends LightningElement {
|
|
|
19
21
|
this._disabled = normalizeBoolean(value);
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
private
|
|
24
|
+
private _value: boolean = false;
|
|
23
25
|
private _disabled: boolean = false;
|
|
24
26
|
private mouseHovering: boolean = false;
|
|
25
27
|
private hasFocus: boolean = false;
|
|
26
28
|
|
|
27
29
|
private get className(): string {
|
|
28
|
-
return cx(this.
|
|
30
|
+
return cx(this.value && "pressed");
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
private get symbol() {
|
|
32
34
|
if (
|
|
33
|
-
(this.
|
|
34
|
-
(this.
|
|
35
|
+
(this.value && this.mouseHovering && !this.hasFocus) ||
|
|
36
|
+
(this.value && this.hasFocus)
|
|
35
37
|
) {
|
|
36
38
|
return "close";
|
|
37
|
-
} else if (this.
|
|
39
|
+
} else if (this.value) {
|
|
38
40
|
return "check";
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
return "add";
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
private handleClick() {
|
|
45
|
-
this._pressed = !this._pressed;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
46
|
private handleMouseEvent(e: MouseEvent) {
|
|
49
47
|
switch (e.type) {
|
|
48
|
+
case "click":
|
|
49
|
+
this._value = !this._value;
|
|
50
|
+
this.dispatchEvent(
|
|
51
|
+
new CustomEvent("toggle", {
|
|
52
|
+
detail: {
|
|
53
|
+
label: this.label,
|
|
54
|
+
value: this.value
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
break;
|
|
50
59
|
case "mouseenter":
|
|
51
60
|
this.mouseHovering = true;
|
|
52
61
|
break;
|
|
@@ -15,6 +15,7 @@ export default class CardTrial extends LightningElement {
|
|
|
15
15
|
@api buttonTwoHref?: string;
|
|
16
16
|
@api buttonTwoIcon?: string;
|
|
17
17
|
@api buttonTwoIconSize?: string = "large";
|
|
18
|
+
@api hideCardDetails?: boolean = false;
|
|
18
19
|
@api href!: string;
|
|
19
20
|
@api imgSrc?: string;
|
|
20
21
|
@api label!: string;
|
|
@@ -50,7 +51,7 @@ export default class CardTrial extends LightningElement {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
get hasDetails() {
|
|
53
|
-
return this.details?.length > 0;
|
|
54
|
+
return this.details?.length > 0 && !this.hideCardDetails;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
get hasOneButton() {
|