@avakhula/ui 0.0.336 → 0.0.501

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avakhula/ui",
3
- "version": "0.0.336",
3
+ "version": "0.0.501",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.umd.cjs",
6
6
  "source": "src/index.js",
@@ -21,6 +21,7 @@
21
21
  "build-storybook": "storybook build"
22
22
  },
23
23
  "dependencies": {
24
+ "@floating-ui/dom": "^1.5.4",
24
25
  "@vueup/vue-quill": "^1.2.0",
25
26
  "mitt": "^3.0.0",
26
27
  "vue": "^3.2.45"
@@ -20,7 +20,14 @@
20
20
  cursor: pointer;
21
21
  transition: background-color 0.3s, border-color 0.3s;
22
22
  @include lineClamp(1);
23
-
23
+ display: flex;
24
+ align-items: center;
25
+
26
+ ion-icon {
27
+ font-size: 16px;
28
+ margin-right: 15px;
29
+ }
30
+
24
31
  p {
25
32
  @include lineClamp(1);
26
33
  }
@@ -15,7 +15,7 @@
15
15
  :disabled="disabled"
16
16
  :required="required"
17
17
  v-model="checked"
18
- @click="onChange"
18
+ @click.stop="onChange"
19
19
  />
20
20
  <div class="ib-checkbox-body">
21
21
  <span
@@ -4,8 +4,8 @@
4
4
  :class="classes"
5
5
  :for="id"
6
6
  :aria-checked="checked"
7
+ @click.prevent="onClick"
7
8
  >
8
- <!-- @click.prevent="onClick" -->
9
9
  <input
10
10
  type="radio"
11
11
  :name="name"
@@ -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) {
@@ -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
36
  this.parentNode.addEventListener("focus", this.showPopover, true);
42
37
  this.parentNode.addEventListener("blur", this.hidePopover, true);
43
- this.parentNode.addEventListener("mouseover", this.showPopover, true);
44
- this.parentNode.addEventListener("mouseleave", 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: 1000;
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
  }