@avakhula/ui 0.0.338 → 0.0.339

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.
@@ -1,6 +1,5 @@
1
1
  <template>
2
2
  <ib-button
3
- @click="onClick"
4
3
  v-bind="attrs"
5
4
  :href="href"
6
5
  :kind="kind"
@@ -16,7 +15,6 @@
16
15
  import IbButton from "../Button/Button.vue";
17
16
  import IbTooltip from "../Tooltip/Tooltip.vue";
18
17
  import { iconButtonKindOptions, iconButtonSize } from "./constants.js";
19
- import removeEvents from "../../helpers/removeEvents";
20
18
 
21
19
  export default {
22
20
  name: "IbIconButton",
@@ -63,11 +61,6 @@ export default {
63
61
  tooltipVisible: false,
64
62
  };
65
63
  },
66
- methods: {
67
- onClick(e) {
68
- this.$emit("click", e);
69
- },
70
- },
71
64
  computed: {
72
65
  classes() {
73
66
  const classList = ["ib-icon-button"];
@@ -85,8 +78,7 @@ export default {
85
78
  return classList;
86
79
  },
87
80
  attrs() {
88
- const attrsList = removeEvents({ ...this.$attrs }, ['onClick']);
89
-
81
+ const attrsList = {...this.$attrs};
90
82
  attrsList.class = [...this.classes, attrsList.class];
91
83
 
92
84
  if (this.disabledFocus) {
@@ -117,6 +117,9 @@ export default {
117
117
  current(newVal) {
118
118
  this.onSelect(newVal);
119
119
  },
120
+ limitSelector(newVal) {
121
+ this.limitValue = newVal;
122
+ },
120
123
  limitValue() {
121
124
  this.currentPage = 1;
122
125
  },
@@ -1,20 +1,20 @@
1
1
  <template>
2
2
  <Transition>
3
- <div v-show="isVisible" :class="classes">
3
+ <div ref="popover" v-show="isVisible" :class="classes">
4
4
  <slot></slot>
5
5
  </div>
6
6
  </Transition>
7
7
  </template>
8
8
 
9
9
  <script>
10
- import { popoverPosition } from "./constants";
10
+ import { computePosition, autoPlacement } from '@floating-ui/dom';
11
11
 
12
12
  export default {
13
13
  name: "IbPopover",
14
14
  props: {
15
15
  position: {
16
- type: String,
17
- default: popoverPosition.topCenter,
16
+ type: [String, Array],
17
+ default: 'top',
18
18
  },
19
19
  alwaysVisible: {
20
20
  type: Boolean,
@@ -25,29 +25,45 @@ export default {
25
25
  return {
26
26
  parentNode: null,
27
27
  isVisible: this.alwaysVisible ? true : false,
28
+ activePosition: null,
28
29
  };
29
30
  },
30
31
  mounted() {
31
32
  this.$nextTick(() => {
32
33
  this.parentNode = this.$el.parentNode;
33
34
 
34
- if (!this.parentNode) return;
35
-
36
- if (getComputedStyle(this.parentNode).position !== "absolute") {
37
- this.parentNode.style.position = "relative";
38
- }
39
-
40
35
  if (!this.alwaysVisible) {
41
- this.parentNode.addEventListener("focus", this.showPopover, true);
42
- this.parentNode.addEventListener("blur", this.hidePopover, true);
43
- this.parentNode.addEventListener("mouseover", this.showPopover, true);
44
- this.parentNode.addEventListener("mouseleave", this.hidePopover, true);
36
+ this.parentNode?.addEventListener("focus", this.showPopover, true);
37
+ this.parentNode?.addEventListener("blur", this.hidePopover, true);
38
+ this.parentNode?.addEventListener("mouseover", this.showPopover);
39
+ this.parentNode?.addEventListener("mouseleave", this.hidePopover);
45
40
  }
46
41
  });
47
42
  },
48
43
  methods: {
49
44
  showPopover() {
45
+ if (this.isVisible) return;
50
46
  this.isVisible = true;
47
+
48
+ computePosition(
49
+ this.parentNode,
50
+ this.$refs.popover,
51
+ {
52
+ middleware: [
53
+ autoPlacement({
54
+ allowedPlacements: this.position,
55
+ })
56
+ ]
57
+ }
58
+ )
59
+ .then(({x, y, placement }) => {
60
+ this.activePosition = placement;
61
+
62
+ Object.assign(this.$refs.popover.style, {
63
+ left: `${x}px`,
64
+ top: `${y}px`,
65
+ });
66
+ });
51
67
  },
52
68
  hidePopover() {
53
69
  this.isVisible = false;
@@ -56,7 +72,7 @@ export default {
56
72
  computed: {
57
73
  classes() {
58
74
  const classList = ["ib-popover"];
59
- classList.push(`ib-${this.position}`);
75
+ classList.push(`ib-${this.activePosition}`);
60
76
 
61
77
  if (this.isVisible) {
62
78
  classList.push("active");
@@ -1,5 +1,4 @@
1
1
  @import "../../assets/scss/typography.scss";
2
- @import "../../assets/scss/mixins/tooltip-position.scss";
3
2
  @import "../../assets/scss/variables/colors.scss";
4
3
  @import "../../assets/scss/variables/shadows.scss";
5
4
 
@@ -16,11 +15,32 @@ $shadow: $ib-shadow-3;
16
15
  color: $textColor;
17
16
  border-radius: 4px;
18
17
  box-shadow: $shadow;
19
- top: auto;
20
- bottom: auto;
21
- left: auto;
22
- right: auto;
23
- @include TooltipPosition;
24
- z-index: 100;
18
+ z-index: 9998;
25
19
  text-align: start;
20
+
21
+ &.ib {
22
+ &-right,
23
+ &-right-start,
24
+ &-right-end {
25
+ margin-left: 7px;
26
+ }
27
+
28
+ &-left,
29
+ &-left-start,
30
+ &-left-end {
31
+ margin-left: -7px;
32
+ }
33
+
34
+ &-top,
35
+ &-top-start,
36
+ &-top-end {
37
+ margin-top: -7px;
38
+ }
39
+
40
+ &-bottom,
41
+ &-bottom-start,
42
+ &-bottom-end {
43
+ margin-bottom: -7px;
44
+ }
45
+ }
26
46
  }
@@ -37,6 +37,7 @@ export default class Tooltip {
37
37
  position: absolute;
38
38
  top: 0px;
39
39
  left: 0px;
40
+ opacity: 0;
40
41
  `;
41
42
 
42
43
  this.tooltipContainer = document.createElement("div");
@@ -59,6 +60,7 @@ export default class Tooltip {
59
60
 
60
61
  const tooltipStyles = this.getPositionStyle(el, position);
61
62
  this.tooltipContainer.firstChild.setAttribute("style", tooltipStyles);
63
+ this.tooltipContainer.setAttribute("style", {'opacity': 1});
62
64
  }
63
65
  }, 100);
64
66
  }