/** * Notifications allow additional UI components to be specified by applications. The service controls the * positioning and styling of these components. * * @module Controls */ /** * Need a comment block here so that the comment block above is interpreted as a file comment, and not a comment on the * import below. * * @hidden */ import { ActionDeclaration } from './actions'; import { ActionableTextTemplateFragment, ImageTemplateFragment, ContainerTemplateFragment } from './templates'; /** * Helper to make the `type` field required on any type that defines it as being optional. */ type WithExplicitType = T & { type: string; }; /** * *Not yet implemented* * * Union of the options objects of all "primary control" components supported by the service. */ export type PrimaryControlOptions = never; /** * Union of options objects of all components that can be added to a notification, includes both buttons and primary * controls. */ export type ControlOptions = Required> | WithExplicitType | WithExplicitType | WithExplicitType; /** * Configuration options for constructing a button within a notification. */ export interface ButtonOptions { /** * The type of the control. Optional, added automatically if `NotificationOptions.buttons` includes the `onClick` * property and therefore generates a `notification-action` event. */ type?: 'button'; /** * User-facing button text. * * The button caption should be kept short, particularly if there are multiple buttons. Notifications are * fixed-width, and all buttons will be displayed on the same row. */ title: string; /** * Indicates that this button will be visually displayed as a 'Call to Action' button. In this case a Call To Action * means the button is made more prominent. We recommend you use this for true calls to action. For example, if you * have a notification which contains a report, it might have an 'OK' button which takes you to the report, and a * 'Dismiss' button which simply closes the notification. We suggest you make only the 'OK' button a CTA here.' * * If set as `false` or `undefined`, the default simple text button will be used instead. */ cta?: boolean; /** * Indicates that this button should submit a form. * If a form is invalid, based on your validation rules provided, the button will be disabled until the users input within the form is valid. */ submit?: boolean; /** * @deprecated * Optional icon URL, if an icon should be placed on the button. * * Icons are placed to the left of the button text. */ iconUrl?: string; /** * Defines the data to be passed back to the application when the button is clicked. * * The {@link NotificationActionResult} specified here will be returned to the application via a * `notification-action` event when the button is clicked. * * If omitted or `null`, applications will not receive a {@link NotificationActionEvent|`notification-action`} * event when the button is clicked. This may be appropriate if the button represents a "dismiss" or some other * side-effect-free interaction. Even if `onClick` is omitted or `null`, a `notification-closed` event will still be * raised after the button click. * */ onClick?: ActionDeclaration | null; /** * Button index used for events. This gets set when hydrating. * * @hidden */ index?: number; formOptions?: { /** * Title to display on a button when form is submitting. */ submittingTitle?: string | null; /** * Title to display on a button when form is in the error state. */ errorTitle?: string | null; /** * Title to display on a button when form is in the success state. */ successTitle?: string | null; } | null; } export {};