Tokens for ContextMenu

pull/5756/head
Cagatay Civici 2024-05-10 11:44:25 +03:00
parent 60130a3f12
commit 98704175e7
7 changed files with 80 additions and 49 deletions

View File

@ -30,7 +30,7 @@
<template v-if="!templates.item"> <template v-if="!templates.item">
<a v-ripple :href="getItemProp(processedItem, 'url')" :class="cx('itemLink')" :target="getItemProp(processedItem, 'target')" tabindex="-1" aria-hidden="true" v-bind="getPTOptions('itemLink', processedItem, index)"> <a v-ripple :href="getItemProp(processedItem, 'url')" :class="cx('itemLink')" :target="getItemProp(processedItem, 'target')" tabindex="-1" aria-hidden="true" v-bind="getPTOptions('itemLink', processedItem, index)">
<component v-if="templates.itemicon" :is="templates.itemicon" :item="processedItem.item" :class="cx('itemIcon')" /> <component v-if="templates.itemicon" :is="templates.itemicon" :item="processedItem.item" :class="cx('itemIcon')" />
<span v-else-if="getItemProp(processedItem, 'icon')" :class="[cx('icon'), getItemProp(processedItem, 'icon')]" v-bind="getPTOptions('itemIcon', processedItem, index)" /> <span v-else-if="getItemProp(processedItem, 'icon')" :class="[cx('itemIcon'), getItemProp(processedItem, 'icon')]" v-bind="getPTOptions('itemIcon', processedItem, index)" />
<span :id="getItemLabelId(processedItem)" :class="cx('itemLabel')" v-bind="getPTOptions('itemLabel', processedItem, index)">{{ getItemLabel(processedItem) }}</span> <span :id="getItemLabelId(processedItem)" :class="cx('itemLabel')" v-bind="getPTOptions('itemLabel', processedItem, index)">{{ getItemLabel(processedItem) }}</span>
<template v-if="getItemProp(processedItem, 'items')"> <template v-if="getItemProp(processedItem, 'items')">
<component v-if="templates.submenuicon" :is="templates.submenuicon" :active="isItemActive(processedItem)" :class="cx('submenuIcon')" /> <component v-if="templates.submenuicon" :is="templates.submenuicon" :active="isItemActive(processedItem)" :class="cx('submenuIcon')" />

View File

