Lara preset for AutoComplete

pull/5701/head
Cagatay Civici 2024-05-07 01:54:05 +03:00
parent bc71f9f402
commit 94b4cf5d3d
6 changed files with 106 additions and 49 deletions

View File

@ -10,11 +10,11 @@ const theme = ({ dt }) => `
position: absolute; position: absolute;
top: 50%; top: 50%;
margin-top: -0.5rem; margin-top: -0.5rem;
right: 0.75rem; right: ${dt('autocomplete.padding.x')};
} }
.p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-loader { .p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-loader {
right: 3.25rem; right: calc(${dt('autocomplete.dropdown.width')} + ${dt('autocomplete.padding.x')});
} }
.p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-input { .p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-input {
@ -78,14 +78,14 @@ const theme = ({ dt }) => `
color: ${dt('autocomplete.overlay.color')}; color: ${dt('autocomplete.overlay.color')};
border: 1px solid ${dt('autocomplete.overlay.border.color')}; border: 1px solid ${dt('autocomplete.overlay.border.color')};
border-radius: ${dt('border.radius.md')}; 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); box-shadow: ${dt('autocomplete.overlay.shadow')};
} }
.p-autocomplete-list { .p-autocomplete-list {
margin: 0; margin: 0;
padding: 0; padding: 0;
list-style-type: none; list-style-type: none;
padding: 0.25rem 0.25rem; padding: ${dt('autocomplete.list.padding')};
} }
.p-autocomplete-option { .p-autocomplete-option {
@ -94,12 +94,12 @@ const theme = ({ dt }) => `
position: relative; position: relative;
overflow: hidden; overflow: hidden;
margin: 2px 0; margin: 2px 0;
padding: 0.5rem 0.75rem; padding: ${dt('autocomplete.option.padding')};
border: 0 none; border: 0 none;
color: ${dt('autocomplete.option.color')}; color: ${dt('autocomplete.option.color')};
background: transparent; background: transparent;
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}; transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')};
border-radius: ${dt('border.radius.sm')}; border-radius: ${dt('autocomplete.option.border.radius')};
} }
.p-autocomplete-option:first-child { .p-autocomplete-option:first-child {
@ -127,65 +127,76 @@ const theme = ({ dt }) => `
.p-autocomplete-option-group { .p-autocomplete-option-group {
margin: 0; margin: 0;
padding: 0.5rem 0.75rem; padding: ${dt('autocomplete.option.group.padding')};
color: ${dt('autocomplete.option.group.color')}; color: ${dt('autocomplete.option.group.color')};
background: ${dt('autocomplete.option.group.background')}; background: ${dt('autocomplete.option.group.background')};
font-weight: 600; font-weight: ${dt('autocomplete.option.group.font.weight')};
} }
.p-autocomplete-input-multiple { .p-autocomplete-input-multiple {
margin: 0; margin: 0;
padding: 0;
list-style-type: none; list-style-type: none;
cursor: text; cursor: text;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
padding: 0.25rem 0.25rem; padding: calc(${dt('autocomplete.padding.y')} / 2) ${dt('autocomplete.padding.x')};
gap: 0.25rem; gap: calc(${dt('autocomplete.padding.y')} / 2);
color: ${dt('autocomplete.input.multiple.color')}; color: ${dt('autocomplete.color')};
background: ${dt('autocomplete.input.multiple.background')}; background: ${dt('autocomplete.background')};
border: 1px solid ${dt('autocomplete.input.multiple.border.color')}; border: 1px solid ${dt('autocomplete.border.color')};
border-radius: ${dt('border.radius.md')}; border-radius: ${dt('autocomplete.border.radius')};
width: 100%; width: 100%;
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')};
outline-color: transparent; outline-color: transparent;
box-shadow: ${dt('autocomplete.input.multiple.shadow')}; box-shadow: ${dt('autocomplete.shadow')};
} }
.p-autocomplete:not(.p-disabled):hover .p-autocomplete-input-multiple { .p-autocomplete:not(.p-disabled):hover .p-autocomplete-input-multiple {
border-color: ${dt('autocomplete.input.multiple.hover.border.color')}; border-color: ${dt('autocomplete.hover.border.color')};
} }
.p-autocomplete:not(.p-disabled).p-focus .p-autocomplete-input-multiple { .p-autocomplete:not(.p-disabled).p-focus .p-autocomplete-input-multiple {
border-color: ${dt('autocomplete.input.multiple.focus.border.color')}; border-color: ${dt('autocomplete.focus.border.color')};
box-shadow: ${dt('autocomplete.focus.shadow')};
outline: 0 none; outline: 0 none;
} }
.p-autocomplete.p-invalid .p-autocomplete-input-multiple { .p-autocomplete.p-invalid .p-autocomplete-input-multiple {
border-color: ${dt('autocomplete.input.multiple.invalid.border.color')}; border-color: ${dt('autocomplete.invalid.border.color')};
} }
.p-variant-filled.p-autocomplete-input-multiple { .p-variant-filled.p-autocomplete-input-multiple {
background: ${dt('autocomplete.input.multiple.filled.background')}; background: ${dt('autocomplete.filled.background')};
} }
.p-autocomplete:not(.p-disabled).p-focus .p-variant-filled.p-autocomplete-input-multiple { .p-autocomplete:not(.p-disabled).p-focus .p-variant-filled.p-autocomplete-input-multiple {
background: ${dt('autocomplete.input.multiple.filled.focus.background')}; background: ${dt('autocomplete.filled.focus.background')};
} }
.p-autocomplete.p-disabled .p-autocomplete-input-multiple { .p-autocomplete.p-disabled .p-autocomplete-input-multiple {
opacity: 1; opacity: 1;
background: ${dt('autocomplete.input.multiple.disabled.background')}; background: ${dt('autocomplete.disabled.background')};
color: ${dt('autocomplete.input.multiple.disabled.color')}; color: ${dt('autocomplete.disabled.color')};
}
.p-autocomplete-input-multiple .p-chip {
padding-top: calc(${dt('autocomplete.padding.y')} / 2);
padding-bottom: calc(${dt('autocomplete.padding.y')} / 2);
border-radius: calc(${dt('autocomplete.border.radius')} - calc(${dt('autocomplete.padding.y')} / 2));
}
.p-autocomplete-input-multiple:has(.p-chip) {
padding-left: calc(${dt('autocomplete.padding.y')} / 2);
padding-right: calc(${dt('autocomplete.padding.y')} / 2);
} }
.p-autocomplete-input-chip { .p-autocomplete-input-chip {
flex: 1 1 auto; flex: 1 1 auto;
display: inline-flex; display: inline-flex;
padding: 0.25rem 0; padding-top: calc(${dt('autocomplete.padding.y')} / 2);
margin-left: 0.5rem; padding-bottom: calc(${dt('autocomplete.padding.y')} / 2);
} }
.p-autocomplete-input-chip input { .p-autocomplete-input-chip input {
@ -204,7 +215,7 @@ const theme = ({ dt }) => `
} }
.p-autocomplete-input-chip input::placeholder { .p-autocomplete-input-chip input::placeholder {
color: ${dt('autocomplete.input.multiple.placeholder.color')}; color: ${dt('autocomplete.placeholder.color')};
} }
.p-fluid .p-autocomplete { .p-fluid .p-autocomplete {

View File

@ -7,15 +7,10 @@ const theme = ({ dt }) => `
background: ${dt('chip.background')}; background: ${dt('chip.background')};
color: ${dt('chip.color')}; color: ${dt('chip.color')};
border-radius: 16px; border-radius: 16px;
padding: 0.25rem 0.75rem; padding: 0.5rem 0.75rem;
}
.p-chip-label {
line-height: 1.5;
} }
.p-chip-icon { .p-chip-icon {
line-height: 1.5;
margin-right: 0.5rem; margin-right: 0.5rem;
} }
@ -32,7 +27,6 @@ const theme = ({ dt }) => `
} }
.p-chip-remove-icon { .p-chip-remove-icon {
line-height: 1.5;
cursor: pointer; cursor: pointer;
margin-left: 0.375rem; margin-left: 0.375rem;
border-radius: 6px; border-radius: 6px;

View File

@ -11,12 +11,20 @@ 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}',
focusShadow: '{form.field.focus.shadow}',
paddingX: '{form.field.padding.x}',
paddingY: '{form.field.padding.y}',
borderRadius: '{form.field.border.radius}'
}, },
overlay: { overlay: {
background: '{overlay.select.background}', background: '{overlay.select.background}',
borderColor: '{overlay.select.border.color}', borderColor: '{overlay.select.border.color}',
color: '{overlay.select.color}' color: '{overlay.select.color}',
shadow: '{overlay.select.shadow}'
},
list: {
padding: '{list.padding}'
}, },
option: { option: {
focusBackground: '{list.option.focus.background}', focusBackground: '{list.option.focus.background}',
@ -25,11 +33,15 @@ 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}'
}, },
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}'
}, },
dropdown: { dropdown: {
width: '2.5rem', width: '2.5rem',

View File

@ -87,6 +87,7 @@ import treetable from 'primevue/themes/aura/treetable';
export default { export default {
primitive: { primitive: {
borderRadius: { borderRadius: {
none: '0',
sm: '4px', sm: '4px',
md: '6px', md: '6px',
lg: '8px', lg: '8px',
@ -142,6 +143,17 @@ export default {
paddingY: '0.5rem', paddingY: '0.5rem',
borderRadius: '{border.radius.md}' borderRadius: '{border.radius.md}'
}, },
list: {
padding: '0.25rem 0.25rem',
option: {
padding: '0.5rem 0.75rem',
borderRadius: '4px'
},
optionGroup: {
padding: '0.5rem 0.75rem',
fontWeight: '600'
}
},
colorScheme: { colorScheme: {
light: { light: {
surface: { surface: {
@ -207,7 +219,8 @@ export default {
select: { select: {
background: '{surface.0}', background: '{surface.0}',
borderColor: '{surface.200}', borderColor: '{surface.200}',
color: '{text.color}' color: '{text.color}',
shadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)'
}, },
popover: { popover: {
background: '{surface.0}', background: '{surface.0}',
@ -313,7 +326,8 @@ export default {
select: { select: {
background: '{surface.900}', background: '{surface.900}',
borderColor: '{surface.700}', borderColor: '{surface.700}',
color: '{text.color}' color: '{text.color}',
shadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)'
}, },
popover: { popover: {
background: '{surface.900}', background: '{surface.900}',

View File

@ -1,5 +1,5 @@
export default { export default {
inputMultiple: { root: {
background: '{form.field.background}', background: '{form.field.background}',
disabledBackground: '{form.field.disabled.background}', disabledBackground: '{form.field.disabled.background}',
filledBackground: '{form.field.filled.background}', filledBackground: '{form.field.filled.background}',
@ -11,12 +11,20 @@ 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}',
focusShadow: '{form.field.focus.shadow}',
paddingX: '{form.field.padding.x}',
paddingY: '{form.field.padding.y}',
borderRadius: '{form.field.border.radius}'
}, },
overlay: { overlay: {
background: '{overlay.select.background}', background: '{overlay.select.background}',
borderColor: '{overlay.select.border.color}', borderColor: '{overlay.select.border.color}',
color: '{overlay.select.color}' color: '{overlay.select.color}',
shadow: '{overlay.select.shadow}'
},
list: {
padding: '{list.padding}'
}, },
option: { option: {
focusBackground: '{list.option.focus.background}', focusBackground: '{list.option.focus.background}',
@ -25,11 +33,15 @@ 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}'
}, },
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}'
}, },
dropdown: { dropdown: {
width: '2.5rem', width: '2.5rem',

View File

@ -87,6 +87,7 @@ import treetable from 'primevue/themes/lara/treetable';
export default { export default {
primitive: { primitive: {
borderRadius: { borderRadius: {
none: '0',
sm: '4px', sm: '4px',
md: '6px', md: '6px',
lg: '8px', lg: '8px',
@ -142,6 +143,17 @@ export default {
paddingY: '0.625rem', paddingY: '0.625rem',
borderRadius: '{border.radius.sm}' borderRadius: '{border.radius.sm}'
}, },
list: {
padding: '0.5rem 0',
option: {
padding: '0.625rem 0.75rem',
borderRadius: '0'
},
optionGroup: {
padding: '0.625rem 0.75rem',
fontWeight: '600'
}
},
colorScheme: { colorScheme: {
light: { light: {
surface: { surface: {
@ -207,7 +219,8 @@ export default {
select: { select: {
background: '{surface.0}', background: '{surface.0}',
borderColor: '{surface.200}', borderColor: '{surface.200}',
color: '{text.color}' color: '{text.color}',
shadow: '0 2px 12px 0 rgba(0, 0, 0, 0.1)'
}, },
popover: { popover: {
background: '{surface.0}', background: '{surface.0}',
@ -231,7 +244,7 @@ export default {
}, },
optionGroup: { optionGroup: {
background: '{surface.0}', background: '{surface.0}',
color: '{text.muted.color}' color: '{text.color}'
} }
}, },
navigation: { navigation: {
@ -313,7 +326,8 @@ export default {
select: { select: {
background: '{surface.900}', background: '{surface.900}',
borderColor: '{surface.700}', borderColor: '{surface.700}',
color: '{text.color}' color: '{text.color}',
shadow: 'rgba(0, 0, 0, 0.2) 0px 2px 4px -1px, rgba(0, 0, 0, 0.14) 0px 4px 5px 0px, rgba(0, 0, 0, 0.12) 0px 1px 10px 0px'
}, },
popover: { popover: {
background: '{surface.900}', background: '{surface.900}',
@ -337,7 +351,7 @@ export default {
}, },
optionGroup: { optionGroup: {
background: '{surface.900}', background: '{surface.900}',
color: '{text.muted.color}' color: '{text.color}'
} }
}, },
navigation: { navigation: {