2023-10-02 10:46:09 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
const theme = ({ dt }) => `
|
2024-05-09 15:02:06 +00:00
|
|
|
.p-message {
|
|
|
|
margin: ${dt('message.margin')};
|
|
|
|
border-radius: ${dt('message.border.radius')};
|
2024-05-09 15:48:00 +00:00
|
|
|
border-width: ${dt('message.border.width')};
|
|
|
|
border-style: solid;
|
2024-05-09 15:02:06 +00:00
|
|
|
}
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
.p-message-content {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2024-05-09 15:02:06 +00:00
|
|
|
padding: ${dt('message.content.padding')};
|
|
|
|
gap: ${dt('message.content.gap')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-icon {
|
|
|
|
flex-shrink: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-close-button {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
flex-shrink: 0;
|
|
|
|
margin: 0 0 0 auto;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
2024-05-09 15:02:06 +00:00
|
|
|
width: ${dt('message.close.button.width')};
|
|
|
|
height: ${dt('message.close.button.height')};
|
|
|
|
border-radius: ${dt('message.close.button.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
background: transparent;
|
2024-05-25 08:18:55 +00:00
|
|
|
transition: background ${dt('message.transition.duration')}, color ${dt('message.transition.duration')}, outline-color ${dt('message.transition.duration')}, box-shadow ${dt('message.transition.duration')};
|
2024-05-01 08:26:48 +00:00
|
|
|
outline-color: transparent;
|
|
|
|
color: inherit;
|
|
|
|
padding: 0;
|
|
|
|
border: none;
|
|
|
|
cursor: pointer;
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
|
2024-05-09 15:02:06 +00:00
|
|
|
.p-message-close-icon {
|
|
|
|
font-size: ${dt('message.close.icon.size')};
|
|
|
|
width: ${dt('message.close.icon.size')};
|
|
|
|
height: ${dt('message.close.icon.size')};
|
|
|
|
}
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
.p-message-close-button:focus-visible {
|
2024-05-09 15:02:06 +00:00
|
|
|
outline-width: ${dt('message.close.button.focus.ring.width')};
|
|
|
|
outline-style: ${dt('message.close.button.focus.ring.style')};
|
|
|
|
outline-offset: ${dt('message.close.button.focus.ring.offset')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-info {
|
|
|
|
background: ${dt('message.info.background')};
|
2024-05-09 15:48:00 +00:00
|
|
|
border-color: ${dt('message.info.border.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
color: ${dt('message.info.color')};
|
2024-05-06 21:23:42 +00:00
|
|
|
box-shadow: ${dt('message.info.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-info .p-message-close-button:focus-visible {
|
2024-05-09 15:02:06 +00:00
|
|
|
outline-color: ${dt('message.info.close.button.focus.ring.color')};
|
|
|
|
box-shadow: ${dt('message.info.close.button.focus.ring.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-info .p-message-close-button:hover {
|
2024-05-04 12:23:26 +00:00
|
|
|
background: ${dt('message.info.close.button.hover.background')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-success {
|
|
|
|
background: ${dt('message.success.background')};
|
2024-05-09 15:48:00 +00:00
|
|
|
border-color: ${dt('message.success.border.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
color: ${dt('message.success.color')};
|
2024-05-06 21:23:42 +00:00
|
|
|
box-shadow: ${dt('message.success.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-success .p-message-close-button:focus-visible {
|
2024-05-09 15:02:06 +00:00
|
|
|
outline-color: ${dt('message.success.close.button.focus.ring.color')};
|
|
|
|
box-shadow: ${dt('message.success.close.button.focus.ring.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-success .p-message-close-button:hover {
|
2024-05-04 12:23:26 +00:00
|
|
|
background: ${dt('message.success.close.button.hover.background')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-warn {
|
|
|
|
background: ${dt('message.warn.background')};
|
2024-05-09 15:48:00 +00:00
|
|
|
border-color: ${dt('message.warn.border.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
color: ${dt('message.warn.color')};
|
2024-05-06 21:23:42 +00:00
|
|
|
box-shadow: ${dt('message.warn.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-warn .p-message-close-button:focus-visible {
|
2024-05-09 15:02:06 +00:00
|
|
|
outline-color: ${dt('message.warn.close.button.focus.ring.color')};
|
|
|
|
box-shadow: ${dt('message.warn.close.button.focus.ring.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-warn .p-message-close-button:hover {
|
2024-05-04 12:23:26 +00:00
|
|
|
background: ${dt('message.warn.close.button.hover.background')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-error {
|
|
|
|
background: ${dt('message.error.background')};
|
2024-05-09 15:48:00 +00:00
|
|
|
border-color: ${dt('message.error.border.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
color: ${dt('message.error.color')};
|
2024-05-06 21:23:42 +00:00
|
|
|
box-shadow: ${dt('message.error.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-error .p-message-close-button:focus-visible {
|
2024-05-09 15:02:06 +00:00
|
|
|
outline-color: ${dt('message.error.close.button.focus.ring.color')};
|
|
|
|
box-shadow: ${dt('message.error.close.button.focus.ring.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-error .p-message-close-button:hover {
|
2024-05-04 12:23:26 +00:00
|
|
|
background: ${dt('message.error.close.button.hover.background')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-secondary {
|
|
|
|
background: ${dt('message.secondary.background')};
|
2024-05-09 15:48:00 +00:00
|
|
|
border-color: ${dt('message.secondary.border.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
color: ${dt('message.secondary.color')};
|
2024-05-06 21:23:42 +00:00
|
|
|
box-shadow: ${dt('message.secondary.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-secondary .p-message-close-button:focus-visible {
|
2024-05-09 15:02:06 +00:00
|
|
|
outline-color: ${dt('message.secondary.close.button.focus.ring.color')};
|
|
|
|
box-shadow: ${dt('message.secondary.close.button.focus.ring.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-secondary .p-message-close-button:hover {
|
2024-05-04 12:23:26 +00:00
|
|
|
background: ${dt('message.secondary.close.button.hover.background')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-contrast {
|
|
|
|
background: ${dt('message.contrast.background')};
|
2024-05-09 15:48:00 +00:00
|
|
|
border-color: ${dt('message.contrast.border.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
color: ${dt('message.contrast.color')};
|
2024-05-06 21:23:42 +00:00
|
|
|
box-shadow: ${dt('message.contrast.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-contrast .p-message-close-button:focus-visible {
|
2024-05-09 15:02:06 +00:00
|
|
|
outline-color: ${dt('message.contrast.close.button.focus.ring.color')};
|
|
|
|
box-shadow: ${dt('message.contrast.close.button.focus.ring.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-contrast .p-message-close-button:hover {
|
2024-05-04 12:23:26 +00:00
|
|
|
background: ${dt('message.contrast.close.button.hover.background')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-text {
|
2024-05-09 15:02:06 +00:00
|
|
|
font-size: ${dt('message.text.font.size')};
|
|
|
|
font-weight: ${dt('message.text.font.weight')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-icon {
|
2024-05-09 15:02:06 +00:00
|
|
|
font-size: ${dt('message.icon.size')};
|
|
|
|
width: ${dt('message.icon.size')};
|
|
|
|
height: ${dt('message.icon.size')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-enter-from {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-enter-active {
|
|
|
|
transition: opacity 0.3s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-message.p-message-leave-from {
|
|
|
|
max-height: 1000px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-message.p-message-leave-to {
|
|
|
|
max-height: 0;
|
|
|
|
opacity: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-leave-active {
|
|
|
|
overflow: hidden;
|
|
|
|
transition: max-height 0.3s cubic-bezier(0, 1, 0, 1), opacity 0.3s, margin 0.15s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-leave-active .p-message-close-button {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
const classes = {
|
|
|
|
root: ({ props }) => 'p-message p-component p-message-' + props.severity,
|
2024-04-30 06:54:48 +00:00
|
|
|
content: 'p-message-content',
|
2023-10-02 10:46:09 +00:00
|
|
|
icon: 'p-message-icon',
|
|
|
|
text: 'p-message-text',
|
2024-04-09 09:00:55 +00:00
|
|
|
closeButton: 'p-message-close-button',
|
2023-10-02 10:46:09 +00:00
|
|
|
closeIcon: 'p-message-close-icon'
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'message',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2023-10-02 10:46:09 +00:00
|
|
|
classes
|
|
|
|
});
|