2024-04-18 14:18:40 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
const theme = ({ dt }) => `
|
|
|
|
.p-inputchips {
|
|
|
|
display: inline-flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-inputchips-input {
|
|
|
|
margin: 0;
|
|
|
|
list-style-type: none;
|
|
|
|
cursor: text;
|
|
|
|
overflow: hidden;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
flex-wrap: wrap;
|
2024-05-07 09:48:55 +00:00
|
|
|
padding: calc(${dt('inputchips.padding.y')} / 2) ${dt('inputchips.padding.x')};
|
|
|
|
gap: calc(${dt('inputchips.padding.y')} / 2);
|
2024-05-01 08:26:48 +00:00
|
|
|
color: ${dt('inputchips.color')};
|
|
|
|
background: ${dt('inputchips.background')};
|
|
|
|
border: 1px solid ${dt('inputchips.border.color')};
|
2024-05-07 09:48:55 +00:00
|
|
|
border-radius: ${dt('inputchips.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
width: 100%;
|
2024-05-24 05:50:38 +00:00
|
|
|
transition: background ${dt('transition.duration')}, color ${dt('transition.duration')}, border-color ${dt('transition.duration')}, outline-color ${dt('transition.duration')}, box-shadow ${dt('transition.duration')};
|
2024-05-01 08:26:48 +00:00
|
|
|
outline-color: transparent;
|
2024-05-06 21:23:42 +00:00
|
|
|
box-shadow: ${dt('inputchips.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-inputchips:not(.p-disabled):hover .p-inputchips-input {
|
|
|
|
border-color: ${dt('inputchips.hover.border.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-inputchips:not(.p-disabled).p-focus .p-inputchips-input {
|
|
|
|
border-color: ${dt('inputchips.focus.border.color')};
|
2024-05-07 09:48:55 +00:00
|
|
|
box-shadow: ${dt('inputchips.focus.ring.shadow')};
|
|
|
|
outline: ${dt('inputchips.focus.ring.width')} ${dt('inputchips.focus.ring.style')} ${dt('inputchips.focus.ring.color')};
|
|
|
|
outline-offset: ${dt('inputchips.focus.ring.offset')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
2024-05-03 20:26:53 +00:00
|
|
|
.p-inputchips.p-invalid .p-inputchips-input {
|
2024-05-01 08:26:48 +00:00
|
|
|
border-color: ${dt('inputchips.invalid.border.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-variant-filled.p-inputchips-input {
|
|
|
|
background: ${dt('inputchips.filled.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-inputchips:not(.p-disabled).p-focus .p-variant-filled.p-inputchips-input {
|
|
|
|
background: ${dt('inputchips.filled.focus.background')};
|
|
|
|
}
|
|
|
|
|
2024-05-03 20:26:53 +00:00
|
|
|
.p-inputchips.p-disabled .p-inputchips-input {
|
2024-05-01 08:26:48 +00:00
|
|
|
opacity: 1;
|
|
|
|
background: ${dt('inputchips.disabled.background')};
|
|
|
|
color: ${dt('inputchips.disabled.color')};
|
|
|
|
}
|
|
|
|
|
2024-05-15 08:48:30 +00:00
|
|
|
.p-inputchips-chip.p-chip {
|
2024-05-07 09:48:55 +00:00
|
|
|
padding-top: calc(${dt('inputchips.padding.y')} / 2);
|
|
|
|
padding-bottom: calc(${dt('inputchips.padding.y')} / 2);
|
|
|
|
border-radius: ${dt('inputchips.chip.border.radius')};
|
2024-05-13 16:04:12 +00:00
|
|
|
transition: background ${dt('transition.duration')}, color ${dt('transition.duration')};
|
|
|
|
}
|
|
|
|
|
2024-05-15 08:48:30 +00:00
|
|
|
.p-inputchips-chip-item.p-focus .p-inputchips-chip {
|
2024-05-13 16:04:12 +00:00
|
|
|
background: ${dt('inputchips.chip.focus.background')};
|
|
|
|
color: ${dt('inputchips.chip.focus.color')};
|
2024-05-07 09:48:55 +00:00
|
|
|
}
|
|
|
|
|
2024-05-15 08:48:30 +00:00
|
|
|
.p-inputchips-input:has(.p-inputchips-chip) {
|
2024-05-07 09:48:55 +00:00
|
|
|
padding-left: calc(${dt('inputchips.padding.y')} / 2);
|
|
|
|
padding-right: calc(${dt('inputchips.padding.y')} / 2);
|
|
|
|
}
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
.p-inputchips-input-item {
|
|
|
|
flex: 1 1 auto;
|
|
|
|
display: inline-flex;
|
2024-05-07 09:48:55 +00:00
|
|
|
padding-top: calc(${dt('inputchips.padding.y')} / 2);
|
|
|
|
padding-bottom: calc(${dt('inputchips.padding.y')} / 2);
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-inputchips-input-item input {
|
|
|
|
border: 0 none;
|
|
|
|
outline: 0 none;
|
|
|
|
background: transparent;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
box-shadow: none;
|
|
|
|
border-radius: 0;
|
|
|
|
width: 100%;
|
|
|
|
font-family: inherit;
|
|
|
|
font-feature-settings: inherit;
|
|
|
|
font-size: 1rem;
|
|
|
|
color: inherit;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-inputchips-input-item input::placeholder {
|
|
|
|
color: ${dt('inputchips.placeholder.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-fluid .p-inputchips {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2024-04-18 14:18:40 +00:00
|
|
|
const classes = {
|
|
|
|
root: ({ instance, props }) => [
|
|
|
|
'p-inputchips p-component p-inputwrapper',
|
|
|
|
{
|
|
|
|
'p-disabled': props.disabled,
|
|
|
|
'p-invalid': props.invalid,
|
|
|
|
'p-focus': instance.focused,
|
|
|
|
'p-inputwrapper-filled': (props.modelValue && props.modelValue.length) || (instance.inputValue && instance.inputValue.length),
|
|
|
|
'p-inputwrapper-focus': instance.focused
|
|
|
|
}
|
|
|
|
],
|
2024-05-03 20:26:53 +00:00
|
|
|
input: ({ props, instance }) => [
|
2024-04-18 14:18:40 +00:00
|
|
|
'p-inputchips-input',
|
|
|
|
{
|
|
|
|
'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled'
|
|
|
|
}
|
|
|
|
],
|
2024-05-15 07:35:36 +00:00
|
|
|
chipItem: ({ state, index }) => ['p-inputchips-chip-item', { 'p-focus': state.focusedIndex === index }],
|
|
|
|
pcChip: 'p-inputchips-chip',
|
2024-05-03 20:26:53 +00:00
|
|
|
chipIcon: 'p-inputchips-chip-icon',
|
|
|
|
inputItem: 'p-inputchips-input-item'
|
2024-04-18 14:18:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'inputchips',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2024-04-18 14:18:40 +00:00
|
|
|
classes
|
|
|
|
});
|