Tokens for Tabs

pull/5756/head
Cagatay Civici 2024-05-11 19:45:10 +03:00
parent 087ea35527
commit 51d7871594
6 changed files with 121 additions and 48 deletions

View File

@ -32,8 +32,6 @@ const theme = ({ dt }) => `
color: ${dt('tabmenu.item.color')}; color: ${dt('tabmenu.item.color')};
padding: ${dt('tabmenu.item.padding')}; padding: ${dt('tabmenu.item.padding')};
font-weight: ${dt('tabmenu.item.font.weight')}; font-weight: ${dt('tabmenu.item.font.weight')};
border-top-right-radius: ${dt('tabmenu.item.border.radius')};
border-top-left-radius: ${dt('tabmenu.item.border.radius')};
transition: background ${dt('transition.duration')}, border-color ${dt('transition.duration')}, color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}; transition: background ${dt('transition.duration')}, border-color ${dt('transition.duration')}, color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')};
margin: ${dt('tabmenu.item.margin')}; margin: ${dt('tabmenu.item.margin')};
outline-color: transparent; outline-color: transparent;
@ -41,6 +39,7 @@ const theme = ({ dt }) => `
} }
.p-tabmenu-item-link:focus-visible { .p-tabmenu-item-link:focus-visible {
z-index: 1;
box-shadow: ${dt('tabmenu.item.focus.ring.shadow')}; box-shadow: ${dt('tabmenu.item.focus.ring.shadow')};
outline: ${dt('tabmenu.item.focus.ring.width')} ${dt('tabmenu.item.focus.ring.style')} ${dt('tabmenu.item.focus.ring.color')}; outline: ${dt('tabmenu.item.focus.ring.width')} ${dt('tabmenu.item.focus.ring.style')} ${dt('tabmenu.item.focus.ring.color')};
outline-offset: ${dt('tabmenu.item.focus.ring.offset')}; outline-offset: ${dt('tabmenu.item.focus.ring.offset')};

View File

@ -29,9 +29,10 @@ const theme = ({ dt }) => `
.p-tablist-tab-list { .p-tablist-tab-list {
position: relative; position: relative;
display: flex; display: flex;
background: ${dt('tabs.tab.list.background')}; background: ${dt('tabs.tablist.background')};
border: 1px solid ${dt('tabs.tab.list.border.color')}; border-style: solid;
border-width: 0 0 1px 0; border-color: ${dt('tabs.tablist.border.color')};
border-width: ${dt('tabs.tablist.border.width')};
} }
.p-tablist-nav-button { .p-tablist-nav-button {
@ -45,15 +46,18 @@ const theme = ({ dt }) => `
justify-content: center; justify-content: center;
background: ${dt('tabs.nav.button.background')}; background: ${dt('tabs.nav.button.background')};
color: ${dt('tabs.nav.button.color')}; color: ${dt('tabs.nav.button.color')};
width: 2.5rem; width: ${dt('tabs.nav.button.width')};
transition: color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}; transition: color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')};
box-shadow: ${dt('tabs.nav.button.shadow')}; box-shadow: ${dt('tabs.nav.button.shadow')};
outline-color: transparent;
cursor: pointer; cursor: pointer;
} }
.p-tablist-nav-button:focus-visible { .p-tablist-nav-button:focus-visible {
outline: ${dt('focus.ring.width')} ${dt('focus.ring.style')} ${dt('focus.ring.color')}; z-index: 1;
outline-offset: ${dt('focus.ring.offset')}; box-shadow: ${dt('tabs.nav.button.focus.ring.shadow')};
outline: ${dt('tabs.nav.button.focus.ring.width')} ${dt('tabs.nav.button.focus.ring.style')} ${dt('tabs.nav.button.focus.ring.color')};
outline-offset: ${dt('tabs.nav.button.focus.ring.offset')};
} }
.p-tablist-nav-button:hover { .p-tablist-nav-button:hover {
@ -69,51 +73,55 @@ const theme = ({ dt }) => `
} }
.p-tab { .p-tab {
position: relative;
overflow: hidden;
cursor: pointer; cursor: pointer;
user-select: none;
position: relative;
border-style: solid; border-style: solid;
border-width: 0 0 1px 0;
border-color: transparent transparent ${dt('tabs.tab.border.color')} transparent;
color: ${dt('tabs.tab.color')};
background: ${dt('tabs.nav.background')};
padding: 1rem 1.125rem;
font-weight: 600;
border-top-right-radius: ${dt('border.radius.md')};
border-top-left-radius: ${dt('border.radius.md')};
transition: color ${dt('transition.duration')}, outline-color ${dt('transition.duration')};
margin: 0 0 -1px 0;
outline-color: transparent;
line-height: 1;
white-space: nowrap; white-space: nowrap;
background: ${dt('tabs.tab.background')};
border-width: ${dt('tabs.tab.border.width')};
border-color: ${dt('tabs.tab.border.color')};
color: ${dt('tabs.tab.color')};
padding: ${dt('tabs.tab.padding')};
font-weight: ${dt('tabs.tab.font.weight')};
transition: background ${dt('transition.duration')}, border-color ${dt('transition.duration')}, color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')};
margin: ${dt('tabs.tab.margin')};
outline-color: transparent;
} }
.p-tab:not(.p-disabled):focus-visible { .p-tab:not(.p-disabled):focus-visible {
outline: ${dt('focus.ring.width')} ${dt('focus.ring.style')} ${dt('focus.ring.color')}; z-index: 1;
outline-offset: -1px; box-shadow: ${dt('tabs.tab.focus.ring.shadow')};
outline: ${dt('tabs.tab.focus.ring.width')} ${dt('tabs.tab.focus.ring.style')} ${dt('tabs.tab.focus.ring.color')};
outline-offset: ${dt('tabs.tab.focus.ring.offset')};
} }
.p-tab:not(.p-tab-active):not(.p-disabled):hover { .p-tab:not(.p-tab-active):not(.p-disabled):hover {
background: ${dt('tabs.tab.hover.background')};
border-color: ${dt('tabs.tab.hover.border.color')};
color: ${dt('tabs.tab.hover.color')}; color: ${dt('tabs.tab.hover.color')};
} }
.p-tab-active { .p-tab-active {
background: ${dt('tabs.tab.active.background')};
border-color: ${dt('tabs.tab.active.border.color')};
color: ${dt('tabs.tab.active.color')}; color: ${dt('tabs.tab.active.color')};
} }
.p-tabpanels { .p-tabpanels {
background: ${dt('tabs.tab.panel.background')}; background: ${dt('tabs.tabpanel.background')};
color: ${dt('tabs.tab.panel.color')}; color: ${dt('tabs.tabpanel.color')};
padding: 0.875rem 1.125rem 1.125rem 1.125rem; padding: ${dt('tabs.tabpanel.padding')};
outline: 0 none;
} }
.p-tablist-active-bar { .p-tablist-active-bar {
z-index: 1; z-index: 1;
display: block; display: block;
position: absolute; position: absolute;
bottom: -1px; bottom: ${dt('tabs.active.bar.bottom')};
height: 1px; height: ${dt('tabs.active.bar.height')};
background-color: ${dt('tabs.tab.active.border.color')}; background: ${dt('tabs.active.bar.background')};
transition: 250ms cubic-bezier(0.35, 0, 0.25, 1); transition: 250ms cubic-bezier(0.35, 0, 0.25, 1);
} }
`; `;

View File

@ -17,7 +17,6 @@ export default {
activeColor: '{primary.color}', activeColor: '{primary.color}',
padding: '1rem 1.125rem', padding: '1rem 1.125rem',
fontWeight: '600', fontWeight: '600',
borderRadius: '{content.border.radius}',
margin: '0 0 -1px 0', margin: '0 0 -1px 0',
gap: '0.5rem', gap: '0.5rem',
focusRing: { focusRing: {

View File

@ -1,23 +1,54 @@
export default { export default {
tabList: { tablist: {
borderWidth: '0 0 1px 0',
background: '{content.background}', background: '{content.background}',
borderColor: '{content.border.color}' borderColor: '{content.border.color}'
}, },
tab: { tab: {
background: 'transparent',
hoverBackground: 'transparent',
activeBackground: 'transparent',
borderWidth: '0 0 1px 0',
borderColor: '{content.border.color}', borderColor: '{content.border.color}',
hoverBorderColor: '{content.border.color}',
activeBorderColor: '{primary.color}', activeBorderColor: '{primary.color}',
color: '{text.muted.color}', color: '{text.muted.color}',
hoverColor: '{text.color}', hoverColor: '{text.color}',
activeColor: '{primary.color}' activeColor: '{primary.color}',
padding: '1rem 1.125rem',
fontWeight: '600',
margin: '0 0 -1px 0',
gap: '0.5rem',
focusRing: {
width: '{focus.ring.width}',
style: '{focus.ring.style}',
color: '{focus.ring.color}',
offset: '{focus.ring.offset}',
shadow: '{focus.ring.shadow}'
}
}, },
tabPanel: { tabpanel: {
background: '{content.background}', background: '{content.background}',
color: '{content.color}' color: '{content.color}',
padding: '0.875rem 1.125rem 1.125rem 1.125rem'
}, },
navButton: { navButton: {
background: '{content.background}', background: '{content.background}',
color: '{text.muted.color}', color: '{text.muted.color}',
hoverColor: '{text.color}' hoverColor: '{text.color}',
width: '2.5rem',
focusRing: {
width: '{focus.ring.width}',
style: '{focus.ring.style}',
color: '{focus.ring.color}',
offset: '-1px',
shadow: '{focus.ring.shadow}'
}
},
activeBar: {
height: '1px',
bottom: '-1px',
background: '{primary.color}'
}, },
colorScheme: { colorScheme: {
light: { light: {

View File

@ -14,7 +14,6 @@ export default {
activeColor: '{primary.color}', activeColor: '{primary.color}',
padding: '1rem 1.25rem', padding: '1rem 1.25rem',
fontWeight: '600', fontWeight: '600',
borderRadius: '0',
margin: '0', margin: '0',
gap: '0.5rem', gap: '0.5rem',
focusRing: { focusRing: {
@ -39,14 +38,14 @@ export default {
light: { light: {
item: { item: {
background: '{surface.100}', background: '{surface.100}',
hoverBackground: '{surface.100}', hoverBackground: '{surface.200}',
activeBackground: '{surface.0}' activeBackground: '{surface.0}'
} }
}, },
dark: { dark: {
item: { item: {
background: '{surface.800}', background: '{surface.800}',
hoverBackground: '{surface.800}', hoverBackground: '{surface.700}',
activeBackground: '{surface.900}' activeBackground: '{surface.900}'
} }
} }

View File

@ -1,33 +1,70 @@
export default { export default {
tabList: { tablist: {
borderWidth: '0',
background: '{content.background}', background: '{content.background}',
borderColor: '{content.border.color}' borderColor: '{content.border.color}'
}, },
tab: { tab: {
borderColor: '{content.border.color}', borderWidth: '2px 0 0 0',
borderColor: 'transparent',
hoverBorderColor: 'transparent',
activeBorderColor: '{primary.color}', activeBorderColor: '{primary.color}',
color: '{text.muted.color}', color: '{text.muted.color}',
hoverColor: '{text.color}', hoverColor: '{text.color}',
activeColor: '{primary.color}' activeColor: '{primary.color}',
padding: '1rem 1.25rem',
fontWeight: '600',
margin: '0',
focusRing: {
width: '{focus.ring.width}',
style: '{focus.ring.style}',
color: '{focus.ring.color}',
offset: '{focus.ring.offset}',
shadow: 'inset {focus.ring.shadow}'
}
}, },
tabPanel: { tabpanel: {
background: '{content.background}', background: '{content.background}',
color: '{content.color}' color: '{content.color}',
padding: '0.875rem 1.125rem 1.125rem 1.125rem'
}, },
navButton: { navButton: {
background: '{content.background}', background: '{content.background}',
color: '{text.muted.color}', color: '{text.muted.color}',
hoverColor: '{text.color}' hoverColor: '{text.color}',
width: '2.5rem',
focusRing: {
width: '{focus.ring.width}',
style: '{focus.ring.style}',
color: '{focus.ring.color}',
offset: '{focus.ring.offset}',
shadow: 'inset {focus.ring.shadow}'
}
},
activeBar: {
height: '0',
bottom: '0',
background: 'transparent'
}, },
colorScheme: { colorScheme: {
light: { light: {
navButton: { navButton: {
boxShadow: '0px 0px 10px 50px rgba(255, 255, 255, 0.6)' shadow: '0px 0px 10px 50px rgba(255, 255, 255, 0.6)'
},
tab: {
background: '{surface.100}',
hoverBackground: '{surface.200}',
activeBackground: '{surface.0}'
} }
}, },
dark: { dark: {
navButton: { navButton: {
boxShadow: '0px 0px 10px 50px color-mix(in srgb, {content.background}, transparent 50%)' shadow: '0px 0px 10px 50px color-mix(in srgb, {content.background}, transparent 50%)'
},
tab: {
background: '{surface.800}',
hoverBackground: '{surface.700}',
activeBackground: '{surface.900}'
} }
} }
} }