1 | import * as React from 'react';
|
2 | import { Autofill } from '../../Autofill';
|
3 | import type { IInputProps } from '../../Pickers';
|
4 | import type { IBaseFloatingPickerProps } from '../../FloatingPicker';
|
5 | import type { IBaseSelectedItemsListProps } from '../../SelectedItemsList';
|
6 | import type { IRefObject } from '../../Utilities';
|
7 | import type { IFocusZoneProps } from '../../FocusZone';
|
8 | export interface IBaseExtendedPicker<T> {
|
9 | /** Forces the picker to resolve */
|
10 | forceResolve?: () => void;
|
11 | /** Gets the current value of the input. */
|
12 | items: T[] | undefined;
|
13 | /** Sets focus to the input. */
|
14 | focus: () => void;
|
15 | }
|
16 | export interface IBaseExtendedPickerProps<T> {
|
17 | /**
|
18 | * Ref of the component
|
19 | */
|
20 | componentRef?: IRefObject<IBaseExtendedPicker<T>>;
|
21 | /**
|
22 | * Header/title element for the picker
|
23 | */
|
24 | headerComponent?: JSX.Element;
|
25 | /**
|
26 | * Initial items that have already been selected and should appear in the people picker.
|
27 | */
|
28 | defaultSelectedItems?: T[];
|
29 | /**
|
30 | * A callback for when the selected list of items changes.
|
31 | */
|
32 | onChange?: (items?: T[]) => void;
|
33 | /**
|
34 | * A callback for when text is pasted into the input
|
35 | */
|
36 | onPaste?: (pastedText: string) => T[];
|
37 | /**
|
38 | * A callback for when the user put focus on the picker
|
39 | */
|
40 | onFocus?: React.FocusEventHandler<HTMLInputElement | Autofill>;
|
41 | /**
|
42 | * A callback for when the user moves the focus away from the picker
|
43 | */
|
44 | onBlur?: React.FocusEventHandler<HTMLInputElement | Autofill>;
|
45 | /**
|
46 | * ClassName for the picker.
|
47 | */
|
48 | className?: string;
|
49 | /**
|
50 | * Function that specifies how the floating picker will appear.
|
51 | */
|
52 | onRenderFloatingPicker: React.ComponentType<IBaseFloatingPickerProps<T>>;
|
53 | /**
|
54 | * Function that specifies how the floating picker will appear.
|
55 | */
|
56 | onRenderSelectedItems: React.ComponentType<IBaseSelectedItemsListProps<T>>;
|
57 | /**
|
58 | * Floating picker properties
|
59 | */
|
60 | floatingPickerProps: IBaseFloatingPickerProps<T>;
|
61 | /**
|
62 | * Selected items list properties
|
63 | */
|
64 | selectedItemsListProps: IBaseSelectedItemsListProps<T>;
|
65 | /**
|
66 | * Autofill input native props
|
67 | * @defaultvalue undefined
|
68 | */
|
69 | inputProps?: IInputProps;
|
70 | /**
|
71 | * Flag for disabling the picker.
|
72 | * @defaultvalue false
|
73 | */
|
74 | disabled?: boolean;
|
75 | /**
|
76 | * Restrict the amount of selectable items.
|
77 | * @defaultvalue undefined
|
78 | */
|
79 | itemLimit?: number;
|
80 | /**
|
81 | * A callback to process a selection after the user selects a suggestion from the picker.
|
82 | * The returned item will be added to the selected items list
|
83 | */
|
84 | onItemSelected?: (selectedItem?: T) => T | PromiseLike<T>;
|
85 | /**
|
86 | * A callback on when an item was added to the selected item list
|
87 | */
|
88 | onItemAdded?: (addedItem: T) => void;
|
89 | /**
|
90 | * A callback on when an item or items were removed from the selected item list
|
91 | */
|
92 | onItemsRemoved?: (removedItems: T[]) => void;
|
93 | /**
|
94 | * If using as a controlled component use selectedItems here instead of the SelectedItemsList
|
95 | */
|
96 | selectedItems?: T[];
|
97 | /**
|
98 | * If using as a controlled component use suggestionItems here instead of FloatingPicker
|
99 | */
|
100 | suggestionItems?: T[];
|
101 | /**
|
102 | * Focus zone props
|
103 | */
|
104 | focusZoneProps?: IFocusZoneProps;
|
105 | /**
|
106 | * Current rendered query string that correlates to the rendered result
|
107 | **/
|
108 | currentRenderedQueryString?: string;
|
109 | }
|