@ansible/ansible-ui-framework 0.0.720 → 0.0.722

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,60 +1,93 @@
1
1
  import { ButtonVariant } from '@patternfly/react-core';
2
2
  import { ComponentClass } from 'react';
3
- import { PageActionType } from './PageActionType';
4
- export type IPageAction<T extends object> = IPageActionSeperator | IPageActionButton | IPageBulkAction<T> | IPageSingleAction<T> | IPageDropdownAction<T>;
5
- export interface IPageActionCommon {
3
+ export declare const enum PageActionType {
4
+ Button = 0,
5
+ Link = 1,
6
+ Switch = 2,
7
+ Dropdown = 3,
8
+ Seperator = 4
9
+ }
10
+ export declare const enum PageActionSelection {
11
+ None = 0,
12
+ Single = 1,
13
+ Multiple = 2
14
+ }
15
+ export type IPageAction<T extends object> = IPageActionButton | IPageActionButtonSingle<T> | IPageActionButtonMultiple<T> | IPageActionLink | IPageActionLinkSingle<T> | IPageActionSwitch | IPageActionSwitchSingle<T> | IPageActionDropdown<T> | IPageActionDropdownSingle<T> | IPageActionDropdownMultiple<T> | IPageActionSeperator;
16
+ interface IPageActionCommon {
6
17
  icon?: ComponentClass;
7
18
  label: string;
8
- shortLabel?: string;
9
19
  tooltip?: string;
10
20
  isDanger?: boolean;
11
21
  ouiaId?: string;
22
+ isPinned?: boolean;
12
23
  }
13
- export interface IPageActionSeperator {
14
- type: PageActionType.seperator;
24
+ interface IPageActionNoneCommon extends IPageActionCommon {
25
+ selection?: PageActionSelection.None;
26
+ isHidden?: () => boolean;
27
+ isDisabled?: string | (() => string | undefined);
15
28
  }
16
- type IPageActionWithLink = IPageActionCommon & {
17
- type: PageActionType.button;
18
- variant?: ButtonVariant;
19
- isDisabled?: string | undefined;
20
- href: string;
21
- onClick?: never;
22
- };
23
- type IPageActionWithOnClick = IPageActionCommon & {
24
- type: PageActionType.button;
29
+ interface IPageActionSingleCommon<T extends object> extends IPageActionCommon {
30
+ selection?: PageActionSelection.Single;
31
+ isHidden?: (item: T) => boolean;
32
+ isDisabled?: string | ((item: T) => string | undefined);
33
+ }
34
+ interface IPageActionMultipleCommon<T extends object> extends IPageActionCommon {
35
+ selection?: PageActionSelection.Multiple;
36
+ isDisabled?: string | ((items: T[]) => string | undefined);
37
+ }
38
+ export interface IPageActionButton extends IPageActionNoneCommon {
39
+ type: PageActionType.Button;
40
+ selection: PageActionSelection.None;
25
41
  variant?: ButtonVariant;
26
- isDisabled?: string | undefined;
27
- onClick: (() => void) | (() => Promise<unknown>);
28
- href?: never;
29
- };
30
- export type IPageActionButton = IPageActionWithLink | IPageActionWithOnClick;
31
- export type IPageBulkAction<T extends object> = IPageActionCommon & {
32
- type: PageActionType.bulk;
42
+ onClick: () => unknown | Promise<unknown>;
43
+ }
44
+ export interface IPageActionButtonSingle<T extends object> extends IPageActionSingleCommon<T> {
45
+ type: PageActionType.Button;
46
+ selection: PageActionSelection.Single;
33
47
  variant?: ButtonVariant;
34
- onClick: (selectedItems: T[]) => void;
35
- };
36
- type IPageSingleActionWithLink<T extends object> = IPageActionCommon & {
37
- type: PageActionType.singleLink;
48
+ onClick: (item: T) => unknown | Promise<unknown>;
49
+ }
50
+ export interface IPageActionButtonMultiple<T extends object> extends IPageActionMultipleCommon<T> {
51
+ type: PageActionType.Button;
52
+ selection: PageActionSelection.Multiple;
38
53
  variant?: ButtonVariant;
54
+ onClick: (items: T[]) => unknown | Promise<unknown>;
55
+ }
56
+ export interface IPageActionLink extends IPageActionNoneCommon {
57
+ type: PageActionType.Link;
58
+ href: string;
59
+ }
60
+ export interface IPageActionLinkSingle<T extends object> extends IPageActionSingleCommon<T> {
61
+ type: PageActionType.Link;
39
62
  href: (item: T) => string;
40
- onClick?: never;
41
- isDisabled?: (item: T) => string | undefined;
42
- isHidden?: (item: T) => boolean;
43
- };
44
- type IPageSingleActionWithOnClick<T extends object> = IPageActionCommon & {
45
- type: PageActionType.single;
46
- variant?: ButtonVariant;
47
- onClick: (item: T) => void | Promise<unknown>;
48
- href?: never;
49
- isDisabled?: (item: T) => string | undefined;
50
- isHidden?: (item: T) => boolean;
51
- };
52
- export type IPageSingleAction<T extends object> = IPageSingleActionWithLink<T> | IPageSingleActionWithOnClick<T>;
53
- export type IPageDropdownAction<T extends object> = IPageActionCommon & {
54
- type: PageActionType.dropdown;
55
- variant?: ButtonVariant;
56
- isHidden?: (item: T) => boolean;
57
- isDisabled?: (item: T) => string;
58
- options: IPageAction<T>[];
59
- };
63
+ }
64
+ export interface IPageActionSwitch extends IPageActionNoneCommon {
65
+ type: PageActionType.Switch;
66
+ onToggle: (enable: boolean) => unknown | Promise<unknown>;
67
+ isSwitchOn: () => boolean;
68
+ showPinnedLabel?: boolean;
69
+ labelOff?: string;
70
+ }
71
+ export interface IPageActionSwitchSingle<T extends object> extends IPageActionSingleCommon<T> {
72
+ type: PageActionType.Switch;
73
+ onToggle: (item: T, enable: boolean) => unknown | Promise<unknown>;
74
+ isSwitchOn: (item: T) => boolean;
75
+ showPinnedLabel?: boolean;
76
+ labelOff?: string;
77
+ }
78
+ export interface IPageActionDropdown<T extends object> extends IPageActionNoneCommon {
79
+ type: PageActionType.Dropdown;
80
+ actions: IPageAction<T>[];
81
+ }
82
+ export interface IPageActionDropdownSingle<T extends object> extends IPageActionSingleCommon<T> {
83
+ type: PageActionType.Dropdown;
84
+ actions: IPageAction<T>[];
85
+ }
86
+ export interface IPageActionDropdownMultiple<T extends object> extends IPageActionMultipleCommon<T> {
87
+ type: PageActionType.Dropdown;
88
+ actions: IPageAction<T>[];
89
+ }
90
+ export interface IPageActionSeperator {
91
+ type: PageActionType.Seperator;
92
+ }
60
93
  export {};
@@ -0,0 +1,10 @@
1
+ import { ComponentClass, FunctionComponent } from 'react';
2
+ import { IPageActionButton, IPageActionButtonMultiple, IPageActionButtonSingle } from './PageAction';
3
+ export declare function PageActionButton<T extends object>(props: {
4
+ action: IPageActionButton | IPageActionButtonSingle<T> | IPageActionButtonMultiple<T>;
5
+ isSecondary?: boolean;
6
+ wrapper?: ComponentClass | FunctionComponent;
7
+ iconOnly?: boolean;
8
+ selectedItem?: T;
9
+ selectedItems?: T[];
10
+ }): JSX.Element;
@@ -1,17 +1,19 @@
1
1
  import { ButtonVariant, DropdownPosition } from '@patternfly/react-core';
2
2
  import { ComponentClass, FunctionComponent } from 'react';
3
3
  import { IPageAction } from './PageAction';
4
- export declare function PageDropdownAction<T extends object>(props: {
4
+ interface PageActionDropdownProps<T extends object> {
5
5
  actions: IPageAction<T>[];
6
- label?: string;
7
6
  icon?: ComponentClass | FunctionComponent;
8
- isDisabled?: boolean;
9
- tooltip?: string;
10
- selectedItems?: T[];
11
- selectedItem?: T;
12
- position?: DropdownPosition;
13
7
  iconOnly?: boolean;
8
+ isDisabled?: string | undefined;
9
+ label?: string;
14
10
  onOpen?: (label: string, open: boolean) => void;
11
+ position?: DropdownPosition;
12
+ selectedItem?: T;
13
+ selectedItems?: T[];
14
+ tooltip?: string;
15
15
  variant?: ButtonVariant;
16
- }): JSX.Element;
16
+ }
17
+ export declare function PageActionDropdown<T extends object>(props: PageActionDropdownProps<T>): JSX.Element;
17
18
  export declare function filterActionSeperators<T extends object>(actions: IPageAction<T>[]): IPageAction<T>[];
19
+ export {};
@@ -0,0 +1,9 @@
1
+ import { ComponentClass, FunctionComponent } from 'react';
2
+ import { IPageActionLink, IPageActionLinkSingle } from './PageAction';
3
+ export declare function PageActionLink<T extends object>(props: {
4
+ action: IPageActionLink | IPageActionLinkSingle<T>;
5
+ wrapper?: ComponentClass | FunctionComponent;
6
+ iconOnly?: boolean;
7
+ selectedItem?: T;
8
+ selectedItems?: T[];
9
+ }): JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { ComponentClass, FunctionComponent } from 'react';
2
+ import { IPageActionSwitch, IPageActionSwitchSingle } from './PageAction';
3
+ export declare function PageActionSwitch<T extends object>(props: {
4
+ action: IPageActionSwitch | IPageActionSwitchSingle<T>;
5
+ wrapper?: ComponentClass | FunctionComponent;
6
+ selectedItem?: T;
7
+ iconOnly?: boolean;
8
+ }): JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { IPageAction } from './PageAction';
2
+ export declare function isPageActionHidden<T extends object>(action: IPageAction<T>, selectedItem: T | undefined): boolean;
3
+ export declare function usePageActionDisabled<T extends object>(): (action: IPageAction<T>, selectedItem: T | undefined, selectedItems?: T[] | undefined) => string | undefined;
@@ -2,7 +2,7 @@ import { DropdownPosition } from '@patternfly/react-core';
2
2
  import { ComponentClass, FunctionComponent } from 'react';
3
3
  import { WindowSize } from '../components/useBreakPoint';
4
4
  import { IPageAction } from './PageAction';
5
- export declare function PageActions<T extends object>(props: {
5
+ interface PageActionProps<T extends object> {
6
6
  actions: IPageAction<T>[];
7
7
  selectedItem?: T;
8
8
  selectedItems?: T[];
@@ -11,5 +11,6 @@ export declare function PageActions<T extends object>(props: {
11
11
  position?: DropdownPosition;
12
12
  iconOnly?: boolean;
13
13
  onOpen?: (open: boolean) => void;
14
- }): JSX.Element;
15
- export declare function isHiddenAction<T extends object>(action: IPageAction<T>, selectedItem: T | undefined): boolean;
14
+ }
15
+ export declare function PageActions<T extends object>(props: PageActionProps<T>): JSX.Element;
16
+ export {};
@@ -1,18 +1,21 @@
1
1
  import { ComponentClass, FunctionComponent } from 'react';
2
2
  import { IPageAction } from './PageAction';
3
- export declare function PagePinnedActions<T extends object>(props: {
3
+ interface PageActionsPinnedProps<T extends object> {
4
4
  actions: IPageAction<T>[];
5
5
  selectedItem?: T;
6
6
  selectedItems?: T[];
7
7
  wrapper?: ComponentClass | FunctionComponent;
8
8
  iconOnly?: boolean;
9
9
  onOpen?: (label: string, open: boolean) => void;
10
- }): JSX.Element;
11
- export declare function PagePinnedAction<T extends object>(props: {
10
+ }
11
+ export declare function PageActionsPinned<T extends object>(props: PageActionsPinnedProps<T>): JSX.Element;
12
+ interface PageActionPinnedProps<T extends object> {
12
13
  action: IPageAction<T>;
13
14
  selectedItem?: T;
14
15
  selectedItems?: T[];
15
16
  wrapper?: ComponentClass | FunctionComponent;
16
17
  iconOnly?: boolean;
17
18
  onOpen?: (label: string, open: boolean) => void;
18
- }): JSX.Element;
19
+ }
20
+ export declare function PageActionPinned<T extends object>(props: PageActionPinnedProps<T>): JSX.Element;
21
+ export {};
@@ -11,3 +11,4 @@ export declare function usePageAlertToaster(): IPageAlertToaster;
11
11
  export declare function PageAlertToasterProvider(props: {
12
12
  children: ReactNode;
13
13
  }): JSX.Element;
14
+ export declare function errorToAlertProps(err: unknown): AlertProps;
@@ -10,6 +10,6 @@ declare class ErrorBoundary extends Component<Props, State> {
10
10
  state: State;
11
11
  static getDerivedStateFromError(_: Error): State;
12
12
  componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
13
- render(): string | number | boolean | JSX.Element | import("react").ReactFragment | null | undefined;
13
+ render(): string | number | boolean | import("react").ReactFragment | JSX.Element | null | undefined;
14
14
  }
15
15
  export default ErrorBoundary;
@@ -1,5 +1,4 @@
1
1
  export * from './PageActions/PageAction';
2
- export * from './PageActions/PageActionType';
3
2
  export * from './PageActions/PageActions';
4
3
  export * from './PageAlertToaster';
5
4
  export * from './PageBody';
@@ -1,32 +1,34 @@
1
1
  import { Dispatch, ReactNode, SetStateAction } from 'react';
2
2
  export interface IFrameworkTranslations {
3
+ by: string;
3
4
  cancelText: string;
4
5
  canceledText: string;
6
+ clearAllFilters: string;
7
+ clickToRefresh: string;
5
8
  closeText: string;
6
9
  confirmText: string;
10
+ countMore: string;
11
+ documentation: string;
7
12
  errorText: string;
13
+ manageColumns: string;
14
+ moreInformation: string;
8
15
  noItemsFound: string;
16
+ noResultsFound: string;
17
+ noResultsMatchCriteria: string;
18
+ noSelection: string;
19
+ noSelections: string;
9
20
  ofText: string;
10
21
  pendingText: string;
22
+ pleaseFixValidationErrors: string;
11
23
  processingText: string;
24
+ selectNone: string;
12
25
  selectedText: string;
26
+ showLess: string;
13
27
  submitText: string;
14
28
  submittingText: string;
15
29
  successText: string;
16
- manageColumns: string;
17
- moreInformation: string;
18
- showLess: string;
19
- countMore: string;
20
- documentation: string;
21
- noResultsFound: string;
22
- noResultsMatchCriteria: string;
23
- clearAllFilters: string;
24
- by: string;
25
- selectNone: string;
26
- pleaseFixValidationErrors: string;
27
- validating: string;
28
- clickToRefresh: string;
29
30
  unknownError: string;
31
+ validating: string;
30
32
  }
31
33
  export declare function FrameworkTranslationsProvider(props: {
32
34
  children: ReactNode;