Tokens fo rTab

pull/5756/head
Cagatay Civici 2024-05-11 12:30:44 +03:00
parent 1505ce359e
commit ac33f3568f
5 changed files with 117 additions and 29 deletions

View File

@ -81,7 +81,7 @@ export interface TabMenuPassThroughOptions {
/** /**
* Used to pass attributes to the inkbar's DOM element. * Used to pass attributes to the inkbar's DOM element.
*/ */
inkbar?: TabMenuPassThroughOptionType; activeBar?: TabMenuPassThroughOptionType;
/** /**
* Used to manage all lifecycle hooks. * Used to manage all lifecycle hooks.
* @see {@link BaseComponent.ComponentHooks} * @see {@link BaseComponent.ComponentHooks}

View File

@ -23,7 +23,7 @@
<component v-else :is="$slots.item" :item="item" :index="i" :active="i === d_activeIndex" :label="label(item)" :props="getMenuItemProps(item, i)"></component> <component v-else :is="$slots.item" :item="item" :index="i" :active="i === d_activeIndex" :label="label(item)" :props="getMenuItemProps(item, i)"></component>
</li> </li>
</template> </template>
<li ref="inkbar" role="none" :class="cx('inkbar')" v-bind="ptm('inkbar')"></li> <li ref="inkbar" role="none" :class="cx('activeBar')" v-bind="ptm('activeBar')"></li>
</ul> </ul>
</div> </div>
</template> </template>

View File

@ -10,10 +10,10 @@ const theme = ({ dt }) => `
margin: 0; margin: 0;
padding: 0; padding: 0;
list-style-type: none; list-style-type: none;
flex: 1 1 auto;
background: ${dt('tabmenu.tablist.background')}; background: ${dt('tabmenu.tablist.background')};
border: 1px solid ${dt('tabmenu.tablist.border.color')}; border-style: solid;
border-width: 0 0 1px 0; border-color: ${dt('tabmenu.tablist.border.color')};
border-width: ${dt('tabmenu.tablist.border.width')};
position: relative; position: relative;
} }
@ -25,46 +25,63 @@ const theme = ({ dt }) => `
text-decoration: none; text-decoration: none;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
background: ${dt('tabmenu.item.background')};
border-style: solid; border-style: solid;
border-width: 0 0 1px 0; border-width: ${dt('tabmenu.item.border.width')};
border-color: transparent transparent ${dt('tabmenu.item.link.border.color')} transparent; border-color: ${dt('tabmenu.item.border.color')};
color: ${dt('tabmenu.item.link.color')}; color: ${dt('tabmenu.item.color')};
padding: 1rem 1.125rem; padding: ${dt('tabmenu.item.padding')};
font-weight: 600; font-weight: ${dt('tabmenu.item.font.weight')};
border-top-right-radius: ${dt('border.radius.md')}; border-top-right-radius: ${dt('tabmenu.item.border.radius')};
border-top-left-radius: ${dt('border.radius.md')}; border-top-left-radius: ${dt('tabmenu.item.border.radius')};
transition: color ${dt('transition.duration')}, outline-color ${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: 0 0 -1px 0; margin: ${dt('tabmenu.item.margin')};
outline-color: transparent; outline-color: transparent;
gap: ${dt('tabmenu.item.gap')};
} }
.p-tabmenu-item-link:focus-visible { .p-tabmenu-item-link:focus-visible {
outline: ${dt('focus.ring.width')} ${dt('focus.ring.style')} ${dt('focus.ring.color')}; box-shadow: ${dt('tabmenu.item.focus.ring.shadow')};
outline-offset: -1px; 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')};
} }
.p-tabmenu-item-icon { .p-tabmenu-item-icon {
margin-right: 0.5rem; color: ${dt('tabmenu.item.icon.color')};
transition: background ${dt('transition.duration')}, border-color ${dt('transition.duration')}, color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')};
} }
.p-tabmenu-item-label { .p-tabmenu-item-label {
line-height: 1; line-height: 1;
} }
.p-tabmenu-item:not(.p-tabmenu-item-active):not(.p-disabled):hover .p-tabmenu-item-link { .p-tabmenu-item:not(.p-tabmenu-item-active):not(.p-disabled):hover .p-tabmenu-item-link {
color: ${dt('tabmenu.item.link.hover.color')}; background: ${dt('tabmenu.item.hover.background')};
border-color: ${dt('tabmenu.item.hover.border.color')};
color: ${dt('tabmenu.item.hover.color')};
}
.p-tabmenu-item:not(.p-tabmenu-item-active):not(.p-disabled):hover .p-tabmenu-item-icon {
color: ${dt('tabmenu.item.icon.hover.color')};
} }
.p-tabmenu-item-active .p-tabmenu-item-link { .p-tabmenu-item-active .p-tabmenu-item-link {
color: ${dt('tabmenu.item.link.active.border.color')}; background: ${dt('tabmenu.item.active.background')};
border-color: ${dt('tabmenu.item.active.border.color')};
color: ${dt('tabmenu.item.active.color')};
} }
.p-tabmenu-ink-bar { .p-tabmenu-item-active .p-tabmenu-item-icon {
color: ${dt('tabmenu.item.icon.active.color')};
}
.p-tabmenu-active-bar {
z-index: 1; z-index: 1;
display: block; display: block;
position: absolute; position: absolute;
bottom: -1px; bottom: ${dt('tabmenu.active.bar.bottom')};
height: 1px; height: ${dt('tabmenu.active.bar.height')};
background-color: ${dt('tabmenu.item.link.active.border.color')}; background: ${dt('tabmenu.active.bar.background')};
transition: 250ms cubic-bezier(0.35, 0, 0.25, 1); transition: 250ms cubic-bezier(0.35, 0, 0.25, 1);
} }
@ -86,7 +103,7 @@ const classes = {
itemLink: 'p-tabmenu-item-link', itemLink: 'p-tabmenu-item-link',
itemIcon: 'p-tabmenu-item-icon', itemIcon: 'p-tabmenu-item-icon',
itemLabel: 'p-tabmenu-item-label', itemLabel: 'p-tabmenu-item-label',
inkbar: 'p-tabmenu-ink-bar' activeBar: 'p-tabmenu-active-bar'
}; };
export default BaseStyle.extend({ export default BaseStyle.extend({

View File

@ -1,12 +1,41 @@
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}'
}, },
itemLink: { item: {
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}',
padding: '1rem 1.125rem',
fontWeight: '600',
borderRadius: '{content.border.radius}',
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}'
}
},
itemIcon: {
color: '{text.muted.color}',
hoverColor: '{text.color}',
activeColor: '{primary.color}'
},
activeBar: {
height: '1px',
bottom: '-1px',
background: '{primary.color}'
} }
}; };

View File

@ -1,12 +1,54 @@
export default { export default {
tablist: { tablist: {
borderWidth: '0',
background: '{content.background}', background: '{content.background}',
borderColor: '{content.border.color}' borderColor: '{content.border.color}'
}, },
itemLink: { item: {
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}',
padding: '1rem 1.25rem',
fontWeight: '600',
borderRadius: '0',
margin: '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}'
}
},
itemIcon: {
color: '{text.muted.color}',
hoverColor: '{text.color}',
activeColor: '{primary.color}'
},
activeBar: {
height: '0',
bottom: '0',
background: 'transparent'
},
colorScheme: {
light: {
item: {
background: '{surface.100}',
hoverBackground: '{surface.100}',
activeBackground: '{surface.0}'
}
},
dark: {
item: {
background: '{surface.800}',
hoverBackground: '{surface.800}',
activeBackground: '{surface.900}'
}
}
} }
}; };