primevue-mirror/components/lib/autocomplete/style/AutoCompleteStyle.js

62 lines
2.0 KiB
JavaScript
Raw Normal View History

import BaseStyle from 'primevue/base/style';
import { ObjectUtils } from 'primevue/utils';
const inlineStyles = {
root: { position: 'relative' }
};
const classes = {
root: ({ instance, props }) => [
'p-autocomplete p-component p-inputwrapper',
{
'p-disabled': props.disabled,
'p-invalid': props.invalid,
'p-focus': instance.focused,
'p-inputwrapper-filled': props.modelValue || ObjectUtils.isNotEmpty(instance.inputValue),
'p-inputwrapper-focus': instance.focused,
2024-04-06 20:52:27 +00:00
'p-autocomplete-open': instance.overlayVisible
2024-02-02 11:46:26 +00:00
}
],
2024-04-06 20:52:27 +00:00
input: 'p-autocomplete-input',
2024-02-02 11:46:26 +00:00
container: ({ props, instance }) => [
2024-04-06 20:52:27 +00:00
'p-autocomplete-chip-group',
2024-02-02 11:46:26 +00:00
{
'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled'
}
],
2024-03-18 10:01:24 +00:00
token: ({ instance, i }) => [
2024-04-06 20:52:27 +00:00
'p-autocomplete-chip',
2024-03-18 10:01:24 +00:00
{
'p-focus': instance.focusedMultipleOptionIndex === i
}
],
2024-04-06 20:52:27 +00:00
tokenLabel: 'p-autocomplete-chip-label',
removeTokenIcon: 'p-autocomplete-chip-icon',
inputToken: 'p-autocomplete-input-chip',
loadingIcon: 'p-autocomplete-loader',
dropdownButton: 'p-autocomplete-dropdown',
2024-03-22 08:58:03 +00:00
panel: ({ instance }) => [
2024-04-06 20:52:27 +00:00
'p-autocomplete-overlay p-component',
{
'p-ripple-disabled': instance.$primevue.config.ripple === false
}
],
2024-04-06 20:52:27 +00:00
list: 'p-autocomplete-list',
2024-04-07 09:40:54 +00:00
itemGroup: 'p-autocomplete-option-group',
item: ({ instance, option, i, getItemOptions }) => [
2024-04-07 09:40:54 +00:00
'p-autocomplete-option',
{
2024-04-07 09:40:54 +00:00
'p-autocomplete-option-selected': instance.isSelected(option),
'p-focus': instance.focusedOptionIndex === instance.getOptionIndex(i, getItemOptions),
'p-disabled': instance.isOptionDisabled(option)
}
],
emptyMessage: 'p-autocomplete-empty-message'
};
export default BaseStyle.extend({
name: 'autocomplete',
classes,
inlineStyles
});