@ansible/ansible-ui-framework 2.4.2571 → 2.4.2573

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,4 @@
1
- import { ButtonVariant } from '@patternfly/react-core';
2
- import { DropdownPosition } from '@patternfly/react-core/deprecated';
1
+ import { ButtonVariant, DropdownPopperProps } from '@patternfly/react-core';
3
2
  import { ComponentClass, FunctionComponent } from 'react';
4
3
  import { WindowSize } from '../components/useBreakPoint';
5
4
  import { IPageAction } from './PageAction';
@@ -9,7 +8,7 @@ interface PageActionProps<T extends object> {
9
8
  selectedItems?: T[];
10
9
  wrapper?: ComponentClass | FunctionComponent;
11
10
  collapse?: WindowSize | 'always' | 'never';
12
- position?: DropdownPosition;
11
+ position?: DropdownPopperProps['position'];
13
12
  iconOnly?: boolean;
14
13
  onOpen?: (open: boolean) => void;
15
14
  variant?: ButtonVariant;
@@ -1,11 +1,13 @@
1
1
  import '@patternfly/patternfly/components/Wizard/wizard.css';
2
2
  import { ErrorAdapter } from '../PageForm/typesErrorAdapter';
3
3
  import type { PageWizardStep } from './types';
4
- export declare function PageWizard<T extends object>(props: {
4
+ export declare function PageWizard<DataT extends NonNullable<object>>(props: {
5
5
  steps: PageWizardStep[];
6
- defaultValue?: Record<string, object>;
6
+ stepDefaults?: {
7
+ [stepID: string]: Partial<DataT>;
8
+ };
7
9
  onCancel?: () => void;
8
- onSubmit: (wizardData: T) => Promise<void>;
10
+ onSubmit: (wizardData: DataT) => Promise<void>;
9
11
  errorAdapter?: ErrorAdapter;
10
12
  disableGrid?: boolean;
11
13
  title?: string;
@@ -1,12 +1,15 @@
1
1
  import { ReactNode } from 'react';
2
- import type { PageWizardParentStep, PageWizardState, PageWizardStep } from './types';
3
- export declare const PageWizardContext: import("react").Context<PageWizardState>;
4
- export declare function usePageWizard(): PageWizardState;
2
+ import type { PageWizardState } from './PageWizardState';
3
+ import type { PageWizardParentStep, PageWizardStep } from './types';
4
+ export declare const PageWizardContext: import("react").Context<PageWizardState<object>>;
5
+ export declare function usePageWizard<DataT extends NonNullable<object> = object>(): PageWizardState<DataT>;
5
6
  export declare function isStepVisible(step: PageWizardStep, values: object): PageWizardStep | null;
6
7
  export declare function isPageWizardParentStep(step: PageWizardStep): step is PageWizardParentStep;
7
- export declare function PageWizardProvider<T extends object>(props: {
8
+ export declare function PageWizardProvider<DataT extends NonNullable<object>>(props: {
8
9
  children: ReactNode;
9
10
  steps: PageWizardStep[];
10
- defaultValue?: Record<string, object>;
11
- onSubmit: (wizardData: T) => Promise<void>;
11
+ stepDefaults?: {
12
+ [stepID: string]: Partial<DataT>;
13
+ };
14
+ onSubmit: (wizardData: DataT) => Promise<void>;
12
15
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { PageWizardStep } from './types';
3
+ export interface PageWizardState<DataT extends NonNullable<object> = object> {
4
+ steps: PageWizardStep[];
5
+ visibleSteps: PageWizardStep[];
6
+ visibleStepsFlattened: PageWizardStep[];
7
+ activeStep: PageWizardStep | null;
8
+ setActiveStep: (step: PageWizardStep) => void;
9
+ wizardData: DataT;
10
+ setWizardData: Dispatch<SetStateAction<DataT>>;
11
+ stepData: {
12
+ [stepID: string]: Partial<DataT>;
13
+ };
14
+ setStepData: Dispatch<SetStateAction<{
15
+ [stepID: string]: Partial<DataT>;
16
+ }>>;
17
+ stepError: Record<string, object>;
18
+ setStepError: Dispatch<SetStateAction<Record<string, object>>>;
19
+ onNext: (stepData: Partial<DataT>) => Promise<void>;
20
+ onBack: () => void;
21
+ isSubmitting: boolean;
22
+ submitError?: Error | undefined;
23
+ setSubmitError: Dispatch<SetStateAction<Error | undefined>>;
24
+ isToggleExpanded: boolean;
25
+ setToggleExpanded: (update: (toggleNavExpanded: boolean) => boolean) => void;
26
+ }
@@ -1,7 +1,7 @@
1
- import { SetStateAction } from 'react';
2
1
  import { ErrorAdapter } from '../PageForm/typesErrorAdapter';
3
2
  export interface PageWizardBasicStep {
4
3
  id: string;
4
+ idOfparentStep?: string;
5
5
  label: string;
6
6
  inputs?: React.ReactNode;
7
7
  element?: React.ReactNode;
@@ -12,26 +12,6 @@ export interface PageWizardParentStep extends Omit<PageWizardBasicStep, 'inputs'
12
12
  substeps: [PageWizardBasicStep, ...PageWizardBasicStep[]];
13
13
  }
14
14
  export type PageWizardStep = PageWizardBasicStep | PageWizardParentStep;
15
- export interface PageWizardState {
16
- activeStep: PageWizardStep | null;
17
- isToggleExpanded: boolean;
18
- setActiveStep: (step: PageWizardStep) => void;
19
- setStepData: React.Dispatch<SetStateAction<Record<string, object>>>;
20
- setStepError: React.Dispatch<SetStateAction<Record<string, object>>>;
21
- setToggleExpanded: (update: (toggleNavExpanded: boolean) => boolean) => void;
22
- setWizardData: (data: object) => void;
23
- stepData: Record<string, object>;
24
- stepError: Record<string, object>;
25
- steps: PageWizardStep[];
26
- visibleSteps: PageWizardStep[];
27
- visibleStepsFlattened: PageWizardStep[];
28
- wizardData: object;
29
- onNext: (formState: object) => Promise<void>;
30
- onBack: () => void;
31
- submitError?: Error | undefined;
32
- setSubmitError: React.Dispatch<SetStateAction<Error | undefined>>;
33
- isSubmitting: boolean;
34
- }
35
15
  export interface PageWizardBody {
36
16
  onCancel?: () => void;
37
17
  errorAdapter?: ErrorAdapter;