diff --git a/package.json b/package.json index bf6b966f..d6e67597 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bestdoctor/ke-beta", - "version": "13.2.4", + "version": "13.2.5", "description": "BestDoctor back-office UI constructor", "author": "pro100filipp", "main": "dist/index.js", diff --git a/src/Wizard/Wizard.tsx b/src/Wizard/Wizard.tsx index 77acc266..a166bd89 100644 --- a/src/Wizard/Wizard.tsx +++ b/src/Wizard/Wizard.tsx @@ -1,8 +1,8 @@ import { Box } from '@chakra-ui/react' -import React, { ReactNode, useCallback, useEffect, useState } from 'react' +import React, { useCallback, useState } from 'react' import { usePropState } from '@cdk/Hooks' -import { WizardProps } from './types' +import { StepArgs, WizardProps } from './types' export const Wizard = ( props: WizardProps @@ -10,7 +10,6 @@ export const Wizard = (null) const next = useCallback( (action: Action, newData: StepData, submit): void => { @@ -45,14 +44,12 @@ export const Wizard = { - setCurrentForm(steps[currentStep]({ data: currentData, next, restart, finish, onChange })) - }, [currentData, currentStep, next, finish, restart, steps, onChange]) + const FormElement: React.FC> = steps[currentStep] return ( {name} - {currentForm} + ) } diff --git a/src/Wizard/types.ts b/src/Wizard/types.ts index 30fe7fcf..32cded18 100644 --- a/src/Wizard/types.ts +++ b/src/Wizard/types.ts @@ -1,8 +1,8 @@ -import { ReactNode } from 'react' +import { FC } from 'react' -interface WizardProps { +export interface WizardProps { map: Record>> - steps: Record) => ReactNode> + steps: Record>> start: Start name: string onStepChange: (stepKey: Key, data: StepData) => void @@ -15,7 +15,7 @@ interface Start { data: StepData } -interface StepArgs { +export interface StepArgs { data: StepData next: NextStep restart: () => void @@ -23,6 +23,4 @@ interface StepArgs { onChange: (data: StepData) => void } -type NextStep = (nextKey: Action, data: StepData, submit?: (data: unknown) => void) => void - -export { WizardProps, NextStep, StepArgs } +export type NextStep = (nextKey: Action, data: StepData, submit?: (data: unknown) => void) => void