Skip to content

Commit

Permalink
finish
Browse files Browse the repository at this point in the history
  • Loading branch information
k11q committed Jul 16, 2023
1 parent a3dee3f commit 70936a4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
10 changes: 3 additions & 7 deletions packages/radix-vue/src/HoverCard/HoverCardContent.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<script lang="ts">
export type Boundary = Element | null | Array<Element | null>;
export interface HoverCardContentProps extends PopperContentProps {
asChild?: boolean;
forceMount?: boolean;
}
export interface HoverCardContentProps extends PopperContentProps {}
</script>

<script setup lang="ts">
Expand Down Expand Up @@ -40,9 +37,8 @@ async function handleMouseleave(e: MouseEvent) {
@mouseover="injectedValue.isHover = true"
@mouseleave="handleMouseleave"
:data-state="injectedValue?.open.value ? 'open' : 'closed'"
role="tooltip"
tabindex="-1"
:as-child="props.asChild"
:data-side="props.side"
:data-align="props.align"
>
<slot />
</PopperContent>
Expand Down
5 changes: 3 additions & 2 deletions packages/radix-vue/src/HoverCard/HoverCardTrigger.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ import { PopperAnchor } from "@/Popper";
import { useHoverDelay, useMouseleaveDelay } from "../shared";
const injectedValue = inject<HoverCardProvideValue>(HOVER_CARD_INJECTION_KEY);
const props = withDefaults(defineProps<HoverCardTriggerProps>(), {
asChild: false,
});
const { primitiveElement, currentElement: triggerElement } =
const { primitiveElement, currentElement } =
usePrimitiveElement();
async function handleMouseEnter(e: MouseEvent) {
const result = await useHoverDelay(
e,
triggerElement.value!,
currentElement.value!,
injectedValue?.openDelay
);
if (result) {
Expand Down
2 changes: 1 addition & 1 deletion packages/radix-vue/src/shared/component/Arrow.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import type { SVGAttributes } from "vue";

Check warning on line 2 in packages/radix-vue/src/shared/component/Arrow.vue

View workflow job for this annotation

GitHub Actions / build

'SVGAttributes' is defined but never used

Check warning on line 2 in packages/radix-vue/src/shared/component/Arrow.vue

View workflow job for this annotation

GitHub Actions / lint

'SVGAttributes' is defined but never used
export interface ArrowProps extends SVGAttributes {
export interface ArrowProps {
width?: number;
height?: number;
}
Expand Down
8 changes: 6 additions & 2 deletions playground/vue3/src/components/Demo/HoverCardDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ const hoverState = ref(false)
<HoverCardContent
class="data-[side=bottom]:animate-slideUpAndFade data-[side=right]:animate-slideLeftAndFade data-[side=left]:animate-slideRightAndFade data-[side=top]:animate-slideDownAndFade w-[300px] rounded-md bg-white p-5 shadow-[hsl(206_22%_7%_/_35%)_0px_10px_38px_-10px,hsl(206_22%_7%_/_20%)_0px_10px_20px_-15px] data-[state=open]:transition-all"
:side-offset="5"
align="start"
:avoidCollisions="false"
side="top"
align="end"
:avoidCollisions="true"
as-child
>
<div>
<div class="flex flex-col gap-[7px]">
<img
class="block h-[60px] w-[60px] rounded-full"
Expand Down Expand Up @@ -78,6 +81,7 @@ const hoverState = ref(false)
</div>

<HoverCardArrow class="fill-white" size="8" />
</div>
</HoverCardContent>
</HoverCardPortal>
</HoverCardRoot>
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 70936a4

Please sign in to comment.