@veritree/ui 0.22.0-0 → 0.22.1-0

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,13 @@
1
1
  import { computePosition, flip, shift, offset, size } from '@floating-ui/dom';
2
2
 
3
3
  export const floatingUiMixin = {
4
+ props: {
5
+ offset: {
6
+ type: [Number, String],
7
+ default: 5,
8
+ },
9
+ },
10
+
4
11
  data() {
5
12
  return {
6
13
  component: null,
@@ -40,7 +47,7 @@ export const floatingUiMixin = {
40
47
  computePosition(trigger, content, {
41
48
  placement: this.placement,
42
49
  middleware: [
43
- offset(5),
50
+ offset(Number(this.offset)),
44
51
  flip(),
45
52
  shift({ padding: 5 }),
46
53
  size({
@@ -64,4 +71,4 @@ export const floatingUiMixin = {
64
71
  });
65
72
  },
66
73
  },
67
- };
74
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/ui",
3
- "version": "0.22.0-0",
3
+ "version": "0.22.1-0",
4
4
  "description": "veritree ui library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -8,16 +8,21 @@
8
8
  "author": "jb",
9
9
  "license": "MIT",
10
10
  "publishConfig": {
11
- "access": "public"
11
+ "registry": "https://registry.npmjs.org"
12
12
  },
13
13
  "dependencies": {
14
- "@floating-ui/dom": "^1.0.4",
14
+ "@floating-ui/dom": "^1.4.5",
15
15
  "@veritree/icons": "^0.45.1"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@nuxt/kit": "^3.0.0",
19
+ "np": "^8.0.4",
19
20
  "prettier": "^2.7.1",
20
21
  "prettier-plugin-tailwindcss": "^0.1.13",
21
22
  "tailwindcss": "^3.2.4"
23
+ },
24
+ "engines": {
25
+ "npm": ">=8.0.0",
26
+ "node": ">=18.0.0"
22
27
  }
23
28
  }
@@ -83,11 +83,5 @@ export default {
83
83
  floatingUiMinWidth: 200,
84
84
  };
85
85
  },
86
-
87
- computed: {
88
- id() {
89
- return `dropdown-menu-${this.componentId}`;
90
- },
91
- },
92
86
  };
93
87
  </script>
@@ -51,7 +51,11 @@ export default {
51
51
 
52
52
  computed: {
53
53
  as() {
54
- return this.href ? 'a' : this.to ? 'NuxtLink' : 'button';
54
+ return this.href
55
+ ? 'a'
56
+ : this.to
57
+ ? resolveComponent('NuxtLink')
58
+ : 'button';
55
59
  },
56
60
  },
57
61
  };
@@ -57,7 +57,7 @@ export default {
57
57
 
58
58
  mounted() {
59
59
  const trigger = {
60
- id: this.id,
60
+ id: this.$el.getAttribute('id'), // avoids issues with hydration
61
61
  el: this.$el,
62
62
  cancel: this.cancel,
63
63
  focus: this.focus,
@@ -1,7 +1,14 @@
1
1
  <template>
2
2
  <img
3
3
  :src="srcComputed"
4
- :class="{ 'animate-pulse': !isLoaded }"
4
+ :class="[
5
+ headless ? null : isLoaded ? null : 'animate-pulse',
6
+ headless
7
+ ? null
8
+ : hasObjectFit
9
+ ? `h-full w-full ${objectFitComputed}`
10
+ : null,
11
+ ]"
5
12
  v-bind="$attrs"
6
13
  @load="onLoad"
7
14
  @error="onError"
@@ -15,18 +22,26 @@ export default {
15
22
  name: 'VTImage',
16
23
 
17
24
  props: {
18
- src: {
19
- type: String,
20
- default: '',
25
+ headless: {
26
+ type: Boolean,
27
+ default: false,
21
28
  },
22
29
  cdnSrc: {
23
30
  type: [String, Object],
24
31
  default: null,
25
32
  },
33
+ objectFit: {
34
+ type: String,
35
+ default: null,
36
+ },
26
37
  placeholder: {
27
38
  type: String,
28
39
  default: `data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22600%22%20height%3D%22400%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20%25%7Bw%7D%20%25%7Bh%7D%22%20preserveAspectRatio%3D%22none%22%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20style%3D%22fill%3A%23bbb%3B%22%3E%3C%2Frect%3E%3C%2Fsvg%3E`,
29
40
  },
41
+ src: {
42
+ type: String,
43
+ default: '',
44
+ },
30
45
  },
31
46
 
32
47
  data() {
@@ -56,6 +71,20 @@ export default {
56
71
 
57
72
  return null;
58
73
  },
74
+
75
+ hasObjectFit() {
76
+ return this.objectFit;
77
+ },
78
+
79
+ objectFitComputed() {
80
+ return this.hasObjectFit
81
+ ? this.objectFit === 'cover'
82
+ ? 'object-cover'
83
+ : this.objectFit === 'contain'
84
+ ? 'object-contain'
85
+ : null
86
+ : null;
87
+ },
59
88
  },
60
89
 
61
90
  methods: {
@@ -32,7 +32,7 @@ import { keys } from '../../utils/keyboard';
32
32
  export default {
33
33
  name: 'VTTabItem',
34
34
 
35
- inject: ['api'],
35
+ inject: ['apiTabs'],
36
36
 
37
37
  props: {
38
38
  headless: {
@@ -43,7 +43,7 @@ export default {
43
43
 
44
44
  data() {
45
45
  return {
46
- api: this.api(),
46
+ api: this.apiTabs(),
47
47
  index: null,
48
48
  indexFocus: null,
49
49
  selected: false,