mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-24 00:40:34 +01:00
chore: set popper options in preset (#97)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
import { PropType, computed, toRef } from 'vue'
|
||||
import { defu } from 'defu'
|
||||
import { usePopper } from '../../composables/usePopper'
|
||||
import type { PopperOptions } from './../types'
|
||||
import type { PopperOptions } from '../../types'
|
||||
import $ui from '#build/ui'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -63,9 +63,9 @@ const isOpen = computed({
|
||||
|
||||
const virtualElement = toRef(props, 'virtualElement')
|
||||
|
||||
const popperOptions = computed(() => defu({}, props.popperOptions, { placement: 'bottom-start', scroll: false }))
|
||||
const popperOptions = computed(() => defu({}, props.popperOptions, $ui.contextMenu.popperOptions))
|
||||
|
||||
const [, container] = usePopper(popperOptions.value, virtualElement)
|
||||
const [, container] = usePopper(popperOptions.value as PopperOptions, virtualElement)
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Ref, PropType } from 'vue'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { computed, ref, onMounted } from 'vue'
|
||||
import { defu } from 'defu'
|
||||
import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue'
|
||||
import { usePopper } from '../../composables/usePopper'
|
||||
import type { PopperOptions } from './../types'
|
||||
import type { PopperOptions } from '../../types'
|
||||
import $ui from '#build/ui'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -59,9 +59,9 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
const popperOptions = computed(() => defu({}, props.popperOptions, { strategy: 'fixed' }))
|
||||
const popperOptions = computed(() => defu({}, props.popperOptions, $ui.popover.popperOptions))
|
||||
|
||||
const [trigger, container] = usePopper(popperOptions.value)
|
||||
const [trigger, container] = usePopper(popperOptions.value as PopperOptions)
|
||||
|
||||
const popoverApi: Ref<any> = ref(null)
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { PropType } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
import { computed, ref } from 'vue'
|
||||
import { defu } from 'defu'
|
||||
import { usePopper } from '../../composables/usePopper'
|
||||
import type { PopperOptions } from './../types'
|
||||
import type { PopperOptions } from '../../types'
|
||||
import $ui from '#build/ui'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -55,9 +55,10 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
const popperOptions = computed(() => defu({}, props.popperOptions, { strategy: 'fixed' }))
|
||||
const popperOptions = computed(() => defu({}, props.popperOptions, $ui.tooltip.popperOptions))
|
||||
|
||||
const [trigger, container] = usePopper(popperOptions.value as PopperOptions)
|
||||
|
||||
const [trigger, container] = usePopper(popperOptions.value)
|
||||
const open = ref(false)
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user