primevue-mirror/components/lib/inputchips/style/InputChipsStyle.js

133 lines
4.1 KiB
JavaScript
Raw Normal View History

2024-04-18 14:18:40 +00:00
import BaseStyle from 'primevue/base/style';
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);
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')};
width: 100%;
transition: background ${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;
2024-05-06 21:23:42 +00:00
box-shadow: ${dt('inputchips.shadow')};
}
.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')};
}
.p-inputchips.p-invalid .p-inputchips-input {
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')};
}
.p-inputchips.p-disabled .p-inputchips-input {
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);
}
.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);
}
.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
}
],
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',
chipIcon: 'p-inputchips-chip-icon',
inputItem: 'p-inputchips-input-item'
2024-04-18 14:18:40 +00:00
};
export default BaseStyle.extend({
name: 'inputchips',
theme,
2024-04-18 14:18:40 +00:00
classes
});