design-system-next 1.2.19 → 1.2.21

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,37 +1,13 @@
1
- import { computed, ref, toRefs } from 'vue';
2
- import { useElementHover } from '@vueuse/core';
3
- import { TooltipPropTypes } from './tooltip';
4
-
5
- import classNames from 'classnames';
1
+ import { ref } from 'vue';
6
2
 
7
- export const useTooltip = (props: TooltipPropTypes) => {
8
- const { position, text } = toRefs(props);
3
+ import { Placement } from 'floating-vue';
9
4
 
10
- const componentRef = ref<HTMLDivElement | null>(null);
11
- const isHovered = useElementHover(componentRef);
5
+ import { TooltipPropTypes } from './tooltip';
12
6
 
13
- const tooltipClasses = computed(() => {
14
- // Tooltip Gap: 6px
15
- return classNames({
16
- hidden: !isHovered.value,
17
- 'bottom-[calc(100%+6px)] left-[50%] translate-x-[-50%]': position.value === 'top',
18
- 'bottom-[calc(100%+6px)] left-0': position.value === 'top-start',
19
- 'bottom-[calc(100%+6px)] right-0': position.value === 'top-end',
20
- 'top-[calc(100%+6px)] left-[50%] translate-x-[-50%]': position.value === 'bottom',
21
- 'top-[calc(100%+6px)] left-0': position.value === 'bottom-start',
22
- 'top-[calc(100%+6px)] right-0': position.value === 'bottom-end',
23
- 'left-[calc(100%+6px)] top-[50%] translate-y-[-50%]': position.value === 'right',
24
- 'left-[calc(100%+6px)] top-0': position.value === 'right-start',
25
- 'left-[calc(100%+6px)] bottom-0': position.value === 'right-end',
26
- 'right-[calc(100%+6px)] top-[50%] translate-y-[-50%]': position.value === 'left',
27
- 'right-[calc(100%+6px)] top-0': position.value === 'left-start',
28
- 'right-[calc(100%+6px)] bottom-0': position.value === 'left-end',
29
- });
30
- });
7
+ export const useTooltip = (props: TooltipPropTypes) => {
8
+ const placement = ref(props.placement as Placement);
31
9
 
32
10
  return {
33
- componentRef,
34
- tooltipClasses,
35
- text,
11
+ placement,
36
12
  };
37
13
  };