New tokens for MultiSelect with Lara support

pull/5701/head
Cagatay Civici 2024-05-08 10:55:59 +03:00
parent c493f0d22a
commit b940bc39f2
5 changed files with 108 additions and 57 deletions

View File

@ -8,8 +8,8 @@ const theme = ({ dt }) => `
user-select: none; user-select: none;
background: ${dt('multiselect.background')}; background: ${dt('multiselect.background')};
border: 1px solid ${dt('multiselect.border.color')}; border: 1px solid ${dt('multiselect.border.color')};
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}; transition: background-color ${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('multiselect.border.radius')};
outline-color: transparent; outline-color: transparent;
box-shadow: ${dt('multiselect.shadow')}; box-shadow: ${dt('multiselect.shadow')};
} }
@ -20,7 +20,9 @@ const theme = ({ dt }) => `
.p-multiselect:not(.p-disabled).p-focus { .p-multiselect:not(.p-disabled).p-focus {
border-color: ${dt('multiselect.focus.border.color')}; border-color: ${dt('multiselect.focus.border.color')};
outline: 0 none; box-shadow: ${dt('multiselect.focus.ring.shadow')};
outline: ${dt('multiselect.focus.ring.width')} ${dt('multiselect.focus.ring.style')} ${dt('multiselect.focus.ring.color')};
outline-offset: ${dt('multiselect.focus.ring.offset')};
} }
.p-multiselect.p-variant-filled { .p-multiselect.p-variant-filled {
@ -47,9 +49,9 @@ const theme = ({ dt }) => `
flex-shrink: 0; flex-shrink: 0;
background: transparent; background: transparent;
color: ${dt('multiselect.dropdown.color')}; color: ${dt('multiselect.dropdown.color')};
width: 2.5rem; width: ${dt('multiselect.dropdown.width')};
border-top-right-radius: ${dt('border.radius.md')}; border-top-right-radius: ${dt('multiselect.border.radius')};
border-bottom-right-radius: ${dt('border.radius.md')}; border-bottom-right-radius: ${dt('multiselect.border.radius')};
} }
.p-multiselect-label-container { .p-multiselect-label-container {
@ -59,12 +61,14 @@ const theme = ({ dt }) => `
} }
.p-multiselect-label { .p-multiselect-label {
display: block; display: flex;
align-items-center;
gap: calc(${dt('multiselect.padding.y')} / 2);
white-space: nowrap; white-space: nowrap;
cursor: pointer; cursor: pointer;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
padding: 0.5rem 0.75rem; padding: ${dt('multiselect.padding.y')} ${dt('multiselect.padding.x')};
color: ${dt('multiselect.color')}; color: ${dt('multiselect.color')};
} }
@ -76,10 +80,6 @@ const theme = ({ dt }) => `
color: ${dt('multiselect.disabled.color')}; color: ${dt('multiselect.disabled.color')};
} }
.p-inputwrapper-filled.p-multiselect.p-multiselect-display-chip .p-multiselect-label {
padding: 0.25rem 0.25rem;
}
.p-multiselect-label-empty { .p-multiselect-label-empty {
overflow: hidden; overflow: hidden;
visibility: hidden; visibility: hidden;
@ -96,39 +96,40 @@ const theme = ({ dt }) => `
background: ${dt('multiselect.overlay.background')}; background: ${dt('multiselect.overlay.background')};
color: ${dt('multiselect.overlay.color')}; color: ${dt('multiselect.overlay.color')};
border: 1px solid ${dt('multiselect.overlay.border.color')}; border: 1px solid ${dt('multiselect.overlay.border.color')};
border-radius: ${dt('border.radius.md')}; border-radius: ${dt('multiselect.overlay.border.radius')};
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('multiselect.overlay.shadow')};
} }
.p-multiselect-header { .p-multiselect-header {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; padding: ${dt('multiselect.list.header.padding')};
padding: 0.5rem 1rem 0 1rem;
} }
.p-multiselect-header .p-checkbox { .p-multiselect-header .p-checkbox {
margin-right: 0.5rem; margin-right: ${dt('multiselect.option.gap')};
} }
.p-multiselect-filter-container { .p-multiselect-filter-container {
flex: 1 1 auto; flex: 1 1 auto;
} }
.p-multiselect-list-container { .p-multiselect-filter {
overflow: auto; width: 100%;
} }
.p-multiselect-filter-container .p-inputtext { .p-multiselect-list-container {
width: 100%; overflow: auto;
padding-right: 1.75rem;
} }
.p-multiselect-list { .p-multiselect-list {
margin: 0; margin: 0;
padding: 0; padding: 0;
list-style-type: none; list-style-type: none;
padding: 0.25rem 0.25rem; padding: ${dt('multiselect.list.padding')};
display: flex;
flex-direction: column;
gap: ${dt('multiselect.list.gap')}
} }
.p-multiselect-option { .p-multiselect-option {
@ -139,21 +140,13 @@ const theme = ({ dt }) => `
overflow: hidden; overflow: hidden;
display: flex; display: flex;
align-items: center; align-items: center;
margin: 2px 0; gap: ${dt('multiselect.option.gap')};
padding: 0.5rem 0.75rem; padding: ${dt('multiselect.option.padding')};
border: 0 none; border: 0 none;
color: ${dt('multiselect.option.color')}; color: ${dt('multiselect.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('multiselect.option.border.radius')}
}
.p-multiselect-option:first-child {
margin-top: 0;
}
.p-multiselect-option:last-child {
margin-bottom: 0;
} }
.p-multiselect-option:not(.p-multiselect-option-selected):not(.p-disabled).p-focus { .p-multiselect-option:not(.p-multiselect-option-selected):not(.p-disabled).p-focus {
@ -171,24 +164,30 @@ const theme = ({ dt }) => `
color: ${dt('multiselect.option.selected.focus.color')}; color: ${dt('multiselect.option.selected.focus.color')};
} }
.p-multiselect-option .p-checkbox {
margin-right: 0.5rem;
}
.p-multiselect-option-group { .p-multiselect-option-group {
cursor: auto; cursor: auto;
margin: 0; margin: 0;
padding: 0.5rem 0.75rem; padding: ${dt('multiselect.option.group.padding')};
color: ${dt('multiselect.option.group.color')};
background: ${dt('multiselect.option.group.background')}; background: ${dt('multiselect.option.group.background')};
font-weight: 600; color: ${dt('multiselect.option.group.color')};
font-weight: ${dt('multiselect.option.group.font.weight')};
} }
.p-multiselect-empty-message { .p-multiselect-empty-message {
padding: 0.5rem 0.75rem; padding: ${dt('multiselect.option.padding')};
background: transparent; background: transparent;
} }
.p-multiselect-label .p-chip {
padding-top: calc(${dt('multiselect.padding.y')} / 2);
padding-bottom: calc(${dt('multiselect.padding.y')} / 2);
border-radius: ${dt('multiselect.chip.border.radius')};
}
.p-multiselect-label:has(.p-chip) {
padding: calc(${dt('multiselect.padding.y')} / 2) calc(${dt('multiselect.padding.x')} / 2);
}
.p-fluid .p-multiselect { .p-fluid .p-multiselect {
display: flex; display: flex;
} }

