@pocketprep/ui-kit 3.1.3 → 3.1.5

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.
@@ -33,9 +33,9 @@ import { Component, Vue, Prop, Emit } from 'vue-facing-decorator'
33
33
  export default class SegmentControl extends Vue {
34
34
  @Prop({ default: 'Option 1' }) option1!: string
35
35
  @Prop({ default: 'Option 2' }) option2!: string
36
- @Prop({ default: 1 }) defaultOption!: string
36
+ @Prop({ default: 1 }) defaultOption!: number
37
37
 
38
- activeOption = this.defaultOption || 1
38
+ activeOption = 1
39
39
 
40
40
  @Emit('change')
41
41
  toggleOption () {
@@ -48,6 +48,10 @@ export default class SegmentControl extends Vue {
48
48
  this.activeOption = option
49
49
  return option
50
50
  }
51
+
52
+ created () {
53
+ this.activeOption = this.defaultOption
54
+ }
51
55
  }
52
56
  </script>
53
57
 
@@ -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="id">
11
+ <div
12
+ :ref="`content_${id}`"
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_${id}`"
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,20 @@ 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
+ id: string | null = null
44
+ created () {
45
+ this.id = (this as unknown as { _uid: string })._uid
46
+ }
33
47
 
34
48
  mounted () {
35
- const content = this.$refs['content'] as HTMLElement
36
-
49
+ const content = this.$refs[`content_${this.id}`] as HTMLElement
50
+ const contentFullWidth = this.$refs[`content_fullwidth_${this.id}`] as HTMLElement
37
51
  this.$nextTick(() => {
38
52
  const truncatedWidth = content.getBoundingClientRect().width
39
- content.style.display = 'inline'
40
- const fullWidth = content.getBoundingClientRect().width
41
- content.style.display = 'block'
53
+ const fullWidth = contentFullWidth.getBoundingClientRect().width
42
54
  this.textOverflows = truncatedWidth < fullWidth
55
+ this.measurementComplete = true
43
56
  })
44
57
  }
45
58
  }
@@ -57,6 +70,10 @@ export default class OverflowTooltip extends Vue {
57
70
  overflow: hidden;
58
71
  text-overflow: ellipsis;
59
72
  white-space: nowrap;
73
+
74
+ &--full-width {
75
+ display: inline;
76
+ }
60
77
  }
61
78
 
62
79
  &__tooltip {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/ui-kit",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "Pocket Prep UI Kit",
5
5
  "author": "pocketprep",
6
6
  "scripts": {