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-menu {
|
|
|
|
padding: 0.25rem 0.25rem;
|
|
|
|
background: ${dt('menu.background')};
|
|
|
|
color: ${dt('menu.color')};
|
|
|
|
border: 1px solid ${dt('menu.border.color')};
|
|
|
|
border-radius: ${dt('rounded.base')};
|
|
|
|
min-width: 12.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-list {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
2024-05-02 10:56:41 +00:00
|
|
|
outline: 0;
|
2024-05-01 08:26:48 +00:00
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-item {
|
|
|
|
margin: 2px 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-item:first-child {
|
|
|
|
margin-top: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-item:last-child {
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-item-link {
|
|
|
|
cursor: pointer;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
text-decoration: none;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
|
|
|
color: inherit;
|
|
|
|
padding: 0.5rem 0.75rem;
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-item-content {
|
|
|
|
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')};
|
|
|
|
border-radius: ${dt('rounded.sm')};
|
|
|
|
color: ${dt('menu.item.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-item-label {
|
|
|
|
line-height: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-item-icon {
|
|
|
|
color: ${dt('menu.item.icon.color')};
|
|
|
|
margin-right: 0.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-item.p-focus .p-menu-item-content {
|
2024-05-05 15:51:29 +00:00
|
|
|
color: ${dt('menu.item.focus.color')};
|
|
|
|
background: ${dt('menu.item.focus.background')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-item.p-focus .p-menu-item-icon {
|
2024-05-04 17:06:51 +00:00
|
|
|
color: ${dt('menu.item.icon.hover.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-item:not(.p-disabled) .p-menu-item-content:hover {
|
2024-05-05 15:51:29 +00:00
|
|
|
color: ${dt('menu.item.focus.color')};
|
|
|
|
background: ${dt('menu.item.focus.background')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-item:not(.p-disabled) .p-menu-item-content:hover .p-menu-item-icon {
|
2024-05-04 17:06:51 +00:00
|
|
|
color: ${dt('menu.item.icon.hover.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-overlay {
|
|
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-submenu-item {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0.5rem 0.75rem;
|
2024-05-04 17:06:51 +00:00
|
|
|
color: ${dt('menu.submenu.item.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
font-weight: 600;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-menu-separator {
|
|
|
|
border-top: 1px solid ${dt('menu.separator.border.color.color')};
|
|
|
|
margin: 2px 0;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
const classes = {
|
|
|
|
root: ({ instance, props }) => [
|
|
|
|
'p-menu p-component',
|
|
|
|
{
|
|
|
|
'p-menu-overlay': props.popup,
|
|
|
|
'p-ripple-disabled': instance.$primevue.config.ripple === false
|
|
|
|
}
|
|
|
|
],
|
|
|
|
start: 'p-menu-start',
|
2024-04-30 13:02:03 +00:00
|
|
|
list: 'p-menu-list',
|
|
|
|
submenuItem: 'p-menu-submenu-item',
|
2024-04-09 11:59:41 +00:00
|
|
|
separator: 'p-menu-separator',
|
2023-10-02 10:46:09 +00:00
|
|
|
end: 'p-menu-end',
|
2024-04-30 13:02:03 +00:00
|
|
|
item: ({ instance }) => [
|
2024-04-09 11:59:41 +00:00
|
|
|
'p-menu-item',
|
2023-10-02 10:46:09 +00:00
|
|
|
{
|
|
|
|
'p-focus': instance.id === instance.focusedOptionId,
|
|
|
|
'p-disabled': instance.disabled()
|
|
|
|
}
|
|
|
|
],
|
2024-04-30 13:02:03 +00:00
|
|
|
itemContent: 'p-menu-item-content',
|
|
|
|
itemLink: 'p-menu-item-link',
|
|
|
|
itemIcon: 'p-menu-item-icon',
|
2024-04-09 13:21:05 +00:00
|
|
|
label: 'p-menu-item-label'
|
2023-10-02 10:46:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'menu',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2023-10-02 10:46:09 +00:00
|
|
|
classes
|
|
|
|
});
|