import { ContextTrinity } from "../createTrinity/index.mjs"; import { SingleContext, SingleContextOptions, SingleOptions, SingleTicket, SingleTicketInput } from "../createSingle/index.mjs"; //#region src/composables/createStep/index.d.ts /** * Input type for step tickets. * Extend this interface to add custom properties. */ interface StepTicketInput extends SingleTicketInput {} /** * Output type for step tickets. * Includes all input properties plus selection methods. */ type StepTicket = SingleTicket; /** * Context returned by createStep. * * @template Z The input ticket type. * @template E The output ticket type. */ interface StepContext = StepTicket> extends Omit, 'register' | 'onboard'> { /** Select the first Ticket in the collection */ first: () => void; /** Select the last Ticket in the collection */ last: () => void; /** Select the next Ticket based on current index */ next: () => void; /** Select the previous Ticket based on current index */ prev: () => void; /** Step through the collection by a given count */ step: (count: number) => void; /** Register a new ticket (accepts input type, returns output type) */ register: (ticket?: Partial) => E; /** Onboard multiple tickets at once */ onboard: (registrations: Partial[]) => E[]; } interface StepOptions extends SingleOptions { /** * Enable circular navigation (wrapping at boundaries). * - true: Navigation wraps around (carousel behavior) * - false: Navigation stops at boundaries (pagination behavior) * @default false */ circular?: boolean; } interface StepContextOptions extends SingleContextOptions { /** * Enable circular navigation (wrapping at boundaries). * - true: Navigation wraps around (carousel behavior) * - false: Navigation stops at boundaries (pagination behavior) * @default false */ circular?: boolean; } /** * Creates a new step instance with navigation through items. * * Extends `createSingle` with `first()`, `last()`, `next()`, `prev()`, and `step(count)` methods * for sequential navigation. Supports both circular (wrapping) and bounded (stopping at edges) modes. * * @param options The options for the step instance. * @template Z The type of the step ticket. * @template E The type of the step context. * @returns A new step instance with navigation methods. * * @remarks * **Key Features:** * - **Configurable Navigation**: `circular: true` for wrapping, `false` for bounded (default: false) * - **Disabled Item Skipping**: Automatically skips disabled items during navigation * - **Bidirectional**: Forward (`next`, positive `step`) and backward (`prev`, negative `step`) * - **Safe Edge Cases**: Handles empty registries and all-disabled scenarios gracefully * * **Navigation Methods:** * - `first()`: Select first non-disabled item * - `last()`: Select last non-disabled item * - `next()`: Move to next item (wraps if circular, stops at end if bounded) * - `prev()`: Move to previous item (wraps if circular, stops at start if bounded) * - `step(count)`: Move by `count` positions (negative for backward) * * **Circular Mode (`circular: true`):** * - Uses modulo arithmetic for wrapping: `((index % length) + length) % length` * - Works correctly with negative indexes and large step counts * - Perfect for carousels, theme switchers, infinite scrolling * * **Bounded Mode (`circular: false`, default):** * - Navigation stops at boundaries (no wrapping) * - `next()` on last item does nothing * - `prev()` on first item does nothing * - Perfect for pagination, wizards with explicit completion, forms * * **Inheritance Chain:** * `createRegistry` → `createSelection` → `createSingle` → `createStep` * * @see https://0.vuetifyjs.com/composables/selection/create-step * * @example * ```ts * import { createStep } from '@vuetify/v0' * * // Bounded navigation (default) - for pagination * const pagination = createStep({ circular: false }) * pagination.onboard([ * { id: 'page-1', value: 1 }, * { id: 'page-2', value: 2 }, * { id: 'page-3', value: 3 }, * ]) * pagination.first() // Select page 1 * pagination.prev() // Does nothing (already at first) * pagination.next() // Select page 2 * * // Circular navigation - for carousels * const carousel = createStep({ circular: true }) * carousel.onboard([ * { id: 'slide-1', value: 'First' }, * { id: 'slide-2', value: 'Second' }, * { id: 'slide-3', value: 'Third' }, * ]) * carousel.first() * carousel.prev() // Wraps to 'slide-3' * carousel.next() // Wraps to 'slide-1' * ``` */ declare function createStep = StepTicket, R extends StepContext = StepContext>(_options?: StepOptions): R; /** * Creates a new step context. * * @param options The options for the step context. * @template Z The input ticket type. * @template E The output ticket type. * @template R The context type. * @returns A new step context. * * @see https://0.vuetifyjs.com/composables/selection/create-step * * @example * ```ts * import { createStepContext } from '@vuetify/v0' * * // With default namespace 'v0:step' * export const [useStep, provideStep, context] = createStepContext() * * // In a parent component: * provideStep() * * // In a child component: * const context = useStep() * context.next() // Progress to next step * ``` */ declare function createStepContext = StepTicket, R extends StepContext = StepContext>(_options?: StepContextOptions): ContextTrinity; /** * Returns the current step instance. * * @param namespace The namespace for the step context. Defaults to `'v0:step'`. * @template Z The input ticket type. * @template E The output ticket type. * @template R The context type. * @returns The current step instance. * * @see https://0.vuetifyjs.com/composables/selection/create-step * * @example * ```vue * * * * ``` */ declare function useStep = StepTicket, R extends StepContext = StepContext>(namespace?: string): R; //#endregion export { StepContext, StepContextOptions, StepOptions, StepTicket, StepTicketInput, createStep, createStepContext, useStep };