@ -2,50 +2,43 @@ import BaseStyle from 'primevue/base/style';
const theme = ({ dt }) => ` const theme = ({ dt }) => `
.p-contextmenu { .p-contextmenu {
padding: 0.25rem 0.25rem;
background: ${dt('contextmenu.background')}; background: ${dt('contextmenu.background')};
color: ${dt('contextmenu.color')}; color: ${dt('contextmenu.color')};
border: 1px solid ${dt('contextmenu.border.color')}; border: 1px solid ${dt('contextmenu.border.color')};
border-radius: ${dt('border.radius.md')}; border-radius: ${dt('contextmenu.border.radius')};
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); box-shadow: ${dt('contextmenu.shadow')};
min-width: 12.5rem; min-width: 12.5rem;
} }
.p-contextmenu-root-list, .p-contextmenu-root-list,
.p-contextmenu-submenu { .p-contextmenu-submenu {
margin: 0; margin: 0;
padding: 0; padding: ${dt('contextmenu.list.padding')};
list-style: none; list-style: none;
outline: 0 none; outline: 0 none;
display: flex;
flex-direction: column;
gap: ${dt('contextmenu.list.gap')};
} }
.p-contextmenu-submenu { .p-contextmenu-submenu {
position: absolute; position: absolute;
min-width: 100%; min-width: 100%;
z-index: 1; z-index: 1;
padding: 0.25rem 0.25rem;
background: ${dt('contextmenu.background')}; background: ${dt('contextmenu.background')};
color: ${dt('contextmenu.color')}; color: ${dt('contextmenu.color')};
border: 1px solid ${dt('contextmenu.border.color')}; border: 1px solid ${dt('contextmenu.border.color')};
border-radius: ${dt('border.radius.md')}; border-radius: ${dt('contextmenu.border.radius')};
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); box-shadow: ${dt('contextmenu.shadow')};
} }
.p-contextmenu-item { .p-contextmenu-item {
position: relative; position: relative;
margin: 2px 0;
}
.p-contextmenu-item:first-child {
margin-top: 0;
}
.p-contextmenu-item:last-child {
margin-bottom: 0;
} }
.p-contextmenu-item-content { .p-contextmenu-item-content {
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}; transition: background ${dt('transition.duration')}, color ${dt('transition.duration')};
border-radius: ${dt('border.radius.sm')}; border-radius: ${dt('contextmenu.item.border.radius')};
color: ${dt('contextmenu.item.color')}; color: ${dt('contextmenu.item.color')};
} }
@ -57,7 +50,8 @@ const theme = ({ dt }) => `
overflow: hidden; overflow: hidden;
position: relative; position: relative;
color: inherit; color: inherit;
padding: 0.5rem 0.75rem; padding: ${dt('contextmenu.item.padding')};
gap: ${dt('contextmenu.item.gap')};
user-select: none; user-select: none;
} }
@ -67,15 +61,14 @@ const theme = ({ dt }) => `
.p-contextmenu-item-icon { .p-contextmenu-item-icon {
color: ${dt('contextmenu.item.icon.color')}; color: ${dt('contextmenu.item.icon.color')};
margin-right: 0.5rem;
} }
.p-contextmenu-submenu-icon { .p-contextmenu-submenu-icon {
color: ${dt('contextmenu.item.icon.color')}; color: ${dt('contextmenu.submenu.icon.color')};
margin-left: auto; margin-left: auto;
font-size: 0.875rem; font-size: ${dt('contextmenu.submenu.icon.size')};
width: 0.875rem; width: ${dt('contextmenu.submenu.icon.size')};
height: 0.875rem; height: ${dt('contextmenu.submenu.icon.size')};
} }
.p-contextmenu-item.p-focus > .p-contextmenu-item-content { .p-contextmenu-item.p-focus > .p-contextmenu-item-content {
@ -83,9 +76,12 @@ const theme = ({ dt }) => `
background: ${dt('contextmenu.item.focus.background')}; background: ${dt('contextmenu.item.focus.background')};
} }
.p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-item-icon, .p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-item-icon {
color: ${dt('contextmenu.item.icon.focus.color')};
}
.p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-submenu-icon { .p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-submenu-icon {
color: ${dt('contextmenu.item.icon.hover.color')}; color: ${dt('contextmenu.submenu.icon.focus.color')};
} }
.p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover { .p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover {
@ -93,24 +89,29 @@ const theme = ({ dt }) => `
background: ${dt('contextmenu.item.focus.background')}; background: ${dt('contextmenu.item.focus.background')};
} }
.p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-item-icon, .p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-item-icon {
color: ${dt('contextmenu.item.icon.focus.color')};
}
.p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-submenu-icon { .p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-submenu-icon {
color: ${dt('contextmenu.item.icon.hover.color')}; color: ${dt('contextmenu.submenu.icon.focus.color')};
} }
.p-contextmenu-item-active > .p-contextmenu-item-content { .p-contextmenu-item-active > .p-contextmenu-item-content {
color: ${dt('contextmenu.item.focus.color')}; color: ${dt('contextmenu.item.active.color')};
background: ${dt('contextmenu.item.focus.background')}; 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')};
} }
.p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-item-icon,
.p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-submenu-icon { .p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-submenu-icon {
color: ${dt('contextmenu.item.icon.hover.color')}; color: ${dt('contextmenu.submenu.icon.active.color')};
} }
.p-contextmenu-separator { .p-contextmenu-separator {
border-top: 1px solid ${dt('contextmenu.separator.border.color')}; border-top: 1px solid ${dt('contextmenu.separator.border.color')};
margin: 2px 0;
} }
.p-contextmenu-enter-from, .p-contextmenu-enter-from,

View File

