| 1 | import { WizardSteps } from "../ui/wizard"; |
| 2 | import { |
| 3 | ADD_PROVIDER_WIZARD_STEPS, |
| 4 | resolveWizardNavigation, |
| 5 | type WizardNavigation, |
| 6 | } from "./AddProviderInstanceDialog.logic"; |
| 7 | |
| 8 | interface AddProviderInstanceWizardStepsProps { |
| 9 | readonly currentStep: number; |
| 10 | readonly summaries: readonly (string | null)[]; |
| 11 | readonly instanceIdError: string | null; |
| 12 | readonly steps?: readonly string[]; |
| 13 | readonly identityStep?: number; |
| 14 | readonly prerequisite?: { |
| 15 | readonly step: number; |
| 16 | readonly error: string | null; |
| 17 | }; |
| 18 | readonly onNavigation: (navigation: WizardNavigation) => void; |
| 19 | readonly disabled?: boolean; |
| 20 | } |
| 21 | |
| 22 | export function AddProviderInstanceWizardSteps({ |
| 23 | currentStep, |
| 24 | summaries, |
| 25 | instanceIdError, |
| 26 | steps = ADD_PROVIDER_WIZARD_STEPS, |
| 27 | identityStep, |
| 28 | prerequisite, |
| 29 | onNavigation, |
| 30 | disabled = false, |
| 31 | }: AddProviderInstanceWizardStepsProps) { |
| 32 | return ( |
| 33 | <WizardSteps |
| 34 | steps={steps} |
| 35 | currentStep={currentStep} |
| 36 | summaries={summaries} |
| 37 | isStepDisabled={() => disabled} |
| 38 | onStepChange={(requestedStep) => |
| 39 | onNavigation( |
| 40 | resolveWizardNavigation(currentStep, requestedStep, steps.length, { |
| 41 | instanceIdError, |
| 42 | ...(identityStep === undefined ? {} : { identityStep }), |
| 43 | ...(prerequisite === undefined ? {} : { prerequisite }), |
| 44 | }), |
| 45 | ) |
| 46 | } |
| 47 | /> |
| 48 | ); |
| 49 | } |