diff --git a/types/react-albus/index.d.ts b/types/react-albus/index.d.ts index 9d34c93c64..48dfcb9a6b 100644 --- a/types/react-albus/index.d.ts +++ b/types/react-albus/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/americanexpress/react-albus#readme // Definitions by: Sindre Seppola // Conrad Reuter +// Jonas Kugelmann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -23,19 +24,31 @@ export interface WizardContext { replace: (id?: string) => void; } -export const Wizard: React.ComponentType<{ +export interface WizardComponentProps { + wizard: WizardContext; +} + +export const withWizard:

( + component: React.ComponentType

+) => React.ComponentType

; + +export interface WizardProps { onNext?: (wizard: WizardContext) => void; render?: (wizard: WizardContext) => React.ReactNode; history?: History; -}>; + basename?: string; +} -export const Steps: React.ComponentType<{ +export const Wizard: React.ComponentType; + +export interface StepsProps { step?: WizardStepObject; -}>; +} -export const Step: React.ComponentType<{ - id: string; -} & ( - | { render?: (wizard: WizardContext) => React.ReactNode; } - | { children: (wizard: WizardContext) => React.ReactNode; } -)>; +export const Steps: React.ComponentType; + +export type StepProps = { id: string } & ( + | { render?: (wizard: WizardContext) => React.ReactNode } + | { children: (wizard: WizardContext) => React.ReactNode }); + +export const Step: React.ComponentType; diff --git a/types/react-albus/react-albus-tests.tsx b/types/react-albus/react-albus-tests.tsx index ed744c3e6f..5bdb3d13c4 100644 --- a/types/react-albus/react-albus-tests.tsx +++ b/types/react-albus/react-albus-tests.tsx @@ -1,8 +1,10 @@ import * as React from "react"; -import { Wizard, Step, Steps } from "react-albus"; +import { Wizard, Step, Steps, withWizard } from "react-albus"; +import { ButtonHTMLAttributes } from "react"; const Example = () => ( { wiz.go(0); const location = wiz.history.location; @@ -46,6 +48,12 @@ const Example = () => ( )} + +

+

Hermoine

+ +
+

Harry

@@ -55,3 +63,8 @@ const Example = () => ( )} /> ); + +export const NextButton = withWizard<{ label: string }>(props => { + const { wizard, label } = props; + return ; +});