Skip to content

Commit 6a07904

Browse files
committed
Tweaks to tooltips
1 parent 8b6ee66 commit 6a07904

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/pg/avatar/__examples__/basic/basic.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ export default class XPgAvatarBasic extends HTMLElement {
3333
handleTooltip(e) {
3434
const { visible, rect, text, position } = e.detail;
3535
this.$tooltip.visible = visible;
36-
this.$tooltip.rect = rect;
37-
this.$tooltip.text = text;
38-
this.$tooltip.position = position;
36+
if (visible) {
37+
this.$tooltip.rect = rect;
38+
this.$tooltip.text = text;
39+
this.$tooltip.position = position;
40+
}
3941
e.stopPropagation();
4042
}
4143
}

src/pg/tabs/tabs.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export default class PgTabs extends HTMLElement {
3434
connect: ($tab, tab, $tabs) => {
3535
$tab.addEventListener('select', (e: any) => {
3636
const { index } = e.detail;
37-
console.log(index, this.#tabs[e.detail.index]);
3837
const elements = this.$slot.assignedElements() as PgTab[];
3938
elements[this.#selectedTab].hide();
4039
$tabs[this.#selectedTab].selected = false;
@@ -74,7 +73,7 @@ export default class PgTabs extends HTMLElement {
7473
e.stopPropagation();
7574
}
7675

77-
handleSlotChange(e) {
76+
handleSlotChange(e: Event) {
7877
const tabs = Array.from(this.$tabset.children) as PgPartialTab[];
7978
const elements = this.$slot.assignedElements() as PgTab[];
8079
if (elements.length !== 0) {

src/pg/tooltip/addTooltip.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { BOTTOM } from "./position";
2+
13
export function addTooltip($part, render, position?) {
24
function handleMouseEnter() {
35
$part.dispatchEvent(
@@ -6,7 +8,7 @@ export function addTooltip($part, render, position?) {
68
visible: true,
79
rect: $part.getBoundingClientRect(),
810
text: render(),
9-
position: position
11+
position: position ?? BOTTOM
1012
},
1113
bubbles: true,
1214
composed: true

0 commit comments

Comments
 (0)