primevue-mirror/components/lib/dialog/style/DialogStyle.js

187 lines
5.0 KiB
JavaScript
Raw Normal View History

import BaseStyle from 'primevue/base/style';
2024-05-01 08:32:36 +00:00
const theme = ({ dt }) => `
.p-dialog {
max-height: 90%;
transform: scale(1);
2024-05-09 11:41:08 +00:00
border-radius: ${dt('dialog.border.radius')};
box-shadow: ${dt('dialog.shadow')};
2024-05-01 08:32:36 +00:00
background: ${dt('dialog.background')};
border: 1px solid ${dt('dialog.border.color')};
color: ${dt('dialog.color')};
}
.p-dialog-content {
overflow-y: auto;
2024-05-09 11:41:08 +00:00
padding: ${dt('dialog.content.padding')};
2024-05-01 08:32:36 +00:00
}
.p-dialog-header {
display: flex;
align-items: center;
justify-content: space-between;
flex-shrink: 0;
2024-05-09 11:41:08 +00:00
padding: ${dt('dialog.header.padding')};
2024-05-01 08:32:36 +00:00
}
.p-dialog-title {
2024-05-09 11:41:08 +00:00
font-weight: ${dt('dialog.title.font.weight')};
font-size: ${dt('dialog.title.font.size')};
2024-05-01 08:32:36 +00:00
}
.p-dialog-footer {
flex-shrink: 0;
2024-05-09 11:41:08 +00:00
padding: ${dt('dialog.footer.padding')};
2024-05-01 08:32:36 +00:00
display: flex;
justify-content: flex-end;
2024-05-09 11:41:08 +00:00
gap: ${dt('dialog.footer.gap')};
2024-05-01 08:32:36 +00:00
}
.p-dialog-header-actions {
display: flex;
align-items: center;
2024-05-09 11:41:08 +00:00
gap: ${dt('dialog.header.gap')};
2024-05-01 08:32:36 +00:00
}
.p-dialog-enter-active {
transition: all 150ms cubic-bezier(0, 0, 0.2, 1);
}
.p-dialog-leave-active {
transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.p-dialog-enter-from,
.p-dialog-leave-to {
opacity: 0;
transform: scale(0.7);
}
.p-dialog-top .p-dialog,
.p-dialog-bottom .p-dialog,
.p-dialog-left .p-dialog,
.p-dialog-right .p-dialog,
.p-dialog-topleft .p-dialog,
.p-dialog-topright .p-dialog,
.p-dialog-bottomleft .p-dialog,
.p-dialog-bottomright .p-dialog {
margin: 0.75rem;
transform: translate3d(0px, 0px, 0px);
}
.p-dialog-top .p-dialog-enter-active,
.p-dialog-top .p-dialog-leave-active,
.p-dialog-bottom .p-dialog-enter-active,
.p-dialog-bottom .p-dialog-leave-active,
.p-dialog-left .p-dialog-enter-active,
.p-dialog-left .p-dialog-leave-active,
.p-dialog-right .p-dialog-enter-active,
.p-dialog-right .p-dialog-leave-active,
.p-dialog-topleft .p-dialog-enter-active,
.p-dialog-topleft .p-dialog-leave-active,
.p-dialog-topright .p-dialog-enter-active,
.p-dialog-topright .p-dialog-leave-active,
.p-dialog-bottomleft .p-dialog-enter-active,
.p-dialog-bottomleft .p-dialog-leave-active,
.p-dialog-bottomright .p-dialog-enter-active,
.p-dialog-bottomright .p-dialog-leave-active {
transition: all 0.3s ease-out;
}
.p-dialog-top .p-dialog-enter-from,
.p-dialog-top .p-dialog-leave-to {
transform: translate3d(0px, -100%, 0px);
}
.p-dialog-bottom .p-dialog-enter-from,
.p-dialog-bottom .p-dialog-leave-to {
transform: translate3d(0px, 100%, 0px);
}
.p-dialog-left .p-dialog-enter-from,
.p-dialog-left .p-dialog-leave-to,
.p-dialog-topleft .p-dialog-enter-from,
.p-dialog-topleft .p-dialog-leave-to,
.p-dialog-bottomleft .p-dialog-enter-from,
.p-dialog-bottomleft .p-dialog-leave-to {
transform: translate3d(-100%, 0px, 0px);
}
.p-dialog-right .p-dialog-enter-from,
.p-dialog-right .p-dialog-leave-to,
.p-dialog-topright .p-dialog-enter-from,
.p-dialog-topright .p-dialog-leave-to,
.p-dialog-bottomright .p-dialog-enter-from,
.p-dialog-bottomright .p-dialog-leave-to {
transform: translate3d(100%, 0px, 0px);
}
.p-dialog-maximized {
width: 100vw !important;
height: 100vh !important;
top: 0px !important;
left: 0px !important;
max-height: 100%;
height: 100%;
border-radius: 0;
}
.p-dialog-maximized .p-dialog-content {
flex-grow: 1;
}
`;
/* Position */
const inlineStyles = {
mask: ({ position, modal }) => ({
position: 'fixed',
height: '100%',
width: '100%',
left: 0,
top: 0,
display: 'flex',
justifyContent: position === 'left' || position === 'topleft' || position === 'bottomleft' ? 'flex-start' : position === 'right' || position === 'topright' || position === 'bottomright' ? 'flex-end' : 'center',
alignItems: position === 'top' || position === 'topleft' || position === 'topright' ? 'flex-start' : position === 'bottom' || position === 'bottomleft' || position === 'bottomright' ? 'flex-end' : 'center',
pointerEvents: modal ? 'auto' : 'none'
}),
root: {
display: 'flex',
flexDirection: 'column',
pointerEvents: 'auto'
}
};
const classes = {
mask: ({ props }) => {
const positions = ['left', 'right', 'top', 'topleft', 'topright', 'bottom', 'bottomleft', 'bottomright'];
const pos = positions.find((item) => item === props.position);
return [
'p-dialog-mask',
{
2024-05-13 14:02:20 +00:00
'p-overlay-mask p-overlay-mask-enter': props.modal
},
pos ? `p-dialog-${pos}` : ''
];
},
root: ({ props, instance }) => [
'p-dialog p-component',
{
'p-dialog-maximized': props.maximizable && instance.maximized
}
],
header: 'p-dialog-header',
title: 'p-dialog-title',
headerActions: 'p-dialog-header-actions',
2024-05-06 15:23:01 +00:00
pcMaximizeButton: 'p-dialog-maximize-button',
pcCloseButton: 'p-dialog-close-button',
content: 'p-dialog-content',
footer: 'p-dialog-footer'
};
export default BaseStyle.extend({
name: 'dialog',
2024-05-01 08:32:36 +00:00
theme,
classes,
inlineStyles
});