UNPKG

7.99 kBTypeScriptView Raw
1import * as React from 'react';
2import { PickOptional } from '../../helpers';
3import { DualListSelectorTreeItemData } from './DualListSelectorTree';
4export interface DualListSelectorProps {
5 /** Additional classes applied to the dual list selector. */
6 className?: string;
7 /** Id of the dual list selector. */
8 id?: string;
9 /** Flag indicating if the dual list selector uses trees instead of simple lists */
10 isTree?: boolean;
11 /** Flag indicating if the dual list selector is in a disabled state */
12 isDisabled?: boolean;
13 /** Content to be rendered in the dual list selector. Panes & controls will not be built dynamically when children are provided. */
14 children?: React.ReactNode;
15 /** Title applied to the dynamically built available options pane. */
16 availableOptionsTitle?: string;
17 /** Options to display in the dynamically built available options pane. When using trees, the options should be in the DualListSelectorTreeItemData[] format. */
18 availableOptions?: React.ReactNode[] | DualListSelectorTreeItemData[];
19 /** Status message to display above the dynamically built available options pane. */
20 availableOptionsStatus?: string;
21 /** Actions to be displayed above the dynamically built available options pane. */
22 availableOptionsActions?: React.ReactNode[];
23 /** Title applied to the dynamically built chosen options pane. */
24 chosenOptionsTitle?: string;
25 /** Options to display in the dynamically built chosen options pane. When using trees, the options should be in the DualListSelectorTreeItemData[] format. */
26 chosenOptions?: React.ReactNode[] | DualListSelectorTreeItemData[];
27 /** Status message to display above the dynamically built chosen options pane.*/
28 chosenOptionsStatus?: string;
29 /** Actions to be displayed above the dynamically built chosen options pane. */
30 chosenOptionsActions?: React.ReactNode[];
31 /** Accessible label for the dynamically built controls between the two panes. */
32 controlsAriaLabel?: string;
33 /** Optional callback for the dynamically built add selected button */
34 addSelected?: (newAvailableOptions: React.ReactNode[], newChosenOptions: React.ReactNode[]) => void;
35 /** Accessible label for the dynamically built add selected button */
36 addSelectedAriaLabel?: string;
37 /** Tooltip content for the dynamically built add selected button */
38 addSelectedTooltip?: React.ReactNode;
39 /** Additonal tooltip properties for the dynamically built add selected tooltip */
40 addSelectedTooltipProps?: any;
41 /** Callback fired every time dynamically built options are chosen or removed */
42 onListChange?: (newAvailableOptions: React.ReactNode[], newChosenOptions: React.ReactNode[]) => void;
43 /** Optional callback for the dynamically built add all button */
44 addAll?: (newAvailableOptions: React.ReactNode[], newChosenOptions: React.ReactNode[]) => void;
45 /** Accessible label for the dynamically built add all button */
46 addAllAriaLabel?: string;
47 /** Tooltip content for the dynamically built add all button */
48 addAllTooltip?: React.ReactNode;
49 /** Additonal tooltip properties for the dynamically built add all tooltip */
50 addAllTooltipProps?: any;
51 /** Optional callback for the dynamically built remove selected button */
52 removeSelected?: (newAvailableOptions: React.ReactNode[], newChosenOptions: React.ReactNode[]) => void;
53 /** Accessible label for the dynamically built remove selected button */
54 removeSelectedAriaLabel?: string;
55 /** Tooltip content for the dynamically built remove selected button */
56 removeSelectedTooltip?: React.ReactNode;
57 /** Additonal tooltip properties for the dynamically built remove selected tooltip */
58 removeSelectedTooltipProps?: any;
59 /** Optional callback for the dynamically built remove all button */
60 removeAll?: (newAvailableOptions: React.ReactNode[], newChosenOptions: React.ReactNode[]) => void;
61 /** Accessible label for the dynamically built remove all button */
62 removeAllAriaLabel?: string;
63 /** Tooltip content for the dynamically built remove all button */
64 removeAllTooltip?: React.ReactNode;
65 /** Additonal tooltip properties for the dynamically built remove all tooltip */
66 removeAllTooltipProps?: any;
67 /** Optional callback fired when a dynamically built option is selected */
68 onOptionSelect?: (e: React.MouseEvent | React.ChangeEvent | React.KeyboardEvent, index: number, isChosen: boolean, id: string, itemData: any, parentData: any) => void;
69 /** Optional callback fired when a dynamically built option is checked */
70 onOptionCheck?: (e: React.MouseEvent | React.ChangeEvent<HTMLInputElement> | React.KeyboardEvent, checked: boolean, checkedId: string, newCheckedItems: string[]) => void;
71 /** Flag indicating a search bar should be included above both the dynamically built available and chosen panes. */
72 isSearchable?: boolean;
73 /** Accessible label for the search input on the dynamically built available options pane. */
74 availableOptionsSearchAriaLabel?: string;
75 /** A callback for when the search input value for the dynamically built available options changes. */
76 onAvailableOptionsSearchInputChanged?: (value: string, event: React.FormEvent<HTMLInputElement>) => void;
77 /** Accessible label for the search input on the dynamically built chosen options pane. */
78 chosenOptionsSearchAriaLabel?: string;
79 /** A callback for when the search input value for the dynamically built chosen options changes. */
80 onChosenOptionsSearchInputChanged?: (value: string, event: React.FormEvent<HTMLInputElement>) => void;
81 /** Optional filter function for custom filtering based on search string. Used with a dynamically built search input. */
82 filterOption?: (option: React.ReactNode, input: string) => boolean;
83}
84interface DualListSelectorState {
85 availableOptions: React.ReactNode[];
86 availableOptionsSelected: number[];
87 availableFilteredOptions: React.ReactNode[];
88 chosenOptions: React.ReactNode[];
89 chosenOptionsSelected: number[];
90 chosenFilteredOptions: React.ReactNode[];
91 availableTreeFilteredOptions: string[];
92 availableTreeOptionsChecked: string[];
93 chosenTreeOptionsChecked: string[];
94 chosenTreeFilteredOptions: string[];
95}
96export declare class DualListSelector extends React.Component<DualListSelectorProps, DualListSelectorState> {
97 static displayName: string;
98 private addAllButtonRef;
99 private addSelectedButtonRef;
100 private removeSelectedButtonRef;
101 private removeAllButtonRef;
102 static defaultProps: PickOptional<DualListSelectorProps>;
103 private createMergedCopy;
104 constructor(props: DualListSelectorProps);
105 componentDidUpdate(): void;
106 onFilterUpdate: (newFilteredOptions: React.ReactNode[], paneType: string, isSearchReset: boolean) => void;
107 addAllVisible: () => void;
108 addAllTreeVisible: () => void;
109 addSelected: () => void;
110 addTreeSelected: () => void;
111 removeAllVisible: () => void;
112 removeAllTreeVisible: () => void;
113 removeSelected: () => void;
114 removeTreeSelected: () => void;
115 onOptionSelect: (e: React.MouseEvent | React.ChangeEvent | React.KeyboardEvent, index: number, isChosen: boolean, id?: string, itemData?: any, parentData?: any) => void;
116 isChecked: (treeItem: DualListSelectorTreeItemData, isChosen: boolean) => boolean;
117 areAllDescendantsChecked: (treeItem: DualListSelectorTreeItemData, isChosen: boolean) => boolean;
118 areSomeDescendantsChecked: (treeItem: DualListSelectorTreeItemData, isChosen: boolean) => boolean;
119 mapChecked: (item: DualListSelectorTreeItemData, isChosen: boolean) => DualListSelectorTreeItemData;
120 onTreeOptionCheck: (evt: React.MouseEvent | React.ChangeEvent<HTMLInputElement> | React.KeyboardEvent, isChecked: boolean, itemData: DualListSelectorTreeItemData, isChosen: boolean) => void;
121 render(): JSX.Element;
122}
123export {};
124//# sourceMappingURL=DualListSelector.d.ts.map
\No newline at end of file