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-carousel {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-carousel-content-container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-carousel-content {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-carousel-viewport {
|
|
|
|
overflow: hidden;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-carousel-item-list {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-carousel-prev-button,
|
|
|
|
.p-carousel-next-button {
|
|
|
|
align-self: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-carousel-indicator-list {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: center;
|
|
|
|
flex-wrap: wrap;
|
2024-05-13 09:27:09 +00:00
|
|
|
padding: ${dt('carousel.indicator.list.padding')};
|
|
|
|
gap: ${dt('carousel.indicator.list.gap')};
|
2024-05-01 08:26:48 +00:00
|
|
|
margin: 0;
|
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-carousel-indicator-button {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
background: ${dt('carousel.indicator.background')};
|
2024-05-13 09:27:09 +00:00
|
|
|
width: ${dt('carousel.indicator.width')};
|
|
|
|
height: ${dt('carousel.indicator.height')};
|
2024-05-01 08:26:48 +00:00
|
|
|
border: 0 none;
|
2024-05-25 08:18:55 +00:00
|
|
|
transition: background ${dt('carousel.transition.duration')}, color ${dt('carousel.transition.duration')}, outline-color ${dt('carousel.transition.duration')}, box-shadow ${dt('carousel.transition.duration')};
|
2024-05-01 08:26:48 +00:00
|
|
|
outline-color: transparent;
|
2024-05-13 09:27:09 +00:00
|
|
|
border-radius: ${dt('carousel.indicator.border.radius')};
|
2024-05-01 08:26:48 +00:00
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
user-select: none;
|
2024-05-13 09:27:09 +00:00
|
|
|
cursor: pointer;
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-carousel-indicator-button:focus-visible {
|
2024-05-13 09:27:09 +00:00
|
|
|
box-shadow: ${dt('carousel.indicator.focus.ring.shadow')};
|
|
|
|
outline: ${dt('carousel.indicator.focus.ring.width')} ${dt('carousel.indicator.focus.ring.style')} ${dt('carousel.indicator.focus.ring.color')};
|
|
|
|
outline-offset: ${dt('carousel.indicator.focus.ring.offset')};
|
2024-05-01 08:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-carousel-indicator-button:hover {
|
|
|
|
background: ${dt('carousel.indicator.hover.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-carousel-indicator-active .p-carousel-indicator-button {
|
|
|
|
background: ${dt('carousel.indicator.active.background')};
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-carousel-vertical .p-carousel-content {
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-carousel-vertical .p-carousel-item-list {
|
|
|
|
flex-direction: column;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-items-hidden .p-carousel-item {
|
|
|
|
visibility: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-items-hidden .p-carousel-item.p-carousel-item-active {
|
|
|
|
visibility: visible;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-10-02 10:46:09 +00:00
|
|
|
const classes = {
|
|
|
|
root: ({ instance }) => [
|
|
|
|
'p-carousel p-component',
|
|
|
|
{
|
|
|
|
'p-carousel-vertical': instance.isVertical(),
|
|
|
|
'p-carousel-horizontal': !instance.isVertical()
|
|
|
|
}
|
|
|
|
],
|
|
|
|
header: 'p-carousel-header',
|
2024-04-30 09:39:18 +00:00
|
|
|
contentContainer: 'p-carousel-content-container',
|
|
|
|
content: 'p-carousel-content',
|
2024-05-27 08:48:42 +00:00
|
|
|
pcPrevButton: ({ instance }) => [
|
2024-04-10 06:34:25 +00:00
|
|
|
'p-carousel-prev-button',
|
2023-10-02 10:46:09 +00:00
|
|
|
{
|
|
|
|
'p-disabled': instance.backwardIsDisabled
|
|
|
|
}
|
|
|
|
],
|
2024-04-30 09:39:18 +00:00
|
|
|
viewport: 'p-carousel-viewport',
|
|
|
|
itemList: 'p-carousel-item-list',
|
|
|
|
itemClone: ({ index, value, totalShiftedItems, d_numVisible }) => [
|
2024-04-10 06:34:25 +00:00
|
|
|
'p-carousel-item p-carousel-item-clone',
|
2023-10-02 10:46:09 +00:00
|
|
|
{
|
|
|
|
'p-carousel-item-active': totalShiftedItems * -1 === value.length + d_numVisible,
|
|
|
|
'p-carousel-item-start': index === 0,
|
|
|
|
'p-carousel-item-end': value.slice(-1 * d_numVisible).length - 1 === index
|
|
|
|
}
|
|
|
|
],
|
|
|
|
item: ({ instance, index }) => [
|
|
|
|
'p-carousel-item',
|
|
|
|
{
|
|
|
|
'p-carousel-item-active': instance.firstIndex() <= index && instance.lastIndex() >= index,
|
|
|
|
'p-carousel-item-start': instance.firstIndex() === index,
|
|
|
|
'p-carousel-item-end': instance.lastIndex() === index
|
|
|
|
}
|
|
|
|
],
|
2024-05-06 15:23:01 +00:00
|
|
|
pcNextButton: ({ instance }) => [
|
2024-04-10 06:34:25 +00:00
|
|
|
'p-carousel-next-button',
|
2023-10-02 10:46:09 +00:00
|
|
|
{
|
|
|
|
'p-disabled': instance.forwardIsDisabled
|
|
|
|
}
|
|
|
|
],
|
2024-04-30 09:39:18 +00:00
|
|
|
indicatorList: 'p-carousel-indicator-list',
|
2023-10-02 10:46:09 +00:00
|
|
|
indicator: ({ instance, index }) => [
|
|
|
|
'p-carousel-indicator',
|
|
|
|
{
|
2024-04-10 06:34:25 +00:00
|
|
|
'p-carousel-indicator-active': instance.d_page === index
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
],
|
2024-04-10 06:34:25 +00:00
|
|
|
indicatorButton: 'p-carousel-indicator-button',
|
2023-10-02 10:46:09 +00:00
|
|
|
footer: 'p-carousel-footer'
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BaseStyle.extend({
|
|
|
|
name: 'carousel',
|
2024-05-01 08:26:48 +00:00
|
|
|
theme,
|
2023-10-02 10:46:09 +00:00
|
|
|
classes
|
|
|
|
});
|