@ -2,19 +2,34 @@ export default {
root: { root: {
background: '{content.background}', background: '{content.background}',
borderColor: '{content.border.color}', borderColor: '{content.border.color}',
color: '{content.color}' color: '{content.color}',
borderRadius: '{content.border.radius}',
shadow: '{overlay.navigation.shadow}'
},
list: {
padding: '{navigation.list.padding}',
gap: '{navigation.list.gap}'
}, },
item: { item: {
focusBackground: '{navigation.item.focus.background}', focusBackground: '{navigation.item.focus.background}',
activeBackground: '{navigation.item.active.background}',
color: '{navigation.item.color}', color: '{navigation.item.color}',
focusColor: '{navigation.item.focus.color}', focusColor: '{navigation.item.focus.color}',
activeColor: '{navigation.item.active.color}',
padding: '{navigation.item.padding}',
borderRadius: '{navigation.item.border.radius}',
gap: '{navigation.item.gap}',
icon: { icon: {
color: '{navigation.item.icon.color}', color: '{navigation.item.icon.color}',
hoverColor: '{navigation.item.icon.hover.color}' focusColor: '{navigation.item.icon.focus.color}',
focusColor: '{navigation.item.icon.active.color}'
} }
}, },
submenuItem: { submenuIcon: {
color: '{navigation.submenu.color}' size: '{navigation.submenu.icon.size}',
color: '{navigation.submenu.icon.color}',
focusColor: '{navigation.submenu.icon.focus.color}',
focusColor: '{navigation.submenu.icon.active.color}'
}, },
separator: { separator: {
borderColor: '{content.border.color}' borderColor: '{content.border.color}'

View File

@ -25,7 +25,7 @@ export default {
submenuLabel: { submenuLabel: {
padding: '{navigation.submenu.label.padding}', padding: '{navigation.submenu.label.padding}',
fontWeight: '{navigation.submenu.label.font.weight}', fontWeight: '{navigation.submenu.label.font.weight}',
bakcground: '{navigation.submenu.label.background.}', background: '{navigation.submenu.label.background.}',
color: '{navigation.submenu.label.color}' color: '{navigation.submenu.label.color}'
}, },
separator: { separator: {

View File

@ -28,7 +28,7 @@ export default {
submenuLabel: { submenuLabel: {
padding: '{navigation.submenu.label.padding}', padding: '{navigation.submenu.label.padding}',
fontWeight: '{navigation.submenu.label.font.weight}', fontWeight: '{navigation.submenu.label.font.weight}',
bakcground: '{navigation.submenu.label.background.}', background: '{navigation.submenu.label.background.}',
color: '{navigation.submenu.label.color}' color: '{navigation.submenu.label.color}'
}, },
submenuIcon: { submenuIcon: {

View File

@ -2,19 +2,40 @@ export default {
root: { root: {
background: '{content.background}', background: '{content.background}',
borderColor: '{content.border.color}', borderColor: '{content.border.color}',
color: '{content.color}' color: '{content.color}',
borderRadius: '{content.border.radius}',
shadow: '{overlay.navigation.shadow}'
},
list: {
padding: '{navigation.list.padding}',
gap: '{navigation.list.gap}'
}, },
item: { item: {
focusBackground: '{navigation.item.focus.background}', focusBackground: '{navigation.item.focus.background}',
activeBackground: '{navigation.item.active.background}',
color: '{navigation.item.color}', color: '{navigation.item.color}',
focusColor: '{navigation.item.focus.color}', focusColor: '{navigation.item.focus.color}',
activeColor: '{navigation.item.active.color}',
padding: '{navigation.item.padding}',
borderRadius: '{navigation.item.border.radius}',
gap: '{navigation.item.gap}',
icon: { icon: {
color: '{navigation.item.icon.color}', color: '{navigation.item.icon.color}',
hoverColor: '{navigation.item.icon.hover.color}' focusColor: '{navigation.item.icon.focus.color}',
focusColor: '{navigation.item.icon.active.color}'
} }
}, },
submenuItem: { submenuLabel: {
color: '{navigation.submenu.color}' padding: '{navigation.submenu.label.padding}',
fontWeight: '{navigation.submenu.label.font.weight}',
background: '{navigation.submenu.label.background.}',
color: '{navigation.submenu.label.color}'
},
submenuIcon: {
size: '{navigation.submenu.icon.size}',
color: '{navigation.submenu.icon.color}',
focusColor: '{navigation.submenu.icon.focus.color}',
focusColor: '{navigation.submenu.icon.active.color}'
}, },
separator: { separator: {
borderColor: '{content.border.color}' borderColor: '{content.border.color}'

View File

@ -25,12 +25,6 @@ export default {
focusColor: '{navigation.item.icon.active.color}' focusColor: '{navigation.item.icon.active.color}'
} }
}, },
submenuLabel: {
padding: '{navigation.submenu.label.padding}',
fontWeight: '{navigation.submenu.label.font.weight}',
bakcground: '{navigation.submenu.label.background.}',
color: '{navigation.submenu.label.color}'
},
submenuIcon: { submenuIcon: {
size: '{navigation.submenu.icon.size}', size: '{navigation.submenu.icon.size}',
color: '{navigation.submenu.icon.color}', color: '{navigation.submenu.icon.color}',