@avakhula/ui 0.0.207 → 0.0.208

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.
@@ -3,15 +3,14 @@ import Tooltip from "./TooltipController";
3
3
  const tooltip = new Tooltip();
4
4
  const createTooltip = (el, binding) => {
5
5
  if (!tooltip.getTooltipContainer()) {
6
- const position = Object.keys(binding.modifiers)[0] || binding.arg;
7
- tooltip.createTooltip(el, binding.value, position);
6
+ tooltip.createTooltip(el, binding.value);
8
7
  }
9
8
  };
10
9
 
11
10
  const destroyTooltip = (event, el) => {
12
11
  const uuid = tooltip.getId();
13
12
 
14
- if (el.getAttribute("describedby") !== uuid) {
13
+ if (el.getAttribute("aria-describedby") !== uuid) {
15
14
  return;
16
15
  }
17
16
 
@@ -27,29 +26,15 @@ const destroyTooltip = (event, el) => {
27
26
  }
28
27
  };
29
28
 
30
- const attachTooltipListeners = (el, binding) => {
31
- el.__tooltip_create = () => createTooltip(el, binding);
32
- el.__tooltip_destroy = (e) => destroyTooltip(e, el);
33
-
34
- el.addEventListener("mouseenter", el.__tooltip_create);
35
- document.addEventListener("mousemove", el.__tooltip_destroy);
36
- };
37
-
38
- const removeTooltipListeners = (el) => {
39
- tooltip.destroyTooltip();
40
- el.removeEventListener("mouseenter", el.__tooltip_create);
41
- document.removeEventListener("mousemove", el.__tooltip_destroy);
42
- };
43
-
44
29
  export const TooltipDirective = {
45
30
  mounted(el, binding) {
46
- attachTooltipListeners(el, binding);
47
- },
48
- updated(el, binding) {
49
- removeTooltipListeners(el);
50
- attachTooltipListeners(el, binding);
31
+ el.addEventListener("mouseenter", () => createTooltip(el, binding));
32
+ document.addEventListener("mousemove", (e) => destroyTooltip(e, el));
51
33
  },
52
- beforeUnmount(el) {
53
- removeTooltipListeners(el);
34
+
35
+ beforeUnmount(el, binding) {
36
+ tooltip.destroyTooltip();
37
+ el.removeEventListener("mouseenter", () => createTooltip(el, binding));
38
+ document.removeEventListener("mousemove", (e) => destroyTooltip(e, el));
54
39
  },
55
40
  };
@@ -1,6 +1,4 @@
1
1
  import IbButton from "../../components/Button/Button.vue";
2
- import IbIconButton from "../../components/IconButton/IconButton.vue";
3
-
4
2
  import { TooltipDirective } from "./tooltip";
5
3
  import readme from "./readme.mdx";
6
4
 
@@ -15,89 +13,18 @@ export default {
15
13
  };
16
14
 
17
15
  const Template = (args) => ({
18
- components: { IbButton, IbIconButton },
16
+ components: { IbButton },
19
17
  directives: { tooltip: TooltipDirective },
20
18
  setup() {
21
19
  return { args };
22
20
  },
23
- template: `
24
- <div style="display:flex;flex-wrap:wrap;">
25
-
26
- <div style="margin:20px">
27
- bottomLeft
28
- <ib-button v-tooltip.bottomLeft="'Tooltip Content Content Content Content'" v-bind="args">aaaabaaaa</ib-button>
29
- <ib-icon-button v-tooltip.bottomLeft="'Tooltip Content Content Content Content'"> <ion-icon style="font-size=20px" name="add"></ion-icon></ib-icon-button>
30
- </div>
31
- <div style="margin:20px">
32
- bottomCenter
33
- <ib-button v-tooltip.bottomCenter="'Tooltip Content Content Content Content'" v-bind="args">aaaabaaaa</ib-button>
34
- <ib-icon-button v-tooltip.bottomCenter="'Tooltip Content Content Content Content'"> <ion-icon style="font-size=20px" name="add"></ion-icon></ib-icon-button>
35
- </div>
36
- <div style="margin:20px">
37
- bottomRight
38
- <ib-button v-tooltip.bottomRight="'Tooltip Content Content Content Content'" v-bind="args">aaaabaaaa</ib-button>
39
- <ib-icon-button v-tooltip.bottomRight="'Tooltip Content Content Content Content'"> <ion-icon style="font-size=20px" name="add"></ion-icon></ib-icon-button>
40
- </div>
41
-
42
- <div style="margin:20px">
43
- topLeft
44
- <ib-button v-tooltip.topLeft="'Tooltip Content Content Content Content'" v-bind="args">aaaabaaaa</ib-button>
45
- <ib-icon-button v-tooltip.topLeft="'Tooltip Content Content Content Content'"> <ion-icon style="font-size=20px" name="add"></ion-icon></ib-icon-button>
46
- </div>
47
- <div style="margin:20px">
48
- <ib-button v-tooltip="'Tooltip Content Content Content Content'" v-bind="args">Hover to me(default)</ib-button>
49
- </div>
50
- <div style="margin:20px">
51
- topRight
52
- <ib-button v-tooltip.topRight="'Tooltip Content Content Content Content'" v-bind="args">aaaabaaaa</ib-button>
53
- <ib-icon-button v-tooltip.topRight="'Tooltip Content Content Content Content'"> <ion-icon style="font-size=20px" name="add"></ion-icon></ib-icon-button>
54
- </div>
55
-
56
- <div style="margin:20px">
57
- leftTop
58
- <ib-button v-tooltip.leftTop="'Tooltip Content Content Content Content'" v-bind="args">aaaabaaaa</ib-button>
59
- <ib-icon-button v-tooltip.leftTop="'Tooltip Content Content Content Content'"> <ion-icon style="font-size=20px" name="add"></ion-icon></ib-icon-button>
60
- </div>
61
- <div style="margin:20px">
62
- leftCenter
63
- <ib-button v-tooltip.leftCenter="'Tooltip Content Content Content Content'" v-bind="args">aaaabaaaa</ib-button>
64
- <ib-icon-button v-tooltip.leftCenter="'Tooltip Content Content Content Content'"> <ion-icon style="font-size=20px" name="add"></ion-icon></ib-icon-button>
65
- </div>
66
- <div style="margin:20px">
67
- leftBottom
68
- <ib-button v-tooltip.leftBottom="'Tooltip Content Content Content Content'" v-bind="args">aaaabaaaa</ib-button>
69
- <ib-icon-button v-tooltip.leftBottom="'Tooltip Content Content Content Content'"> <ion-icon style="font-size=20px" name="add"></ion-icon></ib-icon-button>
70
- <ib-button v-tooltip.leftBottom="'Tooltip Content Content Content Content'" v-bind="args">Hover to me(leftBottom)</ib-button>
71
- </div>
72
-
73
-
74
- <div style="margin:20px">
75
- rightTop
76
- <ib-button v-tooltip.rightTop="'Tooltip Content Content Content Content'" v-bind="args">aaaabaaaa</ib-button>
77
- <ib-icon-button v-tooltip.rightTop="'Tooltip Content Content Content Content'"> <ion-icon style="font-size=20px" name="add"></ion-icon></ib-icon-button>
78
- </div>
79
- <div style="margin:20px">
80
- rightCenter
81
- <ib-button v-tooltip.rightCenter="'Tooltip Content Content Content Content'" v-bind="args">aaaabaaaa</ib-button>
82
- <ib-icon-button v-tooltip.rightCenter="'Tooltip Content Content Content Content'"> <ion-icon style="font-size=20px" name="add"></ion-icon></ib-icon-button>
83
- <ib-button v-tooltip.rightCenter="'Tooltip Content Content Content Content'" v-bind="args">Hover to me(rightCenter)</ib-button>
84
- </div>
85
- <div style="margin:20px">
86
- rightBottom
87
- <ib-icon-button v-tooltip.rightBottom="'Tooltip Content Content Content Content'"> <ion-icon style="font-size=20px" name="add"></ion-icon></ib-icon-button>
88
- <ib-button v-tooltip.rightBottom="'Tooltip Content Content Content Content'" v-bind="args">Hover to me(rightCenter)</ib-button>
89
- </div>
90
-
91
-
92
- </div>
93
-
94
- `,
21
+ template: `<ib-button v-tooltip="'Tooltip Content'" v-bind="args">Hover to me</ib-button>`,
95
22
  });
96
23
 
97
24
  export const Default = Template.bind({});
98
25
  Default.decorators = [
99
26
  () => ({
100
27
  template:
101
- '<div style="display: flex; align-items:center; justify-content: center; width: 600px; height: auto; margin: 0 auto"><story /></div>',
28
+ '<div style="display: flex; align-items:center; justify-content: center; width: 400px; height: 400px; margin: 0 auto"><story /></div>',
102
29
  }),
103
30
  ];
@@ -1,6 +1,6 @@
1
- export default function removeEvents(attrList) {
1
+ export default function removeEvents(attrList, eventsToRemove = []) {
2
2
  for (let prop in attrList) {
3
- if (prop.startsWith("on")) {
3
+ if (prop.startsWith("on") && (eventsToRemove.length === 0 || eventsToRemove.includes(prop))) {
4
4
  delete attrList[prop];
5
5
  }
6
6
  }
package/TODO DELETED
@@ -1,12 +0,0 @@
1
- [X] topLeft
2
- [X] topCenter
3
- [X] topRight
4
- [ ] rightTop
5
- [X] rightCenter
6
- [ ] rightBottom
7
- [X] bottomLeft
8
- [X] bottomCenter
9
- [X] bottomRight
10
- [ ] leftTop
11
- [X] leftCenter
12
- [ ] leftBottom