Tokens for Menu

pull/5756/head
Cagatay Civici 2024-05-10 10:23:39 +03:00
parent e26558ba67
commit 16dd3dc746
5 changed files with 90 additions and 44 deletions

View File

@ -2,11 +2,11 @@ import BaseStyle from 'primevue/base/style';
const theme = ({ dt }) => ` const theme = ({ dt }) => `
.p-menu { .p-menu {
padding: 0.25rem 0.25rem; 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')};
border-radius: ${dt('border.radius.md')}; border-radius: ${dt('menu.border.radius')};
min-width: 12.5rem; min-width: 12.5rem;
} }
@ -15,18 +15,9 @@ const theme = ({ dt }) => `
padding: 0; padding: 0;
outline: 0; outline: 0;
list-style: none; list-style: none;
} display: flex;
flex-direction: column;
.p-menu-item { gap: ${dt('menu.gap')};
margin: 2px 0;
}
.p-menu-item:first-child {
margin-top: 0;
}
.p-menu-item:last-child {
margin-bottom: 0;
} }
.p-menu-item-link { .p-menu-item-link {
@ -37,13 +28,14 @@ const theme = ({ dt }) => `
overflow: hidden; overflow: hidden;
position: relative; position: relative;
color: inherit; color: inherit;
padding: 0.5rem 0.75rem; padding: ${dt('menu.item.padding')};
user-select: none; user-select: none;
gap: ${dt('menu.item.gap')};
} }
.p-menu-item-content { .p-menu-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('menu.item.border.radius')};
color: ${dt('menu.item.color')}; color: ${dt('menu.item.color')};
} }
@ -53,7 +45,6 @@ const theme = ({ dt }) => `
.p-menu-item-icon { .p-menu-item-icon {
color: ${dt('menu.item.icon.color')}; color: ${dt('menu.item.icon.color')};
margin-right: 0.5rem;
} }
.p-menu-item.p-focus .p-menu-item-content { .p-menu-item.p-focus .p-menu-item-content {
@ -62,7 +53,7 @@ const theme = ({ dt }) => `
} }
.p-menu-item.p-focus .p-menu-item-icon { .p-menu-item.p-focus .p-menu-item-icon {
color: ${dt('menu.item.icon.hover.color')}; color: ${dt('menu.item.icon.focus.color')};
} }
.p-menu-item:not(.p-disabled) .p-menu-item-content:hover { .p-menu-item:not(.p-disabled) .p-menu-item-content:hover {
@ -71,23 +62,22 @@ const theme = ({ dt }) => `
} }
.p-menu-item:not(.p-disabled) .p-menu-item-content:hover .p-menu-item-icon { .p-menu-item:not(.p-disabled) .p-menu-item-content:hover .p-menu-item-icon {
color: ${dt('menu.item.icon.hover.color')}; color: ${dt('menu.item.icon.focus.color')};
} }
.p-menu-overlay { .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); box-shadow: ${dt('menu.shadow')};
} }
.p-menu-submenu-item { .p-menu-submenu-item {
margin: 0; background: ${dt('menu.submenu.label.background')};
padding: 0.5rem 0.75rem; padding: ${dt('menu.submenu.label.padding')};
color: ${dt('menu.submenu.item.color')}; color: ${dt('menu.submenu.label.color')};
font-weight: 600; font-weight: ${dt('menu.submenu.label.font.weight')};
} }
.p-menu-separator { .p-menu-separator {
border-top: 1px solid ${dt('menu.separator.border.color.color')}; border-top: 1px solid ${dt('menu.separator.border.color')};
margin: 2px 0;
} }
`; `;

View File

@ -161,7 +161,7 @@ export default {
}, },
option: { option: {
padding: '0.5rem 0.75rem', padding: '0.5rem 0.75rem',
borderRadius: '4px' borderRadius: '{border.radius.sm}'
}, },
optionGroup: { optionGroup: {
padding: '0.5rem 0.75rem', padding: '0.5rem 0.75rem',
@ -171,6 +171,19 @@ export default {
content: { content: {
borderRadius: '{border.radius.md}' borderRadius: '{border.radius.md}'
}, },
navigation: {
padding: '0.25rem 0.25rem',
gap: '2px',
item: {
padding: '0.5rem 0.75rem',
borderRadius: '{border.radius.sm}',
gap: '0.5rem'
},
submenuLabel: {
padding: '0.5rem 0.75rem',
fontWeight: '600'
}
},
overlay: { overlay: {
select: { select: {
borderRadius: '{border.radius.md}', borderRadius: '{border.radius.md}',
@ -185,6 +198,9 @@ export default {
borderRadius: '{border.radius.xl}', borderRadius: '{border.radius.xl}',
padding: '1.25rem', padding: '1.25rem',
shadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)' shadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)'
},
navigation: {
shadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)'
} }
}, },
colorScheme: { colorScheme: {
@ -293,8 +309,9 @@ export default {
focusColor: '{surface.500}' focusColor: '{surface.500}'
} }
}, },
submenu: { submenuLabel: {
color: '{surface.400}' background: '{surface.0}',
color: '{text.muted.color}'
} }
} }
}, },
@ -403,8 +420,9 @@ export default {
focusColor: '{surface.400}' focusColor: '{surface.400}'
} }
}, },
submenu: { submenuLabel: {
color: '{surface.500}' background: '{surface.900}',
color: '{text.muted.color}'
} }
} }
} }

View File

@ -2,19 +2,29 @@ export default {
root: { root: {
background: '{content.background}', background: '{content.background}',
borderColor: '{content.border.color}', borderColor: '{content.border.color}',
color: '{content.color}' color: '{content.color}',
padding: '{navigation.padding}',
borderRadius: '{content.border.radius}',
gap: '{navigation.gap}',
shadow: '{overlay.navigation.shadow}'
}, },
item: { item: {
focusBackground: '{navigation.item.focus.background}', focusBackground: '{navigation.item.focus.background}',
color: '{navigation.item.color}', color: '{navigation.item.color}',
focusColor: '{navigation.item.focus.color}', focusColor: '{navigation.item.focus.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}'
} }
}, },
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}'
}, },
separator: { separator: {
borderColor: '{content.border.color}' borderColor: '{content.border.color}'

View File

@ -170,6 +170,19 @@ export default {
content: { content: {
borderRadius: '{border.radius.sm}' borderRadius: '{border.radius.sm}'
}, },
navigation: {
padding: '0.5rem 0',
gap: '0',
item: {
padding: '0.625rem 1rem',
borderRadius: '0',
gap: '0.5rem'
},
submenuLabel: {
padding: '0.625rem 1rem',
fontWeight: '600'
}
},
overlay: { overlay: {
select: { select: {
borderRadius: '{border.radius.sm}', borderRadius: '{border.radius.sm}',
@ -184,6 +197,9 @@ export default {
borderRadius: '{border.radius.lg}', borderRadius: '{border.radius.lg}',
padding: '1.5rem', padding: '1.5rem',
shadow: '0 1px 3px rgba(0, 0, 0, 0.3)' shadow: '0 1px 3px rgba(0, 0, 0, 0.3)'
},
navigation: {
shadow: '0 2px 12px 0 rgba(0, 0, 0, 0.1)'
} }
}, },
colorScheme: { colorScheme: {
@ -295,8 +311,9 @@ export default {
focusColor: '{surface.500}' focusColor: '{surface.500}'
} }
}, },
submenu: { submenuLabel: {
color: '{surface.400}' background: '{surface.0}',
color: '{text.color}'
} }
} }
}, },
@ -408,8 +425,9 @@ export default {
focusColor: '{surface.400}' focusColor: '{surface.400}'
} }
}, },
submenu: { submenuLabel: {
color: '{surface.500}' background: '{surface.900}',
color: '{text.color}'
} }
} }
} }

View File

@ -2,19 +2,29 @@ export default {
root: { root: {
background: '{content.background}', background: '{content.background}',
borderColor: '{content.border.color}', borderColor: '{content.border.color}',
color: '{content.color}' color: '{content.color}',
padding: '{navigation.padding}',
borderRadius: '{content.border.radius}',
gap: '{navigation.gap}',
shadow: '{overlay.navigation.shadow}'
}, },
item: { item: {
focusBackground: '{navigation.item.focus.background}', focusBackground: '{navigation.item.focus.background}',
color: '{navigation.item.color}', color: '{navigation.item.color}',
focusColor: '{navigation.item.focus.color}', focusColor: '{navigation.item.focus.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}'
} }
}, },
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}'
}, },
separator: { separator: {
borderColor: '{content.border.color}' borderColor: '{content.border.color}'