@pocketprep/ui-kit 3.1.4 → 3.1.6

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.
@@ -7,14 +7,23 @@
7
7
  >
8
8
  <slot />
9
9
  </Tooltip>
10
- <div
11
- ref="content"
12
- class="uikit-overflow-tooltip__content"
13
- @mouseenter="showTooltip = true"
14
- @mouseleave="showTooltip = false"
15
- >
16
- <slot />
17
- </div>
10
+ <template v-if="uid">
11
+ <div
12
+ :ref="`content_${uid}`"
13
+ class="uikit-overflow-tooltip__content"
14
+ @mouseenter="showTooltip = true"
15
+ @mouseleave="showTooltip = false"
16
+ >
17
+ <slot />
18
+ </div>
19
+ <div
20
+ v-if="!measurementComplete"
21
+ :ref="`content_fullwidth_${uid}`"
22
+ class="uikit-overflow-tooltip__content uikit-overflow-tooltip__content--full-width"
23
+ >
24
+ <slot />
25
+ </div>
26
+ </template>
18
27
  </div>
19
28
  </template>
20
29
 
@@ -30,16 +39,18 @@ import Tooltip from '../Tooltips/Tooltip.vue'
30
39
  export default class OverflowTooltip extends Vue {
31
40
  showTooltip = false
32
41
  textOverflows = false
42
+ measurementComplete = false
43
+ uid = Math.floor(Math.random() * 1e9)
33
44
 
34
45
  mounted () {
35
- const content = this.$refs['content'] as HTMLElement
46
+ const content = this.$refs[`content_${this.uid}`] as HTMLElement
47
+ const contentFullWidth = this.$refs[`content_fullwidth_${this.uid}`] as HTMLElement
36
48
 
37
49
  this.$nextTick(() => {
38
50
  const truncatedWidth = content.getBoundingClientRect().width
39
- content.style.display = 'inline'
40
- const fullWidth = content.getBoundingClientRect().width
41
- content.style.display = 'block'
51
+ const fullWidth = contentFullWidth.getBoundingClientRect().width
42
52
  this.textOverflows = truncatedWidth < fullWidth
53
+ this.measurementComplete = true
43
54
  })
44
55
  }
45
56
  }
@@ -57,6 +68,10 @@ export default class OverflowTooltip extends Vue {
57
68
  overflow: hidden;
58
69
  text-overflow: ellipsis;
59
70
  white-space: nowrap;
71
+
72
+ &--full-width {
73
+ display: inline;
74
+ }
60
75
  }
61
76
 
62
77
  &__tooltip {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.1.4",
3
+ "version": "3.1.6",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {