feat: migrate Modal Popover and Tooltip with shared overlay foundation
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { inject, type ComputedRef, type InjectionKey } from "vue";
|
||||
import type { OverlayState } from "../../composables/useOverlayState";
|
||||
|
||||
export interface OverlayDialogContext {
|
||||
state: OverlayState;
|
||||
modal: ComputedRef<boolean>;
|
||||
}
|
||||
export const overlayDialogKey: InjectionKey<OverlayDialogContext> =
|
||||
Symbol("hv-overlay-dialog");
|
||||
export function useOverlayDialog() {
|
||||
const context = inject(overlayDialogKey);
|
||||
if (!context)
|
||||
throw new Error("Overlay dialog parts require OverlayDialogRoot.");
|
||||
return context;
|
||||
}
|
||||
Reference in New Issue
Block a user