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

402 lines
9.8 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
*
*/
2024-04-15 08:08:42 +00:00
import { VNode } from 'vue';
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
2024-04-15 08:08:42 +00:00
import { ButtonPassThroughOptions } from '../button';
2023-09-05 08:50:46 +00:00
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, DesignToken, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type CarouselPassThroughOptionType = CarouselPassThroughAttributes | ((options: CarouselPassThroughMethodOptions) => CarouselPassThroughAttributes | string) | string | null | undefined;
2023-05-04 07:46:18 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface CarouselPassThroughMethodOptions {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-05-04 07:46:18 +00:00
props: CarouselProps;
/**
* Defines current inline state.
*/
2023-05-04 07:46:18 +00:00
state: CarouselState;
/**
* Defines current options.
*/
2023-08-01 07:43:40 +00:00
context: CarouselContext;
/**
* Defines valid attributes.
*/
attrs: any;
/**
* Defines parent options.
*/
parent: any;
2023-09-05 08:50:46 +00:00
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
2023-05-04 07:46:18 +00:00
}
2024-04-15 08:08:42 +00:00
/**
* Custom shared passthrough(pt) option method.
*/
export interface CarouselSharedPassThroughMethodOptions {
/**
* Defines valid properties.
*/
props: CarouselProps;
/**
* Defines current inline state.
*/
state: CarouselState;
}
2023-05-04 07:46:18 +00:00
/**
* Custom passthrough(pt) options.
* @see {@link CarouselProps.pt}
*/
export interface CarouselPassThroughOptions {
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the roots DOM element.
2023-05-04 07:46:18 +00:00
*/
root?: CarouselPassThroughOptionType;
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the headers DOM element.
2023-05-04 07:46:18 +00:00
*/
header?: CarouselPassThroughOptionType;
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the content containers DOM element.
2023-05-04 07:46:18 +00:00
*/
contentContainer?: CarouselPassThroughOptionType;
2023-05-04 07:46:18 +00:00
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the contents DOM element.
2023-05-04 07:46:18 +00:00
*/
content?: CarouselPassThroughOptionType;
2023-05-04 07:46:18 +00:00
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the previous buttons DOM element.
2024-04-15 08:08:42 +00:00
* @see {@link ButtonPassThroughOptions}
2023-05-04 07:46:18 +00:00
*/
2024-05-06 15:23:01 +00:00
pcPreviousButton?: ButtonPassThroughOptions<CarouselSharedPassThroughMethodOptions>;
2023-05-04 07:46:18 +00:00
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the viewports DOM element.
2023-05-04 07:46:18 +00:00
*/
viewport?: CarouselPassThroughOptionType;
2023-05-04 07:46:18 +00:00
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the items lists DOM element.
2023-05-04 07:46:18 +00:00
*/
itemList?: CarouselPassThroughOptionType;
2023-05-04 07:46:18 +00:00
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the item clones DOM element.
2023-05-04 07:46:18 +00:00
*/
itemClone?: CarouselPassThroughOptionType;
2023-05-04 07:46:18 +00:00
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the items DOM element.
2023-05-04 07:46:18 +00:00
*/
item?: CarouselPassThroughOptionType;
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the next buttons DOM element.
2024-04-15 08:08:42 +00:00
* @see {@link ButtonPassThroughOptions}
2023-05-04 07:46:18 +00:00
*/
2024-05-06 15:23:01 +00:00
pcNextButton?: ButtonPassThroughOptions<CarouselSharedPassThroughMethodOptions>;
2023-05-04 07:46:18 +00:00
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the indicator lists DOM element.
2023-05-04 07:46:18 +00:00
*/
indicatorList?: CarouselPassThroughOptionType;
2023-05-04 07:46:18 +00:00
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the indicators DOM element.
2023-05-04 07:46:18 +00:00
*/
indicator?: CarouselPassThroughOptionType;
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the indicator buttons DOM element.
2023-05-04 07:46:18 +00:00
*/
indicatorButton?: CarouselPassThroughOptionType;
/**
2024-05-15 09:22:27 +00:00
* Used to pass attributes to the footers DOM element.
2023-05-04 07:46:18 +00:00
*/
footer?: CarouselPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
2023-11-07 06:16:39 +00:00
* Used to manage all lifecycle hooks.
2023-07-06 11:09:01 +00:00
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
2023-05-04 07:46:18 +00:00
}
/**
* 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;
}
2023-08-01 07:43:40 +00:00
/**
* Defines current inline options in Carousel component.
*/
2023-08-01 07:47:15 +00:00
export interface CarouselContext {
2023-08-01 07:43:40 +00:00
/**
* Current highlighted state of the indicator as a boolean.
* @defaultValue false
*/
highlighted: boolean;
}
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
/**
2024-04-15 08:08:42 +00:00
* Used to pass attributes to the previous Button component.
* @defaultValue { severity: 'secondary', text: true, rounded: true }
2022-12-08 11:04:25 +00:00
*/
2024-04-15 08:08:42 +00:00
prevButtonProps?: object | undefined;
2022-12-08 11:04:25 +00:00
/**
2024-04-15 08:08:42 +00:00
* Used to pass attributes to the next Button component.
* @defaultValue { severity: 'secondary', text: true, rounded: true }
2022-12-08 11:04:25 +00:00
*/
2024-04-15 08:08:42 +00:00
nextButtonProps?: object | undefined;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
2023-05-04 07:46:18 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-05-04 07:46:18 +00:00
* @type {CarouselPassThroughOptions}
*/
pt?: PassThrough<CarouselPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
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[];
/**
* Custom empty template.
*/
empty(): 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' {
export interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Carousel: GlobalComponentConstructor<Carousel>;
2022-09-06 12:03:37 +00:00
}
}
export default Carousel;