Tokens for Stepper

pull/5756/head
Cagatay Civici 2024-05-11 23:33:50 +03:00
parent 51d7871594
commit bf1f8b1017
3 changed files with 125 additions and 37 deletions

View File

@ -17,7 +17,8 @@ const theme = ({ dt }) => `
display: flex; display: flex;
flex: 1 1 auto; flex: 1 1 auto;
align-items: center; align-items: center;
padding: 0.5rem; gap: ${dt('stepper.item.gap')};
padding: ${dt('stepper.item.padding')};
} }
.p-stepper-item:last-of-type { .p-stepper-item:last-of-type {
@ -30,15 +31,18 @@ const theme = ({ dt }) => `
align-items: center; align-items: center;
text-decoration: none; text-decoration: none;
cursor: pointer; cursor: pointer;
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}, outline-color ${dt('transition.duration')}; transition: background ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')};
border-radius: ${dt('border.radius.md')}; border-radius: ${dt('stepper.item.header.border.radius')};
outline-color: transparent; outline-color: transparent;
background: transparent; background: transparent;
padding: ${dt('stepper.item.header.padding')};
gap: ${dt('stepper.item.header.gap')};
} }
.p-stepper-item .p-stepper-item-header:focus-visible { .p-stepper-item-header:focus-visible {
outline: ${dt('focus.ring.width')} ${dt('focus.ring.style')} ${dt('focus.ring.color')}; box-shadow: ${dt('stepper.item.header.focus.ring.shadow')};
outline-offset: ${dt('focus.ring.offset')}; outline: ${dt('stepper.item.header.focus.ring.width')} ${dt('stepper.item.header.focus.ring.style')} ${dt('stepper.item.header.focus.ring.color')};
outline-offset: ${dt('stepper.item.header.focus.ring.offset')};
} }
.p-stepper.p-stepper-readonly .p-stepper-item { .p-stepper.p-stepper-readonly .p-stepper-item {
@ -51,9 +55,8 @@ const theme = ({ dt }) => `
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: 100%; max-width: 100%;
margin-left: 0.5rem;
color: ${dt('stepper.item.title.color')}; color: ${dt('stepper.item.title.color')};
font-weight: 500; font-weight: ${dt('stepper.item.title.font.weight')};
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}, outline-color ${dt('transition.duration')}; transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}, outline-color ${dt('transition.duration')};
} }
@ -61,17 +64,17 @@ const theme = ({ dt }) => `
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: relative;
color: ${dt('stepper.item.number.color')}; color: ${dt('stepper.item.number.color')};
border: 1px solid ${dt('stepper.item.number.border.color')}; border: 2px solid ${dt('stepper.item.number.border.color')};
border-width: 2px;
background: ${dt('stepper.item.number.background')}; background: ${dt('stepper.item.number.background')};
min-width: 2rem; min-width: ${dt('stepper.item.number.size')};
height: 2rem; height: ${dt('stepper.item.number.size')};
line-height: 2rem; line-height: ${dt('stepper.item.number.size')};
font-size: 1.143rem; font-size: ${dt('stepper.item.number.font.size')};
border-radius: 50%; z-index: 1;
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}, outline-color ${dt('transition.duration')}; border-radius: ${dt('stepper.item.number.border.radius')};
position: relative;
font-weight: ${dt('stepper.item.number.font.weight')};
} }
.p-stepper-item-number::after { .p-stepper-item-number::after {
@ -79,8 +82,8 @@ const theme = ({ dt }) => `
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 50%; border-radius: ${dt('stepper.item.number.border.radius')};
box-shadow: 0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12); box-shadow: ${dt('stepper.item.number.shadow')};
} }
.p-stepper-item-active .p-stepper-item-header { .p-stepper-item-active .p-stepper-item-header {
@ -109,13 +112,12 @@ const theme = ({ dt }) => `
flex: 1 1 0; flex: 1 1 0;
background: ${dt('stepper.separator.background')}; background: ${dt('stepper.separator.background')};
width: 100%; width: 100%;
height: 2px; height: ${dt('stepper.separator.size')};
margin-inline-start: 1rem;
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}, outline-color ${dt('transition.duration')}; transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')}, outline-color ${dt('transition.duration')};
} }
.p-stepper-panels { .p-stepper-panels {
padding: 0.875rem 1.125rem 1.125rem 1.125rem; padding: ${dt('stepper.panel.content.orientation.horizontal.padding')};
} }
.p-stepper-panel-content { .p-stepper-panel-content {
@ -153,14 +155,16 @@ const theme = ({ dt }) => `
.p-stepper-vertical .p-stepper-panel .p-stepper-panel-content { .p-stepper-vertical .p-stepper-panel .p-stepper-panel-content {
width: 100%; width: 100%;
padding-left: 1rem; padding: ${dt('stepper.panel.content.orientation.vertical.padding')};
} }
.p-stepper-vertical .p-stepper-panel .p-stepper-separator { .p-stepper-vertical .p-stepper-panel .p-stepper-separator {
flex: 0 0 auto; flex: 0 0 auto;
width: 2px; width: ${dt('stepper.separator.size')};
height: auto; height: auto;
margin-inline-start: calc(1.75rem + 2px); margin: ${dt('stepper.separator.orientation.vertical.margin')};
position: relative;
left: calc(-1 * ${dt('stepper.separator.size')} / 2);
} }
.p-stepper-vertical .p-stepper-panel:has(~ .p-stepper-panel-active) .p-stepper-separator { .p-stepper-vertical .p-stepper-panel:has(~ .p-stepper-panel-active) .p-stepper-separator {
@ -168,7 +172,7 @@ const theme = ({ dt }) => `
} }
.p-stepper-vertical .p-stepper-panel:last-of-type .p-stepper-panel-content { .p-stepper-vertical .p-stepper-panel:last-of-type .p-stepper-panel-content {
padding-left: 3rem; padding: ${dt('stepper.panel.content.orientation.vertical.last.padding')};
} }
`; `;

