mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-15 20:48:12 +01:00
Compare commits
1 Commits
patch-1
...
fix/modal-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd9f97c454 |
@@ -73,7 +73,7 @@ extendDevtoolsMeta({ example: 'ModalExample' })
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, toRef } from 'vue'
|
import { computed, toRef, provide } from 'vue'
|
||||||
import { DialogRoot, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, useForwardPropsEmits } from 'reka-ui'
|
import { DialogRoot, DialogTrigger, DialogPortal, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogClose, useForwardPropsEmits } from 'reka-ui'
|
||||||
import { reactivePick } from '@vueuse/core'
|
import { reactivePick } from '@vueuse/core'
|
||||||
import { useAppConfig } from '#imports'
|
import { useAppConfig } from '#imports'
|
||||||
@@ -112,6 +112,9 @@ const ui = computed(() => modal({
|
|||||||
transition: props.transition,
|
transition: props.transition,
|
||||||
fullscreen: props.fullscreen
|
fullscreen: props.fullscreen
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// Blocks ButtonGroup injections to avoid side-effects if the modal is within a button group.
|
||||||
|
provide(buttonGroupInjectionKey, undefined)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type { GetObjectField } from '../types/utils'
|
|||||||
export const buttonGroupInjectionKey: InjectionKey<ComputedRef<{
|
export const buttonGroupInjectionKey: InjectionKey<ComputedRef<{
|
||||||
size: ButtonGroupProps['size']
|
size: ButtonGroupProps['size']
|
||||||
orientation: ButtonGroupProps['orientation']
|
orientation: ButtonGroupProps['orientation']
|
||||||
}>> = Symbol('nuxt-ui.button-group')
|
}> | undefined> = Symbol('nuxt-ui.button-group')
|
||||||
|
|
||||||
type Props<T> = {
|
type Props<T> = {
|
||||||
size?: GetObjectField<T, 'size'>
|
size?: GetObjectField<T, 'size'>
|
||||||
@@ -14,6 +14,7 @@ type Props<T> = {
|
|||||||
|
|
||||||
export function useButtonGroup<T>(props: Props<T>) {
|
export function useButtonGroup<T>(props: Props<T>) {
|
||||||
const buttonGroup = inject(buttonGroupInjectionKey, undefined)
|
const buttonGroup = inject(buttonGroupInjectionKey, undefined)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
orientation: computed(() => buttonGroup?.value.orientation),
|
orientation: computed(() => buttonGroup?.value.orientation),
|
||||||
size: computed(() => props?.size ?? buttonGroup?.value.size)
|
size: computed(() => props?.size ?? buttonGroup?.value.size)
|
||||||
|
|||||||
Reference in New Issue
Block a user