import { FASTElement } from "@microsoft/fast-element"; /** * @summary A Carousel component for displaying a set of items in a horizontal, scrollable manner. * * @example * ```html * *
Carousel Header
* Prev * Next *
Item 1
*
Item 2
* *
* ``` * * @attr disable-animation - Disables animation when set to true. * * @prop {boolean} disableAnimation - Boolean attribute to disable animation. * @prop {HTMLElement[]} slottedCarouselItems - An array of carousel items that are slotted into the carousel. * @prop {HTMLElement} header - The header element. * @prop {number} currentIndex - The current index of the carousel, indicating which item is currently visible. * @prop {HTMLElement[]} nextButton - The next button element. * @prop {HTMLElement[]} prevButton - The previous button element. * @prop {number} visibleItemsCount - Gets the number of items currently visible in the carousel. (readonly) * * @slot header - Slot for the carousel header content. * @slot prev-button - Slot for the carousel's previous navigation button. * @slot next-button - Slot for the carousel's next navigation button. * @slot - Default slot for carousel items. * * @method next - Moves the carousel to the next set of items. * @method prev - Moves the carousel to the previous set of items. * @method scrollToIndex - Scrolls the carousel to a specific index. * @method isAtEnd - Checks if the carousel is at the end of the items. * @method getNextVisibleItemsCount - Gets the count of the next set of visible items in the carousel. * @method updateVisibleItems - Updates the visible items in the carousel. * * @extends FASTElement * @tagname fabric-carousel * @public */ export declare class Carousel extends FASTElement { #private; /** * Boolean attribute to disable animation. * * @public * @type {boolean} * @attr */ disableAnimation?: boolean; /** * An array of carousel items that are slotted into the carousel. * * @public * @type {HTMLElement[]} * @observable */ slottedCarouselItems: HTMLElement[]; /** * Callback when slottedCarouselItems changes to update button states * @internal */ private slottedCarouselItemsChanged; /** * Boolean attribute to check if the carousel items are loaded */ private slottedCarouselItemsLoaded; /** * The header element * * @public * @type {HTMLElement} * @observable */ header?: HTMLElement; /** * The viewport div element for the carousel slotted elements * @public * @type {HTMLElement} * @observable */ viewportRef?: HTMLElement; /** * The current index of the carousel, indicating which item is currently visible. * * @public * @type {number} * @observable */ currentIndex: number; /** * Callback when currentIndex changes to update button states * @internal */ private currentIndexChanged; /** * The next button element * * @public * @type {HTMLElement[] | null | undefined} * @observable */ nextButton?: HTMLElement[] | null | undefined; /** * The previous button element * * @public * @type {HTMLElement[] | null | undefined} * @observable */ prevButton?: HTMLElement[] | null | undefined; /** * The width of the gap between carousel items, in pixels. * * @private * @type {number} */ private gapWidth; /** * Updates the disabled state of navigation buttons based on carousel position * @internal */ private updateButtonStates; /** * Handle the next button click event. * @internal */ private handleNext; /** * Handle the previous button click event. * @internal */ private handlePrev; /** * Sets event listeners for the carousel's navigation buttons. * @internal */ private setEventListeners; /** * Removes event listeners for the carousel's navigation buttons. * @internal */ private removeEventListeners; /** * Invoked when the carousel is added to the document's DOM. * * @public * @returns {void} */ connectedCallback(): void; /** * Invoked when the carousel is removed from the document's DOM. * * @public * @returns {void} */ disconnectedCallback(): void; /** * Moves the carousel to the next set of items. * * @public * @returns {void} */ next(): void; /** * Moves the carousel to the previous set of items. * * @public * @returns {void} */ prev(): void; /** * Scrolls the carousel to a specific index. * * @public * @param {number} index - The target index to scroll to * @returns {void} */ scrollToIndex(index: number, _attempts?: number): void; /** * Cached container width * @private * @type {number} */ private cachedContainerWidth; /** * Whether the layout should be recalculated * @private * @type {boolean} */ private shouldRecalculateLayout; /** * Resize observer * @private * @type {ResizeObserver} */ private resizeObserver?; /** * Item measurements * @private * @type {number[]} */ private itemMeasurements; /** * Sets up a resize observer to watch for changes in the carousel's container width */ private setupResizeObserver; /** * Measures the width of each item in the carousel. * @internal */ measureItems(): void; /** * The index of the last visible item in the carousel. * @private * @type {number} */ private lastVisibleItemIndex; /** * Gets the number of items currently visible in the carousel. * * @public * @returns {number} The count of visible items. */ get visibleItemsCount(): number; /** * Checks if the carousel is at the end of the items. * * @public * @returns {boolean} True if at the end, false otherwise. */ isAtEnd(): boolean; /** * Gets the count of the next set of visible items in the carousel. * * @public * @param {string} direction - The direction to check ("next" or "prev") * @returns {number} The count of the next visible items. */ getNextVisibleItemsCount(direction: "next" | "prev"): number; /** * Detects if the component is in RTL mode * @private * @returns {boolean} True if RTL is active */ private updateDirection; /** * Gets the appropriate transform direction based on RTL * @private * @param {number} offset - The offset amount * @returns {string} The transform CSS value */ private getTransform; /** * Updates the visible items in the carousel. * * @public * @returns {void} */ updateVisibleItems(): void; } //# sourceMappingURL=carousel.d.ts.map