-
Notifications
You must be signed in to change notification settings - Fork 462
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(popper):
arrow
option & docs consistency across components (#875)
- Loading branch information
1 parent
4ce2374
commit f785ecd
Showing
22 changed files
with
412 additions
and
101 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
docs/components/content/examples/ContextMenuExampleArrow.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> | ||
const { x, y } = useMouse() | ||
const { y: windowY } = useWindowScroll() | ||
const isOpen = ref(false) | ||
const virtualElement = ref({ getBoundingClientRect: () => ({}) }) | ||
function onContextMenu () { | ||
const top = unref(y) - unref(windowY) | ||
const left = unref(x) | ||
virtualElement.value.getBoundingClientRect = () => ({ | ||
width: 0, | ||
height: 0, | ||
top, | ||
left | ||
}) | ||
isOpen.value = true | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="w-full" @contextmenu.prevent="onContextMenu"> | ||
<Placeholder class="h-96 select-none w-full flex items-center justify-center"> | ||
Right click here | ||
</Placeholder> | ||
|
||
<UContextMenu v-model="isOpen" :virtual-element="virtualElement" :popper="{ arrow: true, placement: 'right' }"> | ||
<div class="p-4"> | ||
Menu | ||
</div> | ||
</UContextMenu> | ||
</div> | ||
</template> |
35 changes: 35 additions & 0 deletions
35
docs/components/content/examples/ContextMenuExampleOffset.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> | ||
const { x, y } = useMouse() | ||
const { y: windowY } = useWindowScroll() | ||
const isOpen = ref(false) | ||
const virtualElement = ref({ getBoundingClientRect: () => ({}) }) | ||
function onContextMenu () { | ||
const top = unref(y) - unref(windowY) | ||
const left = unref(x) | ||
virtualElement.value.getBoundingClientRect = () => ({ | ||
width: 0, | ||
height: 0, | ||
top, | ||
left | ||
}) | ||
isOpen.value = true | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="w-full" @contextmenu.prevent="onContextMenu"> | ||
<Placeholder class="h-96 select-none w-full flex items-center justify-center"> | ||
Right click here | ||
</Placeholder> | ||
|
||
<UContextMenu v-model="isOpen" :virtual-element="virtualElement" :popper="{ offset: 0 }"> | ||
<div class="p-4"> | ||
Menu | ||
</div> | ||
</UContextMenu> | ||
</div> | ||
</template> |
35 changes: 35 additions & 0 deletions
35
docs/components/content/examples/ContextMenuExamplePlacement.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> | ||
const { x, y } = useMouse() | ||
const { y: windowY } = useWindowScroll() | ||
const isOpen = ref(false) | ||
const virtualElement = ref({ getBoundingClientRect: () => ({}) }) | ||
function onContextMenu () { | ||
const top = unref(y) - unref(windowY) | ||
const left = unref(x) | ||
virtualElement.value.getBoundingClientRect = () => ({ | ||
width: 0, | ||
height: 0, | ||
top, | ||
left | ||
}) | ||
isOpen.value = true | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="w-full" @contextmenu.prevent="onContextMenu"> | ||
<Placeholder class="h-96 select-none w-full flex items-center justify-center"> | ||
Right click here | ||
</Placeholder> | ||
|
||
<UContextMenu v-model="isOpen" :virtual-element="virtualElement" :popper="{ placement: 'right-start' }"> | ||
<div class="p-4"> | ||
Menu | ||
</div> | ||
</UContextMenu> | ||
</div> | ||
</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,16 @@ | ||
<script setup> | ||
const items = [ | ||
[{ | ||
label: 'Profile', | ||
avatar: { | ||
src: 'https://avatars.githubusercontent.com/u/739984?v=4' | ||
} | ||
}] | ||
] | ||
</script> | ||
|
||
<template> | ||
<UDropdown :items="items" :popper="{ arrow: true }"> | ||
<UButton color="white" label="Options" trailing-icon="i-heroicons-chevron-down-20-solid" /> | ||
</UDropdown> | ||
</template> |
16 changes: 16 additions & 0 deletions
16
docs/components/content/examples/DropdownExampleOffset.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,16 @@ | ||
<script setup> | ||
const items = [ | ||
[{ | ||
label: 'Profile', | ||
avatar: { | ||
src: 'https://avatars.githubusercontent.com/u/739984?v=4' | ||
} | ||
}] | ||
] | ||
</script> | ||
|
||
<template> | ||
<UDropdown :items="items" :popper="{ offsetDistance: 0, placement: 'right-start' }"> | ||
<UButton color="white" label="Options" trailing-icon="i-heroicons-chevron-down-20-solid" /> | ||
</UDropdown> | ||
</template> |
16 changes: 16 additions & 0 deletions
16
docs/components/content/examples/DropdownExamplePlacement.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,16 @@ | ||
<script setup> | ||
const items = [ | ||
[{ | ||
label: 'Profile', | ||
avatar: { | ||
src: 'https://avatars.githubusercontent.com/u/739984?v=4' | ||
} | ||
}] | ||
] | ||
</script> | ||
|
||
<template> | ||
<UDropdown :items="items" :popper="{ placement: 'right-start' }"> | ||
<UButton color="white" label="Options" trailing-icon="i-heroicons-chevron-down-20-solid" /> | ||
</UDropdown> | ||
</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 @@ | ||
<template> | ||
<UPopover :popper="{ arrow: true }"> | ||
<UButton color="white" label="Open" trailing-icon="i-heroicons-chevron-down-20-solid" /> | ||
|
||
<template #panel> | ||
<div class="p-4"> | ||
<Placeholder class="h-20 w-48" /> | ||
</div> | ||
</template> | ||
</UPopover> | ||
</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 @@ | ||
<template> | ||
<UPopover :popper="{ offsetDistance: 0 }"> | ||
<UButton color="white" label="Open" trailing-icon="i-heroicons-chevron-down-20-solid" /> | ||
|
||
<template #panel> | ||
<div class="p-4"> | ||
<Placeholder class="h-20 w-48" /> | ||
</div> | ||
</template> | ||
</UPopover> | ||
</template> |
11 changes: 11 additions & 0 deletions
11
docs/components/content/examples/PopoverExamplePlacement.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 @@ | ||
<template> | ||
<UPopover :popper="{ placement: 'top-end' }"> | ||
<UButton color="white" label="Open" trailing-icon="i-heroicons-chevron-down-20-solid" /> | ||
|
||
<template #panel> | ||
<div class="p-4"> | ||
<Placeholder class="h-20 w-48" /> | ||
</div> | ||
</template> | ||
</UPopover> | ||
</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,9 @@ | ||
<script setup> | ||
const people = ['Wade Cooper', 'Arlene Mccoy', 'Devon Webb', 'Tom Cook', 'Tanya Fox', 'Hellen Schmidt', 'Caroline Schultz', 'Mason Heaney', 'Claudie Smitham', 'Emil Schaefer'] | ||
const selected = ref(people[0]) | ||
</script> | ||
|
||
<template> | ||
<USelectMenu v-model="selected" :options="people" :popper="{ arrow: true }" /> | ||
</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,9 @@ | ||
<script setup> | ||
const people = ['Wade Cooper', 'Arlene Mccoy', 'Devon Webb', 'Tom Cook', 'Tanya Fox', 'Hellen Schmidt', 'Caroline Schultz', 'Mason Heaney', 'Claudie Smitham', 'Emil Schaefer'] | ||
const selected = ref(people[0]) | ||
</script> | ||
|
||
<template> | ||
<USelectMenu v-model="selected" :options="people" :popper="{ offsetDistance: 0 }" /> | ||
</template> |
9 changes: 9 additions & 0 deletions
9
docs/components/content/examples/SelectMenuExamplePlacement.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,9 @@ | ||
<script setup> | ||
const people = ['Wade Cooper', 'Arlene Mccoy', 'Devon Webb', 'Tom Cook', 'Tanya Fox', 'Hellen Schmidt', 'Caroline Schultz', 'Mason Heaney', 'Claudie Smitham', 'Emil Schaefer'] | ||
const selected = ref(people[0]) | ||
</script> | ||
|
||
<template> | ||
<USelectMenu v-model="selected" :options="people" :popper="{ placement: 'left-end' }" /> | ||
</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
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
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
Oops, something went wrong.
f785ecd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ui – ./
ui-nuxt-js.vercel.app
ui.nuxt.com
ui-git-dev-nuxt-js.vercel.app