-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): add hover card for project environments in dashboard
- Loading branch information
1 parent
5c7a053
commit 237907d
Showing
24 changed files
with
556 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script setup lang="ts"> | ||
import { HoverCardRoot, type HoverCardRootEmits, type HoverCardRootProps, useForwardPropsEmits } from 'radix-vue' | ||
const props = defineProps<HoverCardRootProps>() | ||
const emits = defineEmits<HoverCardRootEmits>() | ||
const forwarded = useForwardPropsEmits(props, emits) | ||
</script> | ||
|
||
<template> | ||
<HoverCardRoot v-bind="forwarded"> | ||
<slot /> | ||
</HoverCardRoot> | ||
</template> |
37 changes: 37 additions & 0 deletions
37
resources/js/components/ui/hover-card/HoverCardContent.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<script setup lang="ts"> | ||
import { cn } from '@/lib/utils' | ||
import { | ||
HoverCardContent, | ||
type HoverCardContentProps, | ||
HoverCardPortal, | ||
useForwardProps, | ||
} from 'radix-vue' | ||
import { computed, type HTMLAttributes } from 'vue' | ||
const props = withDefaults( | ||
defineProps<HoverCardContentProps & { class?: HTMLAttributes['class'] }>(), | ||
{ | ||
sideOffset: 4, | ||
}, | ||
) | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwardedProps = useForwardProps(delegatedProps) | ||
</script> | ||
|
||
<template> | ||
<HoverCardPortal> | ||
<HoverCardContent v-bind="forwardedProps" :class="cn( | ||
'z-50 w-64 rounded-md border border-neutral-200 bg-white p-4 text-neutral-950 shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50', | ||
props.class, | ||
) | ||
"> | ||
<slot /> | ||
</HoverCardContent> | ||
</HoverCardPortal> | ||
</template> |
11 changes: 11 additions & 0 deletions
11
resources/js/components/ui/hover-card/HoverCardTrigger.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
import { HoverCardTrigger, type HoverCardTriggerProps } from 'radix-vue' | ||
const props = defineProps<HoverCardTriggerProps>() | ||
</script> | ||
|
||
<template> | ||
<HoverCardTrigger v-bind="props"> | ||
<slot /> | ||
</HoverCardTrigger> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { default as HoverCard } from './HoverCard.vue' | ||
export { default as HoverCardContent } from './HoverCardContent.vue' | ||
export { default as HoverCardTrigger } from './HoverCardTrigger.vue' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<script setup lang="ts"> | ||
import { cn } from '@/lib/utils' | ||
import { | ||
MenubarRoot, | ||
type MenubarRootEmits, | ||
type MenubarRootProps, | ||
useForwardPropsEmits, | ||
} from 'radix-vue' | ||
import { computed, type HTMLAttributes } from 'vue' | ||
const props = defineProps<MenubarRootProps & { class?: HTMLAttributes['class'] }>() | ||
const emits = defineEmits<MenubarRootEmits>() | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwarded = useForwardPropsEmits(delegatedProps, emits) | ||
</script> | ||
|
||
<template> | ||
<MenubarRoot | ||
v-bind="forwarded" | ||
:class=" | ||
cn( | ||
'flex h-10 items-center gap-x-1 rounded-md border border-neutral-200 bg-white p-1 dark:border-neutral-800 dark:bg-neutral-950', | ||
props.class, | ||
) | ||
" | ||
> | ||
<slot /> | ||
</MenubarRoot> | ||
</template> |
40 changes: 40 additions & 0 deletions
40
resources/js/components/ui/menubar/MenubarCheckboxItem.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<script setup lang="ts"> | ||
import { cn } from '@/lib/utils' | ||
import { Check } from 'lucide-vue-next' | ||
import { | ||
MenubarCheckboxItem, | ||
type MenubarCheckboxItemEmits, | ||
type MenubarCheckboxItemProps, | ||
MenubarItemIndicator, | ||
useForwardPropsEmits, | ||
} from 'radix-vue' | ||
import { computed, type HTMLAttributes } from 'vue' | ||
const props = defineProps<MenubarCheckboxItemProps & { class?: HTMLAttributes['class'] }>() | ||
const emits = defineEmits<MenubarCheckboxItemEmits>() | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwarded = useForwardPropsEmits(delegatedProps, emits) | ||
</script> | ||
|
||
<template> | ||
<MenubarCheckboxItem | ||
v-bind="forwarded" | ||
:class="cn( | ||
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-neutral-100 focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50', | ||
props.class, | ||
)" | ||
> | ||
<span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center"> | ||
<MenubarItemIndicator> | ||
<Check class="w-4 h-4" /> | ||
</MenubarItemIndicator> | ||
</span> | ||
<slot /> | ||
</MenubarCheckboxItem> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<script setup lang="ts"> | ||
import { cn } from '@/lib/utils' | ||
import { | ||
MenubarContent, | ||
type MenubarContentProps, | ||
MenubarPortal, | ||
useForwardProps, | ||
} from 'radix-vue' | ||
import { computed, type HTMLAttributes } from 'vue' | ||
const props = withDefaults( | ||
defineProps<MenubarContentProps & { class?: HTMLAttributes['class'] }>(), | ||
{ | ||
align: 'start', | ||
alignOffset: -4, | ||
sideOffset: 8, | ||
}, | ||
) | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwardedProps = useForwardProps(delegatedProps) | ||
</script> | ||
|
||
<template> | ||
<MenubarPortal> | ||
<MenubarContent | ||
v-bind="forwardedProps" | ||
:class=" | ||
cn( | ||
'z-50 min-w-48 overflow-hidden rounded-md border border-neutral-200 bg-white p-1 text-neutral-950 shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50', | ||
props.class, | ||
) | ||
" | ||
> | ||
<slot /> | ||
</MenubarContent> | ||
</MenubarPortal> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
import { MenubarGroup, type MenubarGroupProps } from 'radix-vue' | ||
const props = defineProps<MenubarGroupProps>() | ||
</script> | ||
|
||
<template> | ||
<MenubarGroup v-bind="props"> | ||
<slot /> | ||
</MenubarGroup> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<script setup lang="ts"> | ||
import { cn } from '@/lib/utils' | ||
import { | ||
MenubarItem, | ||
type MenubarItemEmits, | ||
type MenubarItemProps, | ||
useForwardPropsEmits, | ||
} from 'radix-vue' | ||
import { computed, type HTMLAttributes } from 'vue' | ||
const props = defineProps<MenubarItemProps & { class?: HTMLAttributes['class'], inset?: boolean }>() | ||
const emits = defineEmits<MenubarItemEmits>() | ||
const delegatedProps = computed(() => { | ||
const { class: _, ...delegated } = props | ||
return delegated | ||
}) | ||
const forwarded = useForwardPropsEmits(delegatedProps, emits) | ||
</script> | ||
|
||
<template> | ||
<MenubarItem | ||
v-bind="forwarded" | ||
:class="cn( | ||
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-neutral-100 focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50', | ||
inset && 'pl-8', | ||
props.class, | ||
)" | ||
> | ||
<slot /> | ||
</MenubarItem> | ||
</template> |
Oops, something went wrong.