rsuite 5.50.0 → 5.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/CheckTreePicker/styles/index.less +3 -3
- package/DatePicker/styles/index.less +1 -1
- package/Form/styles/mixin.less +1 -2
- package/InputGroup/styles/index.less +0 -14
- package/InputPicker/styles/index.less +1 -1
- package/Picker/styles/index.less +2 -2
- package/Picker/styles/mixin.less +3 -3
- package/TagInput/styles/index.less +1 -1
- package/TagPicker/styles/index.less +5 -1
- package/TreePicker/styles/index.less +2 -2
- package/cjs/@types/common.d.ts +8 -0
- package/cjs/AutoComplete/AutoComplete.js +14 -11
- package/cjs/AutoComplete/Combobox.d.ts +8 -0
- package/cjs/AutoComplete/Combobox.js +31 -0
- package/cjs/Calendar/CalendarContainer.js +35 -37
- package/cjs/Cascader/Cascader.js +12 -11
- package/cjs/Cascader/DropdownMenu.d.ts +3 -20
- package/cjs/Cascader/DropdownMenu.js +48 -48
- package/cjs/Cascader/TreeView.d.ts +24 -0
- package/cjs/Cascader/TreeView.js +174 -0
- package/cjs/CheckPicker/CheckPicker.js +9 -8
- package/cjs/CheckTreePicker/CheckTreeNode.d.ts +2 -2
- package/cjs/CheckTreePicker/CheckTreeNode.js +31 -59
- package/cjs/CheckTreePicker/CheckTreePicker.js +20 -20
- package/cjs/DatePicker/DatePicker.js +5 -6
- package/cjs/DateRangePicker/DateRangePicker.js +3 -4
- package/cjs/Form/Form.d.ts +14 -0
- package/cjs/Form/Form.js +39 -30
- package/cjs/Form/FormContext.d.ts +1 -0
- package/cjs/FormControl/FormControl.js +40 -18
- package/cjs/FormGroup/FormGroup.js +2 -1
- package/cjs/InputPicker/InputPicker.js +46 -29
- package/cjs/InputPicker/InputSearch.js +3 -15
- package/cjs/InputPicker/TagList.d.ts +3 -0
- package/cjs/InputPicker/TagList.js +29 -0
- package/cjs/InputPicker/TextBox.d.ts +18 -0
- package/cjs/InputPicker/TextBox.js +48 -0
- package/cjs/MultiCascader/MultiCascader.js +13 -10
- package/cjs/MultiCascader/{DropdownMenu.d.ts → TreeView.d.ts} +3 -3
- package/cjs/MultiCascader/{DropdownMenu.js → TreeView.js} +77 -74
- package/{esm/Picker/DropdownMenuCheckItem.d.ts → cjs/Picker/ListCheckItem.d.ts} +3 -3
- package/cjs/Picker/{DropdownMenuCheckItem.js → ListCheckItem.js} +14 -30
- package/{esm/Picker/DropdownMenuItem.d.ts → cjs/Picker/ListItem.d.ts} +4 -4
- package/cjs/Picker/{DropdownMenuItem.js → ListItem.js} +15 -24
- package/cjs/Picker/ListItemGroup.d.ts +6 -0
- package/cjs/Picker/{DropdownMenuGroup.js → ListItemGroup.js} +3 -9
- package/cjs/Picker/Listbox.d.ts +35 -0
- package/cjs/Picker/{DropdownMenu.js → Listbox.js} +49 -64
- package/cjs/Picker/{PickerOverlay.d.ts → PickerPopup.d.ts} +3 -3
- package/cjs/Picker/{PickerOverlay.js → PickerPopup.js} +9 -7
- package/cjs/Picker/PickerToggle.d.ts +1 -1
- package/cjs/Picker/PickerToggle.js +16 -9
- package/cjs/Picker/PickerToggleTrigger.d.ts +15 -0
- package/cjs/Picker/PickerToggleTrigger.js +21 -5
- package/cjs/Picker/SearchBar.js +7 -9
- package/cjs/Picker/TreeView.d.ts +7 -0
- package/cjs/Picker/TreeView.js +31 -0
- package/cjs/Picker/hooks/index.d.ts +6 -0
- package/cjs/Picker/hooks/index.js +18 -0
- package/cjs/Picker/hooks/useCombobox.d.ts +7 -0
- package/cjs/Picker/hooks/useCombobox.js +22 -0
- package/cjs/Picker/hooks/useFocusItemValue.d.ts +30 -0
- package/cjs/Picker/hooks/useFocusItemValue.js +246 -0
- package/cjs/Picker/hooks/usePickerClassName.d.ts +21 -0
- package/cjs/Picker/hooks/usePickerClassName.js +39 -0
- package/cjs/Picker/{usePickerRef.d.ts → hooks/usePickerRef.d.ts} +2 -2
- package/cjs/Picker/{usePickerRef.js → hooks/usePickerRef.js} +1 -1
- package/cjs/Picker/hooks/useSearch.d.ts +18 -0
- package/cjs/Picker/hooks/useSearch.js +57 -0
- package/cjs/Picker/hooks/useToggleKeyDownEvent.d.ts +25 -0
- package/cjs/Picker/hooks/useToggleKeyDownEvent.js +101 -0
- package/cjs/Picker/index.d.ts +7 -6
- package/cjs/Picker/index.js +26 -19
- package/cjs/Picker/propTypes.d.ts +0 -6
- package/cjs/Picker/propTypes.js +0 -5
- package/cjs/Picker/utils.d.ts +2 -96
- package/cjs/Picker/utils.js +1 -406
- package/cjs/SelectPicker/SelectPicker.js +8 -8
- package/cjs/TagInput/index.js +4 -0
- package/cjs/TreePicker/TreeNode.d.ts +2 -2
- package/cjs/TreePicker/TreeNode.js +22 -56
- package/cjs/TreePicker/TreePicker.js +19 -20
- package/dist/rsuite-no-reset-rtl.css +109 -117
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +109 -117
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +109 -117
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +109 -117
- package/dist/rsuite.js +184 -74
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/@types/common.d.ts +8 -0
- package/esm/AutoComplete/AutoComplete.js +15 -12
- package/esm/AutoComplete/Combobox.d.ts +8 -0
- package/esm/AutoComplete/Combobox.js +25 -0
- package/esm/Calendar/CalendarContainer.js +37 -39
- package/esm/Cascader/Cascader.js +13 -12
- package/esm/Cascader/DropdownMenu.d.ts +3 -20
- package/esm/Cascader/DropdownMenu.js +50 -49
- package/esm/Cascader/TreeView.d.ts +24 -0
- package/esm/Cascader/TreeView.js +167 -0
- package/esm/CheckPicker/CheckPicker.js +10 -9
- package/esm/CheckTreePicker/CheckTreeNode.d.ts +2 -2
- package/esm/CheckTreePicker/CheckTreeNode.js +33 -61
- package/esm/CheckTreePicker/CheckTreePicker.js +21 -21
- package/esm/DatePicker/DatePicker.js +5 -6
- package/esm/DateRangePicker/DateRangePicker.js +3 -4
- package/esm/Form/Form.d.ts +14 -0
- package/esm/Form/Form.js +41 -32
- package/esm/Form/FormContext.d.ts +1 -0
- package/esm/FormControl/FormControl.js +39 -17
- package/esm/FormGroup/FormGroup.js +3 -2
- package/esm/InputPicker/InputPicker.js +47 -30
- package/esm/InputPicker/InputSearch.js +4 -15
- package/esm/InputPicker/TagList.d.ts +3 -0
- package/esm/InputPicker/TagList.js +23 -0
- package/esm/InputPicker/TextBox.d.ts +18 -0
- package/esm/InputPicker/TextBox.js +42 -0
- package/esm/MultiCascader/MultiCascader.js +14 -11
- package/esm/MultiCascader/{DropdownMenu.d.ts → TreeView.d.ts} +3 -3
- package/esm/MultiCascader/{DropdownMenu.js → TreeView.js} +79 -75
- package/{cjs/Picker/DropdownMenuCheckItem.d.ts → esm/Picker/ListCheckItem.d.ts} +3 -3
- package/esm/Picker/{DropdownMenuCheckItem.js → ListCheckItem.js} +15 -30
- package/{cjs/Picker/DropdownMenuItem.d.ts → esm/Picker/ListItem.d.ts} +4 -4
- package/esm/Picker/{DropdownMenuItem.js → ListItem.js} +16 -24
- package/esm/Picker/ListItemGroup.d.ts +6 -0
- package/esm/Picker/{DropdownMenuGroup.js → ListItemGroup.js} +3 -9
- package/esm/Picker/Listbox.d.ts +35 -0
- package/esm/Picker/{DropdownMenu.js → Listbox.js} +50 -64
- package/esm/Picker/{PickerOverlay.d.ts → PickerPopup.d.ts} +3 -3
- package/esm/Picker/{PickerOverlay.js → PickerPopup.js} +10 -8
- package/esm/Picker/PickerToggle.d.ts +1 -1
- package/esm/Picker/PickerToggle.js +16 -9
- package/esm/Picker/PickerToggleTrigger.d.ts +15 -0
- package/esm/Picker/PickerToggleTrigger.js +20 -5
- package/esm/Picker/SearchBar.js +8 -9
- package/esm/Picker/TreeView.d.ts +7 -0
- package/esm/Picker/TreeView.js +25 -0
- package/esm/Picker/hooks/index.d.ts +6 -0
- package/esm/Picker/hooks/index.js +7 -0
- package/esm/Picker/hooks/useCombobox.d.ts +7 -0
- package/esm/Picker/hooks/useCombobox.js +17 -0
- package/esm/Picker/hooks/useFocusItemValue.d.ts +30 -0
- package/esm/Picker/hooks/useFocusItemValue.js +240 -0
- package/esm/Picker/hooks/usePickerClassName.d.ts +21 -0
- package/esm/Picker/hooks/usePickerClassName.js +33 -0
- package/esm/Picker/{usePickerRef.d.ts → hooks/usePickerRef.d.ts} +2 -2
- package/esm/Picker/{usePickerRef.js → hooks/usePickerRef.js} +1 -1
- package/esm/Picker/hooks/useSearch.d.ts +18 -0
- package/esm/Picker/hooks/useSearch.js +51 -0
- package/esm/Picker/hooks/useToggleKeyDownEvent.d.ts +25 -0
- package/esm/Picker/hooks/useToggleKeyDownEvent.js +96 -0
- package/esm/Picker/index.d.ts +7 -6
- package/esm/Picker/index.js +7 -6
- package/esm/Picker/propTypes.d.ts +0 -6
- package/esm/Picker/propTypes.js +0 -5
- package/esm/Picker/utils.d.ts +2 -96
- package/esm/Picker/utils.js +2 -401
- package/esm/SelectPicker/SelectPicker.js +9 -9
- package/esm/TagInput/index.js +4 -0
- package/esm/TreePicker/TreeNode.d.ts +2 -2
- package/esm/TreePicker/TreeNode.js +24 -58
- package/esm/TreePicker/TreePicker.js +20 -21
- package/package.json +1 -1
- package/styles/variables.less +1 -3
- package/cjs/Picker/DropdownMenu.d.ts +0 -59
- package/cjs/Picker/DropdownMenuGroup.d.ts +0 -6
- package/esm/Picker/DropdownMenu.d.ts +0 -59
- package/esm/Picker/DropdownMenuGroup.d.ts +0 -6
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import isFunction from 'lodash/isFunction';
|
|
4
|
+
import isUndefined from 'lodash/isUndefined';
|
|
5
|
+
import find from 'lodash/find';
|
|
6
|
+
import { getHeight } from 'dom-lib';
|
|
7
|
+
import { useEventCallback, shallowEqual } from '../../utils';
|
|
8
|
+
import { findNodeOfTree } from '../../utils/treeUtils';
|
|
9
|
+
import { onMenuKeyDown } from '../utils';
|
|
10
|
+
/**
|
|
11
|
+
* A hook that manages the focus state of the option.
|
|
12
|
+
* @param defaultFocusItemValue
|
|
13
|
+
* @param props
|
|
14
|
+
*/
|
|
15
|
+
var useFocusItemValue = function useFocusItemValue(defaultFocusItemValue, props) {
|
|
16
|
+
var _props$valueKey = props.valueKey,
|
|
17
|
+
valueKey = _props$valueKey === void 0 ? 'value' : _props$valueKey,
|
|
18
|
+
_props$focusableQuery = props.focusableQueryKey,
|
|
19
|
+
focusableQueryKey = _props$focusableQuery === void 0 ? '[data-key][aria-disabled="false"]' : _props$focusableQuery,
|
|
20
|
+
_props$defaultLayer = props.defaultLayer,
|
|
21
|
+
defaultLayer = _props$defaultLayer === void 0 ? 0 : _props$defaultLayer,
|
|
22
|
+
_props$focusToOption = props.focusToOption,
|
|
23
|
+
focusToOption = _props$focusToOption === void 0 ? true : _props$focusToOption,
|
|
24
|
+
data = props.data,
|
|
25
|
+
target = props.target,
|
|
26
|
+
rtl = props.rtl,
|
|
27
|
+
callback = props.callback,
|
|
28
|
+
_props$getParent = props.getParent,
|
|
29
|
+
getParent = _props$getParent === void 0 ? function (item) {
|
|
30
|
+
return item === null || item === void 0 ? void 0 : item.parent;
|
|
31
|
+
} : _props$getParent;
|
|
32
|
+
var _useState = useState(defaultFocusItemValue),
|
|
33
|
+
focusItemValue = _useState[0],
|
|
34
|
+
setFocusItemValue = _useState[1];
|
|
35
|
+
var _useState2 = useState(defaultLayer),
|
|
36
|
+
layer = _useState2[0],
|
|
37
|
+
setLayer = _useState2[1];
|
|
38
|
+
var _useState3 = useState([]),
|
|
39
|
+
keys = _useState3[0],
|
|
40
|
+
setKeys = _useState3[1];
|
|
41
|
+
var focusCallback = useEventCallback(function (value, event) {
|
|
42
|
+
if (focusToOption) {
|
|
43
|
+
var menu = isFunction(target) ? target() : target;
|
|
44
|
+
var focusElement = menu === null || menu === void 0 ? void 0 : menu.querySelector("[data-key=\"" + value + "\"]");
|
|
45
|
+
focusElement === null || focusElement === void 0 ? void 0 : focusElement.focus();
|
|
46
|
+
}
|
|
47
|
+
callback === null || callback === void 0 ? void 0 : callback(value, event);
|
|
48
|
+
});
|
|
49
|
+
var getScrollContainer = useEventCallback(function () {
|
|
50
|
+
var menu = isFunction(target) ? target() : target;
|
|
51
|
+
|
|
52
|
+
// For Cascader and MutiCascader
|
|
53
|
+
var subMenu = menu === null || menu === void 0 ? void 0 : menu.querySelector("[data-layer=\"" + layer + "\"]");
|
|
54
|
+
if (subMenu) {
|
|
55
|
+
return subMenu;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// For SelectPicker、CheckPicker、Autocomplete、InputPicker、TagPicker
|
|
59
|
+
return menu === null || menu === void 0 ? void 0 : menu.querySelector('[role="listbox"]');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Get the elements visible in all options.
|
|
64
|
+
*/
|
|
65
|
+
var getFocusableMenuItems = function getFocusableMenuItems() {
|
|
66
|
+
if (!target) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
var currentKeys = keys;
|
|
70
|
+
if (layer < 1) {
|
|
71
|
+
var popup = isFunction(target) ? target() : target;
|
|
72
|
+
var rootMenu = popup === null || popup === void 0 ? void 0 : popup.querySelector('[data-layer="0"]');
|
|
73
|
+
if (rootMenu) {
|
|
74
|
+
var _rootMenu$querySelect;
|
|
75
|
+
currentKeys = Array.from((_rootMenu$querySelect = rootMenu.querySelectorAll(focusableQueryKey)) !== null && _rootMenu$querySelect !== void 0 ? _rootMenu$querySelect : []).map(function (item) {
|
|
76
|
+
var _item$dataset;
|
|
77
|
+
return (_item$dataset = item.dataset) === null || _item$dataset === void 0 ? void 0 : _item$dataset.key;
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
var _popup$querySelectorA;
|
|
81
|
+
currentKeys = Array.from((_popup$querySelectorA = popup === null || popup === void 0 ? void 0 : popup.querySelectorAll(focusableQueryKey)) !== null && _popup$querySelectorA !== void 0 ? _popup$querySelectorA : []).map(function (item) {
|
|
82
|
+
var _item$dataset2;
|
|
83
|
+
return (_item$dataset2 = item.dataset) === null || _item$dataset2 === void 0 ? void 0 : _item$dataset2.key;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 1. It is necessary to traverse the `keys` instead of `data` here to preserve the order of the array.
|
|
89
|
+
// 2. The values in `keys` are all string, so the corresponding value of `data` should also be converted to string
|
|
90
|
+
return currentKeys.map(function (key) {
|
|
91
|
+
return find(data, function (i) {
|
|
92
|
+
return "" + i[valueKey] === key;
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get the index of the focus item.
|
|
99
|
+
*/
|
|
100
|
+
var findFocusItemIndex = useEventCallback(function (callback) {
|
|
101
|
+
var items = getFocusableMenuItems();
|
|
102
|
+
for (var i = 0; i < items.length; i += 1) {
|
|
103
|
+
var _items$i;
|
|
104
|
+
if (shallowEqual(focusItemValue, (_items$i = items[i]) === null || _items$i === void 0 ? void 0 : _items$i[valueKey])) {
|
|
105
|
+
callback(items, i);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
callback(items, -1);
|
|
110
|
+
});
|
|
111
|
+
var scrollListItem = useEventCallback(function (direction, itemValue, willOverflow) {
|
|
112
|
+
var container = getScrollContainer();
|
|
113
|
+
var item = container === null || container === void 0 ? void 0 : container.querySelector("[data-key=\"" + itemValue + "\"]");
|
|
114
|
+
if (willOverflow && container) {
|
|
115
|
+
var scrollHeight = container.scrollHeight,
|
|
116
|
+
clientHeight = container.clientHeight;
|
|
117
|
+
container.scrollTop = direction === 'top' ? scrollHeight - clientHeight : 0;
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (item && container) {
|
|
121
|
+
if (!isVisible(item, container, direction)) {
|
|
122
|
+
var height = getHeight(item);
|
|
123
|
+
scrollTo(container, direction, height);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
var focusNextMenuItem = useEventCallback(function (event) {
|
|
128
|
+
findFocusItemIndex(function (items, index) {
|
|
129
|
+
var willOverflow = index + 2 > items.length;
|
|
130
|
+
var nextIndex = willOverflow ? 0 : index + 1;
|
|
131
|
+
var focusItem = items[nextIndex];
|
|
132
|
+
if (!isUndefined(focusItem)) {
|
|
133
|
+
setFocusItemValue(focusItem[valueKey]);
|
|
134
|
+
focusCallback(focusItem[valueKey], event);
|
|
135
|
+
scrollListItem('bottom', focusItem[valueKey], willOverflow);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
var focusPrevMenuItem = useEventCallback(function (event) {
|
|
140
|
+
findFocusItemIndex(function (items, index) {
|
|
141
|
+
var willOverflow = index === 0;
|
|
142
|
+
var nextIndex = willOverflow ? items.length - 1 : index - 1;
|
|
143
|
+
var focusItem = items[nextIndex];
|
|
144
|
+
if (!isUndefined(focusItem)) {
|
|
145
|
+
setFocusItemValue(focusItem[valueKey]);
|
|
146
|
+
focusCallback(focusItem[valueKey], event);
|
|
147
|
+
scrollListItem('top', focusItem[valueKey], willOverflow);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
var getSubMenuKeys = function getSubMenuKeys(nextLayer) {
|
|
152
|
+
var menu = isFunction(target) ? target() : target;
|
|
153
|
+
var subMenu = menu === null || menu === void 0 ? void 0 : menu.querySelector("[data-layer=\"" + nextLayer + "\"]");
|
|
154
|
+
if (subMenu) {
|
|
155
|
+
var _Array$from;
|
|
156
|
+
return (_Array$from = Array.from(subMenu.querySelectorAll(focusableQueryKey))) === null || _Array$from === void 0 ? void 0 : _Array$from.map(function (item) {
|
|
157
|
+
var _item$dataset3;
|
|
158
|
+
return (_item$dataset3 = item.dataset) === null || _item$dataset3 === void 0 ? void 0 : _item$dataset3.key;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
};
|
|
163
|
+
var focusNextLevelMenu = useEventCallback(function (event) {
|
|
164
|
+
var nextLayer = layer + 1;
|
|
165
|
+
var nextKeys = getSubMenuKeys(nextLayer);
|
|
166
|
+
if (nextKeys) {
|
|
167
|
+
setKeys(nextKeys);
|
|
168
|
+
setLayer(nextLayer);
|
|
169
|
+
setFocusItemValue(nextKeys[0]);
|
|
170
|
+
focusCallback(nextKeys[0], event);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
var focusPrevLevelMenu = useEventCallback(function (event) {
|
|
174
|
+
var nextLayer = layer - 1;
|
|
175
|
+
var nextKeys = getSubMenuKeys(nextLayer);
|
|
176
|
+
if (nextKeys) {
|
|
177
|
+
var _getParent;
|
|
178
|
+
setKeys(nextKeys);
|
|
179
|
+
setLayer(nextLayer);
|
|
180
|
+
var focusItem = findNodeOfTree(data, function (item) {
|
|
181
|
+
return item[valueKey] === focusItemValue;
|
|
182
|
+
});
|
|
183
|
+
var parentItemValue = (_getParent = getParent(focusItem)) === null || _getParent === void 0 ? void 0 : _getParent[valueKey];
|
|
184
|
+
if (parentItemValue) {
|
|
185
|
+
setFocusItemValue(parentItemValue);
|
|
186
|
+
focusCallback(parentItemValue, event);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
var handleKeyDown = useEventCallback(function (event) {
|
|
191
|
+
var _onMenuKeyDown;
|
|
192
|
+
onMenuKeyDown(event, (_onMenuKeyDown = {
|
|
193
|
+
down: focusNextMenuItem,
|
|
194
|
+
up: focusPrevMenuItem
|
|
195
|
+
}, _onMenuKeyDown[rtl ? 'left' : 'right'] = focusNextLevelMenu, _onMenuKeyDown[rtl ? 'right' : 'left'] = focusPrevLevelMenu, _onMenuKeyDown));
|
|
196
|
+
});
|
|
197
|
+
return {
|
|
198
|
+
focusItemValue: focusItemValue,
|
|
199
|
+
setFocusItemValue: setFocusItemValue,
|
|
200
|
+
layer: layer,
|
|
201
|
+
setLayer: setLayer,
|
|
202
|
+
keys: keys,
|
|
203
|
+
setKeys: setKeys,
|
|
204
|
+
onKeyDown: handleKeyDown
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
function scrollTo(container, direction, step) {
|
|
208
|
+
var scrollTop = container.scrollTop;
|
|
209
|
+
container.scrollTop = direction === 'top' ? scrollTop - step : scrollTop + step;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Checks if the element has a vertical scrollbar.
|
|
214
|
+
*/
|
|
215
|
+
function hasVerticalScroll(element) {
|
|
216
|
+
var scrollHeight = element.scrollHeight,
|
|
217
|
+
clientHeight = element.clientHeight;
|
|
218
|
+
return scrollHeight > clientHeight;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Checks if the element is within the visible area of the container
|
|
223
|
+
*/
|
|
224
|
+
function isVisible(element, container, direction) {
|
|
225
|
+
if (!hasVerticalScroll(container)) {
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
229
|
+
top = _element$getBoundingC.top,
|
|
230
|
+
bottom = _element$getBoundingC.bottom,
|
|
231
|
+
height = _element$getBoundingC.height;
|
|
232
|
+
var _container$getBoundin = container.getBoundingClientRect(),
|
|
233
|
+
containerTop = _container$getBoundin.top,
|
|
234
|
+
containerBottom = _container$getBoundin.bottom;
|
|
235
|
+
if (direction === 'top') {
|
|
236
|
+
return top + height > containerTop;
|
|
237
|
+
}
|
|
238
|
+
return bottom - height < containerBottom;
|
|
239
|
+
}
|
|
240
|
+
export default useFocusItemValue;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TypeAttributes } from '../../@types/common';
|
|
2
|
+
export interface PickerClassNameProps {
|
|
3
|
+
name?: string;
|
|
4
|
+
classPrefix: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
placement?: TypeAttributes.Placement;
|
|
7
|
+
appearance?: 'default' | 'subtle';
|
|
8
|
+
cleanable?: boolean;
|
|
9
|
+
block?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
countable?: boolean;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
plaintext?: boolean;
|
|
14
|
+
hasValue?: boolean;
|
|
15
|
+
classes?: any;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The className of the assembled Toggle is on the Picker.
|
|
19
|
+
*/
|
|
20
|
+
declare function usePickerClassName(props: PickerClassNameProps): [string, string[]];
|
|
21
|
+
export default usePickerClassName;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
import kebabCase from 'lodash/kebabCase';
|
|
4
|
+
import omit from 'lodash/omit';
|
|
5
|
+
import { useClassNames, placementPolyfill } from '../../utils';
|
|
6
|
+
/**
|
|
7
|
+
* The className of the assembled Toggle is on the Picker.
|
|
8
|
+
*/
|
|
9
|
+
function usePickerClassName(props) {
|
|
10
|
+
var _withClassPrefix;
|
|
11
|
+
var name = props.name,
|
|
12
|
+
classPrefix = props.classPrefix,
|
|
13
|
+
className = props.className,
|
|
14
|
+
placement = props.placement,
|
|
15
|
+
appearance = props.appearance,
|
|
16
|
+
cleanable = props.cleanable,
|
|
17
|
+
block = props.block,
|
|
18
|
+
disabled = props.disabled,
|
|
19
|
+
countable = props.countable,
|
|
20
|
+
readOnly = props.readOnly,
|
|
21
|
+
plaintext = props.plaintext,
|
|
22
|
+
hasValue = props.hasValue,
|
|
23
|
+
rest = _objectWithoutPropertiesLoose(props, ["name", "classPrefix", "className", "placement", "appearance", "cleanable", "block", "disabled", "countable", "readOnly", "plaintext", "hasValue"]);
|
|
24
|
+
var _useClassNames = useClassNames(classPrefix),
|
|
25
|
+
withClassPrefix = _useClassNames.withClassPrefix,
|
|
26
|
+
merge = _useClassNames.merge;
|
|
27
|
+
var classes = merge(className, withClassPrefix(name, appearance, 'toggle-wrapper', (_withClassPrefix = {}, _withClassPrefix["placement-" + kebabCase(placementPolyfill(placement))] = placement, _withClassPrefix['read-only'] = readOnly, _withClassPrefix['has-value'] = hasValue, _withClassPrefix.cleanable = cleanable, _withClassPrefix.block = block, _withClassPrefix.disabled = disabled, _withClassPrefix.countable = countable, _withClassPrefix.plaintext = plaintext, _withClassPrefix)));
|
|
28
|
+
|
|
29
|
+
// Those props that're used for composing the className
|
|
30
|
+
var usedClassNamePropKeys = Object.keys(omit(props, [].concat(Object.keys(rest || {}), ['disabled', 'readOnly', 'plaintext', 'name'])));
|
|
31
|
+
return [classes, usedClassNamePropKeys];
|
|
32
|
+
}
|
|
33
|
+
export default usePickerClassName;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { OverlayTriggerHandle } from '
|
|
3
|
-
import type { ListHandle } from '
|
|
2
|
+
import type { OverlayTriggerHandle } from '../PickerToggleTrigger';
|
|
3
|
+
import type { ListHandle } from '../../Windowing';
|
|
4
4
|
export interface PickerDependentParameters {
|
|
5
5
|
inline?: boolean;
|
|
6
6
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface SearchOptions<T> {
|
|
3
|
+
labelKey: string;
|
|
4
|
+
searchBy?: (keyword: string, label: any, item: T) => boolean;
|
|
5
|
+
callback?: (keyword: string, data: T[], event: React.SyntheticEvent) => void;
|
|
6
|
+
}
|
|
7
|
+
declare type UseSearchResult<T> = {
|
|
8
|
+
searchKeyword: string;
|
|
9
|
+
filteredData: T[];
|
|
10
|
+
checkShouldDisplay: (item: T, keyword?: string) => boolean;
|
|
11
|
+
handleSearch: (searchKeyword: string, event: React.SyntheticEvent) => void;
|
|
12
|
+
resetSearch: () => void;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A hook that handles search filter options
|
|
16
|
+
*/
|
|
17
|
+
declare function useSearch<T>(data: readonly T[], props: SearchOptions<T>): UseSearchResult<T>;
|
|
18
|
+
export default useSearch;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
3
|
+
import isUndefined from 'lodash/isUndefined';
|
|
4
|
+
import { shouldDisplay } from '../utils';
|
|
5
|
+
/**
|
|
6
|
+
* A hook that handles search filter options
|
|
7
|
+
*/
|
|
8
|
+
function useSearch(data, props) {
|
|
9
|
+
var labelKey = props.labelKey,
|
|
10
|
+
searchBy = props.searchBy,
|
|
11
|
+
callback = props.callback; // Use search keywords to filter options.
|
|
12
|
+
var _useState = useState(''),
|
|
13
|
+
searchKeyword = _useState[0],
|
|
14
|
+
setSearchKeyword = _useState[1];
|
|
15
|
+
var resetSearch = useCallback(function () {
|
|
16
|
+
setSearchKeyword('');
|
|
17
|
+
}, []);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Index of keyword in `label`
|
|
21
|
+
* @param {node} label
|
|
22
|
+
*/
|
|
23
|
+
var checkShouldDisplay = useCallback(function (item, keyword) {
|
|
24
|
+
var checkValue = typeof item === 'object' ? item === null || item === void 0 ? void 0 : item[labelKey] : String(item);
|
|
25
|
+
var _keyword = isUndefined(keyword) ? searchKeyword : keyword;
|
|
26
|
+
if (typeof searchBy === 'function') {
|
|
27
|
+
return searchBy(_keyword, checkValue, item);
|
|
28
|
+
}
|
|
29
|
+
return shouldDisplay(checkValue, _keyword);
|
|
30
|
+
}, [labelKey, searchBy, searchKeyword]);
|
|
31
|
+
var filteredData = useMemo(function () {
|
|
32
|
+
return data.filter(function (item) {
|
|
33
|
+
return checkShouldDisplay(item, searchKeyword);
|
|
34
|
+
});
|
|
35
|
+
}, [checkShouldDisplay, data, searchKeyword]);
|
|
36
|
+
var handleSearch = function handleSearch(searchKeyword, event) {
|
|
37
|
+
var filteredData = data.filter(function (item) {
|
|
38
|
+
return checkShouldDisplay(item, searchKeyword);
|
|
39
|
+
});
|
|
40
|
+
setSearchKeyword(searchKeyword);
|
|
41
|
+
callback === null || callback === void 0 ? void 0 : callback(searchKeyword, filteredData, event);
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
searchKeyword: searchKeyword,
|
|
45
|
+
filteredData: filteredData,
|
|
46
|
+
checkShouldDisplay: checkShouldDisplay,
|
|
47
|
+
handleSearch: handleSearch,
|
|
48
|
+
resetSearch: resetSearch
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export default useSearch;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface ToggleKeyDownEventProps {
|
|
3
|
+
toggle?: boolean;
|
|
4
|
+
trigger: React.RefObject<any>;
|
|
5
|
+
target: React.RefObject<any>;
|
|
6
|
+
overlay?: React.RefObject<any>;
|
|
7
|
+
searchInput?: React.RefObject<any>;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
onExit?: (event: any) => void;
|
|
13
|
+
onKeyDown?: (event: any) => void;
|
|
14
|
+
onOpen?: () => void;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
onMenuKeyDown?: (event: any) => void;
|
|
17
|
+
onMenuPressEnter?: (event: any) => void;
|
|
18
|
+
onMenuPressBackspace?: (event: any) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A hook to control the toggle keyboard operation
|
|
22
|
+
* @param props
|
|
23
|
+
*/
|
|
24
|
+
declare const useToggleKeyDownEvent: (props: ToggleKeyDownEventProps) => (...args: any[]) => any;
|
|
25
|
+
export default useToggleKeyDownEvent;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEventCallback, KEY_VALUES } from '../../utils';
|
|
3
|
+
/**
|
|
4
|
+
* A hook to control the toggle keyboard operation
|
|
5
|
+
* @param props
|
|
6
|
+
*/
|
|
7
|
+
var useToggleKeyDownEvent = function useToggleKeyDownEvent(props) {
|
|
8
|
+
var _props$toggle = props.toggle,
|
|
9
|
+
toggle = _props$toggle === void 0 ? true : _props$toggle,
|
|
10
|
+
trigger = props.trigger,
|
|
11
|
+
target = props.target,
|
|
12
|
+
overlay = props.overlay,
|
|
13
|
+
searchInput = props.searchInput,
|
|
14
|
+
active = props.active,
|
|
15
|
+
readOnly = props.readOnly,
|
|
16
|
+
disabled = props.disabled,
|
|
17
|
+
loading = props.loading,
|
|
18
|
+
onExit = props.onExit,
|
|
19
|
+
onOpen = props.onOpen,
|
|
20
|
+
onClose = props.onClose,
|
|
21
|
+
onKeyDown = props.onKeyDown,
|
|
22
|
+
onMenuKeyDown = props.onMenuKeyDown,
|
|
23
|
+
onMenuPressEnter = props.onMenuPressEnter,
|
|
24
|
+
onMenuPressBackspace = props.onMenuPressBackspace;
|
|
25
|
+
var handleClose = useEventCallback(function () {
|
|
26
|
+
var _trigger$current, _trigger$current$clos, _trigger$current2, _trigger$current2$foc;
|
|
27
|
+
(_trigger$current = trigger.current) === null || _trigger$current === void 0 ? void 0 : (_trigger$current$clos = _trigger$current.close) === null || _trigger$current$clos === void 0 ? void 0 : _trigger$current$clos.call(_trigger$current);
|
|
28
|
+
|
|
29
|
+
// The focus is on the trigger button after closing
|
|
30
|
+
(_trigger$current2 = trigger.current) === null || _trigger$current2 === void 0 ? void 0 : (_trigger$current2$foc = _trigger$current2.focus) === null || _trigger$current2$foc === void 0 ? void 0 : _trigger$current2$foc.call(_trigger$current2);
|
|
31
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
32
|
+
});
|
|
33
|
+
var handleOpen = useEventCallback(function () {
|
|
34
|
+
var _trigger$current3, _trigger$current3$ope;
|
|
35
|
+
(_trigger$current3 = trigger.current) === null || _trigger$current3 === void 0 ? void 0 : (_trigger$current3$ope = _trigger$current3.open) === null || _trigger$current3$ope === void 0 ? void 0 : _trigger$current3$ope.call(_trigger$current3);
|
|
36
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
37
|
+
});
|
|
38
|
+
var handleToggleDropdown = useEventCallback(function () {
|
|
39
|
+
if (active) {
|
|
40
|
+
handleClose();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
handleOpen();
|
|
44
|
+
});
|
|
45
|
+
var onToggle = useEventCallback(function (event) {
|
|
46
|
+
// Keyboard events should not be processed when readOnly and disabled are set.
|
|
47
|
+
if (readOnly || disabled || loading) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (event.target === (target === null || target === void 0 ? void 0 : target.current)) {
|
|
51
|
+
// enter
|
|
52
|
+
if (toggle && event.key === KEY_VALUES.ENTER) {
|
|
53
|
+
handleToggleDropdown();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// delete
|
|
57
|
+
if (event.key === KEY_VALUES.BACKSPACE) {
|
|
58
|
+
onExit === null || onExit === void 0 ? void 0 : onExit(event);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (overlay !== null && overlay !== void 0 && overlay.current) {
|
|
62
|
+
// The keyboard operation callback on the menu.
|
|
63
|
+
onMenuKeyDown === null || onMenuKeyDown === void 0 ? void 0 : onMenuKeyDown(event);
|
|
64
|
+
if (event.key === KEY_VALUES.ENTER) {
|
|
65
|
+
onMenuPressEnter === null || onMenuPressEnter === void 0 ? void 0 : onMenuPressEnter(event);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* There is no callback when typing the Backspace key in the search box.
|
|
70
|
+
* The default is to remove search keywords
|
|
71
|
+
*/
|
|
72
|
+
if (event.key === KEY_VALUES.BACKSPACE && event.target !== (searchInput === null || searchInput === void 0 ? void 0 : searchInput.current)) {
|
|
73
|
+
onMenuPressBackspace === null || onMenuPressBackspace === void 0 ? void 0 : onMenuPressBackspace(event);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// The search box gets focus when typing characters and numbers.
|
|
77
|
+
if (event.key.length === 1 && /\w/.test(event.key)) {
|
|
78
|
+
var _event$target;
|
|
79
|
+
// Exclude Input
|
|
80
|
+
// eg: <SelectPicker renderExtraFooter={() => <Input />} />
|
|
81
|
+
if (((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.tagName) !== 'INPUT') {
|
|
82
|
+
var _searchInput$current;
|
|
83
|
+
searchInput === null || searchInput === void 0 ? void 0 : (_searchInput$current = searchInput.current) === null || _searchInput$current === void 0 ? void 0 : _searchInput$current.focus();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (event.key === KEY_VALUES.ESC || event.key === KEY_VALUES.TAB) {
|
|
88
|
+
handleClose();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Native event callback
|
|
92
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
93
|
+
});
|
|
94
|
+
return onToggle;
|
|
95
|
+
};
|
|
96
|
+
export default useToggleKeyDownEvent;
|
package/esm/Picker/index.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { pickTriggerPropKeys, omitTriggerPropKeys, OverlayTriggerHandle, PositionChildProps } from './PickerToggleTrigger';
|
|
2
2
|
import { PickerToggleProps } from './PickerToggle';
|
|
3
3
|
import { PickerHandle, PickerComponent } from './types';
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as
|
|
8
|
-
export { default as
|
|
4
|
+
export { default as TreeView } from './TreeView';
|
|
5
|
+
export { default as Listbox } from './Listbox';
|
|
6
|
+
export { default as ListItem } from './ListItem';
|
|
7
|
+
export { default as ListItemGroup } from './ListItemGroup';
|
|
8
|
+
export { default as ListCheckItem } from './ListCheckItem';
|
|
9
|
+
export { default as PickerPopup } from './PickerPopup';
|
|
9
10
|
export { default as PickerToggle } from './PickerToggle';
|
|
10
11
|
export { default as PickerLabel } from './PickerLabel';
|
|
11
12
|
export { default as PickerIndicator } from './PickerIndicator';
|
|
12
13
|
export { default as PickerToggleTrigger } from './PickerToggleTrigger';
|
|
13
14
|
export { default as SearchBar } from './SearchBar';
|
|
14
15
|
export { default as SelectedElement } from './SelectedElement';
|
|
15
|
-
export { default as usePickerRef } from './usePickerRef';
|
|
16
16
|
export { pickTriggerPropKeys, omitTriggerPropKeys };
|
|
17
17
|
export type { OverlayTriggerHandle, PositionChildProps, PickerHandle, PickerComponent, PickerToggleProps };
|
|
18
|
+
export * from './hooks';
|
|
18
19
|
export * from './utils';
|
|
19
20
|
export * from './propTypes';
|
package/esm/Picker/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { pickTriggerPropKeys, omitTriggerPropKeys } from './PickerToggleTrigger';
|
|
3
|
-
export { default as
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as
|
|
3
|
+
export { default as TreeView } from './TreeView';
|
|
4
|
+
export { default as Listbox } from './Listbox';
|
|
5
|
+
export { default as ListItem } from './ListItem';
|
|
6
|
+
export { default as ListItemGroup } from './ListItemGroup';
|
|
7
|
+
export { default as ListCheckItem } from './ListCheckItem';
|
|
8
|
+
export { default as PickerPopup } from './PickerPopup';
|
|
8
9
|
export { default as PickerToggle } from './PickerToggle';
|
|
9
10
|
export { default as PickerLabel } from './PickerLabel';
|
|
10
11
|
export { default as PickerIndicator } from './PickerIndicator';
|
|
11
12
|
export { default as PickerToggleTrigger } from './PickerToggleTrigger';
|
|
12
13
|
export { default as SearchBar } from './SearchBar';
|
|
13
14
|
export { default as SelectedElement } from './SelectedElement';
|
|
14
|
-
export { default as usePickerRef } from './usePickerRef';
|
|
15
15
|
export { pickTriggerPropKeys, omitTriggerPropKeys };
|
|
16
|
+
export * from './hooks';
|
|
16
17
|
export * from './utils';
|
|
17
18
|
export * from './propTypes';
|
|
@@ -13,9 +13,6 @@ export declare const pickerPropTypes: {
|
|
|
13
13
|
menuStyle: PropTypes.Requireable<object>;
|
|
14
14
|
placeholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
15
15
|
placement: PropTypes.Requireable<"top" | "bottom" | "right" | "left" | "bottomStart" | "bottomEnd" | "topStart" | "topEnd" | "leftStart" | "rightStart" | "leftEnd" | "rightEnd" | "auto" | "autoVertical" | "autoVerticalStart" | "autoVerticalEnd" | "autoHorizontal" | "autoHorizontalStart" | "autoHorizontalEnd">;
|
|
16
|
-
/**
|
|
17
|
-
* Prevent floating element overflow
|
|
18
|
-
*/
|
|
19
16
|
preventOverflow: PropTypes.Requireable<boolean>;
|
|
20
17
|
open: PropTypes.Requireable<boolean>;
|
|
21
18
|
defaultOpen: PropTypes.Requireable<boolean>;
|
|
@@ -55,9 +52,6 @@ export declare const listPickerPropTypes: {
|
|
|
55
52
|
menuStyle: PropTypes.Requireable<object>;
|
|
56
53
|
placeholder: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
57
54
|
placement: PropTypes.Requireable<"top" | "bottom" | "right" | "left" | "bottomStart" | "bottomEnd" | "topStart" | "topEnd" | "leftStart" | "rightStart" | "leftEnd" | "rightEnd" | "auto" | "autoVertical" | "autoVerticalStart" | "autoVerticalEnd" | "autoHorizontal" | "autoHorizontalStart" | "autoHorizontalEnd">;
|
|
58
|
-
/**
|
|
59
|
-
* Prevent floating element overflow
|
|
60
|
-
*/
|
|
61
55
|
preventOverflow: PropTypes.Requireable<boolean>;
|
|
62
56
|
open: PropTypes.Requireable<boolean>;
|
|
63
57
|
defaultOpen: PropTypes.Requireable<boolean>;
|
package/esm/Picker/propTypes.js
CHANGED
|
@@ -13,15 +13,10 @@ export var pickerPropTypes = _extends({}, animationPropTypes, {
|
|
|
13
13
|
containerPadding: PropTypes.number,
|
|
14
14
|
container: PropTypes.oneOfType([PropTypes.any, PropTypes.func]),
|
|
15
15
|
disabled: PropTypes.bool,
|
|
16
|
-
// PropTypes.elementType conflictin with React.ElementType
|
|
17
|
-
// toggleAs: PropTypes.elementType,
|
|
18
16
|
menuClassName: PropTypes.string,
|
|
19
17
|
menuStyle: PropTypes.object,
|
|
20
18
|
placeholder: PropTypes.node,
|
|
21
19
|
placement: PropTypes.oneOf(PLACEMENT),
|
|
22
|
-
/**
|
|
23
|
-
* Prevent floating element overflow
|
|
24
|
-
*/
|
|
25
20
|
preventOverflow: PropTypes.bool,
|
|
26
21
|
open: PropTypes.bool,
|
|
27
22
|
defaultOpen: PropTypes.bool,
|