@veritree/ui 0.37.0 → 0.38.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.
@@ -20,7 +20,7 @@ export const floatingUiContentMixin = {
20
20
  },
21
21
 
22
22
  mounted() {
23
- document.addEventListener('click', (e) => this.onDocumentClick(e));
23
+ document.addEventListener('click', (e) => this.onDocumentClick);
24
24
  },
25
25
 
26
26
  destroyed() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/ui",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "description": "veritree ui library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -17,8 +17,7 @@
17
17
  "dependencies": {
18
18
  "@floating-ui/dom": "^1.2.0",
19
19
  "@linusborg/vue-simple-portal": "^0.1.5",
20
- "@veritree/icons": "^0.43.0",
21
- "vue": "^2.7.2"
20
+ "@veritree/icons": "^0.43.0"
22
21
  },
23
22
  "devDependencies": {
24
23
  "@vitejs/plugin-vue2": "^1.1.2",
@@ -29,6 +28,7 @@
29
28
  "tailwindcss": "^3.2.4",
30
29
  "vite": "latest",
31
30
  "vitest": "latest",
31
+ "vue": "^2.7.2",
32
32
  "vue-template-compiler": "^2.7.2"
33
33
  }
34
34
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- v-if="show"
3
+ v-if="visible"
4
4
  :class="[
5
5
  // default styles
6
6
  headless ? 'alert' : 'flex items-start gap-3 rounded border border-solid',
@@ -29,7 +29,15 @@
29
29
  <button
30
30
  v-if="dismissable"
31
31
  :class="[
32
- headless ? 'alert-close' : 'ml-auto mt-1 h-4 w-4 shrink-0 text-current',
32
+ // default styles
33
+ headless ? 'alert-close' : 'ml-auto h-4 w-4 shrink-0 text-current',
34
+ headless
35
+ ? `alert-close--${variant}`
36
+ : isLarge
37
+ ? 'mt-1'
38
+ : isSmall
39
+ ? 'mt-0.5'
40
+ : null,
33
41
  ]"
34
42
  @click="hide"
35
43
  >
@@ -48,6 +56,10 @@ export default {
48
56
  IconClose,
49
57
  },
50
58
 
59
+ model: {
60
+ prop: 'visible',
61
+ },
62
+
51
63
  props: {
52
64
  variant: {
53
65
  type: String,
@@ -65,12 +77,10 @@ export default {
65
77
  type: Boolean,
66
78
  default: false,
67
79
  },
68
- },
69
-
70
- data() {
71
- return {
72
- show: true,
73
- };
80
+ visible: {
81
+ type: Boolean,
82
+ default: false,
83
+ },
74
84
  },
75
85
 
76
86
  computed: {
@@ -97,7 +107,7 @@ export default {
97
107
 
98
108
  methods: {
99
109
  hide() {
100
- this.show = false;
110
+ this.$emit('input', false);
101
111
  this.$emit('dismiss');
102
112
  },
103
113
  },
@@ -2,7 +2,6 @@
2
2
  <div
3
3
  :id="id"
4
4
  :aria-describedby="ariaDescribedBy"
5
- class="flex min-w-min"
6
5
  @mouseenter="onMouseenter"
7
6
  @mouseleave="onmouseout"
8
7
  >
@@ -75,8 +74,7 @@ export default {
75
74
  // delay stop propagation to close other visible
76
75
  // dropdowns and delay click event to control
77
76
  // this dropdown visibility
78
- setTimeout(() => e.stopImmediatePropagation(), 50);
79
- setTimeout(() => this.showComponentContent(), 100);
77
+ this.showComponentContent();
80
78
  },
81
79
 
82
80
  cancel() {
@@ -2,11 +2,11 @@
2
2
  <Portal>
3
3
  <transition
4
4
  enter-active-class="duration-200 ease-out"
5
- enter-class="translate-y-[15px] opacity-0"
6
- enter-to-class="translate-y-0 opacity-100"
5
+ :enter-class="transitionEnterClass"
6
+ :enter-to-class="transitionEnterToClass"
7
7
  leave-active-class="duration-200 ease-in"
8
- leave-class="translate-y-0 opacity-100"
9
- leave-to-class="translate-y-[15px] opacity-0"
8
+ :leave-class="transitionLeaveClass"
9
+ :leave-to-class="transitionLeaveToClass"
10
10
  @after-leave="hidden"
11
11
  @after-enter="shown"
12
12
  >
@@ -62,6 +62,22 @@ export default {
62
62
  ? 'bg-gray-800 text-sm text-white py-1 px-2'
63
63
  : 'bg-white py-2 px-3';
64
64
  },
65
+
66
+ transitionEnterClass() {
67
+ return this.isTooltip ? 'opacity-0' : 'translate-y-[15px] opacity-0';
68
+ },
69
+
70
+ transitionEnterToClass() {
71
+ return this.isTooltip ? 'opacity-100' : 'translate-y-0 opacity-100';
72
+ },
73
+
74
+ transitionLeaveClass() {
75
+ return this.transitionEnterToClass;
76
+ },
77
+
78
+ transitionLeaveToClass() {
79
+ return this.transitionEnterClass;
80
+ },
65
81
  },
66
82
 
67
83
  methods: {
@@ -1,31 +0,0 @@
1
- # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2
- # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3
-
4
- name: Node.js CI
5
-
6
- on:
7
- push:
8
- branches: [ "main" ]
9
- pull_request:
10
- branches: [ "main" ]
11
-
12
- jobs:
13
- build:
14
-
15
- runs-on: ubuntu-latest
16
-
17
- strategy:
18
- matrix:
19
- node-version: [14.x, 16.x, 18.x]
20
- # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21
-
22
- steps:
23
- - uses: actions/checkout@v3
24
- - name: Use Node.js ${{ matrix.node-version }}
25
- uses: actions/setup-node@v3
26
- with:
27
- node-version: ${{ matrix.node-version }}
28
- cache: 'npm'
29
- - run: npm ci
30
- - run: npm run build --if-present
31
- - run: npm test