primevue-mirror/components/lib/message/style/MessageStyle.js

204 lines
5.8 KiB
JavaScript
Raw Normal View History

import BaseStyle from 'primevue/base/style';
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
}
.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')};
}
.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')};
background: transparent;
2024-05-09 15:02:06 +00:00
transition: background ${dt('transition.duration')}, color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')};
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')};
}
.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')};
}
.p-message-info {
background: ${dt('message.info.background')};
2024-05-09 15:48:00 +00:00
border-color: ${dt('message.info.border.color')};
color: ${dt('message.info.color')};
2024-05-06 21:23:42 +00:00
box-shadow: ${dt('message.info.shadow')};
}
.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')};
}
.p-message-info .p-message-close-button:hover {
2024-05-04 12:23:26 +00:00
background: ${dt('message.info.close.button.hover.background')};
}
.p-message-success {
background: ${dt('message.success.background')};
2024-05-09 15:48:00 +00:00
border-color: ${dt('message.success.border.color')};
color: ${dt('message.success.color')};
2024-05-06 21:23:42 +00:00
box-shadow: ${dt('message.success.shadow')};
}
.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')};
}
.p-message-success .p-message-close-button:hover {
2024-05-04 12:23:26 +00:00
background: ${dt('message.success.close.button.hover.background')};
}
.p-message-warn {
background: ${dt('message.warn.background')};
2024-05-09 15:48:00 +00:00
border-color: ${dt('message.warn.border.color')};
color: ${dt('message.warn.color')};
2024-05-06 21:23:42 +00:00
box-shadow: ${dt('message.warn.shadow')};
}
.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')};
}
.p-message-warn .p-message-close-button:hover {
2024-05-04 12:23:26 +00:00
background: ${dt('message.warn.close.button.hover.background')};
}
.p-message-error {
background: ${dt('message.error.background')};
2024-05-09 15:48:00 +00:00
border-color: ${dt('message.error.border.color')};
color: ${dt('message.error.color')};
2024-05-06 21:23:42 +00:00
box-shadow: ${dt('message.error.shadow')};
}
.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')};
}
.p-message-error .p-message-close-button:hover {
2024-05-04 12:23:26 +00:00
background: ${dt('message.error.close.button.hover.background')};
}
.p-message-secondary {
background: ${dt('message.secondary.background')};
2024-05-09 15:48:00 +00:00
border-color: ${dt('message.secondary.border.color')};
color: ${dt('message.secondary.color')};
2024-05-06 21:23:42 +00:00
box-shadow: ${dt('message.secondary.shadow')};
}
.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')};
}
.p-message-secondary .p-message-close-button:hover {
2024-05-04 12:23:26 +00:00
background: ${dt('message.secondary.close.button.hover.background')};
}
.p-message-contrast {
background: ${dt('message.contrast.background')};
2024-05-09 15:48:00 +00:00
border-color: ${dt('message.contrast.border.color')};
color: ${dt('message.contrast.color')};
2024-05-06 21:23:42 +00:00
box-shadow: ${dt('message.contrast.shadow')};
}
.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')};
}
.p-message-contrast .p-message-close-button:hover {
2024-05-04 12:23:26 +00:00
background: ${dt('message.contrast.close.button.hover.background')};
}
.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')};
}
.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')};
}
.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;
}
`;
const classes = {
root: ({ props }) => 'p-message p-component p-message-' + props.severity,
2024-04-30 06:54:48 +00:00
content: 'p-message-content',
icon: 'p-message-icon',
text: 'p-message-text',
2024-04-09 09:00:55 +00:00
closeButton: 'p-message-close-button',
closeIcon: 'p-message-close-icon'
};
export default BaseStyle.extend({
name: 'message',
theme,
classes
});