@nectary/components 5.1.4 → 5.2.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/bundle.js +11 -3
- package/package.json +1 -1
- package/radio/index.js +11 -4
package/bundle.js
CHANGED
|
@@ -8092,6 +8092,10 @@ class Radio extends NectaryElement {
|
|
|
8092
8092
|
}
|
|
8093
8093
|
}
|
|
8094
8094
|
#onOptionKeyDown = (e) => {
|
|
8095
|
+
const option = e.target?.closest("sinch-radio-option") ?? null;
|
|
8096
|
+
if (option === null) {
|
|
8097
|
+
return;
|
|
8098
|
+
}
|
|
8095
8099
|
switch (e.code) {
|
|
8096
8100
|
case "ArrowUp":
|
|
8097
8101
|
case "ArrowLeft": {
|
|
@@ -8119,11 +8123,15 @@ class Radio extends NectaryElement {
|
|
|
8119
8123
|
this.#onValueChange(this.value);
|
|
8120
8124
|
};
|
|
8121
8125
|
#onOptionClick = (e) => {
|
|
8122
|
-
const target =
|
|
8123
|
-
if (target === null
|
|
8126
|
+
const target = e.target;
|
|
8127
|
+
if (target === null) {
|
|
8128
|
+
return;
|
|
8129
|
+
}
|
|
8130
|
+
const option = target.closest("sinch-radio-option");
|
|
8131
|
+
if (option === null || option.hasAttribute("disabled")) {
|
|
8124
8132
|
return;
|
|
8125
8133
|
}
|
|
8126
|
-
const value = getAttribute(
|
|
8134
|
+
const value = getAttribute(option, "value");
|
|
8127
8135
|
this.dispatchEvent(
|
|
8128
8136
|
new CustomEvent("-change", { detail: value })
|
|
8129
8137
|
);
|
package/package.json
CHANGED
package/radio/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getBooleanAttribute, updateAttribute, getAttribute, updateBooleanAttribute, isAttrTrue } from "../utils/dom.js";
|
|
2
2
|
import { defineCustomElement, NectaryElement } from "../utils/element.js";
|
|
3
3
|
import { getReactEventHandler } from "../utils/get-react-event-handler.js";
|
|
4
|
-
import { getTargetByAttribute } from "../utils/event-target.js";
|
|
5
4
|
import { setFormValue } from "../utils/form.js";
|
|
6
5
|
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:var(--sinch-comp-radio-direction,column);gap:var(--sinch-comp-radio-gap,8px);box-sizing:border-box;width:100%}</style><div id="wrapper"><slot></slot></div>';
|
|
7
6
|
const template = document.createElement("template");
|
|
@@ -85,6 +84,10 @@ class Radio extends NectaryElement {
|
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
#onOptionKeyDown = (e) => {
|
|
87
|
+
const option = e.target?.closest("sinch-radio-option") ?? null;
|
|
88
|
+
if (option === null) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
88
91
|
switch (e.code) {
|
|
89
92
|
case "ArrowUp":
|
|
90
93
|
case "ArrowLeft": {
|
|
@@ -112,11 +115,15 @@ class Radio extends NectaryElement {
|
|
|
112
115
|
this.#onValueChange(this.value);
|
|
113
116
|
};
|
|
114
117
|
#onOptionClick = (e) => {
|
|
115
|
-
const target =
|
|
116
|
-
if (target === null
|
|
118
|
+
const target = e.target;
|
|
119
|
+
if (target === null) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const option = target.closest("sinch-radio-option");
|
|
123
|
+
if (option === null || option.hasAttribute("disabled")) {
|
|
117
124
|
return;
|
|
118
125
|
}
|
|
119
|
-
const value = getAttribute(
|
|
126
|
+
const value = getAttribute(option, "value");
|
|
120
127
|
this.dispatchEvent(
|
|
121
128
|
new CustomEvent("-change", { detail: value })
|
|
122
129
|
);
|