import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; export type CarbonModalContext = Record; export type CarbonLayerContext = import("svelte/store").Readable; export type CarbonComposedModalContext = { closeModal: () => void; submit: () => void; updateLabel: (value: string | undefined) => void; updateTitle: (value: string | undefined) => void; registerHeader: () => () => void; registerFooter: () => () => void; ids: import("svelte/store").Readable<{ label: string; title: string; body: string }>; label: import("svelte/store").Writable; title: import("svelte/store").Writable; bodyId: import("svelte/store").Writable; setBodyId: (value: string | undefined) => void; }; type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Set the size of the composed modal. * Also accepts Carbon v11's `"md"`, the default width. */ size?: "xs" | "sm" | "md" | "lg" | undefined; /** * Set to `true` to open the modal. * @default false */ open?: boolean; /** * Set to `true` to use the danger variant * @default false */ danger?: boolean; /** * Set to `true` to enable alert mode. * The dialog uses `role="alertdialog"` and is described by `ModalBody`. * @default false */ alert?: boolean; /** * Set to `true` to remove the modal body padding so content spans edge to edge * @default false */ fullWidth?: boolean; /** * Control whether clicking outside the modal closes it. * By default, a passive modal (one without a `ModalFooter`) closes and a * modal with a `ModalFooter` stays open, as in Carbon v11. * Set to `true` to always keep the modal open on an outside click, or * `false` to always close it. */ preventCloseOnClickOutside?: boolean | undefined; /** * Specify a class for the inner modal * @default "" */ containerClass?: string; /** * Specify a selector to be focused when opening the modal. * @default "[data-modal-primary-focus]" */ selectorPrimaryFocus?: null | string; /** * Set to `true` to build the modal's content the first time it opens * instead of at mount, and keep it afterwards. A closed modal is still * laid out (it is only made invisible), so this saves its nodes on pages * that hold modals most visitors never open. Content is not in the DOM, * or in server-rendered markup, until then. * @default false */ lazy?: boolean; /** * Obtain a reference to the top-level HTML element. * @default null */ ref?: null | HTMLDivElement; /** * Set an id for the top-level element. * The header label, header title, and body ids derive from it as * `{id}-label`, `{id}-title`, and `{id}-body`. * @default uniqueId() */ id?: string; decorator?: (this: void) => void; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type ComposedModalProps = Omit<$RestProps, keyof $Props> & $Props; export default class ComposedModal extends SvelteComponentTyped< ComposedModalProps, { click: WindowEventMap["click"]; "click:button--primary": CustomEvent; close: CustomEvent<{ trigger: "escape-key" | "outside-click" | "close-button" | "programmatic"; }>; keydown: WindowEventMap["keydown"]; mouseenter: WindowEventMap["mouseenter"]; mouseleave: WindowEventMap["mouseleave"]; mouseover: WindowEventMap["mouseover"]; open: CustomEvent; submit: CustomEvent; transitionend: CustomEvent<{ open: boolean; }>; }, { default: Record; decorator: Record; } > {}