fix: Fixed tooltip trigger error
Fixed tooltip error that occurs when the tooltip doesn't work with the trigger props
This commit is contained in:
52
package-lock.json
generated
52
package-lock.json
generated
@@ -11,7 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vueuse/core": "9.3.0",
|
"@vueuse/core": "9.3.0",
|
||||||
"classnames": "2.3.2",
|
"classnames": "2.3.2",
|
||||||
"floating-vue": "^2.0.0-beta.20",
|
"floating-vue": "^2.0.0-beta.24",
|
||||||
"flowbite": "1.5.4",
|
"flowbite": "1.5.4",
|
||||||
"lodash-es": "4.17.21",
|
"lodash-es": "4.17.21",
|
||||||
"nanoid": "4.0.0",
|
"nanoid": "4.0.0",
|
||||||
@@ -380,16 +380,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@floating-ui/core": {
|
"node_modules/@floating-ui/core": {
|
||||||
"version": "0.3.1",
|
"version": "1.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-0.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.3.1.tgz",
|
||||||
"integrity": "sha512-ensKY7Ub59u16qsVIFEo2hwTCqZ/r9oZZFh51ivcLGHfUwTn8l1Xzng8RJUe91H/UP8PeqeBronAGx0qmzwk2g=="
|
"integrity": "sha512-Bu+AMaXNjrpjh41znzHqaz3r2Nr8hHuHZT6V2LBKMhyMl0FgKA62PNYbqnfgmzOhoWZj70Zecisbo4H1rotP5g=="
|
||||||
},
|
},
|
||||||
"node_modules/@floating-ui/dom": {
|
"node_modules/@floating-ui/dom": {
|
||||||
"version": "0.1.10",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-0.1.10.tgz",
|
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.1.1.tgz",
|
||||||
"integrity": "sha512-4kAVoogvQm2N0XE0G6APQJuCNuErjOfPW8Ux7DFxh8+AfugWflwVJ5LDlHOwrwut7z/30NUvdtHzQ3zSip4EzQ==",
|
"integrity": "sha512-TpIO93+DIujg3g7SykEAGZMDtbJRrmnYRCNYSjJlvIbGhBjRSNTLVbNeDQBrzy9qDgUbiWdc7KA0uZHZ2tJmiw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@floating-ui/core": "^0.3.0"
|
"@floating-ui/core": "^1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@humanwhocodes/config-array": {
|
"node_modules/@humanwhocodes/config-array": {
|
||||||
@@ -2676,15 +2676,21 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/floating-vue": {
|
"node_modules/floating-vue": {
|
||||||
"version": "2.0.0-beta.20",
|
"version": "2.0.0-beta.24",
|
||||||
"resolved": "https://registry.npmjs.org/floating-vue/-/floating-vue-2.0.0-beta.20.tgz",
|
"resolved": "https://registry.npmjs.org/floating-vue/-/floating-vue-2.0.0-beta.24.tgz",
|
||||||
"integrity": "sha512-N68otcpp6WwcYC7zP8GeJqNZVdfvS7tEY88lwmuAHeqRgnfWx1Un8enzLxROyVnBDZ3TwUoUdj5IFg+bUT7JeA==",
|
"integrity": "sha512-URSzP6YXaF4u1oZ9XGL8Sn8puuM7ivp5jkOUrpy5Q1mfo9BfGppJOn+ierTmsSUfJEeHBae8KT7r5DeI3vQIEw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@floating-ui/dom": "^0.1.10",
|
"@floating-ui/dom": "~1.1.1",
|
||||||
"vue-resize": "^2.0.0-alpha.1"
|
"vue-resize": "^2.0.0-alpha.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
"@nuxt/kit": "^3.2.0",
|
||||||
"vue": "^3.2.0"
|
"vue": "^3.2.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@nuxt/kit": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/flowbite": {
|
"node_modules/flowbite": {
|
||||||
@@ -5658,16 +5664,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@floating-ui/core": {
|
"@floating-ui/core": {
|
||||||
"version": "0.3.1",
|
"version": "1.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-0.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.3.1.tgz",
|
||||||
"integrity": "sha512-ensKY7Ub59u16qsVIFEo2hwTCqZ/r9oZZFh51ivcLGHfUwTn8l1Xzng8RJUe91H/UP8PeqeBronAGx0qmzwk2g=="
|
"integrity": "sha512-Bu+AMaXNjrpjh41znzHqaz3r2Nr8hHuHZT6V2LBKMhyMl0FgKA62PNYbqnfgmzOhoWZj70Zecisbo4H1rotP5g=="
|
||||||
},
|
},
|
||||||
"@floating-ui/dom": {
|
"@floating-ui/dom": {
|
||||||
"version": "0.1.10",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-0.1.10.tgz",
|
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.1.1.tgz",
|
||||||
"integrity": "sha512-4kAVoogvQm2N0XE0G6APQJuCNuErjOfPW8Ux7DFxh8+AfugWflwVJ5LDlHOwrwut7z/30NUvdtHzQ3zSip4EzQ==",
|
"integrity": "sha512-TpIO93+DIujg3g7SykEAGZMDtbJRrmnYRCNYSjJlvIbGhBjRSNTLVbNeDQBrzy9qDgUbiWdc7KA0uZHZ2tJmiw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@floating-ui/core": "^0.3.0"
|
"@floating-ui/core": "^1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@humanwhocodes/config-array": {
|
"@humanwhocodes/config-array": {
|
||||||
@@ -7299,11 +7305,11 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"floating-vue": {
|
"floating-vue": {
|
||||||
"version": "2.0.0-beta.20",
|
"version": "2.0.0-beta.24",
|
||||||
"resolved": "https://registry.npmjs.org/floating-vue/-/floating-vue-2.0.0-beta.20.tgz",
|
"resolved": "https://registry.npmjs.org/floating-vue/-/floating-vue-2.0.0-beta.24.tgz",
|
||||||
"integrity": "sha512-N68otcpp6WwcYC7zP8GeJqNZVdfvS7tEY88lwmuAHeqRgnfWx1Un8enzLxROyVnBDZ3TwUoUdj5IFg+bUT7JeA==",
|
"integrity": "sha512-URSzP6YXaF4u1oZ9XGL8Sn8puuM7ivp5jkOUrpy5Q1mfo9BfGppJOn+ierTmsSUfJEeHBae8KT7r5DeI3vQIEw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@floating-ui/dom": "^0.1.10",
|
"@floating-ui/dom": "~1.1.1",
|
||||||
"vue-resize": "^2.0.0-alpha.1"
|
"vue-resize": "^2.0.0-alpha.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vueuse/core": "9.3.0",
|
"@vueuse/core": "9.3.0",
|
||||||
"classnames": "2.3.2",
|
"classnames": "2.3.2",
|
||||||
"floating-vue": "^2.0.0-beta.20",
|
"floating-vue": "2.0.0-beta.24",
|
||||||
"flowbite": "1.5.4",
|
"flowbite": "1.5.4",
|
||||||
"lodash-es": "4.17.21",
|
"lodash-es": "4.17.21",
|
||||||
"nanoid": "4.0.0",
|
"nanoid": "4.0.0",
|
||||||
|
|||||||
@@ -10,31 +10,24 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { PropType } from 'vue'
|
|
||||||
import type { TooltipPlacement, TooltipStyle, TooltipTrigger } from './types'
|
import type { TooltipPlacement, TooltipStyle, TooltipTrigger } from './types'
|
||||||
import * as pkg from 'floating-vue'
|
import { Tooltip } from 'floating-vue'
|
||||||
const { Tooltip } = pkg
|
|
||||||
import 'floating-vue/dist/style.css'
|
import 'floating-vue/dist/style.css'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
interface TooltipProps {
|
||||||
const props = defineProps({
|
placement?: TooltipPlacement
|
||||||
placement: {
|
theme?: TooltipStyle
|
||||||
type: String as PropType<TooltipPlacement>,
|
trigger?: TooltipTrigger
|
||||||
default: 'top',
|
}
|
||||||
},
|
const props = withDefaults(defineProps<TooltipProps>(), {
|
||||||
theme: {
|
placement: 'top',
|
||||||
type: String as PropType<TooltipStyle>,
|
theme: 'dark',
|
||||||
default: 'dark',
|
trigger: 'hover',
|
||||||
},
|
|
||||||
trigger: {
|
|
||||||
type: String as PropType<TooltipTrigger>,
|
|
||||||
default: 'hover',
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
const theme = computed(() => {
|
const theme = computed(() => {
|
||||||
const themes = {
|
const themes = {
|
||||||
'light': 'tooltip-light',
|
light: 'tooltip-light',
|
||||||
'dark': 'tooltip-dark',
|
dark: 'tooltip-dark',
|
||||||
}
|
}
|
||||||
return themes[props.theme]
|
return themes[props.theme]
|
||||||
})
|
})
|
||||||
@@ -83,5 +76,4 @@ const theme = computed(() => {
|
|||||||
.v-popper--theme-tooltip-light .v-popper__arrow-outer {
|
.v-popper--theme-tooltip-light .v-popper__arrow-outer {
|
||||||
border-color: #ddd;
|
border-color: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user