import { action, NAME, pattern, UI, type VNode, Writable } from "commonfabric"; import { Controls, SelectControl, SwitchControl, } from "../ui/controls/index.ts"; // deno-lint-ignore no-empty-interface interface ModalStoryInput {} export interface ModalStoryOutput { [NAME]: string; [UI]: VNode; controls: VNode; } export default pattern(() => { const dialogOpen = new Writable(false); const sheetOpen = new Writable(false); const size = new Writable<"sm" | "md" | "lg" | "full">("md"); const dismissible = new Writable(true); const grabber = new Writable(true); const detent = new Writable<"auto" | "half" | "full">("auto"); const openDialog = action(() => dialogOpen.set(true)); const closeDialog = action(() => dialogOpen.set(false)); const openSheet = action(() => sheetOpen.set(true)); const closeSheet = action(() => sheetOpen.set(false)); return { [NAME]: "cf-modal Story", [UI]: (
Open Dialog Open Sheet
Dialog Modal
This is a centered dialog modal. Uses fade + scale animation. Width controlled by the size attribute.
Cancel Confirm
Sheet Modal
This is a bottom sheet modal. Slides up from bottom with iOS-style animation. Height controlled by the detent attribute.
Cancel Done
), controls: ( <> ), }; });