primevue-mirror/components/lib/carousel/Carousel.d.ts

334 lines
8.3 KiB
TypeScript
Raw Normal View History

2023-03-01 14:46:28 +00:00
/**
*
* Carousel is a content slider featuring various customization options.
*
* [Live Demo](https://www.primevue.org/carousel/)
*
* @module carousel
*
*/
2022-12-08 11:04:25 +00:00
import { ButtonHTMLAttributes, VNode } from 'vue';
2022-09-06 12:03:37 +00:00
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
2023-05-04 07:46:18 +00:00
export declare type CarouselPassThroughOptionType = CarouselPassThroughAttributes | ((options: CarouselPassThroughMethodOptions) => CarouselPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface CarouselPassThroughMethodOptions {
props: CarouselProps;
state: CarouselState;
}
/**
* Custom passthrough(pt) options.
* @see {@link CarouselProps.pt}
*/
export interface CarouselPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the header's DOM element.
*/
header?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the content's DOM element.
*/
content?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the container's DOM element.
*/
container?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the previous button's DOM element.
*/
previousButton?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the previous button icon's DOM element.
*/
previousButtonIcon?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the items content's DOM element.
*/
itemsContent?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the items container's DOM element.
*/
itemsContainer?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the item cloned's DOM element.
*/
itemCloned?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the item's DOM element.
*/
item?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the next button's DOM element.
*/
nextButton?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the next button icon's DOM element.
*/
nextButtonIcon?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the indicators's DOM element.
*/
indicators?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the indicator's DOM element.
*/
indicator?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the indicator button's DOM element.
*/
indicatorButton?: CarouselPassThroughOptionType;
/**
* Uses to pass attributes to the footer's DOM element.
*/
footer?: CarouselPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface CarouselPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Carousel component.
*/
export interface CarouselState {
/**
* Remaining items' count as a number.
* @defaultValue 0
*/
remainingItems: number;
/**
* Number of items per page as a number.
* @defaultValue 1
*/
d_numVisible: number;
/**
* Number of items to scroll as a number.
* @defaultValue 1
*/
d_numScroll: number;
/**
* Old number of items to scroll as a number.
* @defaultValue 0
*/
d_oldNumScroll: number;
/**
* Old number of items per page as a number.
* @defaultValue 0
*/
d_oldNumVisible: number;
/**
* Old array of objects to display.
*/
d_oldValue: number;
/**
* Index of the first item.
* @defaultValue 0
*/
d_page: number;
/**
* Total shifted items' count as a number.
* @defaultValue 0
*/
totalShiftedItems: number;
/**
* Allow autoplay as a boolean.
* @defaultValue false
*/
allowAutoplay: boolean;
/**
* Defines if scrolling would be infinite as a boolean.
* @defaultValue false
*/
d_circular: boolean;
/**
* Swipe threshold count as a number.
* @defaultValue 20
*/
swipeThreshold: number;
}
2022-09-06 12:03:37 +00:00
export interface CarouselResponsiveOptions {
/**
* Breakpoint for responsive mode. Exp; @media screen and (max-width: ${breakpoint}) {...}
*/
breakpoint: string;
/**
* The number of visible items on breakpoint.
*/
numVisible: number;
/**
* The number of scrolled items on breakpoint.
*/
numScroll: number;
}
2023-05-04 07:46:18 +00:00
2023-03-01 14:46:28 +00:00
/**
* Defines valid properties in Carousel component.
*/
2022-09-06 12:03:37 +00:00
export interface CarouselProps {
/**
* An array of objects to display.
*/
value?: any | undefined;
/**
* Index of the first item.
2023-03-01 14:46:28 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
2022-09-14 11:26:01 +00:00
page?: number | undefined;
2022-09-06 12:03:37 +00:00
/**
* Number of items per page.
2023-03-01 14:46:28 +00:00
* @defaultValue 1
2022-09-06 12:03:37 +00:00
*/
2022-09-14 11:26:01 +00:00
numVisible?: number | undefined;
2022-09-06 12:03:37 +00:00
/**
* Number of items to scroll.
2023-03-01 14:46:28 +00:00
* @defaultValue 1
2022-09-06 12:03:37 +00:00
*/
2022-09-14 11:26:01 +00:00
numScroll?: number | undefined;
2022-09-06 12:03:37 +00:00
/**
* An array of options for responsive design.
* @see CarouselResponsiveOptions
*/
2022-09-14 11:26:01 +00:00
responsiveOptions?: CarouselResponsiveOptions[] | undefined;
2022-09-06 12:03:37 +00:00
/**
* Specifies the layout of the component, valid values are 'horizontal' and 'vertical'.
2023-03-01 14:46:28 +00:00
* @defaultValue horizontal
2022-09-06 12:03:37 +00:00
*/
2023-03-01 14:46:28 +00:00
orientation?: 'horizontal' | 'vertical' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Height of the viewport in vertical layout.
2023-03-08 10:51:52 +00:00
* @defaultValue 300px
2022-09-06 12:03:37 +00:00
*/
2022-09-14 11:26:01 +00:00
verticalViewPortHeight?: string | undefined;
2022-09-06 12:03:37 +00:00
/**
* Style class of the viewport container.
*/
2022-09-14 11:26:01 +00:00
containerClass?: any;
2022-09-06 12:03:37 +00:00
/**
* Style class of main content.
*/
2022-09-14 11:26:01 +00:00
contentClass?: any;
2022-09-06 12:03:37 +00:00
/**
* Style class of the indicator items.
*/
2022-09-14 11:26:01 +00:00
indicatorsContentClass?: any;
2022-09-06 12:03:37 +00:00
/**
* Defines if scrolling would be infinite.
2023-03-01 14:46:28 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
2022-09-14 11:26:01 +00:00
circular?: boolean | undefined;
2022-09-06 12:03:37 +00:00
/**
* Time in milliseconds to scroll items automatically.
2023-03-01 14:46:28 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
2022-09-14 11:26:01 +00:00
autoplayInterval?: number | undefined;
/**
* Whether to display navigation buttons in container.
2023-03-01 14:46:28 +00:00
* @defaultValue true
2022-09-14 11:26:01 +00:00
*/
showNavigators?: boolean | undefined;
/**
* Whether to display indicator container.
2023-03-01 14:46:28 +00:00
* @defaultValue true
2022-09-14 11:26:01 +00:00
*/
showIndicators?: boolean | undefined;
2022-12-08 11:04:25 +00:00
/**
* Uses to pass all properties of the HTMLButtonElement to the previous navigation button.
*/
prevButtonProps?: ButtonHTMLAttributes | undefined;
/**
* Uses to pass all properties of the HTMLButtonElement to the next navigation button.
*/
nextButtonProps?: ButtonHTMLAttributes | undefined;
2023-05-04 07:46:18 +00:00
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {CarouselPassThroughOptions}
*/
pt?: CarouselPassThroughOptions;
2023-05-31 13:57:44 +00:00
/**
* When enabled, it removes component related styles in the core.
* @defaultValue false
*/
unstyled?: boolean;
2022-09-06 12:03:37 +00:00
}
2023-03-01 14:46:28 +00:00
/**
* Defines valid slots in Carousel slots.
*/
2022-09-06 12:03:37 +00:00
export interface CarouselSlots {
/**
* Custom content for each item.
* @param {Object} scope - item slot's params.
*/
2023-03-01 14:46:28 +00:00
item(scope: {
2022-09-06 12:03:37 +00:00
/**
* Data of the component
*/
data: any;
/**
* Index of the item
*/
index: number;
2023-03-01 14:46:28 +00:00
}): VNode[];
2022-09-14 11:26:01 +00:00
/**
2022-09-06 12:03:37 +00:00
* Custom header template.
*/
2023-03-01 14:46:28 +00:00
header(): VNode[];
2022-09-14 11:26:01 +00:00
/**
* Custom footer template.
*/
2023-03-01 14:46:28 +00:00
footer(): VNode[];
/**
* Custom previous icon template.
*/
previousicon(): VNode[];
/**
* Custom next icon template.
*/
nexticon(): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 14:46:28 +00:00
/**
* Defines valid emits in Carousel component.
*/
export interface CarouselEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the page changes.
* @param {number} value - New page value.
*/
2023-03-01 14:46:28 +00:00
'update:page'(value: number): void;
}
2022-09-06 12:03:37 +00:00
2023-03-01 14:46:28 +00:00
/**
* **PrimeVue - Carousel**
*
* _Carousel is a content slider featuring various customization options._
*
* [Live Demo](https://www.primevue.org/carousel/)
* --- ---
2023-03-03 10:55:20 +00:00
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
2023-03-01 14:46:28 +00:00
*
* @group Component
*
*/
2022-09-14 11:26:01 +00:00
declare class Carousel extends ClassComponent<CarouselProps, CarouselSlots, CarouselEmits> {}
2022-09-06 12:03:37 +00:00
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Carousel: GlobalComponentConstructor<Carousel>;
2022-09-06 12:03:37 +00:00
}
}
export default Carousel;