2023-10-02 10:46:09 +00:00
|
|
|
import BaseStyle from 'primevue/base/style';
|
|
|
|
|
2024-05-01 08:26:48 +00:00
|
|
|
const theme = ({ dt }) => `
|
|
|
|
.p-rating {
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2024-05-07 08:58:34 +00:00
|
|
|
gap: ${dt('rating.gap')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-rating-option {
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
cursor: pointer;
|
|
|
|
outline-color: transparent;
|
|
|
|
border-radius: 50%;
|
|
|
|
cursor: pointer;
|
2024-05-25 08:18:55 +00:00
|
|
|
transition: background ${dt('rating.transition.duration')}, color ${dt('rating.transition.duration')}, border-color ${dt('rating.transition.duration')}, outline-color ${dt('rating.transition.duration')}, box-shadow ${dt('rating.transition.duration')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-rating-option.p-focus-visible {
|
2024-05-07 08:58:34 +00:00
|
|
|
box-shadow: ${dt('focus.ring.shadow')};
|
2024-05-01 08:26:48 +00:00
|
|
|
outline: ${dt('focus.ring.width')} ${dt('focus.ring.style')} ${dt('focus.ring.color')};
|
|
|
|
outline-offset: ${dt('focus.ring.offset')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-rating-icon {
|
|
|
|
color: ${dt('rating.icon.color')};
|
2024-05-25 08:18:55 +00:00
|
|
|
transition: background ${dt('rating.transition.duration')}, color ${dt('rating.transition.duration')}, border-color ${dt('rating.transition.duration')}, outline-color ${dt('rating.transition.duration')}, box-shadow ${dt('rating.transition.duration')};
|
2024-05-07 08:58:34 +00:00
|
|
|
font-size: ${dt('rating.icon.size')};
|
|
|
|
width: ${dt('rating.icon.size')};
|
|
|
|
height: ${dt('rating.icon.size')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-rating:not(.p-disabled):not(.p-readonly) .p-rating-option:hover .p-rating-icon {
|
|
|
|
color: ${dt('rating.icon.hover.color')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-rating-option-active .p-rating-icon {
|
|
|
|
color: ${dt('rating.icon.active.color')};
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
const classes = {
|
|
|
|
root: ({ props }) => [
|
|
|
|
'p-rating',
|
|
|
|
{
|
|
|
|
'p-readonly': props.readonly,
|
|
|
|
'p-disabled': props.disabled
|
|
|
|
}
|
|
|
|
],
|
2024-05-03 12:23:10 +00:00
|
|
|
option: ({ instance, props, value }) => [
|
2024-04-07 10:55:28 +00:00
|
|
|
'p-rating-option',
|
2023-10-02 10:46:09 +00:00
|
|
|
{
|
2024-04-07 10:55:28 +00:00
|
|
|
'p-rating-option-active': value <= props.modelValue,
|
2024-03-26 07:28:22 +00:00
|
|
|
'p-focus-visible': value === instance.focusedOptionIndex && instance.isFocusVisibleItem
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
],
|
2024-04-07 10:55:28 +00:00
|
|
|
onIcon: 'p-rating-icon p-rating-on-icon',
|
|
|
|
offIcon: 'p-rating-icon p-rating-off-icon'
|
2023-10-02 10:46:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'rating',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2023-10-02 10:46:09 +00:00
|
|
|
classes
|
|
|
|
});
|