@nectary/components 5.48.0 → 5.48.1
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/action-menu-option/index.js +9 -0
- package/bundle.js +9 -0
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ class ActionMenuOption extends NectaryElement {
|
|
|
18
18
|
this.#controller = new AbortController();
|
|
19
19
|
const { signal } = this.#controller;
|
|
20
20
|
this.setAttribute("role", "option");
|
|
21
|
+
this.addEventListener("pointerenter", this.#updateTitle, { signal });
|
|
21
22
|
this.addEventListener("mousedown", this.#onMouseDown, { signal });
|
|
22
23
|
this.addEventListener("-click", this.#onClickReactHandler, { signal });
|
|
23
24
|
}
|
|
@@ -35,6 +36,7 @@ class ActionMenuOption extends NectaryElement {
|
|
|
35
36
|
switch (name) {
|
|
36
37
|
case "text": {
|
|
37
38
|
this.#$content.textContent = newVal;
|
|
39
|
+
this.#updateTitle();
|
|
38
40
|
break;
|
|
39
41
|
}
|
|
40
42
|
case "disabled": {
|
|
@@ -91,6 +93,13 @@ class ActionMenuOption extends NectaryElement {
|
|
|
91
93
|
#onClickReactHandler = (e) => {
|
|
92
94
|
getReactEventHandler(this, "on-click")?.(e);
|
|
93
95
|
};
|
|
96
|
+
#updateTitle = () => {
|
|
97
|
+
requestAnimationFrame(() => {
|
|
98
|
+
const text = this.text;
|
|
99
|
+
const hasOverflow = text.length > 0 && this.#$content.offsetWidth < this.#$content.scrollWidth;
|
|
100
|
+
updateAttribute(this, "title", hasOverflow ? text : null);
|
|
101
|
+
});
|
|
102
|
+
};
|
|
94
103
|
}
|
|
95
104
|
defineCustomElement("sinch-action-menu-option", ActionMenuOption);
|
|
96
105
|
export {
|
package/bundle.js
CHANGED
|
@@ -748,6 +748,7 @@ class ActionMenuOption extends NectaryElement {
|
|
|
748
748
|
this.#controller = new AbortController();
|
|
749
749
|
const { signal } = this.#controller;
|
|
750
750
|
this.setAttribute("role", "option");
|
|
751
|
+
this.addEventListener("pointerenter", this.#updateTitle, { signal });
|
|
751
752
|
this.addEventListener("mousedown", this.#onMouseDown, { signal });
|
|
752
753
|
this.addEventListener("-click", this.#onClickReactHandler, { signal });
|
|
753
754
|
}
|
|
@@ -765,6 +766,7 @@ class ActionMenuOption extends NectaryElement {
|
|
|
765
766
|
switch (name) {
|
|
766
767
|
case "text": {
|
|
767
768
|
this.#$content.textContent = newVal;
|
|
769
|
+
this.#updateTitle();
|
|
768
770
|
break;
|
|
769
771
|
}
|
|
770
772
|
case "disabled": {
|
|
@@ -821,6 +823,13 @@ class ActionMenuOption extends NectaryElement {
|
|
|
821
823
|
#onClickReactHandler = (e) => {
|
|
822
824
|
getReactEventHandler(this, "on-click")?.(e);
|
|
823
825
|
};
|
|
826
|
+
#updateTitle = () => {
|
|
827
|
+
requestAnimationFrame(() => {
|
|
828
|
+
const text = this.text;
|
|
829
|
+
const hasOverflow = text.length > 0 && this.#$content.offsetWidth < this.#$content.scrollWidth;
|
|
830
|
+
updateAttribute(this, "title", hasOverflow ? text : null);
|
|
831
|
+
});
|
|
832
|
+
};
|
|
824
833
|
}
|
|
825
834
|
defineCustomElement("sinch-action-menu-option", ActionMenuOption);
|
|
826
835
|
const isSinchActionMenuOption = (el) => {
|