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 }) => `
|
|
|
|
.p-contextmenu {
|
|
|
|
background: ${dt('contextmenu.background')};
|
|
|
|
color: ${dt('contextmenu.color')};
|
|
|
|
border: 1px solid ${dt('contextmenu.border.color')};
|
2024-05-10 08:44:25 +00:00
|
|
|
border-radius: ${dt('contextmenu.border.radius')};
|
|
|
|
box-shadow: ${dt('contextmenu.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
min-width: 12.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-root-list,
|
|
|
|
.p-contextmenu-submenu {
|
|
|
|
margin: 0;
|
2024-05-10 08:44:25 +00:00
|
|
|
padding: ${dt('contextmenu.list.padding')};
|
2024-05-01 08:26:48 +00:00
|
|
|
list-style: none;
|
|
|
|
outline: 0 none;
|
2024-05-10 08:44:25 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
gap: ${dt('contextmenu.list.gap')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-submenu {
|
|
|
|
position: absolute;
|
2024-05-10 08:57:09 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2024-05-01 08:26:48 +00:00
|
|
|
min-width: 100%;
|
|
|
|
z-index: 1;
|
|
|
|
background: ${dt('contextmenu.background')};
|
|
|
|
color: ${dt('contextmenu.color')};
|
|
|
|
border: 1px solid ${dt('contextmenu.border.color')};
|
2024-05-10 08:44:25 +00:00
|
|
|
border-radius: ${dt('contextmenu.border.radius')};
|
|
|
|
box-shadow: ${dt('contextmenu.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-item {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-item-content {
|
2024-05-10 08:44:25 +00:00
|
|
|
transition: background ${dt('transition.duration')}, color ${dt('transition.duration')};
|
|
|
|
border-radius: ${dt('contextmenu.item.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
color: ${dt('contextmenu.item.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-item-link {
|
|
|
|
cursor: pointer;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
text-decoration: none;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
|
|
|
color: inherit;
|
2024-05-10 08:44:25 +00:00
|
|
|
padding: ${dt('contextmenu.item.padding')};
|
|
|
|
gap: ${dt('contextmenu.item.gap')};
|
2024-05-01 08:26:48 +00:00
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-item-label {
|
|
|
|
line-height: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-item-icon {
|
|
|
|
color: ${dt('contextmenu.item.icon.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-submenu-icon {
|
2024-05-10 08:44:25 +00:00
|
|
|
color: ${dt('contextmenu.submenu.icon.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
margin-left: auto;
|
2024-05-10 08:44:25 +00:00
|
|
|
font-size: ${dt('contextmenu.submenu.icon.size')};
|
|
|
|
width: ${dt('contextmenu.submenu.icon.size')};
|
|
|
|
height: ${dt('contextmenu.submenu.icon.size')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-item.p-focus > .p-contextmenu-item-content {
|
2024-05-05 15:51:29 +00:00
|
|
|
color: ${dt('contextmenu.item.focus.color')};
|
|
|
|
background: ${dt('contextmenu.item.focus.background')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
2024-05-10 08:44:25 +00:00
|
|
|
.p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-item-icon {
|
|
|
|
color: ${dt('contextmenu.item.icon.focus.color')};
|
|
|
|
}
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
.p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-submenu-icon {
|
2024-05-10 08:44:25 +00:00
|
|
|
color: ${dt('contextmenu.submenu.icon.focus.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover {
|
2024-05-05 15:51:29 +00:00
|
|
|
color: ${dt('contextmenu.item.focus.color')};
|
|
|
|
background: ${dt('contextmenu.item.focus.background')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
2024-05-10 08:44:25 +00:00
|
|
|
.p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-item-icon {
|
|
|
|
color: ${dt('contextmenu.item.icon.focus.color')};
|
|
|
|
}
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
.p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-submenu-icon {
|
2024-05-10 08:44:25 +00:00
|
|
|
color: ${dt('contextmenu.submenu.icon.focus.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-item-active > .p-contextmenu-item-content {
|
2024-05-10 08:44:25 +00:00
|
|
|
color: ${dt('contextmenu.item.active.color')};
|
|
|
|
background: ${dt('contextmenu.item.active.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-item-icon {
|
|
|
|
color: ${dt('contextmenu.item.icon.active.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-submenu-icon {
|
2024-05-10 08:44:25 +00:00
|
|
|
color: ${dt('contextmenu.submenu.icon.active.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-separator {
|
|
|
|
border-top: 1px solid ${dt('contextmenu.separator.border.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-enter-from,
|
|
|
|
.p-contextmenu-leave-active {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-contextmenu-enter-active {
|
|
|
|
transition: opacity 250ms;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
const classes = {
|
2024-05-08 15:58:22 +00:00
|
|
|
root: 'p-contextmenu p-component',
|
2024-04-30 11:51:44 +00:00
|
|
|
rootList: 'p-contextmenu-root-list',
|
|
|
|
item: ({ instance, processedItem }) => [
|
2024-04-09 13:21:05 +00:00
|
|
|
'p-contextmenu-item',
|
2023-10-02 10:46:09 +00:00
|
|
|
{
|
2024-04-09 13:21:05 +00:00
|
|
|
'p-contextmenu-item-active': instance.isItemActive(processedItem),
|
2023-10-02 10:46:09 +00:00
|
|
|
'p-focus': instance.isItemFocused(processedItem),
|
|
|
|
'p-disabled': instance.isItemDisabled(processedItem)
|
|
|
|
}
|
|
|
|
],
|
2024-04-30 11:51:44 +00:00
|
|
|
itemContent: 'p-contextmenu-item-content',
|
|
|
|
itemLink: 'p-contextmenu-item-link',
|
|
|
|
itemIcon: 'p-contextmenu-item-icon',
|
|
|
|
itemLabel: 'p-contextmenu-item-label',
|
2024-04-09 13:21:05 +00:00
|
|
|
submenuIcon: 'p-contextmenu-submenu-icon',
|
2024-04-09 13:43:12 +00:00
|
|
|
submenu: 'p-contextmenu-submenu',
|
2024-04-09 13:21:05 +00:00
|
|
|
separator: 'p-contextmenu-separator'
|
2023-10-02 10:46:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'contextmenu',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2023-10-02 10:46:09 +00:00
|
|
|
classes
|
|
|
|
});
|