View File

@ -11,15 +11,35 @@ 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}',
header: {
padding: '{list.header.padding}'
}
}, },
option: { option: {
focusBackground: '{list.option.focus.background}', focusBackground: '{list.option.focus.background}',
@ -28,10 +48,18 @@ export default {
color: '{list.option.color}', color: '{list.option.color}',
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}',
gap: '0.5rem'
}, },
optionGroup: { optionGroup: {
background: '{list.option.group.background}', background: '{list.option.group.background}',
color: '{list.option.group.color}' color: '{list.option.group.color}',
fontWeight: '{list.option.group.font.weight}',
padding: '{list.option.group.padding}'
},
chip: {
borderRadius: '{border.radius.sm}'
} }
}; };

View File

@ -58,9 +58,6 @@ export default {
fontWeight: '{list.option.group.font.weight}', fontWeight: '{list.option.group.font.weight}',
padding: '{list.option.group.padding}' padding: '{list.option.group.padding}'
}, },
filterIcon: {
color: '{form.field.icon.color}'
},
clearIcon: { clearIcon: {
color: '{form.field.icon.color}' color: '{form.field.icon.color}'
}, },

View File

@ -11,15 +11,35 @@ 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}',
header: {
padding: '{list.header.padding}'
}
}, },
option: { option: {
focusBackground: '{list.option.focus.background}', focusBackground: '{list.option.focus.background}',
@ -28,10 +48,20 @@ export default {
color: '{list.option.color}', color: '{list.option.color}',
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}',
gap: '0.5rem'
}, },
optionGroup: { optionGroup: {
background: '{list.option.group.background}', background: '{list.option.group.background}',
color: '{list.option.group.color}' color: '{list.option.group.color}',
background: '{list.option.group.background}',
color: '{list.option.group.color}',
fontWeight: '{list.option.group.font.weight}',
padding: '{list.option.group.padding}'
},
chip: {
borderRadius: '{border.radius.xs}'
} }
}; };

View File

@ -32,7 +32,7 @@ export default {
borderColor: '{overlay.select.border.color}', borderColor: '{overlay.select.border.color}',
borderRadius: '{overlay.select.border.radius}', borderRadius: '{overlay.select.border.radius}',
color: '{overlay.select.color}', color: '{overlay.select.color}',
shadow: '{overlay.select.shadow}', shadow: '{overlay.select.shadow}'
}, },
list: { list: {
padding: '{list.padding}', padding: '{list.padding}',
@ -58,9 +58,6 @@ export default {
fontWeight: '{list.option.group.font.weight}', fontWeight: '{list.option.group.font.weight}',
padding: '{list.option.group.padding}' padding: '{list.option.group.padding}'
}, },
filterIcon: {
color: '{form.field.icon.color}'
},
checkmark: { checkmark: {
color: '{list.option.color}' color: '{list.option.color}'
} }