@brightspace-ui/core 3.287.4 → 3.287.5
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.
|
@@ -39,16 +39,16 @@ class ButtonToggle extends LitElement {
|
|
|
39
39
|
|
|
40
40
|
firstUpdated(changedProperties) {
|
|
41
41
|
super.firstUpdated(changedProperties);
|
|
42
|
-
if (this
|
|
43
|
-
this
|
|
42
|
+
if (this.#focusOnFirstRender) {
|
|
43
|
+
this.#focusOnFirstRender = false;
|
|
44
44
|
this.focus();
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
render() {
|
|
49
49
|
return html`
|
|
50
|
-
<slot @click="${this
|
|
51
|
-
<slot @click="${this
|
|
50
|
+
<slot @click="${this.#handleNotPressedClick}" name="not-pressed"></slot>
|
|
51
|
+
<slot @click="${this.#handlePressedClick}" name="pressed"></slot>
|
|
52
52
|
`;
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -63,7 +63,7 @@ class ButtonToggle extends LitElement {
|
|
|
63
63
|
|
|
64
64
|
focus() {
|
|
65
65
|
if (!this.hasUpdated) {
|
|
66
|
-
this
|
|
66
|
+
this.#focusOnFirstRender = true;
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -75,28 +75,30 @@ class ButtonToggle extends LitElement {
|
|
|
75
75
|
elem.focus();
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
#focusOnFirstRender = false;
|
|
79
|
+
|
|
80
|
+
async #handleClick(pressed) {
|
|
79
81
|
const beforeToggleEvent = new CustomEvent('d2l-button-toggle-before-change', {
|
|
80
82
|
detail: {
|
|
81
|
-
update: (newPressed) => this
|
|
83
|
+
update: (newPressed) => this.#updatePressedState(newPressed)
|
|
82
84
|
},
|
|
83
85
|
cancelable: true
|
|
84
86
|
});
|
|
85
87
|
this.dispatchEvent(beforeToggleEvent);
|
|
86
88
|
if (beforeToggleEvent.defaultPrevented) return;
|
|
87
89
|
|
|
88
|
-
this
|
|
90
|
+
this.#updatePressedState(pressed);
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
|
|
92
|
-
this
|
|
93
|
+
#handleNotPressedClick() {
|
|
94
|
+
this.#handleClick(true);
|
|
93
95
|
}
|
|
94
96
|
|
|
95
|
-
|
|
96
|
-
this
|
|
97
|
+
#handlePressedClick() {
|
|
98
|
+
this.#handleClick(false);
|
|
97
99
|
}
|
|
98
100
|
|
|
99
|
-
async
|
|
101
|
+
async #updatePressedState(newPressed) {
|
|
100
102
|
this.pressed = newPressed;
|
|
101
103
|
await this.updateComplete;
|
|
102
104
|
this.focus();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "3.287.
|
|
3
|
+
"version": "3.287.5",
|
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|