@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
98 lines (97 loc) • 5.62 kB
TypeScript
/// <reference path="../../index.d.ts" />
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
import type { Appearance, Kind, Scale, Width } from "../interfaces.js";
import type { IconName } from "../calcite-icon/interfaces.js";
/**
* Notices are intended to be used to present users with important-but-not-crucial contextual tips or copy. Because
* notices are displayed inline, a common use case is displaying them on page-load to present users with short hints or contextual copy.
* They are optionally closable - useful for keeping track of whether or not a user has closed the notice. You can also choose not
* to display a notice on page load and set the "active" attribute as needed to contextually provide inline messaging to users.
*
* @cssproperty [--calcite-notice-background-color] - When `appearance="outline-fill"`, specifies the component's background color.
* @cssproperty [--calcite-notice-border-color] - When `appearance="outline-fill"`, specifies the component's border color.
* @cssproperty [--calcite-notice-corner-radius] - Specifies the component's border radius.
* @cssproperty [--calcite-notice-close-background-color] - Specifies the background color of the component's close element.
* @cssproperty [--calcite-notice-close-background-color-hover] - Specifies the background color of the component's close element when hovered.
* @cssproperty [--calcite-notice-close-background-color-focus] - [Deprecated] Specifies the background color of the component's close element when hovered. Use `--calcite-notice-close-background-color-hover` instead.
* @cssproperty [--calcite-notice-close-background-color-press] - Specifies the background color of the component's close element when active.
* @cssproperty [--calcite-notice-close-icon-color-hover] - Specifies the icon color of the component's close element when hovered or active.
* @cssproperty [--calcite-notice-close-icon-color] - Specifies the icon color of the component's close element.
* @cssproperty [--calcite-notice-title-text-color] - Specifies the component's slotted `"title"` content text color.
* @cssproperty [--calcite-notice-content-text-color] - Specifies the component's slotted `"message"` content text color.
* @cssproperty [--calcite-notice-width] - [Deprecated] Specifies the component's width.
* @cssproperty [--calcite-notice-shadow] - Specifies the component's shadow.
* @slot [title] - A slot for adding a title.
* @slot [message] - A slot for adding a message.
* @slot [link] - A slot for adding a `calcite-action` to take, such as: "undo", "try again", "link to page", etc.
* @slot [actions-end] - A slot for adding `calcite-action`s to the end of the component. It is recommended to use two or less `calcite-action`s.
*/
export abstract class Notice extends LitElement {
/**
* Specifies the appearance of the component.
*
* @default "outline-fill"
*/
accessor appearance: Extract<"transparent" | "outline-fill", Appearance>;
/**
* When `true`, displays a close button in the component.
*
* @default false
*/
accessor closable: boolean;
/** When `true`, shows a default recommended icon. Alternatively, pass a Calcite UI Icon name to display a specific icon. */
accessor icon: IconName | boolean;
/**
* When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`).
*
* @default false
*/
accessor iconFlipRtl: boolean;
/**
* Specifies the kind of the component, which will apply to the top border and icon.
*
* @default "brand"
*/
accessor kind: Extract<"brand" | "danger" | "info" | "success" | "warning" | "neutral", Kind>;
/** Overrides individual strings used by the component. */
accessor messageOverrides: { close?: string; };
/**
* When `true`, the component is visible.
*
* @default false
*/
accessor open: boolean;
/**
* Specifies the size of the component.
*
* @default "m"
*/
accessor scale: Scale;
/**
* Specifies the width of the component. [Deprecated] The `"half"` value is deprecated, use `"full"` instead.
*
* @default "auto"
*/
accessor width: Extract<Width, "auto" | "half" | "full">;
/**
* Sets focus on the component's first focusable element.
*
* @param options - When specified an optional object customizes the component's focusing process. When `preventScroll` is `true`, scrolling will not occur on the component.
* @mdn [focus(options)](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#options)
*/
setFocus(options?: FocusOptions): Promise<void>;
/** Fires when the component is requested to be closed and before the closing transition begins. */
readonly calciteNoticeBeforeClose: import("@arcgis/lumina").TargetedEvent<this, void>;
/** Fires when the component is added to the DOM but not rendered, and before the opening transition begins. */
readonly calciteNoticeBeforeOpen: import("@arcgis/lumina").TargetedEvent<this, void>;
/** Fires when the component is closed and animation is complete. */
readonly calciteNoticeClose: import("@arcgis/lumina").TargetedEvent<this, void>;
/** Fires when the component is open and animation is complete. */
readonly calciteNoticeOpen: import("@arcgis/lumina").TargetedEvent<this, void>;
readonly "@eventTypes": {
calciteNoticeBeforeClose: Notice["calciteNoticeBeforeClose"]["detail"];
calciteNoticeBeforeOpen: Notice["calciteNoticeBeforeOpen"]["detail"];
calciteNoticeClose: Notice["calciteNoticeClose"]["detail"];
calciteNoticeOpen: Notice["calciteNoticeOpen"]["detail"];
};
}