@1024pix/pix-ui 20.1.0 → 20.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/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
<span
|
|
1
|
+
<span
|
|
2
|
+
class="pix-tooltip"
|
|
3
|
+
{{on-escape-action this.hideTooltip}}
|
|
4
|
+
{{on "mouseover" this.showTooltip}}
|
|
5
|
+
{{on "mouseout" this.hideTooltipOnMouseOut}}
|
|
6
|
+
{{on "focusin" this.showTooltip}}
|
|
7
|
+
{{on "focusout" this.hideTooltip}}
|
|
8
|
+
...attributes
|
|
9
|
+
>
|
|
2
10
|
{{#if (has-block "triggerElement")}}
|
|
3
11
|
{{yield to="triggerElement"}}
|
|
4
12
|
{{/if}}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
+
import { action } from '@ember/object';
|
|
2
3
|
|
|
3
4
|
export default class PixTooltip extends Component {
|
|
4
5
|
get position() {
|
|
@@ -18,4 +19,25 @@ export default class PixTooltip extends Component {
|
|
|
18
19
|
get display() {
|
|
19
20
|
return typeof this.args.hide === 'undefined' || !this.args.hide;
|
|
20
21
|
}
|
|
22
|
+
|
|
23
|
+
@action
|
|
24
|
+
showTooltip(event) {
|
|
25
|
+
event.target.classList.add('pix-tooltip--visible');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@action
|
|
29
|
+
hideTooltip(event) {
|
|
30
|
+
event.target.classList.remove('pix-tooltip--visible');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@action
|
|
34
|
+
hideTooltipOnMouseOut(event) {
|
|
35
|
+
const isFocused = document.activeElement === event.target;
|
|
36
|
+
|
|
37
|
+
if (isFocused) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
this.hideTooltip(event);
|
|
42
|
+
}
|
|
21
43
|
}
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
display: flex;
|
|
6
6
|
justify-content: center;
|
|
7
7
|
align-items: center;
|
|
8
|
+
}
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
.pix-tooltip--visible {
|
|
11
|
+
+ .pix-tooltip__content {
|
|
11
12
|
display: block;
|
|
12
13
|
opacity: 1;
|
|
13
14
|
}
|