import React from 'react'; import type { ThemeVars } from '@coinbase/cds-common/core/theme'; import type { IconName } from '@coinbase/cds-common/types'; import { type SpringConfig, type SpringValue } from '@react-spring/web'; import type { IconProps } from '../icons/Icon'; import { type BoxDefaultElement, type BoxProps } from '../layout/Box'; import { type VStackBaseProps, type VStackProps } from '../layout/VStack'; import type { ResponsiveProp } from '../styles/styleProps'; /** Data that represents a single step within a Stepper.*/ export type StepperValue = Record> = { /** A unique indetifier of the step. This is used to reference the Stepper's active step. */ id: string; /** The text or ReactNode displayed within the Stepper's Label subcomponent. */ label?: React.ReactNode; accessibilityLabel?: string; /** Optional step metadata which is passed to the the Stepper subcomponents. */ metadata?: Metadata; subSteps?: StepperValue[]; Component?: StepperStepComponent | null; StepperSubstepContainerComponent?: StepperSubstepContainerComponent | null; StepperIconComponent?: StepperIconComponent | null; StepperLabelComponent?: StepperLabelComponent | null; StepperProgressComponent?: StepperProgressComponent | null; StepperHeaderComponent?: StepperHeaderComponent | null; }; /** Props shared by most of Stepper's subcomponents. */ type StepperSubcomponentProps = Record> = { /** The step object being rendered. */ step: StepperValue; /** The parent step of the step being rendered */ parentStep: StepperValue | null; /** The id of the current active step. Can be null if no active step. */ activeStepId: string | null; /** The depth/nesting level of this step (0 = root, 1 = first level sub-step, etc.) */ depth: number; /** Whether the step is the current, active step */ active: boolean; /** Whether the step has been visited */ visited: boolean; /** An array of all step ids in the stepper */ flatStepIds: string[]; /** Whether the entire stepper is complete */ complete?: boolean; /** Whether the active step is a descendent of this step */ isDescendentActive: boolean; /** A CSS class name applied to this component */ className?: string; /** Inline styles for the subcomponent element */ style?: React.CSSProperties; }; export type StepperStepProps = Record> = StepperSubcomponentProps & BoxProps & { /** * An animated SpringValue between 0 and 1. * You can use this to animate your own custom Progress subcomponent. */ progress: SpringValue; activeStepLabelElement: HTMLElement | null; setActiveStepLabelElement: (element: HTMLElement) => void; progressSpringConfig?: SpringConfig; animate?: boolean; disableAnimateOnMount?: boolean; completedStepAccessibilityLabel?: string; StepperStepComponent?: StepperStepComponent; StepperSubstepContainerComponent?: StepperSubstepContainerComponent | null; StepperLabelComponent?: StepperLabelComponent | null; StepperProgressComponent?: StepperProgressComponent | null; StepperIconComponent?: StepperIconComponent | null; styles?: { step?: React.CSSProperties; label?: React.CSSProperties; progress?: React.CSSProperties; icon?: React.CSSProperties; header?: React.CSSProperties; substepContainer?: React.CSSProperties; }; classNames?: { step?: string; label?: string; progress?: string; icon?: string; header?: string; substepContainer?: string; }; }; export type StepperSubstepContainerProps< Metadata extends Record = Record, > = StepperSubcomponentProps & BoxProps & { children: React.ReactNode; }; export type StepperHeaderProps = Record> = BoxProps & { activeStep: StepperValue | null; flatStepIds: string[]; complete?: boolean; className?: string; style?: React.CSSProperties; }; export type StepperLabelProps = Record> = StepperSubcomponentProps & BoxProps & { setActiveStepLabelElement: (element: HTMLElement) => void; defaultColor?: ResponsiveProp; activeColor?: ResponsiveProp; descendentActiveColor?: ResponsiveProp; visitedColor?: ResponsiveProp; completeColor?: ResponsiveProp; completedStepAccessibilityLabel?: string; }; export type StepperProgressProps< Metadata extends Record = Record, > = StepperSubcomponentProps & BoxProps & { progress: SpringValue; activeStepLabelElement: HTMLElement | null; progressSpringConfig?: SpringConfig; animate?: boolean; disableAnimateOnMount?: boolean; defaultFill?: ResponsiveProp; activeFill?: ResponsiveProp; descendentActiveFill?: ResponsiveProp; completeFill?: ResponsiveProp; visitedFill?: ResponsiveProp; }; export type StepperIconProps = Record> = StepperSubcomponentProps & Omit & { name?: IconName; defaultName?: IconName; activeName?: IconName; descendentActiveName?: IconName; visitedName?: IconName; completeName?: IconName; defaultColor?: ResponsiveProp; activeColor?: ResponsiveProp; descendentActiveColor?: ResponsiveProp; visitedColor?: ResponsiveProp; completeColor?: ResponsiveProp; }; export type StepperStepComponent< Metadata extends Record = Record, > = React.FC>; export type StepperSubstepContainerComponent< Metadata extends Record = Record, > = React.FC>; export type StepperLabelComponent< Metadata extends Record = Record, > = React.FC>; export type StepperProgressComponent< Metadata extends Record = Record, > = React.FC>; export type StepperIconComponent< Metadata extends Record = Record, > = React.FC>; export type StepperHeaderComponent< Metadata extends Record = Record, > = React.FC>; export type StepperBaseProps = Record> = VStackBaseProps & { /** An optional accessibility label used to announce a step as complete/visited. Useful for providing an internationalized label for this state. * @default "Complete" */ completedStepAccessibilityLabel?: string; /** The orientation of the stepper. */ direction: 'vertical' | 'horizontal'; /** * An array of steps to render. * @see StepperValue */ steps: StepperValue[]; /** * The id of the current/active step. * Set this to null to visualize a completely unfilled/incomplete Stepper. */ activeStepId: string | null; /** Set this to true to visualize a completely filled/complete Stepper */ complete?: boolean; /** An optional component to render in place of the default Step subcomponent. */ StepperStepComponent?: StepperStepComponent; /** An optional component to render in place of the default SubstepContainer subcomponent. */ StepperSubstepContainerComponent?: StepperSubstepContainerComponent | null; /** An optional component to render in place of the default Label subcomponent. Set to null to render nothing in this slot. */ StepperLabelComponent?: StepperLabelComponent | null; /** An optional component to render in place of the default Progress subcomponent. Set to null to render nothing in this slot. */ StepperProgressComponent?: StepperProgressComponent | null; /** An optional component to render in place of the default Icon subcomponent. Set to null to render nothing in this slot. */ StepperIconComponent?: StepperIconComponent | null; /** An optional component to render in place of the default Header subcomponent. Set to null to render nothing in this slot. */ StepperHeaderComponent?: StepperHeaderComponent | null; /** The spring config to use for the progress spring. */ progressSpringConfig?: SpringConfig; /** Whether to animate the progress spring. * @default true */ animate?: boolean; /** Whether to disable the animation on mount. */ disableAnimateOnMount?: boolean; }; export declare const stepperDefaultElement = 'div'; export type StepperDefaultElement = typeof stepperDefaultElement; export type StepperProps = Record> = VStackProps & StepperBaseProps & { /** Custom styles for individual elements of the Stepper component */ styles?: { /** Root Stepper container element */ root?: React.CSSProperties; /** Step subcomponent element */ step?: React.CSSProperties; /** Substep container element */ substepContainer?: React.CSSProperties; /** Label subcomponent element */ label?: React.CSSProperties; /** Progress subcomponent element */ progress?: React.CSSProperties; /** Icon subcomponent element */ icon?: React.CSSProperties; /** Header subcomponent element */ header?: React.CSSProperties; }; /** Custom class names for individual elements of the Stepper component */ classNames?: { /** Root Stepper container element */ root?: string; /** Step subcomponent element */ step?: string; /** Substep container element */ substepContainer?: string; /** Label subcomponent element */ label?: string; /** Progress subcomponent element */ progress?: string; /** Icon subcomponent element */ icon?: string; /** Header subcomponent element */ header?: string; }; }; export declare const horizontalStepGap: { readonly phone: 0.5; readonly tablet: 1; readonly desktop: 1; }; export declare const defaultProgressSpringConfig: { friction: number; tension: number; clamp: boolean; }; type StepperComponent = = Record>( props: StepperProps & { ref?: React.Ref; }, ) => React.ReactElement; export declare const Stepper: StepperComponent; export {}; //# sourceMappingURL=Stepper.d.ts.map