View File

@ -1,21 +1,63 @@
export default { export default {
separator: { separator: {
background: '{content.border.color}', background: '{content.border.color}',
activeBackground: '{primary.color}' activeBackground: '{primary.color}',
orientation: {
vertical: {
margin: '0 0 0 1.625rem'
}
},
size: '2px'
},
item: {
padding: '0.5rem',
gap: '1rem'
},
itemHeader: {
padding: '0',
borderRadius: '{content.border.radius}',
focusRing: {
width: '{focus.ring.width}',
style: '{focus.ring.style}',
color: '{focus.ring.color}',
offset: '{focus.ring.offset}',
shadow: '{focus.ring.shadow}'
},
gap: '0.5rem'
}, },
itemTitle: { itemTitle: {
color: '{text.color}', color: '{text.muted.color}',
activeColor: '{primary.color}' activeColor: '{primary.color}',
fontWeight: '500'
}, },
itemNumber: { itemNumber: {
background: '{content.background}', background: '{content.background}',
activeBackground: '{content.background}', activeBackground: '{content.background}',
borderColor: '{content.border.color}', borderColor: '{content.border.color}',
color: '{text.muted.color}', color: '{text.muted.color}',
activeColor: '{primary.color}' activeColor: '{primary.color}',
size: '2rem',
fontSize: '1.143rem',
fontWeight: '500',
borderRadius: '50%',
shadow: '0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12)'
},
verticalPanelContainer: {
paddingLeft: '1rem'
}, },
panelContent: { panelContent: {
background: '{content.background}', background: '{content.background}',
color: '{content.color}' color: '{content.color}',
orientation: {
horizontal: {
padding: '0.875rem 0.5rem 1.125rem 0.5rem'
},
vertical: {
padding: '0 0 0 1rem',
last: {
padding: '0 0 0 3rem'
}
}
}
} }
}; };

View File

@ -1,21 +1,63 @@
export default { export default {
separator: { separator: {
background: '{content.border.color}', background: '{content.border.color}',
activeBackground: '{primary.color}' activeBackground: '{primary.color}',
orientation: {
vertical: {
margin: '0 0 0 1.625rem'
}
},
size: '2px'
},
item: {
padding: '0.5rem',
gap: '1rem'
},
itemHeader: {
padding: '0',
borderRadius: '{content.border.radius}',
focusRing: {
width: '{focus.ring.width}',
style: '{focus.ring.style}',
color: '{focus.ring.color}',
offset: '{focus.ring.offset}',
shadow: '{focus.ring.shadow}'
},
gap: '0.5rem'
}, },
itemTitle: { itemTitle: {
color: '{text.color}', color: '{text.muted.color}',
activeColor: '{primary.color}' activeColor: '{primary.color}',
fontWeight: '500'
}, },
itemNumber: { itemNumber: {
background: '{content.background}', background: '{content.background}',
activeBackground: '{content.background}', activeBackground: '{primary.color}',
borderColor: '{content.border.color}', borderColor: '{content.border.color}',
color: '{text.muted.color}', color: '{text.muted.color}',
activeColor: '{primary.color}' activeColor: '{primary.inverse.color}',
size: '2.25rem',
fontSize: '1.125rem',
fontWeight: '500',
borderRadius: '50%',
shadow: 'none'
},
verticalPanelContainer: {
paddingLeft: '1rem'
}, },
panelContent: { panelContent: {
background: '{content.background}', background: '{content.background}',
color: '{content.color}' color: '{content.color}',
orientation: {
horizontal: {
padding: '0.875rem 0.5rem 1.125rem 0.5rem'
},
vertical: {
padding: '0 0 0 1rem',
last: {
padding: '0 0 0 3rem'
}
}
}
} }
}; };