import React from 'react'; import type { StyleProp, View, ViewStyle } from 'react-native'; import type { WithTimingConfig } from 'react-native-reanimated'; import type { ThemeVars } from '@coinbase/cds-common/core/theme'; import type { IconName } from '@coinbase/cds-common/types/IconName'; import type { SpringConfig } from '@react-spring/core'; import type { IconProps } from '../icons/Icon'; import { type BoxBaseProps, type BoxProps } from '../layout/Box'; /** 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; /** Inline styles for the subcomponent element */ style?: StyleProp; }; export type StepperStepProps = Record> = StepperSubcomponentProps & BoxProps & { /** * A value between 0 and 1 representing the step's progress. * Progress bar subcomponents animate to this value internally. */ progress: number; activeStepLabelElement: View | null; setActiveStepLabelElement: (element: View) => void; progressTimingConfig?: WithTimingConfig; animate?: boolean; disableAnimateOnMount?: boolean; completedStepAccessibilityLabel?: string; StepperStepComponent?: StepperStepComponent; StepperSubstepContainerComponent?: StepperSubstepContainerComponent | null; StepperLabelComponent?: StepperLabelComponent | null; StepperProgressComponent?: StepperProgressComponent | null; StepperIconComponent?: StepperIconComponent | null; styles?: { step?: StyleProp; label?: StyleProp; progress?: StyleProp; icon?: StyleProp; header?: StyleProp; substepContainer?: StyleProp; }; }; export type StepperSubstepContainerProps< Metadata extends Record = Record, > = StepperSubcomponentProps & BoxProps & { children: React.ReactNode; }; export type StepperHeaderProps = Record> = BoxProps & { activeStep: StepperValue | null; flatStepIds: string[]; complete?: boolean; disableAnimateOnMount?: boolean; style?: StyleProp; }; export type StepperLabelProps = Record> = StepperSubcomponentProps & BoxProps & { setActiveStepLabelElement: (element: View) => void; defaultColor?: ThemeVars.Color; activeColor?: ThemeVars.Color; descendentActiveColor?: ThemeVars.Color; visitedColor?: ThemeVars.Color; completeColor?: ThemeVars.Color; completedStepAccessibilityLabel?: string; }; export type StepperProgressProps< Metadata extends Record = Record, > = StepperSubcomponentProps & BoxProps & { progress: number; activeStepLabelElement: View | null; progressTimingConfig?: WithTimingConfig; animate?: boolean; disableAnimateOnMount?: boolean; defaultFill?: ThemeVars.Color; activeFill?: ThemeVars.Color; descendentActiveFill?: ThemeVars.Color; visitedFill?: ThemeVars.Color; completeFill?: ThemeVars.Color; }; export type StepperIconProps = Record> = StepperSubcomponentProps & Omit & { name?: IconName; defaultName?: IconName; activeName?: IconName; descendentActiveName?: IconName; visitedName?: IconName; completeName?: IconName; defaultColor?: ThemeVars.Color; activeColor?: ThemeVars.Color; descendentActiveColor?: ThemeVars.Color; visitedColor?: ThemeVars.Color; completeColor?: ThemeVars.Color; }; 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> = BoxBaseProps & { /** 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 timing config to use for the progress animation. */ progressTimingConfig?: WithTimingConfig; /** * @deprecated Stepper no longer uses react-spring for progress; this value is ignored but retained for migration only. Use {@link progressTimingConfig} instead. This will be removed in a future major release. * @deprecationExpectedRemoval v10 */ progressSpringConfig?: SpringConfig; /** Whether to animate the progress bar. * @default true */ animate?: boolean; /** Whether to disable the animation on mount. */ disableAnimateOnMount?: boolean; }; export type StepperProps = Record> = BoxProps & StepperBaseProps & { /** Custom styles for individual elements of the Stepper component */ styles?: { /** Root Stepper container element */ root?: StyleProp; /** Step subcomponent element */ step?: StyleProp; /** Substep container element */ substepContainer?: StyleProp; /** Label subcomponent element */ label?: StyleProp; /** Progress subcomponent element */ progress?: StyleProp; /** Icon subcomponent element */ icon?: StyleProp; /** Header subcomponent element */ header?: StyleProp; }; }; export declare const horizontalStepGap = 0.5; export declare const defaultProgressTimingConfig: WithTimingConfig; /** * @deprecated Use {@link defaultProgressTimingConfig}. Retained for migration only; Stepper no longer uses react-spring for progress. This will be removed in a future major release. * @deprecationExpectedRemoval v10 */ export declare const defaultProgressSpringConfig: SpringConfig; type StepperComponent = = Record>( props: StepperProps & { ref?: React.Ref; }, ) => React.ReactElement; export declare const Stepper: StepperComponent; export {}; //# sourceMappingURL=Stepper.d.ts.map