Initial commit with files
Still need to fix the imports
This commit is contained in:
20
src/lib/components/dialog/DialogOverlay.svelte
Normal file
20
src/lib/components/dialog/DialogOverlay.svelte
Normal file
@@ -0,0 +1,20 @@
|
||||
<script lang="ts">
|
||||
import { DialogStates, useDialogContext } from "./Dialog.svelte";
|
||||
import { useId } from "./use-id";
|
||||
let api = useDialogContext("DialogOverlay");
|
||||
let id = `headlessui-dialog-overlay-${useId()}`;
|
||||
function handleClick(event: MouseEvent) {
|
||||
if (event.target !== event.currentTarget) return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
$api.close();
|
||||
}
|
||||
$: propsWeControl = {
|
||||
id,
|
||||
"aria-hidden": true,
|
||||
};
|
||||
</script>
|
||||
|
||||
<div {...{ ...$$restProps, ...propsWeControl }} on:click={handleClick}>
|
||||
<slot open={$api.dialogState === DialogStates.Open} />
|
||||
</div>
|
||||
Reference in New Issue
Block a user