Tokens for Menubar

pull/5756/head
Cagatay Civici 2024-05-10 19:37:24 +03:00
parent be1cf3625b
commit aaa8105a29
8 changed files with 161 additions and 95 deletions

View File

@ -4,15 +4,16 @@ const theme = ({ dt }) => `
.p-menubar { .p-menubar {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0.5rem 0.5rem;
background: ${dt('menubar.background')}; background: ${dt('menubar.background')};
color: ${dt('menubar.color')};
border: 1px solid ${dt('menubar.border.color')}; border: 1px solid ${dt('menubar.border.color')};
border-radius: ${dt('border.radius.md')}; border-radius: ${dt('menubar.border.radius')};
color: ${dt('menubar.color')};
padding: ${dt('menubar.padding')};
} }
.p-menubar-root-list, .p-menubar-root-list,
.p-menubar-submenu { .p-menubar-submenu {
display: flex;
margin: 0; margin: 0;
padding: 0; padding: 0;
list-style: none; list-style: none;
@ -20,18 +21,22 @@ const theme = ({ dt }) => `
} }
.p-menubar-root-list { .p-menubar-root-list {
display: flex;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
gap: ${dt('menubar.gap')};
} }
.p-menubar-submenu { .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content {
flex-direction: column border-radius: ${dt('menubar.base.item.border.radius')};
}
.p-menubar-root-list > .p-menubar-item > .p-menubar-item-content > .p-menubar-item-link {
padding: ${dt('menubar.base.item.padding')};
} }
.p-menubar-item-content { .p-menubar-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('menubar.item.border.radius')};
color: ${dt('menubar.item.color')}; color: ${dt('menubar.item.color')};
} }
@ -43,8 +48,10 @@ const theme = ({ dt }) => `
overflow: hidden; overflow: hidden;
position: relative; position: relative;
color: inherit; color: inherit;
padding: 0.5rem 0.75rem; padding: ${dt('menubar.item.padding')};
gap: ${dt('menubar.item.gap')};
user-select: none; user-select: none;
outline: 0 none;
} }
.p-menubar-item-label { .p-menubar-item-label {
@ -53,7 +60,14 @@ const theme = ({ dt }) => `
.p-menubar-item-icon { .p-menubar-item-icon {
color: ${dt('menubar.item.icon.color')}; color: ${dt('menubar.item.icon.color')};
margin-right: 0.5rem; }
.p-menubar-submenu-icon {
color: ${dt('menubar.submenu.icon.color')};
margin-left: auto;
font-size: ${dt('menubar.submenu.icon.size')};
width: ${dt('menubar.submenu.icon.size')};
height: ${dt('menubar.submenu.icon.size')};
} }
.p-menubar-item.p-focus > .p-menubar-item-content { .p-menubar-item.p-focus > .p-menubar-item-content {
@ -61,9 +75,12 @@ const theme = ({ dt }) => `
background: ${dt('menubar.item.focus.background')}; background: ${dt('menubar.item.focus.background')};
} }
.p-menubar-item.p-focus > .p-menubar-item-content .p-menubar-item-icon, .p-menubar-item.p-focus > .p-menubar-item-content .p-menubar-item-icon {
color: ${dt('menubar.item.icon.focus.color')};
}
.p-menubar-item.p-focus > .p-menubar-item-content .p-menubar-submenu-icon { .p-menubar-item.p-focus > .p-menubar-item-content .p-menubar-submenu-icon {
color: ${dt('menubar.item.icon.hover.color')}; color: ${dt('menubar.submenu.icon.focus.color')};
} }
.p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover { .p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover {
@ -71,31 +88,25 @@ const theme = ({ dt }) => `
background: ${dt('menubar.item.focus.background')}; background: ${dt('menubar.item.focus.background')};
} }
.p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover .p-menubar-item-icon, .p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover .p-menubar-item-icon {
color: ${dt('menubar.item.icon.focus.color')};
}
.p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover .p-menubar-submenu-icon { .p-menubar-item:not(.p-disabled) > .p-menubar-item-content:hover .p-menubar-submenu-icon {
color: ${dt('menubar.item.icon.hover.color')}; color: ${dt('menubar.submenu.icon.focus.color')};
} }
.p-menubar-item-active > .p-menubar-item-content { .p-menubar-item-active > .p-menubar-item-content {
color: ${dt('menubar.item.focus.color')}; color: ${dt('menubar.item.active.color')};
background: ${dt('menubar.item.focus.background')}; background: ${dt('menubar.item.active.background')};
}
.p-menubar-item-active > .p-menubar-item-content .p-menubar-item-icon {
color: ${dt('menubar.item.icon.active.color')};
} }
.p-menubar-item-active > .p-menubar-item-content .p-menubar-item-icon,
.p-menubar-item-active > .p-menubar-item-content .p-menubar-submenu-icon { .p-menubar-item-active > .p-menubar-item-content .p-menubar-submenu-icon {
color: ${dt('menubar.item.icon.hover.color')}; color: ${dt('menubar.submenu.icon.active.color')};
}
.p-menubar-submenu-icon {
color: ${dt('menubar.item.icon.color')};
margin-left: auto;
font-size: 0.875rem;
width: 0.875rem;
height: 0.875rem;
}
.p-menubar-root-list > .p-menubar-item > .p-menubar-item-content .p-menubar-submenu-icon {
margin-left: 0.5rem;
} }
.p-menubar-submenu { .p-menubar-submenu {
@ -103,30 +114,22 @@ const theme = ({ dt }) => `
position: absolute; position: absolute;
min-width: 12.5rem; min-width: 12.5rem;
z-index: 1; z-index: 1;
padding: 0.25rem 0.25rem; background: ${dt('menubar.submenu.background')};
background: ${dt('menubar.background')}; border: 1px solid ${dt('menubar.submenu.border.color')};
color: ${dt('menubar.color')}; border-radius: ${dt('menubar.border.radius')};
border: 1px solid ${dt('menubar.border.color')}; box-shadow: ${dt('menubar.submenu.shadow')};
border-radius: ${dt('border.radius.md')}; color: ${dt('menubar.submenu.color')};
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); flex-direction: column;
padding: ${dt('menubar.submenu.padding')};
gap: ${dt('menubar.submenu.gap')};
} }
.p-menubar-submenu .p-menubar-separator { .p-menubar-submenu .p-menubar-separator {
border-top: 1px solid ${dt('menubar.separator.border.color')}; border-top: 1px solid ${dt('menubar.separator.border.color')};
margin: 2px 0;
} }
.p-menubar-submenu .p-menubar-item { .p-menubar-submenu .p-menubar-item {
position: relative; position: relative;
margin: 2px 0;
}
.p-menubar-submenu .p-menubar-item:first-child {
margin-top: 0;
}
.p-menubar-submenu .p-menubar-item:last-child {
margin-bottom: 0;
} }
.p-menubar-submenu > .p-menubar-item-active > .p-menubar-submenu { .p-menubar-submenu > .p-menubar-item-active > .p-menubar-submenu {
@ -145,25 +148,26 @@ const theme = ({ dt }) => `
justify-content: center; justify-content: center;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
width: 1.75rem; width: ${dt('menubar.mobile.button.size')};
height: 1.75rem; height: ${dt('menubar.mobile.button.size')};
position: relative; position: relative;
color: ${dt('menubar.mobile.toggle.color')}; color: ${dt('menubar.mobile.button.color')};
border: 0 none; border: 0 none;
background: transparent; background: transparent;
border-radius: 50%; border-radius: ${dt('menubar.mobile.button.border.radius')};
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}; transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, outline-color ${dt('transition.duration')};
outline-color: transparent; outline-color: transparent;
} }
.p-menubar-button:hover { .p-menubar-button:hover {
color: ${dt('menubar.mobile.toggle.hover.color')}; color: ${dt('menubar.mobile.button.hover.color')};
background: ${dt('menubar.mobile.toggle.hover.background')}; background: ${dt('menubar.mobile.button.hover.background')};
} }
.p-menubar-button:focus-visible { .p-menubar-button:focus-visible {
outline: ${dt('focus.ring.width')} ${dt('focus.ring.style')} ${dt('focus.ring.color')}; box-shadow: ${dt('menubar.mobile.button.focus.ring.shadow')};
outline-offset: ${dt('focus.ring.offset')}; outline: ${dt('menubar.mobile.button.focus.ring.width')} ${dt('menubar.mobile.button.focus.ring.style')} ${dt('menubar.mobile.button.focus.ring.color')};
outline-offset: ${dt('menubar.mobile.button.focus.ring.offset')};
} }
.p-menubar-mobile { .p-menubar-mobile {
@ -178,10 +182,18 @@ const theme = ({ dt }) => `
position: absolute; position: absolute;
display: none; display: none;
width: 100%; width: 100%;
padding: 0.25rem 0.25rem; padding: ${dt('menubar.submenu.padding')};
background: ${dt('menubar.background')}; background: ${dt('menubar.submenu.background')};
border: 1px solid ${dt('menubar.border.color')}; border: 1px solid ${dt('menubar.submenu.border.color')};
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('menubar.submenu.shadow')};
}
.p-menubar-mobile .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content {
border-radius: ${dt('menubar.item.border.radius')};
}
.p-menubar-mobile .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content > .p-menubar-item-link {
padding: ${dt('menubar.item.padding')};
} }
.p-menubar-mobile-active .p-menubar-root-list { .p-menubar-mobile-active .p-menubar-root-list {
@ -198,21 +210,7 @@ const theme = ({ dt }) => `
} }
.p-menubar-mobile .p-menubar-root-list .p-menubar-separator { .p-menubar-mobile .p-menubar-root-list .p-menubar-separator {
border-top: 1px solid #e2e8f0; border-top: 1px solid ${dt('menubar.separator.border.color')};
margin: 2px 0;
}
.p-menubar-mobile .p-menubar-root-list > .p-menubar-item {
position: relative;
margin: 2px 0;
}
.p-menubar-mobile .p-menubar-root-list > .p-menubar-item:first-child {
margin-top: 0;
}
.p-menubar-mobile .p-menubar-root-list > .p-menubar-item:last-child {
margin-bottom: 0;
} }
.p-menubar-mobile .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content .p-menubar-submenu-icon { .p-menubar-mobile .p-menubar-root-list > .p-menubar-item > .p-menubar-item-content .p-menubar-submenu-icon {
@ -238,7 +236,7 @@ const theme = ({ dt }) => `
position: static; position: static;
box-shadow: none; box-shadow: none;
border: 0 none; border: 0 none;
padding-left: 1rem; padding-left: ${dt('menubar.submenu.mobile.indent')};
} }
`; `;

View File

@ -22,14 +22,14 @@ export default {
icon: { icon: {
color: '{navigation.item.icon.color}', color: '{navigation.item.icon.color}',
focusColor: '{navigation.item.icon.focus.color}', focusColor: '{navigation.item.icon.focus.color}',
focusColor: '{navigation.item.icon.active.color}' activeColor: '{navigation.item.icon.active.color}'
} }
}, },
submenuIcon: { submenuIcon: {
size: '{navigation.submenu.icon.size}', size: '{navigation.submenu.icon.size}',
color: '{navigation.submenu.icon.color}', color: '{navigation.submenu.icon.color}',
focusColor: '{navigation.submenu.icon.focus.color}', focusColor: '{navigation.submenu.icon.focus.color}',
focusColor: '{navigation.submenu.icon.active.color}' activeColor: '{navigation.submenu.icon.active.color}'
}, },
separator: { separator: {
borderColor: '{content.border.color}' borderColor: '{content.border.color}'

View File

@ -2,26 +2,60 @@ export default {
root: { root: {
background: '{content.background}', background: '{content.background}',
borderColor: '{content.border.color}', borderColor: '{content.border.color}',
color: '{content.color}' borderRadius: '{content.border.radius}',
color: '{content.color}',
padding: '0.5rem 0.5rem',
gap: '0.5rem'
},
baseItem: {
borderRadius: '{content.border.radius}',
padding: '{navigation.item.padding}'
}, },
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}',
activeColor: '{navigation.item.icon.active.color}'
} }
}, },
submenuItem: { submenu: {
color: '{navigation.submenu.color}' padding: '{navigation.list.padding}',
gap: '{navigation.list.gap}',
background: '{content.background}',
borderColor: '{content.border.color}',
borderRadius: '{content.border.radius}',
shadow: '{overlay.navigation.shadow}',
mobileIndent: '1rem'
},
submenuIcon: {
size: '{navigation.submenu.icon.size}',
color: '{navigation.submenu.icon.color}',
focusColor: '{navigation.submenu.icon.focus.color}',
activeColor: '{navigation.submenu.icon.active.color}'
}, },
separator: { separator: {
borderColor: '{content.border.color}' borderColor: '{content.border.color}'
}, },
mobileToggle: { mobileButton: {
borderRadius: '50%',
size: '1.75rem',
color: '{text.muted.color}', color: '{text.muted.color}',
hoverColor: '{text.muted.hover.color}', hoverColor: '{text.muted.hover.color}',
hoverBackground: '{content.hover.background}' hoverBackground: '{content.hover.background}',
focusRing: {
width: '{focus.ring.width}',
style: '{focus.ring.style}',
color: '{focus.ring.color}',
offset: '{focus.ring.offset}',
shadow: '{focus.ring.shadow}'
}
} }
}; };

View File

@ -22,7 +22,7 @@ export default {
icon: { icon: {
color: '{navigation.item.icon.color}', color: '{navigation.item.icon.color}',
focusColor: '{navigation.item.icon.focus.color}', focusColor: '{navigation.item.icon.focus.color}',
focusColor: '{navigation.item.icon.active.color}' activeColor: '{navigation.item.icon.active.color}'
} }
}, },
submenuLabel: { submenuLabel: {
@ -35,7 +35,7 @@ export default {
size: '{navigation.submenu.icon.size}', size: '{navigation.submenu.icon.size}',
color: '{navigation.submenu.icon.color}', color: '{navigation.submenu.icon.color}',
focusColor: '{navigation.submenu.icon.focus.color}', focusColor: '{navigation.submenu.icon.focus.color}',
focusColor: '{navigation.submenu.icon.active.color}' activeColor: '{navigation.submenu.icon.active.color}'
}, },
separator: { separator: {
borderColor: '{content.border.color}' borderColor: '{content.border.color}'

View File

@ -22,7 +22,7 @@ export default {
icon: { icon: {
color: '{navigation.item.icon.color}', color: '{navigation.item.icon.color}',
focusColor: '{navigation.item.icon.focus.color}', focusColor: '{navigation.item.icon.focus.color}',
focusColor: '{navigation.item.icon.active.color}' activeColor: '{navigation.item.icon.active.color}'
} }
}, },
submenuLabel: { submenuLabel: {
@ -35,7 +35,7 @@ export default {
size: '{navigation.submenu.icon.size}', size: '{navigation.submenu.icon.size}',
color: '{navigation.submenu.icon.color}', color: '{navigation.submenu.icon.color}',
focusColor: '{navigation.submenu.icon.focus.color}', focusColor: '{navigation.submenu.icon.focus.color}',
focusColor: '{navigation.submenu.icon.active.color}' activeColor: '{navigation.submenu.icon.active.color}'
}, },
separator: { separator: {
borderColor: '{content.border.color}' borderColor: '{content.border.color}'

View File

@ -2,26 +2,60 @@ export default {
root: { root: {
background: '{content.background}', background: '{content.background}',
borderColor: '{content.border.color}', borderColor: '{content.border.color}',
color: '{content.color}' borderRadius: '{content.border.radius}',
color: '{content.color}',
gap: '0.5rem',
padding: '0.75rem 0.75rem'
},
baseItem: {
borderRadius: '{content.border.radius}',
padding: '0.75rem 1rem'
}, },
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}',
activeColor: '{navigation.item.icon.active.color}'
} }
}, },
submenuItem: { submenu: {
color: '{navigation.submenu.color}' padding: '{navigation.list.padding}',
gap: '{navigation.list.gap}',
background: '{content.background}',
borderColor: '{content.border.color}',
borderRadius: '{content.border.radius}',
shadow: '{overlay.navigation.shadow}',
mobileIndent: '1.25rem'
},
submenuIcon: {
size: '{navigation.submenu.icon.size}',
color: '{navigation.submenu.icon.color}',
focusColor: '{navigation.submenu.icon.focus.color}',
activeColor: '{navigation.submenu.icon.active.color}'
}, },
separator: { separator: {
borderColor: '{content.border.color}' borderColor: '{content.border.color}'
}, },
mobileToggle: { mobileButton: {
borderRadius: '50%',
size: '2rem',
color: '{text.muted.color}', color: '{text.muted.color}',
hoverColor: '{text.muted.hover.color}', hoverColor: '{text.muted.hover.color}',
hoverBackground: '{content.hover.background}' hoverBackground: '{content.hover.background}',
focusRing: {
width: '{focus.ring.width}',
style: '{focus.ring.style}',
color: '{focus.ring.color}',
offset: '{focus.ring.offset}',
shadow: '{focus.ring.shadow}'
}
} }
}; };

View File

@ -22,14 +22,14 @@ export default {
icon: { icon: {
color: '{navigation.item.icon.color}', color: '{navigation.item.icon.color}',
focusColor: '{navigation.item.icon.focus.color}', focusColor: '{navigation.item.icon.focus.color}',
focusColor: '{navigation.item.icon.active.color}' activeColor: '{navigation.item.icon.active.color}'
} }
}, },
submenuIcon: { submenuIcon: {
size: '{navigation.submenu.icon.size}', size: '{navigation.submenu.icon.size}',
color: '{navigation.submenu.icon.color}', color: '{navigation.submenu.icon.color}',
focusColor: '{navigation.submenu.icon.focus.color}', focusColor: '{navigation.submenu.icon.focus.color}',
focusColor: '{navigation.submenu.icon.active.color}' activeColor: '{navigation.submenu.icon.active.color}'
}, },
separator: { separator: {
borderColor: '{content.border.color}' borderColor: '{content.border.color}'

View File

@ -107,7 +107,7 @@ const theme = ({ dt }) => `
} }
.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.active.color')}; color: ${dt('tieredmenu.submenu.icon.active.color')};
} }
.p-tieredmenu-separator { .p-tieredmenu-separator {