2023-10-02 10:46:09 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
|
|
|
|
// Position
|
|
|
|
const inlineStyles = {
|
|
|
|
root: ({ position }) => ({
|
|
|
|
position: 'fixed',
|
|
|
|
top: position === 'top-right' || position === 'top-left' || position === 'top-center' ? '20px' : position === 'center' ? '50%' : null,
|
|
|
|
right: (position === 'top-right' || position === 'bottom-right') && '20px',
|
|
|
|
bottom: (position === 'bottom-left' || position === 'bottom-right' || position === 'bottom-center') && '20px',
|
|
|
|
left: position === 'top-left' || position === 'bottom-left' ? '20px' : position === 'center' || position === 'top-center' || position === 'bottom-center' ? '50%' : null
|
|
|
|
})
|
|
|
|
};
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ props, instance }) => [
|
|
|
|
'p-toast p-component p-toast-' + props.position,
|
|
|
|
{
|
|
|
|
'p-ripple-disabled': instance.$primevue.config.ripple === false
|
|
|
|
}
|
|
|
|
],
|
2024-04-30 08:15:34 +00:00
|
|
|
message: ({ props }) => [
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-toast-message',
|
|
|
|
{
|
|
|
|
'p-toast-message-info': props.message.severity === 'info' || props.message.severity === undefined,
|
|
|
|
'p-toast-message-warn': props.message.severity === 'warn',
|
|
|
|
'p-toast-message-error': props.message.severity === 'error',
|
2024-02-03 11:36:08 +00:00
|
|
|
'p-toast-message-success': props.message.severity === 'success',
|
|
|
|
'p-toast-message-secondary': props.message.severity === 'secondary',
|
|
|
|
'p-toast-message-contrast': props.message.severity === 'contrast'
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
],
|
2024-04-30 08:15:34 +00:00
|
|
|
messageContent: 'p-toast-message-content',
|
|
|
|
messageIcon: ({ props }) => [
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-toast-message-icon',
|
|
|
|
{
|
|
|
|
[props.infoIcon]: props.message.severity === 'info',
|
|
|
|
[props.warnIcon]: props.message.severity === 'warn',
|
|
|
|
[props.errorIcon]: props.message.severity === 'error',
|
|
|
|
[props.successIcon]: props.message.severity === 'success'
|
|
|
|
}
|
|
|
|
],
|
2024-04-30 08:15:34 +00:00
|
|
|
messageText: 'p-toast-message-text',
|
2023-10-02 10:46:09 +00:00
|
|
|
summary: 'p-toast-summary',
|
|
|
|
detail: 'p-toast-detail',
|
2024-04-09 09:05:34 +00:00
|
|
|
closeButton: 'p-toast-close-button',
|
|
|
|
closeIcon: 'p-toast-close-icon'
|
2023-10-02 10:46:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'toast',
|
|
|
|
classes,
|
|
|
|
inlineStyles
|
|
|
|
});
|