UNPKG

@awsui/components-react

Version:

On July 19th, 2022, we launched [Cloudscape Design System](https://cloudscape.design). Cloudscape is an evolution of AWS-UI. It consists of user interface guidelines, front-end components, design resources, and development tools for building intuitive, en

140 lines (139 loc) 4.11 kB
import React from 'react'; import { ErrorContext } from '../internal/analytics/interfaces'; import { BaseComponentProps } from '../internal/base-component'; import { NonCancelableEventHandler } from '../internal/events'; export declare namespace AlertProps { type Type = 'success' | 'error' | 'warning' | 'info'; interface Ref { /** * Sets focus on the alert content. */ focus(): void; } interface I18nStrings { successIconAriaLabel?: string; errorIconAriaLabel?: string; warningIconAriaLabel?: string; infoIconAriaLabel?: string; dismissAriaLabel?: string; } interface AnalyticsMetadata { errorContext?: ErrorContext; } interface Style { root?: { background?: string; borderColor?: string; borderRadius?: string; borderWidth?: string; color?: string; focusRing?: { borderColor?: string; borderRadius?: string; borderWidth?: string; }; }; icon?: { color?: string; }; dismissButton?: { color?: { active?: string; default?: string; hover?: string; }; focusRing?: { borderColor?: string; borderRadius?: string; borderWidth?: string; }; }; } interface PersistenceConfig { uniqueKey: string; crossServicePersistence?: boolean; } } export interface AlertProps extends BaseComponentProps { /** * Specifies the type of message you want to display. */ type?: AlertProps.Type; /** * Provides a text alternative for the icon. * * @deprecated Use the label properties inside `i18nStrings` instead. * If the label is assigned via the `i18nStrings` property, this label will be ignored. */ statusIconAriaLabel?: string; /** * Determines whether the alert is displayed. * @deprecated Use conditional rendering in your code instead of this prop. */ visible?: boolean; /** * Adds a close button to the alert when set to `true`. * An `onDismiss` event is fired when a user clicks the button. */ dismissible?: boolean; /** * Adds an aria-label to the dismiss button. * @i18n * * @deprecated Use `i18nStrings.dismissAriaLabel` instead. * If the label is assigned via the `i18nStrings` property, this label will be ignored. */ dismissAriaLabel?: string; /** * Primary text displayed in the element. */ children?: React.ReactNode; /** * Heading text. */ header?: React.ReactNode; /** * Displays an action button next to the message area when set. * An `onButtonClick` event is fired when the user clicks it. * @deprecated Replaced by `action`. */ buttonText?: React.ReactNode; /** * Specifies an action for the alert message. * Although it is technically possible to insert any content, our UX guidelines only allow you to add a button. */ action?: React.ReactNode; /** * Fired when the user clicks the close icon that is displayed * when the `dismissible` property is set to `true`. */ onDismiss?: NonCancelableEventHandler; /** * Fired when the user clicks the action button. * **Deprecated** Replaced by `action`. */ onButtonClick?: NonCancelableEventHandler; /** * An object containing all the necessary localized strings required by the component. * @property {AlertProps.I18nStrings} [i18nStrings] - optional * @i18n */ i18nStrings?: AlertProps.I18nStrings; /** * Specifies additional analytics-related metadata. * * `errorContext` - Identifies the error category and sub-category. * @analytics */ analyticsMetadata?: AlertProps.AnalyticsMetadata; /** * @awsuiSystem core */ /** * Config to persist dismiss state for dismissable Alert * persistenceConfig contains: * * `uniqueKey` (string) - This key to store the persistence state, it must be unique across your console. * * `crossServicePersistence` (boolean) - (Optional) If true, the persistence state will be shared across AWS services. * @awsuiSystem console */ persistenceConfig?: AlertProps.PersistenceConfig; }