);
}
}
SearchListControl.propTypes = {
/**
* Additional CSS classes.
*/
className: PropTypes.string,
/**
* Whether the list of items is hierarchical or not. If true, each list item is expected to
* have a parent property.
*/
isHierarchical: PropTypes.bool,
/**
* Whether the list of items is still loading.
*/
isLoading: PropTypes.bool,
/**
* Restrict selections to one item.
*/
isSingle: PropTypes.bool,
/**
* A complete list of item objects, each with id, name properties. This is displayed as a
* clickable/keyboard-able list, and possibly filtered by the search term (searches name).
*/
list: PropTypes.arrayOf(
PropTypes.shape( {
id: PropTypes.number,
name: PropTypes.string,
} )
),
/**
* Messages displayed or read to the user. Configure these to reflect your object type.
* See `defaultMessages` above for examples.
*/
messages: PropTypes.shape( {
/**
* A more detailed label for the "Clear all" button, read to screen reader users.
*/
clear: PropTypes.string,
/**
* Label for the list of selectable items, only read to screen reader users.
*/
list: PropTypes.string,
/**
* Message to display when the list is empty (implies nothing loaded from the server
* or parent component).
*/
noItems: PropTypes.string,
/**
* Message to display when no matching results are found. %s is the search term.
*/
noResults: PropTypes.string,
/**
* Label for the search input
*/
search: PropTypes.string,
/**
* Label for the selected items. This is actually a function, so that we can pass
* through the count of currently selected items.
*/
selected: PropTypes.func,
/**
* Label indicating that search results have changed, read to screen reader users.
*/
updated: PropTypes.string,
} ),
/**
* Callback fired when selected items change, whether added, cleared, or removed.
* Passed an array of item objects (as passed in via props.list).
*/
onChange: PropTypes.func.isRequired,
/**
* Callback to render each item in the selection list, allows any custom object-type rendering.
*/
renderItem: PropTypes.func,
/**
* The list of currently selected items.
*/
selected: PropTypes.array.isRequired,
// from withState
search: PropTypes.string,
setState: PropTypes.func,
// from withSpokenMessages
debouncedSpeak: PropTypes.func,
// from withInstanceId
instanceId: PropTypes.number,
};
export default compose( [
withState( {
search: '',
} ),
withSpokenMessages,
withInstanceId,
] )( SearchListControl );