Updated CascadeSelect with new tokens

pull/5701/head
Cagatay Civici 2024-05-08 12:42:15 +03:00
parent b940bc39f2
commit 67ee675f62
3 changed files with 68 additions and 30 deletions

View File

@ -8,8 +8,8 @@ const theme = ({ dt }) => `
user-select: none; user-select: none;
background: ${dt('cascadeselect.background')}; background: ${dt('cascadeselect.background')};
border: 1px solid ${dt('cascadeselect.border.color')}; border: 1px solid ${dt('cascadeselect.border.color')};
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${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('cascadeselect.border.radius')};
outline-color: transparent; outline-color: transparent;
box-shadow: ${dt('cascadeselect.shadow')}; box-shadow: ${dt('cascadeselect.shadow')};
} }
@ -20,7 +20,9 @@ const theme = ({ dt }) => `
.p-cascadeselect:not(.p-disabled).p-focus { .p-cascadeselect:not(.p-disabled).p-focus {
border-color: ${dt('cascadeselect.focus.border.color')}; border-color: ${dt('cascadeselect.focus.border.color')};
outline: 0 none; box-shadow: ${dt('cascadeselect.focus.ring.shadow')};
outline: ${dt('cascadeselect.focus.ring.width')} ${dt('cascadeselect.focus.ring.style')} ${dt('cascadeselect.focus.ring.color')};
outline-offset: ${dt('multiscascadeselectelect.focus.ring.offset')};
} }
.p-cascadeselect.p-variant-filled { .p-cascadeselect.p-variant-filled {
@ -47,7 +49,7 @@ const theme = ({ dt }) => `
flex-shrink: 0; flex-shrink: 0;
background: transparent; background: transparent;
color: ${dt('cascadeselect.dropdown.color')}; color: ${dt('cascadeselect.dropdown.color')};
width: 2.5rem; width: ${dt('cascadeselect.dropdown.width')};
border-top-right-radius: ${dt('border.radius.md')}; border-top-right-radius: ${dt('border.radius.md')};
border-bottom-right-radius: ${dt('border.radius.md')}; border-bottom-right-radius: ${dt('border.radius.md')};
} }
@ -58,10 +60,9 @@ const theme = ({ dt }) => `
overflow: hidden; overflow: hidden;
flex: 1 1 auto; flex: 1 1 auto;
width: 1%; width: 1%;
padding: 0.5rem 0.75rem;
text-overflow: ellipsis; text-overflow: ellipsis;
cursor: pointer; cursor: pointer;
color: ${dt('cascadeselect.color')}; padding: ${dt('cascadeselect.padding.y')} ${dt('cascadeselect.padding.x')};
background: transparent; background: transparent;
border: 0 none; border: 0 none;
outline: 0 none; outline: 0 none;
@ -94,10 +95,10 @@ const theme = ({ dt }) => `
.p-cascadeselect-overlay { .p-cascadeselect-overlay {
background: ${dt('cascadeselect.overlay.background')}; background: ${dt('cascadeselect.overlay.background')};
border: 1px solid ${dt('cascadeselect.overlay.border.color')};
border-radius: ${dt('border.radius.md')};
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
color: ${dt('cascadeselect.overlay.color')}; color: ${dt('cascadeselect.overlay.color')};
border: 1px solid ${dt('cascadeselect.overlay.border.color')};
border-radius: ${dt('cascadeselect.overlay.border.radius')};
box-shadow: ${dt('cascadeselect.overlay.shadow')};
} }
.p-cascadeselect .p-cascadeselect-overlay { .p-cascadeselect .p-cascadeselect-overlay {
@ -112,30 +113,25 @@ const theme = ({ dt }) => `
} }
.p-cascadeselect-list { .p-cascadeselect-list {
list-style-type: none;
margin: 0;
min-width: 100%; min-width: 100%;
padding: 0.25rem 0.25rem; margin: 0;
padding: 0;
list-style-type: none;
padding: ${dt('cascadeselect.list.padding')};
display: flex;
flex-direction: column;
gap: ${dt('cascadeselect.list.gap')}
} }
.p-cascadeselect-item { .p-cascadeselect-item {
cursor: pointer; cursor: pointer;
font-weight: normal; font-weight: normal;
white-space: nowrap; white-space: nowrap;
margin: 2px 0;
border: 0 none; border: 0 none;
color: ${dt('cascadeselect.option.color')}; color: ${dt('cascadeselect.option.color')};
background: transparent; background: transparent;
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')};
border-radius: ${dt('border.radius.sm')}; border-radius: ${dt('cascadeselect.option.border.radius')};
}
.p-cascadeselect-item:first-child {
margin-top: 0;
}
.p-cascadeselect-item:last-child {
margin-bottom: 0;
} }
.p-cascadeselect-item:not(.p-cascadeselect-item-selected):not(.p-disabled).p-focus { .p-cascadeselect-item:not(.p-cascadeselect-item-selected):not(.p-disabled).p-focus {
@ -174,12 +170,14 @@ const theme = ({ dt }) => `
align-items: center; align-items: center;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
padding: 0.5rem 0.75rem; padding: ${dt('cascadeselect.option.padding')};
} }
.p-cascadeselect-group-icon { .p-cascadeselect-group-icon {
margin-left: auto; margin-left: auto;
font-size: 0.875rem; font-size: ${dt('cascadeselect.option.icon.size')};
width: ${dt('cascadeselect.option.icon.size')};
height: ${dt('cascadeselect.option.icon.size')};
color: ${dt('cascadeselect.option.icon.color')}; color: ${dt('cascadeselect.option.icon.color')};
} }
`; `;

View File

@ -11,15 +11,32 @@ export default {
color: '{form.field.color}', color: '{form.field.color}',
disabledColor: '{form.field.disabled.color}', disabledColor: '{form.field.disabled.color}',
placeholderColor: '{form.field.placeholder.color}', placeholderColor: '{form.field.placeholder.color}',
shadow: '{form.field.shadow}' shadow: '{form.field.shadow}',
paddingX: '{form.field.padding.x}',
paddingY: '{form.field.padding.y}',
borderRadius: '{form.field.border.radius}',
focusRing: {
width: '{form.field.focus.ring.width}',
style: '{form.field.focus.ring.style}',
color: '{form.field.focus.ring.color}',
offset: '{form.field.focus.ring.offset}',
shadow: '{form.field.focus.ring.shadow}'
}
}, },
dropdown: { dropdown: {
width: '2.5rem',
color: '{form.field.icon.color}' color: '{form.field.icon.color}'
}, },
overlay: { overlay: {
background: '{overlay.select.background}', background: '{overlay.select.background}',
borderColor: '{overlay.select.border.color}', borderColor: '{overlay.select.border.color}',
color: '{overlay.select.color}' borderRadius: '{overlay.select.border.radius}',
color: '{overlay.select.color}',
shadow: '{overlay.select.shadow}'
},
list: {
padding: '{list.padding}',
gap: '{list.gap}'
}, },
option: { option: {
focusBackground: '{list.option.focus.background}', focusBackground: '{list.option.focus.background}',
@ -29,9 +46,12 @@ export default {
focusColor: '{list.option.focus.color}', focusColor: '{list.option.focus.color}',
selectedColor: '{list.option.selected.color}', selectedColor: '{list.option.selected.color}',
selectedFocusColor: '{list.option.selected.focus.color}', selectedFocusColor: '{list.option.selected.focus.color}',
padding: '{list.option.padding}',
borderRadius: '{list.option.border.radius}',
icon: { icon: {
color: '{list.option.icon.color}', color: '{list.option.icon.color}',
focusColor: '{list.option.icon.focus.color}' focusColor: '{list.option.icon.focus.color}',
size: '0.875rem'
} }
} }
}; };

View File

@ -11,15 +11,32 @@ export default {
color: '{form.field.color}', color: '{form.field.color}',
disabledColor: '{form.field.disabled.color}', disabledColor: '{form.field.disabled.color}',
placeholderColor: '{form.field.placeholder.color}', placeholderColor: '{form.field.placeholder.color}',
shadow: '{form.field.shadow}' shadow: '{form.field.shadow}',
paddingX: '{form.field.padding.x}',
paddingY: '{form.field.padding.y}',
borderRadius: '{form.field.border.radius}',
focusRing: {
width: '{form.field.focus.ring.width}',
style: '{form.field.focus.ring.style}',
color: '{form.field.focus.ring.color}',
offset: '{form.field.focus.ring.offset}',
shadow: '{form.field.focus.ring.shadow}'
}
}, },
dropdown: { dropdown: {
width: '2.5rem',
color: '{form.field.icon.color}' color: '{form.field.icon.color}'
}, },
overlay: { overlay: {
background: '{overlay.select.background}', background: '{overlay.select.background}',
borderColor: '{overlay.select.border.color}', borderColor: '{overlay.select.border.color}',
color: '{overlay.select.color}' borderRadius: '{overlay.select.border.radius}',
color: '{overlay.select.color}',
shadow: '{overlay.select.shadow}'
},
list: {
padding: '{list.padding}',
gap: '{list.gap}'
}, },
option: { option: {
focusBackground: '{list.option.focus.background}', focusBackground: '{list.option.focus.background}',
@ -29,9 +46,12 @@ export default {
focusColor: '{list.option.focus.color}', focusColor: '{list.option.focus.color}',
selectedColor: '{list.option.selected.color}', selectedColor: '{list.option.selected.color}',
selectedFocusColor: '{list.option.selected.focus.color}', selectedFocusColor: '{list.option.selected.focus.color}',
padding: '{list.option.padding}',
borderRadius: '{list.option.border.radius}',
icon: { icon: {
color: '{list.option.icon.color}', color: '{list.option.icon.color}',
focusColor: '{list.option.icon.focus.color}' focusColor: '{list.option.icon.focus.color}',
size: '0.875rem'
} }
} }
}; };