Root/Trigger/Overlay/Close/Title/Description now share a small provide/inject context instead of reka-ui's Dialog primitives. DialogContent/DialogScrollContent follow in the next commit since they need the focus-trap and dismissable-layer composables.
21 lines
450 B
Vue
21 lines
450 B
Vue
<script setup lang="ts">
|
|
import { inject } from 'vue'
|
|
import { Primitive } from '@/lib/primitive'
|
|
import { DialogContextKey } from './context'
|
|
|
|
const props = defineProps<{ asChild?: boolean }>()
|
|
|
|
const context = inject(DialogContextKey)!
|
|
</script>
|
|
|
|
<template>
|
|
<Primitive
|
|
as="button"
|
|
:as-child="props.asChild"
|
|
type="button"
|
|
data-slot="dialog-close"
|
|
@click="context.open.value = false"
|
|
>
|
|
<slot />
|
|
</Primitive>
|
|
</template>
|