-
Notifications
You must be signed in to change notification settings - Fork 15
/
ComboboxContainer.tsx
47 lines (42 loc) · 1.36 KB
/
ComboboxContainer.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* Copyright Zendesk, Inc.
*
* Use of this source code is governed under the Apache License, Version 2.0
* found at http://www.apache.org/licenses/LICENSE-2.0.
*/
import React from 'react';
import PropTypes from 'prop-types';
import { useCombobox } from './useCombobox';
import { IComboboxContainerProps } from './types';
export const ComboboxContainer: React.FC<IComboboxContainerProps> = props => {
const { children, render = children, ...options } = props;
return <>{render!(useCombobox(options))}</>;
};
ComboboxContainer.propTypes = {
children: PropTypes.func,
render: PropTypes.func,
idPrefix: PropTypes.string,
triggerRef: PropTypes.any.isRequired,
inputRef: PropTypes.any.isRequired,
listboxRef: PropTypes.any.isRequired,
isAutocomplete: PropTypes.bool,
isMultiselectable: PropTypes.bool,
isEditable: PropTypes.bool,
disabled: PropTypes.bool,
hasHint: PropTypes.bool,
hasMessage: PropTypes.bool,
options: PropTypes.arrayOf(PropTypes.any).isRequired,
inputValue: PropTypes.string,
selectionValue: PropTypes.any,
isExpanded: PropTypes.bool,
defaultExpanded: PropTypes.bool,
initialExpanded: PropTypes.bool,
activeIndex: PropTypes.number,
defaultActiveIndex: PropTypes.number,
initialActiveIndex: PropTypes.number,
onChange: PropTypes.func,
environment: PropTypes.any
};
ComboboxContainer.defaultProps = {
isEditable: true
};