primevue-mirror/components/lib/toast/Toast.d.ts

171 lines
3.9 KiB
TypeScript
Raw Normal View History

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-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-03-27 08:09:36 +00:00
severity?: 'success' | 'info' | 'warn' | 'error' | string | 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-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.
*/
closeIcon?: string | undefined;
/**
* Icon to display in the toast.
2022-12-08 11:04:25 +00:00
*/
icon?: string | undefined;
2022-12-08 11:04:25 +00:00
/**
* Uses to pass all properties of the HTMLButtonElement to the close button.
*/
closeButtonProps?: ButtonHTMLAttributes | undefined;
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[];
/**
* 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.
*/
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;