2024-05-08 06:13:13 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
const theme = ({ dt }) => `
|
|
|
|
.p-select {
|
|
|
|
display: inline-flex;
|
|
|
|
cursor: pointer;
|
|
|
|
position: relative;
|
|
|
|
user-select: none;
|
|
|
|
background: ${dt('select.background')};
|
|
|
|
border: 1px solid ${dt('select.border.color')};
|
2024-05-07 17:43:55 +00:00
|
|
|
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('select.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
outline-color: transparent;
|
2024-05-06 21:23:42 +00:00
|
|
|
box-shadow: ${dt('select.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-select:not(.p-disabled):hover {
|
|
|
|
border-color: ${dt('select.hover.border.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-select:not(.p-disabled).p-focus {
|
2024-05-07 17:43:55 +00:00
|
|
|
border-color: ${dt('select.focus.border.color')};
|
|
|
|
box-shadow: ${dt('select.focus.ring.shadow')};
|
|
|
|
outline: ${dt('select.focus.ring.width')} ${dt('select.focus.ring.style')} ${dt('select.focus.ring.color')};
|
|
|
|
outline-offset: ${dt('select.focus.ring.offset')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-select.p-variant-filled {
|
|
|
|
background: ${dt('select.filled.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-select.p-variant-filled.p-focus {
|
|
|
|
background: ${dt('select.filled.focus.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-select.p-invalid {
|
|
|
|
border-color: ${dt('select.invalid.border.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-select.p-disabled {
|
|
|
|
opacity: 1;
|
|
|
|
background: ${dt('select.disabled.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-clear-icon {
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
margin-top: -0.5rem;
|
2024-05-07 17:43:55 +00:00
|
|
|
color: ${dt('select.clear.icon.color')};
|
|
|
|
right: ${dt('select.dropdown.width')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-dropdown {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
flex-shrink: 0;
|
|
|
|
background: transparent;
|
2024-05-05 17:08:51 +00:00
|
|
|
color: ${dt('select.dropdown.color')};
|
2024-05-07 17:43:55 +00:00
|
|
|
width: ${dt('select.dropdown.width')};
|
|
|
|
border-top-right-radius: ${dt('select.border.radius')};
|
|
|
|
border-bottom-right-radius: ${dt('select.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-label {
|
|
|
|
display: block;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
flex: 1 1 auto;
|
|
|
|
width: 1%;
|
2024-05-07 17:43:55 +00:00
|
|
|
padding: ${dt('select.padding.y')} ${dt('select.padding.x')};
|
2024-05-01 08:26:48 +00:00
|
|
|
text-overflow: ellipsis;
|
|
|
|
cursor: pointer;
|
|
|
|
color: ${dt('select.color')};
|
|
|
|
background: transparent;
|
|
|
|
border: 0 none;
|
|
|
|
outline: 0 none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-label.p-placeholder {
|
|
|
|
color: ${dt('select.placeholder.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-select:has(.p-select-clear-icon) .p-select-label {
|
2024-05-07 17:43:55 +00:00
|
|
|
padding-right: calc(1 + ${dt('select.padding.x')});
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-select.p-disabled .p-select-label {
|
|
|
|
color: ${dt('select.disabled.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-label-empty {
|
|
|
|
overflow: hidden;
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
input.p-select-label {
|
|
|
|
cursor: default;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-select .p-select-overlay {
|
|
|
|
min-width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-overlay {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
background: ${dt('select.overlay.background')};
|
|
|
|
color: ${dt('select.overlay.color')};
|
|
|
|
border: 1px solid ${dt('select.overlay.border.color')};
|
2024-05-07 17:43:55 +00:00
|
|
|
border-radius: ${dt('select.overlay.border.radius')};
|
|
|
|
box-shadow: ${dt('select.overlay.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-header {
|
2024-05-07 17:43:55 +00:00
|
|
|
padding: ${dt('select.list.header.padding')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-filter {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-list-container {
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-option-group {
|
|
|
|
cursor: auto;
|
|
|
|
margin: 0;
|
2024-05-07 17:43:55 +00:00
|
|
|
padding: ${dt('select.option.group.padding')};
|
2024-05-05 17:08:51 +00:00
|
|
|
background: ${dt('select.option.group.background')};
|
|
|
|
color: ${dt('select.option.group.color')};
|
2024-05-07 17:43:55 +00:00
|
|
|
font-weight: ${dt('select.option.group.font.weight')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-list {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
list-style-type: none;
|
2024-05-07 17:43:55 +00:00
|
|
|
padding: ${dt('select.list.padding')};
|
|
|
|
gap: ${dt('select.list.gap')};
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-option {
|
|
|
|
cursor: pointer;
|
|
|
|
font-weight: normal;
|
|
|
|
white-space: nowrap;
|
|
|
|
position: relative;
|
|
|
|
overflow: hidden;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2024-05-07 17:43:55 +00:00
|
|
|
padding: ${dt('select.option.padding')};
|
2024-05-01 08:26:48 +00:00
|
|
|
border: 0 none;
|
2024-05-05 17:08:51 +00:00
|
|
|
color: ${dt('select.option.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
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')};
|
2024-05-07 17:43:55 +00:00
|
|
|
border-radius: ${dt('select.option.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-option:not(.p-select-option-selected):not(.p-disabled).p-focus {
|
2024-05-05 17:08:51 +00:00
|
|
|
background: ${dt('select.option.focus.background')};
|
|
|
|
color: ${dt('select.option.focus.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-option.p-select-option-selected {
|
2024-05-05 17:08:51 +00:00
|
|
|
background: ${dt('select.option.selected.background')};
|
|
|
|
color: ${dt('select.option.selected.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-option.p-select-option-selected.p-focus {
|
2024-05-05 17:08:51 +00:00
|
|
|
background: ${dt('select.option.selected.focus.background')};
|
|
|
|
color: ${dt('select.option.selected.focus.color')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-option-check-icon {
|
|
|
|
position: relative;
|
|
|
|
margin-left: -0.375rem;
|
|
|
|
margin-right: 0.375rem;
|
|
|
|
color: ${dt('select.checkmark.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-select-empty-message {
|
2024-05-08 10:04:04 +00:00
|
|
|
padding: ${dt('select.empty.message.padding')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-fluid .p-select {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
2024-05-06 10:00:41 +00:00
|
|
|
.p-fluid .p-select-label {
|
2024-05-01 08:26:48 +00:00
|
|
|
width: 1%;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2024-04-18 14:17:41 +00:00
|
|
|
const classes = {
|
|
|
|
root: ({ instance, props, state }) => [
|
|
|
|
'p-select p-component p-inputwrapper',
|
|
|
|
{
|
|
|
|
'p-disabled': props.disabled,
|
|
|
|
'p-invalid': props.invalid,
|
|
|
|
'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled',
|
|
|
|
'p-focus': state.focused,
|
|
|
|
'p-inputwrapper-filled': instance.hasSelectedOption,
|
|
|
|
'p-inputwrapper-focus': state.focused || state.overlayVisible,
|
|
|
|
'p-select-open': state.overlayVisible
|
|
|
|
}
|
|
|
|
],
|
2024-05-03 20:53:04 +00:00
|
|
|
label: ({ instance, props }) => [
|
2024-04-18 14:17:41 +00:00
|
|
|
'p-select-label',
|
|
|
|
{
|
|
|
|
'p-placeholder': !props.editable && instance.label === props.placeholder,
|
|
|
|
'p-select-label-empty': !props.editable && !instance.$slots['value'] && (instance.label === 'p-emptylabel' || instance.label.length === 0)
|
|
|
|
}
|
|
|
|
],
|
|
|
|
clearIcon: 'p-select-clear-icon',
|
2024-05-03 20:53:04 +00:00
|
|
|
dropdown: 'p-select-dropdown',
|
2024-04-18 14:17:41 +00:00
|
|
|
loadingicon: 'p-select-loading-icon',
|
|
|
|
dropdownIcon: 'p-select-dropdown-icon',
|
2024-05-03 20:53:04 +00:00
|
|
|
overlay: ({ instance }) => [
|
2024-04-18 14:17:41 +00:00
|
|
|
'p-select-overlay p-component',
|
|
|
|
{
|
|
|
|
'p-ripple-disabled': instance.$primevue.config.ripple === false
|
|
|
|
}
|
|
|
|
],
|
|
|
|
header: 'p-select-header',
|
2024-05-06 15:23:01 +00:00
|
|
|
pcFilter: 'p-select-filter',
|
2024-05-03 20:53:04 +00:00
|
|
|
listContainer: 'p-select-list-container',
|
2024-04-18 14:17:41 +00:00
|
|
|
list: 'p-select-list',
|
2024-05-03 20:53:04 +00:00
|
|
|
optionGroup: 'p-select-option-group',
|
|
|
|
optionGroupLabel: 'p-select-option-group-label',
|
|
|
|
option: ({ instance, props, state, option, focusedOption }) => [
|
2024-04-18 14:17:41 +00:00
|
|
|
'p-select-option',
|
|
|
|
{
|
|
|
|
'p-select-option-selected': instance.isSelected(option) && props.highlightOnSelect,
|
|
|
|
'p-focus': state.focusedOptionIndex === focusedOption,
|
|
|
|
'p-disabled': instance.isOptionDisabled(option)
|
|
|
|
}
|
|
|
|
],
|
2024-05-03 20:53:04 +00:00
|
|
|
optionLabel: 'p-select-option-label',
|
|
|
|
optionCheckIcon: 'p-select-option-check-icon',
|
|
|
|
optionBlankIcon: 'p-select-option-blank-icon',
|
2024-04-18 14:17:41 +00:00
|
|
|
emptyMessage: 'p-select-empty-message'
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'select',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2024-04-18 14:17:41 +00:00
|
|
|
classes
|
|
|
|
});
|