2023-03-01 13:06:17 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Toast is used to display messages in an overlay.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/toast/)
|
|
|
|
*
|
|
|
|
* @module toast
|
|
|
|
*
|
|
|
|
*/
|
2022-12-08 11:04:25 +00:00
|
|
|
import { ButtonHTMLAttributes, VNode } from 'vue';
|
2022-09-06 12:03:37 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
|
|
|
|
2023-04-28 13:39:19 +00:00
|
|
|
export declare type ToastPassThroughOptionType = ToastPassThroughAttributes | ((options: ToastPassThroughMethodOptions) => ToastPassThroughAttributes) | null | undefined;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface ToastPassThroughMethodOptions {
|
|
|
|
props: ToastProps;
|
|
|
|
state: ToastState;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link ToastProps.pt}
|
|
|
|
*/
|
|
|
|
export interface ToastPassThroughOptions {
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the root's DOM element.
|
|
|
|
*/
|
|
|
|
root?: ToastPassThroughOptionType;
|
2023-05-03 14:14:24 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the message's DOM element.
|
|
|
|
*/
|
|
|
|
message?: ToastPassThroughOptionType;
|
2023-04-28 13:39:19 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the container's DOM element.
|
|
|
|
*/
|
|
|
|
container?: ToastPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the content's DOM element.
|
|
|
|
*/
|
|
|
|
content?: ToastPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the icon's DOM element.
|
|
|
|
*/
|
|
|
|
icon?: ToastPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the text's DOM element.
|
|
|
|
*/
|
|
|
|
text?: ToastPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the summary's DOM element.
|
|
|
|
*/
|
|
|
|
summary?: ToastPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the detail's DOM element.
|
|
|
|
*/
|
|
|
|
detail?: ToastPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the button container's DOM element.
|
|
|
|
*/
|
|
|
|
buttonContainer?: ToastPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the button's DOM element.
|
|
|
|
*/
|
|
|
|
button?: ToastPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the button icon's DOM element.
|
|
|
|
*/
|
|
|
|
buttonIcon?: ToastPassThroughOptionType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface ToastPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
2023-03-07 08:00:47 +00:00
|
|
|
/**
|
|
|
|
* Defines message options in Toast component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface ToastMessageOptions {
|
|
|
|
/**
|
|
|
|
* Severity level of the message.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue info
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-04-14 12:03:58 +00:00
|
|
|
severity?: 'success' | 'info' | 'warn' | 'error' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Summary content of the message.
|
|
|
|
*/
|
|
|
|
summary?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Detail content of the message.
|
|
|
|
*/
|
|
|
|
detail?: any | undefined;
|
|
|
|
/**
|
|
|
|
* Whether the message can be closed manually using the close icon.
|
2023-03-03 08:18:55 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
closable?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Delay in milliseconds to close the message automatically.
|
|
|
|
*/
|
|
|
|
life?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Key of the Toast to display the message.
|
|
|
|
*/
|
|
|
|
group?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Style class of the message.
|
|
|
|
*/
|
|
|
|
styleClass?: any;
|
|
|
|
/**
|
|
|
|
* Style class of the content.
|
|
|
|
*/
|
|
|
|
contentStyleClass?: any;
|
|
|
|
}
|
|
|
|
|
2023-03-07 08:00:47 +00:00
|
|
|
/**
|
|
|
|
* Defines breakpoints type in Toast component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface ToastBreakpointsType {
|
|
|
|
/**
|
|
|
|
* Breakpoint for responsive mode.
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
*
|
|
|
|
* <Toast :breakpoints="{'960px': { width: '75vw', ... }" ... />
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
2023-04-28 13:39:19 +00:00
|
|
|
/**
|
|
|
|
* Defines current inline state in Toast component.
|
|
|
|
*/
|
|
|
|
export interface ToastState {
|
|
|
|
/**
|
|
|
|
* Current messages.
|
|
|
|
*/
|
|
|
|
messages: any[];
|
|
|
|
}
|
|
|
|
|
2023-03-01 13:06:17 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in Toast component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface ToastProps {
|
|
|
|
/**
|
|
|
|
* Unique identifier of a message group.
|
|
|
|
*/
|
|
|
|
group?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Position of the toast in viewport.
|
2023-03-01 13:06:17 +00:00
|
|
|
* @defaultValue top-right
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 13:06:17 +00:00
|
|
|
position?: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'center' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Whether to automatically manage layering.
|
2023-03-01 13:06:17 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
autoZIndex?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Base zIndex value to use in layering.
|
2023-03-01 13:06:17 +00:00
|
|
|
* @defaultValue 0
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
baseZIndex?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Object literal to define styles per screen size.
|
|
|
|
* @see ToastBreakpointsType
|
|
|
|
*/
|
|
|
|
breakpoints?: ToastBreakpointsType;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Icon to display in the toast close button.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'closeicon' slot.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
closeIcon?: string | undefined;
|
|
|
|
/**
|
2023-04-14 12:03:58 +00:00
|
|
|
* Icon to display in the toast with info severity.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'icon' slot.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
2023-04-14 12:03:58 +00:00
|
|
|
infoIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Icon to display in the toast with warn severity.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'icon' slot.
|
2023-04-14 12:03:58 +00:00
|
|
|
*/
|
|
|
|
warnIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Icon to display in the toast with error severity.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'icon' slot.
|
2023-04-14 12:03:58 +00:00
|
|
|
*/
|
|
|
|
errorIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Icon to display in the toast with success severity.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'icon' slot.
|
2023-04-14 12:03:58 +00:00
|
|
|
*/
|
|
|
|
successIcon?: string | undefined;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass all properties of the HTMLButtonElement to the close button.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.26.0. Use 'pt' property.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
closeButtonProps?: ButtonHTMLAttributes | undefined;
|
2023-04-28 13:39:19 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to DOM elements inside the component.
|
|
|
|
* @type {ToastPassThroughOptions}
|
|
|
|
*/
|
|
|
|
pt?: ToastPassThroughOptions;
|
2023-05-25 21:53:07 +00:00
|
|
|
/**
|
|
|
|
* When enabled, it removes component related styles in the core.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
unstyled?: boolean;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-07 08:00:47 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slot in Toast component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface ToastSlots {
|
|
|
|
/**
|
|
|
|
* Custom message template.
|
|
|
|
* @param {Object} scope - message slot's params.
|
|
|
|
*/
|
2023-03-01 13:06:17 +00:00
|
|
|
message(scope: {
|
2022-09-14 11:26:01 +00:00
|
|
|
/**
|
|
|
|
* Message of the component
|
|
|
|
*/
|
|
|
|
message: any;
|
2023-03-01 13:06:17 +00:00
|
|
|
}): VNode[];
|
2023-04-11 21:25:24 +00:00
|
|
|
/**
|
|
|
|
* Custom icon template.
|
|
|
|
*/
|
|
|
|
icon(): VNode[];
|
|
|
|
/**
|
|
|
|
* Custom close icon template.
|
|
|
|
*/
|
|
|
|
closeicon(): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-07 08:00:47 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in Toast component.
|
|
|
|
*/
|
2023-03-07 12:36:38 +00:00
|
|
|
export interface ToastEmits {
|
|
|
|
/**
|
|
|
|
* Callback to invoke when the toast is closed.
|
|
|
|
* @param {ToastMessageOptions} message - Toast message.
|
|
|
|
*/
|
|
|
|
close(message: ToastMessageOptions): void;
|
|
|
|
/**
|
|
|
|
* Callback to invoke when the toast's timeout is over.
|
|
|
|
* @param {ToastMessageOptions} message - Toast message.
|
|
|
|
*/
|
|
|
|
'life-end'(message: ToastMessageOptions): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 13:06:17 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - Toast**
|
|
|
|
*
|
|
|
|
* _Toast is used to display messages in an overlay._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/toast/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-01 13:06:17 +00:00
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
declare class Toast extends ClassComponent<ToastProps, ToastSlots, ToastEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
Toast: GlobalComponentConstructor<Toast>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Toast;
|