mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
* chore(deps-dev): remove @carbon/themes * chore(deps-dev): bump devDependencies * fix(tabs): forward click event to Tab * feat(toggle): dispatch toggle event * feat(tag): dispatch close event * feat(tooltip-icon): make tooltipText slottable * feat(dropdown): add hideLabel prop * docs(select): add "Hidden label" example * refactor(modal): use class directive * feat(modal): dispatch transitionend event * chore(deps-dev): upgrade carbon-components to 10.28.0-rc.0 * feat(date-picker): add warn state * feat(tag): support small size variant * fix(search): add semantic role * feat(toolbar-search): add disabled state * fix(composed-modal): add aria-label prop, update header semantic tags * chore(deps-dev): upgrade carbon-components to v10.28 * docs(overflow-menu): add light variant example * docs(link): document OutboundLink in Component API * chore(tooltip-icon): rename slot to "tooltipText" * docs(component-api): wrap code blocks to minimize width * docs(aspect-ratio): remove inline outline style * fix(tab): do not trigger focus when mounting * docs(tabs): add reactive example Closes #438
134 lines
3.2 KiB
TypeScript
134 lines
3.2 KiB
TypeScript
/// <reference types="svelte" />
|
|
|
|
export interface ModalProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
|
|
/**
|
|
* Set the size of the modal
|
|
*/
|
|
size?: "xs" | "sm" | "lg";
|
|
|
|
/**
|
|
* 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
|
|
* @default false
|
|
*/
|
|
alert?: boolean;
|
|
|
|
/**
|
|
* Set to `true` to use the passive variant
|
|
* @default false
|
|
*/
|
|
passiveModal?: boolean;
|
|
|
|
/**
|
|
* Specify the modal heading
|
|
*/
|
|
modalHeading?: string;
|
|
|
|
/**
|
|
* Specify the modal label
|
|
*/
|
|
modalLabel?: string;
|
|
|
|
/**
|
|
* Specify the ARIA label for the modal
|
|
*/
|
|
modalAriaLabel?: string;
|
|
|
|
/**
|
|
* Specify the ARIA label for the close icon
|
|
* @default "Close the modal"
|
|
*/
|
|
iconDescription?: string;
|
|
|
|
/**
|
|
* Set to `true` if the modal contains form elements
|
|
* @default false
|
|
*/
|
|
hasForm?: boolean;
|
|
|
|
/**
|
|
* Set to `true` if the modal contains scrolling content
|
|
* @default false
|
|
*/
|
|
hasScrollingContent?: boolean;
|
|
|
|
/**
|
|
* Specify the primary button text
|
|
* @default ""
|
|
*/
|
|
primaryButtonText?: string;
|
|
|
|
/**
|
|
* Set to `true` to disable the primary button
|
|
* @default false
|
|
*/
|
|
primaryButtonDisabled?: boolean;
|
|
|
|
/**
|
|
* Set to `true` for the primary button to be triggered when pressing "Enter"
|
|
* @default true
|
|
*/
|
|
shouldSubmitOnEnter?: boolean;
|
|
|
|
/**
|
|
* Specify the secondary button text
|
|
* @default ""
|
|
*/
|
|
secondaryButtonText?: string;
|
|
|
|
/**
|
|
* Specify a selector to be focused when opening the modal
|
|
* @default "[data-modal-primary-focus]"
|
|
*/
|
|
selectorPrimaryFocus?: string;
|
|
|
|
/**
|
|
* Set to `true` to prevent the modal from closing when clicking outside
|
|
* @default false
|
|
*/
|
|
preventCloseOnClickOutside?: boolean;
|
|
|
|
/**
|
|
* Set an id for the top-level element
|
|
* @default "ccs-" + Math.random().toString(36)
|
|
*/
|
|
id?: string;
|
|
|
|
/**
|
|
* Obtain a reference to the top-level HTML element
|
|
* @default null
|
|
*/
|
|
ref?: null | HTMLDivElement;
|
|
}
|
|
|
|
export default class Modal {
|
|
$$prop_def: ModalProps;
|
|
$$slot_def: {
|
|
default: {};
|
|
heading: {};
|
|
label: {};
|
|
};
|
|
|
|
$on(eventname: "transitionend", cb: (event: CustomEvent<{ open: boolean }>) => void): () => void;
|
|
$on(eventname: "keydown", cb: (event: WindowEventMap["keydown"]) => void): () => void;
|
|
$on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void;
|
|
$on(eventname: "mouseover", cb: (event: WindowEventMap["mouseover"]) => void): () => void;
|
|
$on(eventname: "mouseenter", cb: (event: WindowEventMap["mouseenter"]) => void): () => void;
|
|
$on(eventname: "mouseleave", cb: (event: WindowEventMap["mouseleave"]) => void): () => void;
|
|
$on(eventname: "submit", cb: (event: CustomEvent<any>) => void): () => void;
|
|
$on(eventname: "click:button--secondary", cb: (event: CustomEvent<any>) => void): () => void;
|
|
$on(eventname: "close", cb: (event: CustomEvent<any>) => void): () => void;
|
|
$on(eventname: "open", cb: (event: CustomEvent<any>) => void): () => void;
|
|
$on(eventname: string, cb: (event: Event) => void): () => void;
|
|
}
|