Tokens for TieredMenu

pull/5756/head
Cagatay Civici 2024-05-10 11:05:59 +03:00
parent 32c592b74e
commit 3cc7a5d44c
8 changed files with 145 additions and 65 deletions

View File

@ -2,7 +2,6 @@ import BaseStyle from 'primevue/base/style';
const theme = ({ dt }) => ` const theme = ({ dt }) => `
.p-menu { .p-menu {
padding: ${dt('menu.padding')};
background: ${dt('menu.background')}; background: ${dt('menu.background')};
color: ${dt('menu.color')}; color: ${dt('menu.color')};
border: 1px solid ${dt('menu.border.color')}; border: 1px solid ${dt('menu.border.color')};
@ -12,12 +11,18 @@ const theme = ({ dt }) => `
.p-menu-list { .p-menu-list {
margin: 0; margin: 0;
padding: 0; padding: ${dt('menu.list.padding')};
outline: 0; outline: 0 none;
list-style: none; list-style: none;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: ${dt('menu.gap')}; gap: ${dt('menu.list.gap')};
}
.p-menu-item-content {
transition: background ${dt('transition.duration')}, color ${dt('transition.duration')};
border-radius: ${dt('menu.item.border.radius')};
color: ${dt('menu.item.color')};
} }
.p-menu-item-link { .p-menu-item-link {
@ -29,17 +34,11 @@ const theme = ({ dt }) => `
position: relative; position: relative;
color: inherit; color: inherit;
padding: ${dt('menu.item.padding')}; padding: ${dt('menu.item.padding')};
user-select: none;
gap: ${dt('menu.item.gap')}; gap: ${dt('menu.item.gap')};
user-select: none;
outline: 0 none; outline: 0 none;
} }
.p-menu-item-content {
transition: background ${dt('transition.duration')}, color ${dt('transition.duration')};
border-radius: ${dt('menu.item.border.radius')};
color: ${dt('menu.item.color')};
}
.p-menu-item-label { .p-menu-item-label {
line-height: 1; line-height: 1;
} }

View File

@ -184,6 +184,9 @@ export default {
submenuLabel: { submenuLabel: {
padding: '0.5rem 0.75rem', padding: '0.5rem 0.75rem',
fontWeight: '600' fontWeight: '600'
},
submenuIcon: {
size: '0.875rem'
} }
}, },
overlay: { overlay: {
@ -304,16 +307,24 @@ export default {
navigation: { navigation: {
item: { item: {
focusBackground: '{surface.100}', focusBackground: '{surface.100}',
activeBackground: '{surface.100}',
color: '{text.color}', color: '{text.color}',
focusColor: '{text.hover.color}', focusColor: '{text.hover.color}',
activeColor: '{text.hover.color}',
icon: { icon: {
color: '{surface.400}', color: '{surface.400}',
focusColor: '{surface.500}' focusColor: '{surface.500}',
activeColor: '{surface.500}',
} }
}, },
submenuLabel: { submenuLabel: {
background: '{surface.0}', background: '{surface.0}',
color: '{text.muted.color}' color: '{text.muted.color}'
},
submenuIcon: {
color: '{surface.400}',
focusColor: '{surface.500}',
activeColor: '{surface.500}'
} }
} }
}, },
@ -415,16 +426,24 @@ export default {
navigation: { navigation: {
item: { item: {
focusBackground: '{surface.800}', focusBackground: '{surface.800}',
activeBackground: '{surface.800}',
color: '{text.color}', color: '{text.color}',
focusColor: '{text.hover.color}', focusColor: '{text.hover.color}',
activeColor: '{text.hover.color}',
icon: { icon: {
color: '{surface.500}', color: '{surface.500}',
focusColor: '{surface.400}' focusColor: '{surface.400}',
activeColor: '{surface.400}'
} }
}, },
submenuLabel: { submenuLabel: {
background: '{surface.900}', background: '{surface.900}',
color: '{text.muted.color}' color: '{text.muted.color}'
},
submenuIcon: {
color: '{surface.500}',
focusColor: '{surface.400}',
activeColor: '{surface.400}'
} }
} }
} }

View File

@ -3,11 +3,13 @@ export default {
background: '{content.background}', background: '{content.background}',
borderColor: '{content.border.color}', borderColor: '{content.border.color}',
color: '{content.color}', color: '{content.color}',
padding: '{navigation.list.padding}',
borderRadius: '{content.border.radius}', borderRadius: '{content.border.radius}',
gap: '{navigation.list.gap}',
shadow: '{overlay.navigation.shadow}' 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}',
color: '{navigation.item.color}', color: '{navigation.item.color}',

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}',
bakcground: '{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

@ -183,6 +183,9 @@ export default {
submenuLabel: { submenuLabel: {
padding: '0.625rem 1rem', padding: '0.625rem 1rem',
fontWeight: '600' fontWeight: '600'
},
submenuIcon: {
size: '0.875rem'
} }
}, },
overlay: { overlay: {
@ -306,16 +309,24 @@ export default {
navigation: { navigation: {
item: { item: {
focusBackground: '{surface.100}', focusBackground: '{surface.100}',
activeBackground: '{surface.100}',
color: '{text.color}', color: '{text.color}',
focusColor: '{text.hover.color}', focusColor: '{text.hover.color}',
activeColor: '{text.hover.color}',
icon: { icon: {
color: '{surface.400}', color: '{surface.400}',
focusColor: '{surface.500}' focusColor: '{surface.500}',
activeColor: '{surface.500}'
} }
}, },
submenuLabel: { submenuLabel: {
background: '{surface.0}', background: '{surface.0}',
color: '{text.color}' color: '{text.color}'
},
submenuIcon: {
color: '{surface.400}',
focusColor: '{surface.500}',
activeColor: '{surface.500}'
} }
} }
}, },
@ -420,16 +431,24 @@ export default {
navigation: { navigation: {
item: { item: {
focusBackground: '{surface.800}', focusBackground: '{surface.800}',
activeBackground: '{surface.800}',
color: '{text.color}', color: '{text.color}',
focusColor: '{text.hover.color}', focusColor: '{text.hover.color}',
activeColor: '{text.hover.color}',
icon: { icon: {
color: '{surface.500}', color: '{surface.500}',
focusColor: '{surface.400}' focusColor: '{surface.400}',
activeColor: '{surface.400}'
} }
}, },
submenuLabel: { submenuLabel: {
background: '{surface.900}', background: '{surface.900}',
color: '{text.color}' color: '{text.color}'
},
submenuIcon: {
color: '{surface.500}',
focusColor: '{surface.400}',
activeColor: '{surface.400}'
} }
} }
} }

View File

@ -3,11 +3,13 @@ export default {
background: '{content.background}', background: '{content.background}',
borderColor: '{content.border.color}', borderColor: '{content.border.color}',
color: '{content.color}', color: '{content.color}',
padding: '{navigation.list.padding}',
borderRadius: '{content.border.radius}', borderRadius: '{content.border.radius}',
gap: '{navigation.list.gap}',
shadow: '{overlay.navigation.shadow}' 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}',
color: '{navigation.item.color}', color: '{navigation.item.color}',
@ -23,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

@ -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}',
bakcground: '{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

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