replace popper to floating-vue

This commit is contained in:
hirakei1203
2022-11-24 23:57:27 +09:00
parent 66aa000808
commit 9ed0804cea
8 changed files with 290 additions and 305 deletions

View File

@@ -1,32 +1,17 @@
<template>
<Tooltip :placement="placement" hover arrow>
<Tooltip>
<template #trigger>
<button type="button"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
<slot name="trigger-text"></slot>
Default Tooltip
</button>
</template>
<template #content>
<div
class="py-2 px-3 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm transition-opacity duration-300 dark:bg-gray-700">
<slot name="content-text"></slot>
</div>
Tooltip content
</template>
</Tooltip>
</template>
<script lang="ts" setup>
import { Tooltip } from '../../../../src/index'
import type { PropType } from 'vue'
import type { TooltipPlacement } from '../../../../src/components/Tooltip/types'
const props = defineProps({
placement: {
type: String as PropType<TooltipPlacement>,
default: 'top'
}
})
</script>
<script setup>
import { Tooltip } from '../../../../src/index'
</script>

View File

@@ -0,0 +1,56 @@
<template>
<div class="flex flex-wrap justify-center py-8 space-x-3">
<!-- Show tooltip on top -->
<Tooltip placement="top">
<template #trigger>
<button type="button"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
Tooltip top
</button>
</template>
<template #content>
Tooltip on top
</template>
</Tooltip>
<!-- Show tooltip on right -->
<Tooltip placement="right">
<template #trigger>
<button type="button"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
Tooltip right
</button>
</template>
<template #content>
Tooltip on right
</template>
</Tooltip>
<!-- Show tooltip on bottom -->
<Tooltip placement="bottom">
<template #trigger>
<button type="button"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
Tooltip bottom
</button>
</template>
<template #content>
Tooltip on bottom
</template>
</Tooltip>
<!-- Show tooltip on left -->
<Tooltip placement="left">
<template #trigger>
<button type="button"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
Tooltip left
</button>
</template>
<template #content>
Tooltip on left
</template>
</Tooltip>
</div>
</template>
<script setup>
import { Tooltip } from '../../../../src/index'
</script>

View File

@@ -1,34 +1,32 @@
<template>
<Tooltip :placement="placement" :class="colorStyle" hover arrow>
<template #trigger>
<button type="button"
<div class="flex flex-wrap justify-center py-8 space-x-3">
<!-- light style tooltip -->
<Tooltip tooltip-style="tooltip-light">
<template #trigger>
<button type="button"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
<slot name="trigger-text"></slot>
Light Tooltip
</button>
</template>
<template #content>
<slot name="tooltip"></slot>
</template>
</Tooltip>
</template>
<template #content>
Tooltip content
</template>
</Tooltip>
<!-- dark style tooltip -->
<Tooltip tooltip-style="tooltip-dark">
<template #trigger>
<button type="button"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
Dark Tooltip
</button>
</template>
<template #content>
Tooltip content
</template>
</Tooltip>
</div>
</template>
<script lang="ts" setup>
import { Tooltip } from '../../../../src/index'
import type { PropType } from 'vue'
import type { TooltipPlacement, TooltipStyle } from '../../../../src/components/Tooltip/types'
const props = defineProps({
placement: {
type: String as PropType<TooltipPlacement>,
default: 'top'
},
colorStyle: {
type: String as PropType<TooltipStyle>,
default: "tooltip-dark",
}
})
</script>
<script setup>
import { Tooltip } from '../../../../src/index'
</script>

View File

@@ -1,21 +1,30 @@
<template>
<Tooltip :placement="placement" click arrow>
<template #trigger>
<button type="button"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
<slot name="trigger-text"></slot>
</button>
</template>
<template #content>
<div
class="py-2 px-3 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm transition-opacity duration-300 dark:bg-gray-700">
<slot name="content-text"></slot>
</div>
</template>
</Tooltip>
<div class="flex flex-wrap justify-center py-8 space-x-3">
<!-- Show tooltip on hover -->
<Tooltip trigger="hover">
<template #trigger>
<button type="button"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
Tooltip hover
</button>
</template>
<template #content>
Tooltip content
</template>
</Tooltip>
<!-- Show tooltip on click -->
<Tooltip trigger="click">
<template #trigger>
<button type="button"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
Tooltip click
</button>
</template>
<template #content>
Tooltip content
</template>
</Tooltip>
</div>
</template>
<script lang="ts" setup>