@zendeskgarden/react-dropdowns 8.57.0 → 8.58.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/dist/index.cjs.js +844 -1123
- package/dist/index.esm.js +844 -1123
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -20,202 +20,63 @@ import mergeRefs from 'react-merge-refs';
|
|
|
20
20
|
import { useSelection } from '@zendeskgarden/container-selection';
|
|
21
21
|
import { createPortal } from 'react-dom';
|
|
22
22
|
|
|
23
|
-
function ownKeys(object, enumerableOnly) {
|
|
24
|
-
var keys = Object.keys(object);
|
|
25
|
-
|
|
26
|
-
if (Object.getOwnPropertySymbols) {
|
|
27
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
28
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
29
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
30
|
-
})), keys.push.apply(keys, symbols);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return keys;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function _objectSpread2(target) {
|
|
37
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
38
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
39
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
40
|
-
_defineProperty(target, key, source[key]);
|
|
41
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
42
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return target;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function _defineProperty(obj, key, value) {
|
|
50
|
-
if (key in obj) {
|
|
51
|
-
Object.defineProperty(obj, key, {
|
|
52
|
-
value: value,
|
|
53
|
-
enumerable: true,
|
|
54
|
-
configurable: true,
|
|
55
|
-
writable: true
|
|
56
|
-
});
|
|
57
|
-
} else {
|
|
58
|
-
obj[key] = value;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return obj;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
23
|
function _extends$5() {
|
|
65
24
|
_extends$5 = Object.assign ? Object.assign.bind() : function (target) {
|
|
66
25
|
for (var i = 1; i < arguments.length; i++) {
|
|
67
26
|
var source = arguments[i];
|
|
68
|
-
|
|
69
27
|
for (var key in source) {
|
|
70
28
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
71
29
|
target[key] = source[key];
|
|
72
30
|
}
|
|
73
31
|
}
|
|
74
32
|
}
|
|
75
|
-
|
|
76
33
|
return target;
|
|
77
34
|
};
|
|
78
35
|
return _extends$5.apply(this, arguments);
|
|
79
36
|
}
|
|
80
37
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
var sourceKeys = Object.keys(source);
|
|
85
|
-
var key, i;
|
|
86
|
-
|
|
87
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
88
|
-
key = sourceKeys[i];
|
|
89
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
90
|
-
target[key] = source[key];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return target;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function _objectWithoutProperties(source, excluded) {
|
|
97
|
-
if (source == null) return {};
|
|
98
|
-
|
|
99
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
100
|
-
|
|
101
|
-
var key, i;
|
|
102
|
-
|
|
103
|
-
if (Object.getOwnPropertySymbols) {
|
|
104
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
105
|
-
|
|
106
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
107
|
-
key = sourceSymbolKeys[i];
|
|
108
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
109
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
110
|
-
target[key] = source[key];
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return target;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function _slicedToArray(arr, i) {
|
|
118
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function _arrayWithHoles(arr) {
|
|
122
|
-
if (Array.isArray(arr)) return arr;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function _iterableToArrayLimit(arr, i) {
|
|
126
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
127
|
-
|
|
128
|
-
if (_i == null) return;
|
|
129
|
-
var _arr = [];
|
|
130
|
-
var _n = true;
|
|
131
|
-
var _d = false;
|
|
132
|
-
|
|
133
|
-
var _s, _e;
|
|
134
|
-
|
|
135
|
-
try {
|
|
136
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
137
|
-
_arr.push(_s.value);
|
|
138
|
-
|
|
139
|
-
if (i && _arr.length === i) break;
|
|
140
|
-
}
|
|
141
|
-
} catch (err) {
|
|
142
|
-
_d = true;
|
|
143
|
-
_e = err;
|
|
144
|
-
} finally {
|
|
145
|
-
try {
|
|
146
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
147
|
-
} finally {
|
|
148
|
-
if (_d) throw _e;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return _arr;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
156
|
-
if (!o) return;
|
|
157
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
158
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
159
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
160
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
161
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function _arrayLikeToArray(arr, len) {
|
|
165
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
166
|
-
|
|
167
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
168
|
-
|
|
169
|
-
return arr2;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function _nonIterableRest() {
|
|
173
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
var DropdownContext = React__default.createContext(undefined);
|
|
177
|
-
var useDropdownContext = function useDropdownContext() {
|
|
178
|
-
var dropdownContext = useContext(DropdownContext);
|
|
38
|
+
const DropdownContext = React__default.createContext(undefined);
|
|
39
|
+
const useDropdownContext = () => {
|
|
40
|
+
const dropdownContext = useContext(DropdownContext);
|
|
179
41
|
if (!dropdownContext) {
|
|
180
42
|
throw new Error('This component must be rendered within a `Dropdown` component.');
|
|
181
43
|
}
|
|
182
44
|
return dropdownContext;
|
|
183
45
|
};
|
|
184
46
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
var NEXT_KEY = rtl ? KEY_CODES.LEFT : KEY_CODES.RIGHT;
|
|
47
|
+
const REMOVE_ITEM_STATE_TYPE = 'REMOVE_ITEM';
|
|
48
|
+
const Dropdown = props => {
|
|
49
|
+
const {
|
|
50
|
+
children,
|
|
51
|
+
isOpen,
|
|
52
|
+
selectedItem,
|
|
53
|
+
selectedItems,
|
|
54
|
+
highlightedIndex,
|
|
55
|
+
inputValue,
|
|
56
|
+
onSelect,
|
|
57
|
+
onStateChange,
|
|
58
|
+
onInputValueChange,
|
|
59
|
+
downshiftProps
|
|
60
|
+
} = props;
|
|
61
|
+
const itemIndexRef = useRef(0);
|
|
62
|
+
const previousItemRef = useRef(undefined);
|
|
63
|
+
const previousIndexRef = useRef(undefined);
|
|
64
|
+
const nextItemsHashRef = useRef({});
|
|
65
|
+
const containsMultiselectRef = useRef(false);
|
|
66
|
+
const itemSearchRegistry = useRef([]);
|
|
67
|
+
const [dropdownType, setDropdownType] = useState('');
|
|
68
|
+
const themeContext = useContext(ThemeContext);
|
|
69
|
+
const hasMenuRef = useRef(false);
|
|
70
|
+
const popperReferenceElementRef = useRef(null);
|
|
71
|
+
const customGetInputProps = (_ref, downshift, rtl) => {
|
|
72
|
+
let {
|
|
73
|
+
onKeyDown,
|
|
74
|
+
...other
|
|
75
|
+
} = _ref;
|
|
76
|
+
return {
|
|
77
|
+
onKeyDown: composeEventHandlers(onKeyDown, e => {
|
|
78
|
+
const PREVIOUS_KEY = rtl ? KEY_CODES.RIGHT : KEY_CODES.LEFT;
|
|
79
|
+
const NEXT_KEY = rtl ? KEY_CODES.LEFT : KEY_CODES.RIGHT;
|
|
219
80
|
if (downshift.isOpen) {
|
|
220
81
|
if (e.keyCode === PREVIOUS_KEY && previousIndexRef.current !== null && previousIndexRef.current !== undefined && !downshift.inputValue) {
|
|
221
82
|
e.preventDefault();
|
|
@@ -223,7 +84,7 @@ var Dropdown = function Dropdown(props) {
|
|
|
223
84
|
downshift.selectItemAtIndex(previousIndexRef.current);
|
|
224
85
|
}
|
|
225
86
|
if (e.keyCode === NEXT_KEY) {
|
|
226
|
-
|
|
87
|
+
const nextItemIndexes = Object.values(nextItemsHashRef.current);
|
|
227
88
|
if (nextItemIndexes.includes(downshift.highlightedIndex)) {
|
|
228
89
|
e.preventDefault();
|
|
229
90
|
e.stopPropagation();
|
|
@@ -235,23 +96,24 @@ var Dropdown = function Dropdown(props) {
|
|
|
235
96
|
e.stopPropagation();
|
|
236
97
|
downshift.openMenu();
|
|
237
98
|
}
|
|
238
|
-
})
|
|
239
|
-
|
|
99
|
+
}),
|
|
100
|
+
...other
|
|
101
|
+
};
|
|
240
102
|
};
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
getToggleButtonProps:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
103
|
+
const transformDownshift = _ref2 => {
|
|
104
|
+
let {
|
|
105
|
+
getInputProps,
|
|
106
|
+
getToggleButtonProps,
|
|
107
|
+
...downshift
|
|
108
|
+
} = _ref2;
|
|
109
|
+
return {
|
|
110
|
+
getInputProps: p => getInputProps(customGetInputProps(p, downshift, themeContext.rtl)),
|
|
111
|
+
getToggleButtonProps: p => getToggleButtonProps({
|
|
112
|
+
'aria-label': undefined,
|
|
113
|
+
...p
|
|
114
|
+
}),
|
|
115
|
+
...downshift
|
|
116
|
+
};
|
|
255
117
|
};
|
|
256
118
|
return React__default.createElement(Manager, null, React__default.createElement(Downshift, _extends$5({
|
|
257
119
|
suppressRefError: true
|
|
@@ -261,26 +123,28 @@ var Dropdown = function Dropdown(props) {
|
|
|
261
123
|
selectedItem: selectedItem || null
|
|
262
124
|
,
|
|
263
125
|
inputValue: inputValue,
|
|
264
|
-
onInputValueChange:
|
|
265
|
-
if (
|
|
126
|
+
onInputValueChange: (inputVal, stateAndHelpers) => {
|
|
127
|
+
if (onInputValueChange) {
|
|
266
128
|
if (stateAndHelpers.isOpen) {
|
|
267
|
-
|
|
129
|
+
onInputValueChange(inputVal, stateAndHelpers);
|
|
268
130
|
} else if (dropdownType === 'multiselect') {
|
|
269
|
-
|
|
131
|
+
onInputValueChange('', stateAndHelpers);
|
|
270
132
|
}
|
|
271
133
|
}
|
|
272
134
|
},
|
|
273
|
-
onStateChange:
|
|
135
|
+
onStateChange: (changes, stateAndHelpers) => {
|
|
274
136
|
if (dropdownType === 'autocomplete' && changes.isOpen === false && !changes.selectedItem) {
|
|
275
137
|
onSelect && onSelect(selectedItem, stateAndHelpers);
|
|
276
138
|
}
|
|
277
139
|
if (Object.prototype.hasOwnProperty.call(changes, 'selectedItem') && changes.selectedItem !== null) {
|
|
278
140
|
if (selectedItems) {
|
|
279
|
-
|
|
280
|
-
|
|
141
|
+
const {
|
|
142
|
+
itemToString
|
|
143
|
+
} = stateAndHelpers;
|
|
144
|
+
const existingItemIndex = selectedItems.findIndex(item => {
|
|
281
145
|
return itemToString(item) === itemToString(changes.selectedItem);
|
|
282
146
|
});
|
|
283
|
-
|
|
147
|
+
const updatedSelectedItems = Array.from(selectedItems);
|
|
284
148
|
if (existingItemIndex === -1) {
|
|
285
149
|
updatedSelectedItems.splice(updatedSelectedItems.length, 0, changes.selectedItem);
|
|
286
150
|
} else {
|
|
@@ -298,38 +162,37 @@ var Dropdown = function Dropdown(props) {
|
|
|
298
162
|
});
|
|
299
163
|
}
|
|
300
164
|
}
|
|
301
|
-
|
|
165
|
+
onStateChange && onStateChange(changes, stateAndHelpers);
|
|
302
166
|
},
|
|
303
|
-
stateReducer:
|
|
167
|
+
stateReducer: (_state, changes) => {
|
|
304
168
|
switch (changes.type) {
|
|
305
169
|
case Downshift.stateChangeTypes.changeInput:
|
|
306
170
|
if (changes.inputValue === '' && dropdownType === 'combobox') {
|
|
307
|
-
return
|
|
171
|
+
return {
|
|
172
|
+
...changes,
|
|
308
173
|
isOpen: false
|
|
309
|
-
}
|
|
174
|
+
};
|
|
310
175
|
}
|
|
311
176
|
return changes;
|
|
312
177
|
default:
|
|
313
178
|
return changes;
|
|
314
179
|
}
|
|
315
180
|
}
|
|
316
|
-
}, downshiftProps),
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
}, children);
|
|
332
|
-
}));
|
|
181
|
+
}, downshiftProps), downshift => React__default.createElement(DropdownContext.Provider, {
|
|
182
|
+
value: {
|
|
183
|
+
hasMenuRef,
|
|
184
|
+
itemIndexRef,
|
|
185
|
+
previousItemRef,
|
|
186
|
+
previousIndexRef,
|
|
187
|
+
nextItemsHashRef,
|
|
188
|
+
popperReferenceElementRef,
|
|
189
|
+
selectedItems,
|
|
190
|
+
downshift: transformDownshift(downshift),
|
|
191
|
+
containsMultiselectRef,
|
|
192
|
+
itemSearchRegistry,
|
|
193
|
+
setDropdownType
|
|
194
|
+
}
|
|
195
|
+
}, children)));
|
|
333
196
|
};
|
|
334
197
|
Dropdown.propTypes = {
|
|
335
198
|
isOpen: PropTypes.bool,
|
|
@@ -361,7 +224,7 @@ function getPopperPlacement(gardenPlacement) {
|
|
|
361
224
|
}
|
|
362
225
|
}
|
|
363
226
|
function getRtlPopperPlacement(gardenPlacement) {
|
|
364
|
-
|
|
227
|
+
const popperPlacement = getPopperPlacement(gardenPlacement);
|
|
365
228
|
switch (popperPlacement) {
|
|
366
229
|
case 'left':
|
|
367
230
|
return 'right';
|
|
@@ -388,7 +251,7 @@ function getRtlPopperPlacement(gardenPlacement) {
|
|
|
388
251
|
}
|
|
389
252
|
}
|
|
390
253
|
function getArrowPosition(popperPlacement) {
|
|
391
|
-
|
|
254
|
+
const arrowPositionMappings = {
|
|
392
255
|
auto: 'top',
|
|
393
256
|
top: 'bottom',
|
|
394
257
|
'top-start': 'bottom-left',
|
|
@@ -412,85 +275,65 @@ function getMenuPosition(popperPlacement) {
|
|
|
412
275
|
return popperPlacement ? popperPlacement.split('-')[0] : 'bottom';
|
|
413
276
|
}
|
|
414
277
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
};
|
|
422
|
-
}).withConfig({
|
|
278
|
+
const COMPONENT_ID$m = 'dropdowns.menu';
|
|
279
|
+
const StyledMenu = styled.ul.attrs(props => ({
|
|
280
|
+
'data-garden-id': COMPONENT_ID$m,
|
|
281
|
+
'data-garden-version': '8.58.0',
|
|
282
|
+
className: props.isAnimated && 'is-animated'
|
|
283
|
+
})).withConfig({
|
|
423
284
|
displayName: "StyledMenu",
|
|
424
285
|
componentId: "sc-1vpttfd-0"
|
|
425
|
-
})(["position:static !important;max-height:", ";overflow-y:auto;", ";", ";"],
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
inset: '2px',
|
|
431
|
-
animationModifier: props.isAnimated ? '.is-animated' : undefined
|
|
432
|
-
});
|
|
433
|
-
}, function (props) {
|
|
434
|
-
return retrieveComponentStyles(COMPONENT_ID$m, props);
|
|
435
|
-
});
|
|
286
|
+
})(["position:static !important;max-height:", ";overflow-y:auto;", ";", ";"], props => props.maxHeight, props => props.hasArrow && arrowStyles(getArrowPosition(props.placement), {
|
|
287
|
+
size: `${props.theme.space.base * 2}px`,
|
|
288
|
+
inset: '2px',
|
|
289
|
+
animationModifier: props.isAnimated ? '.is-animated' : undefined
|
|
290
|
+
}), props => retrieveComponentStyles(COMPONENT_ID$m, props));
|
|
436
291
|
StyledMenu.defaultProps = {
|
|
437
292
|
theme: DEFAULT_THEME
|
|
438
293
|
};
|
|
439
294
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
};
|
|
447
|
-
}).withConfig({
|
|
295
|
+
const COMPONENT_ID$l = 'dropdowns.menu_wrapper';
|
|
296
|
+
const StyledMenuWrapper = styled.div.attrs(props => ({
|
|
297
|
+
'data-garden-id': COMPONENT_ID$l,
|
|
298
|
+
'data-garden-version': '8.58.0',
|
|
299
|
+
className: props.isAnimated && 'is-animated'
|
|
300
|
+
})).withConfig({
|
|
448
301
|
displayName: "StyledMenuWrapper",
|
|
449
302
|
componentId: "sc-tiwdxz-0"
|
|
450
|
-
})(["", ";", ";"],
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
});
|
|
458
|
-
}, function (props) {
|
|
459
|
-
return retrieveComponentStyles(COMPONENT_ID$l, props);
|
|
460
|
-
});
|
|
303
|
+
})(["", ";", ";"], props => menuStyles(getMenuPosition(props.placement), {
|
|
304
|
+
theme: props.theme,
|
|
305
|
+
hidden: props.isHidden,
|
|
306
|
+
margin: `${props.theme.space.base * (props.hasArrow ? 2 : 1)}px`,
|
|
307
|
+
zIndex: props.zIndex,
|
|
308
|
+
animationModifier: props.isAnimated ? '.is-animated' : undefined
|
|
309
|
+
}), props => retrieveComponentStyles(COMPONENT_ID$l, props));
|
|
461
310
|
StyledMenuWrapper.defaultProps = {
|
|
462
311
|
theme: DEFAULT_THEME
|
|
463
312
|
};
|
|
464
313
|
|
|
465
|
-
|
|
466
|
-
|
|
314
|
+
const COMPONENT_ID$k = 'dropdowns.separator';
|
|
315
|
+
const StyledSeparator = styled.li.attrs({
|
|
467
316
|
'data-garden-id': COMPONENT_ID$k,
|
|
468
|
-
'data-garden-version': '8.
|
|
317
|
+
'data-garden-version': '8.58.0',
|
|
469
318
|
role: 'separator'
|
|
470
319
|
}).withConfig({
|
|
471
320
|
displayName: "StyledSeparator",
|
|
472
321
|
componentId: "sc-1mrnp18-0"
|
|
473
|
-
})(["display:block;margin:", "px 0;border-bottom:", ";", ";"],
|
|
474
|
-
return props.theme.space.base;
|
|
475
|
-
}, function (props) {
|
|
476
|
-
return "".concat(props.theme.borders.sm, " ").concat(getColor('neutralHue', 200, props.theme));
|
|
477
|
-
}, function (props) {
|
|
478
|
-
return retrieveComponentStyles(COMPONENT_ID$k, props);
|
|
479
|
-
});
|
|
322
|
+
})(["display:block;margin:", "px 0;border-bottom:", ";", ";"], props => props.theme.space.base, props => `${props.theme.borders.sm} ${getColor('neutralHue', 200, props.theme)}`, props => retrieveComponentStyles(COMPONENT_ID$k, props));
|
|
480
323
|
StyledSeparator.defaultProps = {
|
|
481
324
|
theme: DEFAULT_THEME
|
|
482
325
|
};
|
|
483
326
|
|
|
484
|
-
|
|
485
|
-
|
|
327
|
+
const COMPONENT_ID$j = 'dropdowns.item';
|
|
328
|
+
const getItemPaddingVertical = props => {
|
|
486
329
|
if (props.isCompact) {
|
|
487
|
-
return
|
|
330
|
+
return `${props.theme.space.base}px`;
|
|
488
331
|
}
|
|
489
|
-
return
|
|
332
|
+
return `${props.theme.space.base * 2}px`;
|
|
490
333
|
};
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
334
|
+
const getColorStyles = props => {
|
|
335
|
+
let foregroundColor;
|
|
336
|
+
let backgroundColor;
|
|
494
337
|
if (props.disabled) {
|
|
495
338
|
foregroundColor = getColor('neutralHue', 400, props.theme);
|
|
496
339
|
} else if (props.isDanger) {
|
|
@@ -502,115 +345,65 @@ var getColorStyles = function getColorStyles(props) {
|
|
|
502
345
|
}
|
|
503
346
|
return css(["background-color:", ";color:", ";& a,& a:hover,& a:focus,& a:active{color:inherit;}"], backgroundColor, foregroundColor);
|
|
504
347
|
};
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
};
|
|
511
|
-
}).withConfig({
|
|
348
|
+
const StyledItem = styled.li.attrs(props => ({
|
|
349
|
+
'data-garden-id': COMPONENT_ID$j,
|
|
350
|
+
'data-garden-version': '8.58.0',
|
|
351
|
+
'aria-disabled': props.disabled
|
|
352
|
+
})).withConfig({
|
|
512
353
|
displayName: "StyledItem",
|
|
513
354
|
componentId: "sc-1xeog7q-0"
|
|
514
|
-
})(["display:block;position:relative;z-index:0;cursor:", ";padding:", " ", "px;text-decoration:none;line-height:", "px;word-wrap:break-word;user-select:none;&:first-child{margin-top:", "px;}&:last-child{margin-bottom:", "px;}&:focus{outline:none;}& a,& a:hover,& a:focus,& a:active{text-decoration:none;}", ";", ";"],
|
|
515
|
-
return props.disabled ? 'default' : 'pointer';
|
|
516
|
-
}, function (props) {
|
|
517
|
-
return getItemPaddingVertical(props);
|
|
518
|
-
}, function (props) {
|
|
519
|
-
return props.theme.space.base * 9;
|
|
520
|
-
}, function (props) {
|
|
521
|
-
return props.theme.space.base * 5;
|
|
522
|
-
}, function (props) {
|
|
523
|
-
return props.theme.space.base;
|
|
524
|
-
}, function (props) {
|
|
525
|
-
return props.theme.space.base;
|
|
526
|
-
}, function (props) {
|
|
527
|
-
return getColorStyles(props);
|
|
528
|
-
}, function (props) {
|
|
529
|
-
return retrieveComponentStyles(COMPONENT_ID$j, props);
|
|
530
|
-
});
|
|
355
|
+
})(["display:block;position:relative;z-index:0;cursor:", ";padding:", " ", "px;text-decoration:none;line-height:", "px;word-wrap:break-word;user-select:none;&:first-child{margin-top:", "px;}&:last-child{margin-bottom:", "px;}&:focus{outline:none;}& a,& a:hover,& a:focus,& a:active{text-decoration:none;}", ";", ";"], props => props.disabled ? 'default' : 'pointer', props => getItemPaddingVertical(props), props => props.theme.space.base * 9, props => props.theme.space.base * 5, props => props.theme.space.base, props => props.theme.space.base, props => getColorStyles(props), props => retrieveComponentStyles(COMPONENT_ID$j, props));
|
|
531
356
|
StyledItem.defaultProps = {
|
|
532
357
|
theme: DEFAULT_THEME
|
|
533
358
|
};
|
|
534
359
|
|
|
535
|
-
|
|
536
|
-
|
|
360
|
+
const COMPONENT_ID$i = 'dropdowns.add_item';
|
|
361
|
+
const StyledAddItem = styled(StyledItem).attrs({
|
|
537
362
|
'data-garden-id': COMPONENT_ID$i,
|
|
538
|
-
'data-garden-version': '8.
|
|
363
|
+
'data-garden-version': '8.58.0'
|
|
539
364
|
}).withConfig({
|
|
540
365
|
displayName: "StyledAddItem",
|
|
541
366
|
componentId: "sc-ekqk50-0"
|
|
542
|
-
})(["color:", ";", ";"],
|
|
543
|
-
return !props.disabled && getColor('primaryHue', 600, props.theme);
|
|
544
|
-
}, function (props) {
|
|
545
|
-
return retrieveComponentStyles(COMPONENT_ID$i, props);
|
|
546
|
-
});
|
|
367
|
+
})(["color:", ";", ";"], props => !props.disabled && getColor('primaryHue', 600, props.theme), props => retrieveComponentStyles(COMPONENT_ID$i, props));
|
|
547
368
|
StyledAddItem.defaultProps = {
|
|
548
369
|
theme: DEFAULT_THEME
|
|
549
370
|
};
|
|
550
371
|
|
|
551
|
-
|
|
552
|
-
|
|
372
|
+
const COMPONENT_ID$h = 'dropdowns.item_meta';
|
|
373
|
+
const StyledItemMeta = styled.span.attrs({
|
|
553
374
|
'data-garden-id': COMPONENT_ID$h,
|
|
554
|
-
'data-garden-version': '8.
|
|
375
|
+
'data-garden-version': '8.58.0'
|
|
555
376
|
}).withConfig({
|
|
556
377
|
displayName: "StyledItemMeta",
|
|
557
378
|
componentId: "sc-k6xy28-0"
|
|
558
|
-
})(["display:block;line-height:", "px;color:", ";font-size:", ";", ";"],
|
|
559
|
-
return props.theme.space.base * (props.isCompact ? 3 : 4);
|
|
560
|
-
}, function (props) {
|
|
561
|
-
return getColor('neutralHue', props.isDisabled ? 400 : 600, props.theme);
|
|
562
|
-
}, function (props) {
|
|
563
|
-
return props.theme.fontSizes.sm;
|
|
564
|
-
}, function (props) {
|
|
565
|
-
return retrieveComponentStyles(COMPONENT_ID$h, props);
|
|
566
|
-
});
|
|
379
|
+
})(["display:block;line-height:", "px;color:", ";font-size:", ";", ";"], props => props.theme.space.base * (props.isCompact ? 3 : 4), props => getColor('neutralHue', props.isDisabled ? 400 : 600, props.theme), props => props.theme.fontSizes.sm, props => retrieveComponentStyles(COMPONENT_ID$h, props));
|
|
567
380
|
StyledItemMeta.defaultProps = {
|
|
568
381
|
theme: DEFAULT_THEME
|
|
569
382
|
};
|
|
570
383
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
return css(["width:", ";height:calc(", "px + ", ");"], props.theme.iconSizes.md, props.theme.space.base * 5, math(
|
|
384
|
+
const COMPONENT_ID$g = 'dropdowns.item_icon';
|
|
385
|
+
const getSizeStyles = props => {
|
|
386
|
+
return css(["width:", ";height:calc(", "px + ", ");"], props.theme.iconSizes.md, props.theme.space.base * 5, math(`${getItemPaddingVertical(props)} * 2`));
|
|
574
387
|
};
|
|
575
|
-
|
|
388
|
+
const StyledItemIcon = styled.div.attrs({
|
|
576
389
|
'data-garden-id': COMPONENT_ID$g,
|
|
577
|
-
'data-garden-version': '8.
|
|
390
|
+
'data-garden-version': '8.58.0'
|
|
578
391
|
}).withConfig({
|
|
579
392
|
displayName: "StyledItemIcon",
|
|
580
393
|
componentId: "sc-1v0ty11-0"
|
|
581
|
-
})(["display:flex;position:absolute;top:0;", ":", "px;align-items:center;justify-content:center;transition:opacity 0.1s ease-in-out;opacity:", ";color:", ";", ";& > *{width:", ";height:", ";}"],
|
|
582
|
-
return props.theme.rtl ? 'right' : 'left';
|
|
583
|
-
}, function (props) {
|
|
584
|
-
return props.theme.space.base * 3;
|
|
585
|
-
}, function (props) {
|
|
586
|
-
return props.isVisible ? '1' : '0';
|
|
587
|
-
}, function (props) {
|
|
588
|
-
return props.isDisabled ? 'inherit' : getColor('primaryHue', 600, props.theme);
|
|
589
|
-
}, function (props) {
|
|
590
|
-
return getSizeStyles(props);
|
|
591
|
-
}, function (props) {
|
|
592
|
-
return props.theme.iconSizes.md;
|
|
593
|
-
}, function (props) {
|
|
594
|
-
return props.theme.iconSizes.md;
|
|
595
|
-
});
|
|
394
|
+
})(["display:flex;position:absolute;top:0;", ":", "px;align-items:center;justify-content:center;transition:opacity 0.1s ease-in-out;opacity:", ";color:", ";", ";& > *{width:", ";height:", ";}"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.space.base * 3, props => props.isVisible ? '1' : '0', props => props.isDisabled ? 'inherit' : getColor('primaryHue', 600, props.theme), props => getSizeStyles(props), props => props.theme.iconSizes.md, props => props.theme.iconSizes.md);
|
|
596
395
|
StyledItemIcon.defaultProps = {
|
|
597
396
|
theme: DEFAULT_THEME
|
|
598
397
|
};
|
|
599
398
|
|
|
600
|
-
|
|
601
|
-
|
|
399
|
+
const COMPONENT_ID$f = 'dropdowns.next_item';
|
|
400
|
+
const StyledNextItem = styled(StyledItem).attrs({
|
|
602
401
|
'data-garden-id': COMPONENT_ID$f,
|
|
603
|
-
'data-garden-version': '8.
|
|
402
|
+
'data-garden-version': '8.58.0'
|
|
604
403
|
}).withConfig({
|
|
605
404
|
displayName: "StyledNextItem",
|
|
606
405
|
componentId: "sc-1bcygn5-0"
|
|
607
|
-
})(["", "{right:", ";left:", ";}", ";"], StyledItemIcon,
|
|
608
|
-
return props.theme.rtl ? 'auto' : "".concat(props.theme.space.base * 3, "px");
|
|
609
|
-
}, function (props) {
|
|
610
|
-
return props.theme.rtl ? "".concat(props.theme.space.base * 3, "px") : 'auto';
|
|
611
|
-
}, function (props) {
|
|
612
|
-
return retrieveComponentStyles(COMPONENT_ID$f, props);
|
|
613
|
-
});
|
|
406
|
+
})(["", "{right:", ";left:", ";}", ";"], StyledItemIcon, props => props.theme.rtl ? 'auto' : `${props.theme.space.base * 3}px`, props => props.theme.rtl ? `${props.theme.space.base * 3}px` : 'auto', props => retrieveComponentStyles(COMPONENT_ID$f, props));
|
|
614
407
|
StyledNextItem.defaultProps = {
|
|
615
408
|
theme: DEFAULT_THEME
|
|
616
409
|
};
|
|
@@ -626,48 +419,41 @@ var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
|
626
419
|
height: 16,
|
|
627
420
|
focusable: "false",
|
|
628
421
|
viewBox: "0 0 16 16",
|
|
629
|
-
"aria-hidden": "true"
|
|
422
|
+
"aria-hidden": "true",
|
|
423
|
+
role: "img"
|
|
630
424
|
}, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
|
|
631
425
|
fill: "currentColor",
|
|
632
426
|
d: "M5.61 3.312a.5.5 0 01.718-.69l.062.066 4 5a.5.5 0 01.054.542l-.054.082-4 5a.5.5 0 01-.83-.55l.05-.074L9.359 8l-3.75-4.688z"
|
|
633
427
|
})));
|
|
634
428
|
};
|
|
635
429
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
430
|
+
const COMPONENT_ID$e = 'dropdowns.next_item_icon';
|
|
431
|
+
const NextIconComponent = _ref => {
|
|
432
|
+
let {
|
|
433
|
+
className
|
|
434
|
+
} = _ref;
|
|
639
435
|
return React__default.createElement(SvgChevronRightStroke, {
|
|
640
436
|
"data-garden-id": COMPONENT_ID$e,
|
|
641
|
-
"data-garden-version": '8.
|
|
437
|
+
"data-garden-version": '8.58.0',
|
|
642
438
|
className: className
|
|
643
439
|
});
|
|
644
440
|
};
|
|
645
|
-
|
|
441
|
+
const StyledNextIcon = styled(NextIconComponent).withConfig({
|
|
646
442
|
displayName: "StyledNextIcon",
|
|
647
443
|
componentId: "sc-1rinki2-0"
|
|
648
|
-
})(["transform:", ";color:", ";", ";"],
|
|
649
|
-
return props.theme.rtl && 'rotate(180deg)';
|
|
650
|
-
}, function (props) {
|
|
651
|
-
return props.isDisabled ? 'inherit' : getColor('neutralHue', 600, props.theme);
|
|
652
|
-
}, function (props) {
|
|
653
|
-
return retrieveComponentStyles(COMPONENT_ID$e, props);
|
|
654
|
-
});
|
|
444
|
+
})(["transform:", ";color:", ";", ";"], props => props.theme.rtl && 'rotate(180deg)', props => props.isDisabled ? 'inherit' : getColor('neutralHue', 600, props.theme), props => retrieveComponentStyles(COMPONENT_ID$e, props));
|
|
655
445
|
StyledNextIcon.defaultProps = {
|
|
656
446
|
theme: DEFAULT_THEME
|
|
657
447
|
};
|
|
658
448
|
|
|
659
|
-
|
|
660
|
-
|
|
449
|
+
const COMPONENT_ID$d = 'dropdowns.previous_item';
|
|
450
|
+
const StyledPreviousItem = styled(StyledItem).attrs({
|
|
661
451
|
'data-garden-id': COMPONENT_ID$d,
|
|
662
|
-
'data-garden-version': '8.
|
|
452
|
+
'data-garden-version': '8.58.0'
|
|
663
453
|
}).withConfig({
|
|
664
454
|
displayName: "StyledPreviousItem",
|
|
665
455
|
componentId: "sc-1nmdds9-0"
|
|
666
|
-
})(["font-weight:", ";", ";"],
|
|
667
|
-
return props.theme.fontWeights.semibold;
|
|
668
|
-
}, function (props) {
|
|
669
|
-
return retrieveComponentStyles(COMPONENT_ID$d, props);
|
|
670
|
-
});
|
|
456
|
+
})(["font-weight:", ";", ";"], props => props.theme.fontWeights.semibold, props => retrieveComponentStyles(COMPONENT_ID$d, props));
|
|
671
457
|
StyledPreviousItem.defaultProps = {
|
|
672
458
|
theme: DEFAULT_THEME
|
|
673
459
|
};
|
|
@@ -683,326 +469,245 @@ var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
|
683
469
|
height: 16,
|
|
684
470
|
focusable: "false",
|
|
685
471
|
viewBox: "0 0 16 16",
|
|
686
|
-
"aria-hidden": "true"
|
|
472
|
+
"aria-hidden": "true",
|
|
473
|
+
role: "img"
|
|
687
474
|
}, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
|
|
688
475
|
fill: "currentColor",
|
|
689
476
|
d: "M10.39 12.688a.5.5 0 01-.718.69l-.062-.066-4-5a.5.5 0 01-.054-.542l.054-.082 4-5a.5.5 0 01.83.55l-.05.074L6.641 8l3.75 4.688z"
|
|
690
477
|
})));
|
|
691
478
|
};
|
|
692
479
|
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
480
|
+
const COMPONENT_ID$c = 'dropdowns.previous_item_icon';
|
|
481
|
+
const PreviousIconComponent = _ref => {
|
|
482
|
+
let {
|
|
483
|
+
className
|
|
484
|
+
} = _ref;
|
|
696
485
|
return React__default.createElement(SvgChevronLeftStroke, {
|
|
697
486
|
"data-garden-id": COMPONENT_ID$c,
|
|
698
|
-
"data-garden-version": '8.
|
|
487
|
+
"data-garden-version": '8.58.0',
|
|
699
488
|
className: className
|
|
700
489
|
});
|
|
701
490
|
};
|
|
702
|
-
|
|
491
|
+
const StyledPreviousIcon = styled(PreviousIconComponent).withConfig({
|
|
703
492
|
displayName: "StyledPreviousIcon",
|
|
704
493
|
componentId: "sc-czfwj7-0"
|
|
705
|
-
})(["transform:", ";color:", ";", ";"],
|
|
706
|
-
return props.theme.rtl && 'rotate(180deg)';
|
|
707
|
-
}, function (props) {
|
|
708
|
-
return props.isDisabled ? 'inherit' : getColor('neutralHue', 600, props.theme);
|
|
709
|
-
}, function (props) {
|
|
710
|
-
return retrieveComponentStyles(COMPONENT_ID$c, props);
|
|
711
|
-
});
|
|
494
|
+
})(["transform:", ";color:", ";", ";"], props => props.theme.rtl && 'rotate(180deg)', props => props.isDisabled ? 'inherit' : getColor('neutralHue', 600, props.theme), props => retrieveComponentStyles(COMPONENT_ID$c, props));
|
|
712
495
|
StyledPreviousIcon.defaultProps = {
|
|
713
496
|
theme: DEFAULT_THEME
|
|
714
497
|
};
|
|
715
498
|
|
|
716
|
-
|
|
717
|
-
|
|
499
|
+
const COMPONENT_ID$b = 'dropdowns.header_icon';
|
|
500
|
+
const StyledHeaderIcon = styled.div.attrs({
|
|
718
501
|
'data-garden-id': COMPONENT_ID$b,
|
|
719
|
-
'data-garden-version': '8.
|
|
502
|
+
'data-garden-version': '8.58.0'
|
|
720
503
|
}).withConfig({
|
|
721
504
|
displayName: "StyledHeaderIcon",
|
|
722
505
|
componentId: "sc-1fl6nsz-0"
|
|
723
|
-
})(["display:flex;position:absolute;top:0;bottom:0;align-items:center;justify-content:center;", ":", "px;color:", ";& > *{width:", ";height:", ";}", ";"],
|
|
724
|
-
return props.theme.rtl ? 'right' : 'left';
|
|
725
|
-
}, function (props) {
|
|
726
|
-
return props.theme.space.base * 3;
|
|
727
|
-
}, function (props) {
|
|
728
|
-
return getColor('neutralHue', 600, props.theme);
|
|
729
|
-
}, function (props) {
|
|
730
|
-
return props.theme.iconSizes.md;
|
|
731
|
-
}, function (props) {
|
|
732
|
-
return props.theme.iconSizes.md;
|
|
733
|
-
}, function (props) {
|
|
734
|
-
return retrieveComponentStyles(COMPONENT_ID$b, props);
|
|
735
|
-
});
|
|
506
|
+
})(["display:flex;position:absolute;top:0;bottom:0;align-items:center;justify-content:center;", ":", "px;color:", ";& > *{width:", ";height:", ";}", ";"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.space.base * 3, props => getColor('neutralHue', 600, props.theme), props => props.theme.iconSizes.md, props => props.theme.iconSizes.md, props => retrieveComponentStyles(COMPONENT_ID$b, props));
|
|
736
507
|
StyledHeaderIcon.defaultProps = {
|
|
737
508
|
theme: DEFAULT_THEME
|
|
738
509
|
};
|
|
739
510
|
|
|
740
|
-
|
|
741
|
-
|
|
511
|
+
const COMPONENT_ID$a = 'dropdowns.header_item';
|
|
512
|
+
const getHorizontalPadding = props => {
|
|
742
513
|
if (props.hasIcon) {
|
|
743
514
|
return undefined;
|
|
744
515
|
}
|
|
745
|
-
return
|
|
516
|
+
return `${props.theme.space.base * 3}px`;
|
|
746
517
|
};
|
|
747
|
-
|
|
518
|
+
const StyledHeaderItem = styled(StyledItem).attrs({
|
|
748
519
|
'data-garden-id': COMPONENT_ID$a,
|
|
749
|
-
'data-garden-version': '8.
|
|
520
|
+
'data-garden-version': '8.58.0'
|
|
750
521
|
}).withConfig({
|
|
751
522
|
displayName: "StyledHeaderItem",
|
|
752
523
|
componentId: "sc-137filx-0"
|
|
753
|
-
})(["cursor:default;padding-right:", ";padding-left:", ";font-weight:", ";", ";"],
|
|
754
|
-
return getHorizontalPadding(props);
|
|
755
|
-
}, function (props) {
|
|
756
|
-
return getHorizontalPadding(props);
|
|
757
|
-
}, function (props) {
|
|
758
|
-
return props.theme.fontWeights.semibold;
|
|
759
|
-
}, function (props) {
|
|
760
|
-
return retrieveComponentStyles(COMPONENT_ID$a, props);
|
|
761
|
-
});
|
|
524
|
+
})(["cursor:default;padding-right:", ";padding-left:", ";font-weight:", ";", ";"], props => getHorizontalPadding(props), props => getHorizontalPadding(props), props => props.theme.fontWeights.semibold, props => retrieveComponentStyles(COMPONENT_ID$a, props));
|
|
762
525
|
StyledHeaderItem.defaultProps = {
|
|
763
526
|
theme: DEFAULT_THEME
|
|
764
527
|
};
|
|
765
528
|
|
|
766
|
-
|
|
767
|
-
|
|
529
|
+
const COMPONENT_ID$9 = 'dropdowns.media_body';
|
|
530
|
+
const StyledMediaBody = styled.div.attrs({
|
|
768
531
|
'data-garden-id': COMPONENT_ID$9,
|
|
769
|
-
'data-garden-version': '8.
|
|
532
|
+
'data-garden-version': '8.58.0'
|
|
770
533
|
}).withConfig({
|
|
771
534
|
displayName: "StyledMediaBody",
|
|
772
535
|
componentId: "sc-36j7ef-0"
|
|
773
|
-
})(["display:block;overflow:hidden;padding-", ":", "px;", ";"],
|
|
774
|
-
return props.theme.rtl ? 'right' : 'left';
|
|
775
|
-
}, function (props) {
|
|
776
|
-
return props.theme.space.base * 2;
|
|
777
|
-
}, function (props) {
|
|
778
|
-
return retrieveComponentStyles(COMPONENT_ID$9, props);
|
|
779
|
-
});
|
|
536
|
+
})(["display:block;overflow:hidden;padding-", ":", "px;", ";"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.space.base * 2, props => retrieveComponentStyles(COMPONENT_ID$9, props));
|
|
780
537
|
StyledMediaBody.defaultProps = {
|
|
781
538
|
theme: DEFAULT_THEME
|
|
782
539
|
};
|
|
783
540
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
541
|
+
const COMPONENT_ID$8 = 'dropdowns.media_figure';
|
|
542
|
+
const StyledMediaFigure = styled(
|
|
543
|
+
_ref => {
|
|
544
|
+
let {
|
|
545
|
+
children,
|
|
546
|
+
isCompact,
|
|
547
|
+
theme,
|
|
548
|
+
...props
|
|
549
|
+
} = _ref;
|
|
792
550
|
return (
|
|
793
551
|
React__default.cloneElement(Children.only(children), props)
|
|
794
552
|
);
|
|
795
553
|
}).attrs({
|
|
796
554
|
'data-garden-id': COMPONENT_ID$8,
|
|
797
|
-
'data-garden-version': '8.
|
|
555
|
+
'data-garden-version': '8.58.0'
|
|
798
556
|
}).withConfig({
|
|
799
557
|
displayName: "StyledMediaFigure",
|
|
800
558
|
componentId: "sc-2f2x8x-0"
|
|
801
|
-
})(["float:", ";margin-top:", "px !important;width:", ";height:", ";", ";"],
|
|
802
|
-
return props.theme.rtl ? 'right' : 'left';
|
|
803
|
-
}, function (props) {
|
|
804
|
-
return props.theme.space.base * 0.5;
|
|
805
|
-
}, function (props) {
|
|
806
|
-
return props.theme.iconSizes.md;
|
|
807
|
-
}, function (props) {
|
|
808
|
-
return props.theme.iconSizes.md;
|
|
809
|
-
}, function (props) {
|
|
810
|
-
return retrieveComponentStyles(COMPONENT_ID$8, props);
|
|
811
|
-
});
|
|
559
|
+
})(["float:", ";margin-top:", "px !important;width:", ";height:", ";", ";"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.space.base * 0.5, props => props.theme.iconSizes.md, props => props.theme.iconSizes.md, props => retrieveComponentStyles(COMPONENT_ID$8, props));
|
|
812
560
|
StyledMediaFigure.defaultProps = {
|
|
813
561
|
theme: DEFAULT_THEME
|
|
814
562
|
};
|
|
815
563
|
|
|
816
|
-
|
|
817
|
-
|
|
564
|
+
const COMPONENT_ID$7 = 'dropdowns.media_item';
|
|
565
|
+
const StyledMediaItem = styled(StyledItem).attrs({
|
|
818
566
|
'data-garden-id': COMPONENT_ID$7,
|
|
819
|
-
'data-garden-version': '8.
|
|
567
|
+
'data-garden-version': '8.58.0'
|
|
820
568
|
}).withConfig({
|
|
821
569
|
displayName: "StyledMediaItem",
|
|
822
570
|
componentId: "sc-ikwshz-0"
|
|
823
|
-
})(["", ";"],
|
|
824
|
-
return retrieveComponentStyles(COMPONENT_ID$7, props);
|
|
825
|
-
});
|
|
571
|
+
})(["", ";"], props => retrieveComponentStyles(COMPONENT_ID$7, props));
|
|
826
572
|
StyledMediaItem.defaultProps = {
|
|
827
573
|
theme: DEFAULT_THEME
|
|
828
574
|
};
|
|
829
575
|
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
};
|
|
838
|
-
}).withConfig({
|
|
576
|
+
const COMPONENT_ID$6 = 'dropdowns.faux_input';
|
|
577
|
+
const StyledFauxInput = styled(FauxInput).attrs(props => ({
|
|
578
|
+
'data-garden-id': COMPONENT_ID$6,
|
|
579
|
+
'data-garden-version': '8.58.0',
|
|
580
|
+
mediaLayout: true,
|
|
581
|
+
theme: props.theme
|
|
582
|
+
})).withConfig({
|
|
839
583
|
displayName: "StyledFauxInput",
|
|
840
584
|
componentId: "sc-1l592ed-0"
|
|
841
|
-
})(["cursor:", ";min-width:", "px;", ";"],
|
|
842
|
-
return !props.disabled && 'pointer';
|
|
843
|
-
}, function (props) {
|
|
844
|
-
return props.theme.space.base * (props.isCompact ? 25 : 36);
|
|
845
|
-
}, function (props) {
|
|
846
|
-
return retrieveComponentStyles(COMPONENT_ID$6, props);
|
|
847
|
-
});
|
|
585
|
+
})(["cursor:", ";min-width:", "px;", ";"], props => !props.disabled && 'pointer', props => props.theme.space.base * (props.isCompact ? 25 : 36), props => retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
848
586
|
StyledFauxInput.defaultProps = {
|
|
849
587
|
theme: DEFAULT_THEME
|
|
850
588
|
};
|
|
851
589
|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
590
|
+
const COMPONENT_ID$5 = 'dropdowns.input';
|
|
591
|
+
const hiddenStyling = css(["position:fixed;border:0;clip:rect(1px,1px,1px,1px);padding:0;width:1px;height:1px;overflow:hidden;white-space:nowrap;"]);
|
|
592
|
+
const StyledInput = styled(Input).attrs({
|
|
855
593
|
'data-garden-id': COMPONENT_ID$5,
|
|
856
|
-
'data-garden-version': '8.
|
|
594
|
+
'data-garden-version': '8.58.0',
|
|
857
595
|
isBare: true
|
|
858
596
|
}).withConfig({
|
|
859
597
|
displayName: "StyledInput",
|
|
860
598
|
componentId: "sc-hzhvmp-0"
|
|
861
|
-
})(["", ";", ";"],
|
|
862
|
-
return props.isHidden && hiddenStyling;
|
|
863
|
-
}, function (props) {
|
|
864
|
-
return retrieveComponentStyles(COMPONENT_ID$5, props);
|
|
865
|
-
});
|
|
599
|
+
})(["", ";", ";"], props => props.isHidden && hiddenStyling, props => retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
866
600
|
StyledInput.defaultProps = {
|
|
867
601
|
theme: DEFAULT_THEME
|
|
868
602
|
};
|
|
869
603
|
|
|
870
|
-
|
|
871
|
-
|
|
604
|
+
const COMPONENT_ID$4 = 'dropdowns.select';
|
|
605
|
+
const StyledSelect = styled.div.attrs({
|
|
872
606
|
'data-garden-id': COMPONENT_ID$4,
|
|
873
|
-
'data-garden-version': '8.
|
|
607
|
+
'data-garden-version': '8.58.0'
|
|
874
608
|
}).withConfig({
|
|
875
609
|
displayName: "StyledSelect",
|
|
876
610
|
componentId: "sc-xifmwj-0"
|
|
877
|
-
})(["flex-grow:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", ";"],
|
|
878
|
-
return retrieveComponentStyles(COMPONENT_ID$4, props);
|
|
879
|
-
});
|
|
611
|
+
})(["flex-grow:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", ";"], props => retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
880
612
|
StyledSelect.defaultProps = {
|
|
881
613
|
theme: DEFAULT_THEME
|
|
882
614
|
};
|
|
883
615
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
616
|
+
const COMPONENT_ID$3 = 'dropdowns.multiselect_input';
|
|
617
|
+
const visibleStyling = props => {
|
|
618
|
+
const margin = props.isVisible ? `${props.theme.space.base / 2}px` : 0;
|
|
619
|
+
const minWidth = props.isVisible ? `${props.theme.space.base * 15}px` : 0;
|
|
620
|
+
let height = '0';
|
|
889
621
|
if (props.isVisible) {
|
|
890
|
-
height =
|
|
622
|
+
height = `${props.theme.space.base * (props.isCompact ? 5 : 8)}px`;
|
|
891
623
|
}
|
|
892
624
|
return css(["opacity:", ";margin:", ";width:", ";min-width:", ";height:", ";"], !props.isVisible && 0, margin, !props.isVisible && 0, minWidth, height);
|
|
893
625
|
};
|
|
894
|
-
|
|
626
|
+
const StyledMultiselectInput = styled(StyledInput).attrs({
|
|
895
627
|
'data-garden-id': COMPONENT_ID$3,
|
|
896
|
-
'data-garden-version': '8.
|
|
628
|
+
'data-garden-version': '8.58.0'
|
|
897
629
|
}).withConfig({
|
|
898
630
|
displayName: "StyledMultiselectInput",
|
|
899
631
|
componentId: "sc-1avnf6f-0"
|
|
900
|
-
})(["flex-basis:", "px;flex-grow:1;align-self:center;min-height:0;", ";", ";"],
|
|
901
|
-
return props.theme.space.base * 15;
|
|
902
|
-
}, function (props) {
|
|
903
|
-
return visibleStyling(props);
|
|
904
|
-
}, function (props) {
|
|
905
|
-
return retrieveComponentStyles(COMPONENT_ID$3, props);
|
|
906
|
-
});
|
|
632
|
+
})(["flex-basis:", "px;flex-grow:1;align-self:center;min-height:0;", ";", ";"], props => props.theme.space.base * 15, props => visibleStyling(props), props => retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
907
633
|
StyledMultiselectInput.defaultProps = {
|
|
908
634
|
theme: DEFAULT_THEME
|
|
909
635
|
};
|
|
910
636
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
637
|
+
const COMPONENT_ID$2 = 'dropdowns.multiselect_items_container';
|
|
638
|
+
const sizeStyles = props => {
|
|
639
|
+
let margin;
|
|
640
|
+
let padding;
|
|
915
641
|
if (!props.isBare) {
|
|
916
|
-
|
|
917
|
-
margin =
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
padding =
|
|
642
|
+
const marginVertical = props.isCompact ? `-${props.theme.space.base * 1.5}px` : `-${props.theme.space.base * 2.5}px`;
|
|
643
|
+
margin = `${marginVertical} 0`;
|
|
644
|
+
const paddingVertical = props.isCompact ? '3px' : '1px';
|
|
645
|
+
const paddingEnd = `${props.theme.space.base}px`;
|
|
646
|
+
padding = `${paddingVertical} ${props.theme.rtl ? 0 : paddingEnd} ${paddingVertical} ${props.theme.rtl ? paddingEnd : 0}`;
|
|
921
647
|
}
|
|
922
648
|
return css(["margin:", ";padding:", ";"], margin, padding);
|
|
923
649
|
};
|
|
924
|
-
|
|
650
|
+
const StyledMultiselectItemsContainer = styled.div.attrs({
|
|
925
651
|
'data-garden-id': COMPONENT_ID$2,
|
|
926
|
-
'data-garden-version': '8.
|
|
652
|
+
'data-garden-version': '8.58.0'
|
|
927
653
|
}).withConfig({
|
|
928
654
|
displayName: "StyledMultiselectItemsContainer",
|
|
929
655
|
componentId: "sc-1jzhet8-0"
|
|
930
|
-
})(["display:inline-flex;flex-grow:1;flex-wrap:wrap;min-width:0;", ";", ";"],
|
|
931
|
-
return sizeStyles(props);
|
|
932
|
-
}, function (props) {
|
|
933
|
-
return retrieveComponentStyles(COMPONENT_ID$2, props);
|
|
934
|
-
});
|
|
656
|
+
})(["display:inline-flex;flex-grow:1;flex-wrap:wrap;min-width:0;", ";", ";"], props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
935
657
|
StyledMultiselectItemsContainer.defaultProps = {
|
|
936
658
|
theme: DEFAULT_THEME
|
|
937
659
|
};
|
|
938
660
|
|
|
939
|
-
|
|
940
|
-
|
|
661
|
+
const COMPONENT_ID$1 = 'dropdowns.multiselect_item_wrapper';
|
|
662
|
+
const StyledMultiselectItemWrapper = styled.div.attrs({
|
|
941
663
|
'data-garden-id': COMPONENT_ID$1,
|
|
942
|
-
'data-garden-version': '8.
|
|
664
|
+
'data-garden-version': '8.58.0'
|
|
943
665
|
}).withConfig({
|
|
944
666
|
displayName: "StyledMultiselectItemWrapper",
|
|
945
667
|
componentId: "sc-1rb2bye-0"
|
|
946
|
-
})(["display:inline-flex;align-items:center;margin:", "px;max-width:100%;", ";"],
|
|
947
|
-
return props.theme.space.base / 2;
|
|
948
|
-
}, function (props) {
|
|
949
|
-
return retrieveComponentStyles(COMPONENT_ID$1, props);
|
|
950
|
-
});
|
|
668
|
+
})(["display:inline-flex;align-items:center;margin:", "px;max-width:100%;", ";"], props => props.theme.space.base / 2, props => retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
951
669
|
StyledMultiselectItemWrapper.defaultProps = {
|
|
952
670
|
theme: DEFAULT_THEME
|
|
953
671
|
};
|
|
954
672
|
|
|
955
|
-
|
|
956
|
-
|
|
673
|
+
const COMPONENT_ID = 'dropdowns.multiselect_more_anchor';
|
|
674
|
+
const StyledMultiselectMoreAnchor = styled.div.attrs({
|
|
957
675
|
'data-garden-id': COMPONENT_ID,
|
|
958
|
-
'data-garden-version': '8.
|
|
676
|
+
'data-garden-version': '8.58.0'
|
|
959
677
|
}).withConfig({
|
|
960
678
|
displayName: "StyledMultiselectMoreAnchor",
|
|
961
679
|
componentId: "sc-1m9v46e-0"
|
|
962
|
-
})(["display:inline-block;cursor:", ";padding:", "px 0;overflow:hidden;user-select:none;text-overflow:ellipsis;line-height:", ";white-space:nowrap;color:", ";:hover{text-decoration:", ";}", ";"],
|
|
963
|
-
return props.isDisabled ? 'default' : 'pointer';
|
|
964
|
-
}, function (props) {
|
|
965
|
-
return props.theme.space.base * (props.isCompact ? 0.75 : 1.5);
|
|
966
|
-
}, function (props) {
|
|
967
|
-
return props.isCompact ? '1em' : getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md);
|
|
968
|
-
}, function (props) {
|
|
969
|
-
return props.isDisabled ? getColor('neutralHue', 400, props.theme) : getColor('primaryHue', 600, props.theme);
|
|
970
|
-
}, function (props) {
|
|
971
|
-
return !props.isDisabled && 'underline';
|
|
972
|
-
}, function (props) {
|
|
973
|
-
return retrieveComponentStyles(COMPONENT_ID, props);
|
|
974
|
-
});
|
|
680
|
+
})(["display:inline-block;cursor:", ";padding:", "px 0;overflow:hidden;user-select:none;text-overflow:ellipsis;line-height:", ";white-space:nowrap;color:", ";:hover{text-decoration:", ";}", ";"], props => props.isDisabled ? 'default' : 'pointer', props => props.theme.space.base * (props.isCompact ? 0.75 : 1.5), props => props.isCompact ? '1em' : getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => props.isDisabled ? getColor('neutralHue', 400, props.theme) : getColor('primaryHue', 600, props.theme), props => !props.isDisabled && 'underline', props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
975
681
|
StyledMultiselectMoreAnchor.defaultProps = {
|
|
976
682
|
theme: DEFAULT_THEME
|
|
977
683
|
};
|
|
978
684
|
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
getRootProps
|
|
990
|
-
getToggleButtonProps
|
|
991
|
-
getInputProps
|
|
992
|
-
isOpen
|
|
993
|
-
highlightedIndex
|
|
994
|
-
selectItemAtIndex
|
|
995
|
-
setHighlightedIndex
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
useEffect(function () {
|
|
685
|
+
const Trigger = _ref => {
|
|
686
|
+
let {
|
|
687
|
+
children,
|
|
688
|
+
refKey,
|
|
689
|
+
...triggerProps
|
|
690
|
+
} = _ref;
|
|
691
|
+
const {
|
|
692
|
+
hasMenuRef,
|
|
693
|
+
itemSearchRegistry,
|
|
694
|
+
downshift: {
|
|
695
|
+
getRootProps,
|
|
696
|
+
getToggleButtonProps,
|
|
697
|
+
getInputProps,
|
|
698
|
+
isOpen,
|
|
699
|
+
highlightedIndex,
|
|
700
|
+
selectItemAtIndex,
|
|
701
|
+
setHighlightedIndex
|
|
702
|
+
}
|
|
703
|
+
} = useDropdownContext();
|
|
704
|
+
const hiddenInputRef = useRef(null);
|
|
705
|
+
const triggerRef = useRef(null);
|
|
706
|
+
const previousIsOpenRef = useRef(undefined);
|
|
707
|
+
const [searchString, setSearchString] = useState('');
|
|
708
|
+
const searchTimeoutRef = useRef();
|
|
709
|
+
const currentSearchIndexRef = useRef(0);
|
|
710
|
+
useEffect(() => {
|
|
1006
711
|
if (hiddenInputRef.current && isOpen && !previousIsOpenRef.current) {
|
|
1007
712
|
hiddenInputRef.current.focus();
|
|
1008
713
|
}
|
|
@@ -1011,32 +716,32 @@ var Trigger = function Trigger(_ref) {
|
|
|
1011
716
|
}
|
|
1012
717
|
previousIsOpenRef.current = isOpen;
|
|
1013
718
|
}, [isOpen, hasMenuRef]);
|
|
1014
|
-
useEffect(
|
|
719
|
+
useEffect(() => {
|
|
1015
720
|
if (hasMenuRef.current === false) {
|
|
1016
721
|
hasMenuRef.current = true;
|
|
1017
722
|
}
|
|
1018
723
|
}, [hasMenuRef]);
|
|
1019
|
-
useEffect(
|
|
724
|
+
useEffect(() => {
|
|
1020
725
|
if (searchTimeoutRef.current) {
|
|
1021
726
|
clearTimeout(searchTimeoutRef.current);
|
|
1022
727
|
}
|
|
1023
|
-
searchTimeoutRef.current = window.setTimeout(
|
|
728
|
+
searchTimeoutRef.current = window.setTimeout(() => {
|
|
1024
729
|
setSearchString('');
|
|
1025
730
|
}, 500);
|
|
1026
|
-
return
|
|
731
|
+
return () => {
|
|
1027
732
|
clearTimeout(searchTimeoutRef.current);
|
|
1028
733
|
};
|
|
1029
734
|
}, [searchString]);
|
|
1030
|
-
|
|
1031
|
-
for (
|
|
1032
|
-
|
|
735
|
+
const searchItems = useCallback((searchValue, startIndex, endIndex) => {
|
|
736
|
+
for (let index = startIndex; index < endIndex; index++) {
|
|
737
|
+
const itemTextValue = itemSearchRegistry.current[index];
|
|
1033
738
|
if (itemTextValue && itemTextValue.toUpperCase().indexOf(searchValue.toUpperCase()) === 0) {
|
|
1034
739
|
return index;
|
|
1035
740
|
}
|
|
1036
741
|
}
|
|
1037
742
|
return undefined;
|
|
1038
743
|
}, [itemSearchRegistry]);
|
|
1039
|
-
|
|
744
|
+
const onInputKeyDown = useCallback(e => {
|
|
1040
745
|
if (e.keyCode === KEY_CODES.SPACE) {
|
|
1041
746
|
if (searchString) {
|
|
1042
747
|
e.preventDefault();
|
|
@@ -1050,7 +755,7 @@ var Trigger = function Trigger(_ref) {
|
|
|
1050
755
|
if ((e.keyCode < 48 || e.keyCode > 57) && (e.keyCode < 65 || e.keyCode > 90) && e.keyCode !== KEY_CODES.SPACE) {
|
|
1051
756
|
return;
|
|
1052
757
|
}
|
|
1053
|
-
|
|
758
|
+
const character = String.fromCharCode(e.which || e.keyCode);
|
|
1054
759
|
if (!character || character.length === 0) {
|
|
1055
760
|
return;
|
|
1056
761
|
}
|
|
@@ -1061,9 +766,9 @@ var Trigger = function Trigger(_ref) {
|
|
|
1061
766
|
currentSearchIndexRef.current = highlightedIndex;
|
|
1062
767
|
}
|
|
1063
768
|
}
|
|
1064
|
-
|
|
769
|
+
const newSearchString = searchString + character;
|
|
1065
770
|
setSearchString(newSearchString);
|
|
1066
|
-
|
|
771
|
+
let matchingIndex = searchItems(newSearchString, currentSearchIndexRef.current + 1, itemSearchRegistry.current.length);
|
|
1067
772
|
if (matchingIndex === undefined) {
|
|
1068
773
|
matchingIndex = searchItems(newSearchString, 0, currentSearchIndexRef.current);
|
|
1069
774
|
}
|
|
@@ -1071,35 +776,45 @@ var Trigger = function Trigger(_ref) {
|
|
|
1071
776
|
setHighlightedIndex(matchingIndex);
|
|
1072
777
|
}
|
|
1073
778
|
}, [searchString, searchItems, itemSearchRegistry, highlightedIndex, selectItemAtIndex, setHighlightedIndex]);
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
779
|
+
const renderChildren = popperRef => {
|
|
780
|
+
const {
|
|
781
|
+
ref: rootPropsRefCallback,
|
|
782
|
+
...rootProps
|
|
783
|
+
} = getRootProps();
|
|
784
|
+
const listboxToggleProps = getToggleButtonProps({
|
|
785
|
+
...rootProps,
|
|
1079
786
|
role: null,
|
|
1080
|
-
'aria-labelledby': undefined
|
|
1081
|
-
|
|
1082
|
-
|
|
787
|
+
'aria-labelledby': undefined,
|
|
788
|
+
...triggerProps,
|
|
789
|
+
...children.props
|
|
790
|
+
});
|
|
791
|
+
const menuToggleProps = {
|
|
792
|
+
...listboxToggleProps,
|
|
1083
793
|
'aria-haspopup': 'true',
|
|
1084
794
|
'aria-controls': listboxToggleProps['aria-owns'],
|
|
1085
795
|
'aria-owns': null
|
|
796
|
+
};
|
|
797
|
+
const toggleButtonProps = hasMenuRef.current ? menuToggleProps : listboxToggleProps;
|
|
798
|
+
return React__default.cloneElement(React__default.Children.only(children), {
|
|
799
|
+
...toggleButtonProps,
|
|
800
|
+
[refKey]: childRef => {
|
|
801
|
+
popperRef(childRef);
|
|
802
|
+
triggerRef.current = childRef;
|
|
803
|
+
rootPropsRefCallback(childRef);
|
|
804
|
+
}
|
|
1086
805
|
});
|
|
1087
|
-
var toggleButtonProps = hasMenuRef.current ? menuToggleProps : listboxToggleProps;
|
|
1088
|
-
return React__default.cloneElement(React__default.Children.only(children), _objectSpread2(_objectSpread2({}, toggleButtonProps), {}, _defineProperty({}, refKey, function (childRef) {
|
|
1089
|
-
popperRef(childRef);
|
|
1090
|
-
triggerRef.current = childRef;
|
|
1091
|
-
rootPropsRefCallback(childRef);
|
|
1092
|
-
})));
|
|
1093
806
|
};
|
|
1094
|
-
return React__default.createElement(Reference, null,
|
|
1095
|
-
|
|
807
|
+
return React__default.createElement(Reference, null, _ref2 => {
|
|
808
|
+
let {
|
|
809
|
+
ref: popperReference
|
|
810
|
+
} = _ref2;
|
|
1096
811
|
return React__default.createElement(React__default.Fragment, null, renderChildren(popperReference), React__default.createElement(StyledInput, getInputProps({
|
|
1097
812
|
readOnly: true,
|
|
1098
813
|
isHidden: true,
|
|
1099
814
|
tabIndex: -1,
|
|
1100
815
|
ref: hiddenInputRef,
|
|
1101
816
|
value: '',
|
|
1102
|
-
onClick:
|
|
817
|
+
onClick: e => {
|
|
1103
818
|
if (isOpen) {
|
|
1104
819
|
e.nativeEvent.preventDownshiftDefault = true;
|
|
1105
820
|
}
|
|
@@ -1127,91 +842,88 @@ var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
|
|
|
1127
842
|
height: 16,
|
|
1128
843
|
focusable: "false",
|
|
1129
844
|
viewBox: "0 0 16 16",
|
|
1130
|
-
"aria-hidden": "true"
|
|
845
|
+
"aria-hidden": "true",
|
|
846
|
+
role: "img"
|
|
1131
847
|
}, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
|
|
1132
848
|
fill: "currentColor",
|
|
1133
849
|
d: "M12.688 5.61a.5.5 0 01.69.718l-.066.062-5 4a.5.5 0 01-.542.054l-.082-.054-5-4a.5.5 0 01.55-.83l.074.05L8 9.359l4.688-3.75z"
|
|
1134
850
|
})));
|
|
1135
851
|
};
|
|
1136
852
|
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
853
|
+
const FieldContext = React__default.createContext(undefined);
|
|
854
|
+
const useFieldContext = () => {
|
|
855
|
+
const fieldContext = useContext(FieldContext);
|
|
1140
856
|
if (!fieldContext) {
|
|
1141
857
|
throw new Error('This component must be rendered within a `Field` component.');
|
|
1142
858
|
}
|
|
1143
859
|
return fieldContext;
|
|
1144
860
|
};
|
|
1145
861
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
getToggleButtonProps
|
|
1157
|
-
getInputProps
|
|
1158
|
-
getRootProps
|
|
1159
|
-
isOpen
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
isFocused = _useState4[0],
|
|
1173
|
-
setIsFocused = _useState4[1];
|
|
1174
|
-
useEffect(function () {
|
|
862
|
+
const Autocomplete = forwardRef((_ref, ref) => {
|
|
863
|
+
let {
|
|
864
|
+
children,
|
|
865
|
+
inputRef: controlledInputRef,
|
|
866
|
+
start,
|
|
867
|
+
...props
|
|
868
|
+
} = _ref;
|
|
869
|
+
const {
|
|
870
|
+
popperReferenceElementRef,
|
|
871
|
+
downshift: {
|
|
872
|
+
getToggleButtonProps,
|
|
873
|
+
getInputProps,
|
|
874
|
+
getRootProps,
|
|
875
|
+
isOpen
|
|
876
|
+
},
|
|
877
|
+
setDropdownType
|
|
878
|
+
} = useDropdownContext();
|
|
879
|
+
const {
|
|
880
|
+
isLabelHovered
|
|
881
|
+
} = useFieldContext();
|
|
882
|
+
const inputRef = useRef();
|
|
883
|
+
const triggerRef = useRef();
|
|
884
|
+
const previousIsOpenRef = useRef(isOpen);
|
|
885
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
886
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
887
|
+
useEffect(() => {
|
|
1175
888
|
if (inputRef.current && isOpen !== previousIsOpenRef.current) {
|
|
1176
889
|
inputRef.current.focus();
|
|
1177
890
|
}
|
|
1178
891
|
previousIsOpenRef.current = isOpen;
|
|
1179
892
|
}, [inputRef, isOpen]);
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
893
|
+
const {
|
|
894
|
+
type,
|
|
895
|
+
onKeyDown,
|
|
896
|
+
...selectProps
|
|
897
|
+
} = getToggleButtonProps(getRootProps({
|
|
898
|
+
role: null,
|
|
899
|
+
...props,
|
|
900
|
+
onKeyDown: e => {
|
|
1184
901
|
if (isOpen) {
|
|
1185
902
|
e.nativeEvent.preventDownshiftDefault = true;
|
|
1186
903
|
}
|
|
1187
904
|
},
|
|
1188
|
-
onMouseEnter: composeEventHandlers(props.onMouseEnter,
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
_getToggleButtonProps.type;
|
|
1196
|
-
var onKeyDown = _getToggleButtonProps.onKeyDown,
|
|
1197
|
-
selectProps = _objectWithoutProperties(_getToggleButtonProps, _excluded2$4);
|
|
1198
|
-
var onSelectKeyDown = composeEventHandlers(props.onKeyDown, onKeyDown);
|
|
1199
|
-
var isContainerHovered = isLabelHovered && !isOpen;
|
|
1200
|
-
var isContainerFocused = isOpen || isFocused;
|
|
1201
|
-
useEffect(function () {
|
|
905
|
+
onMouseEnter: composeEventHandlers(props.onMouseEnter, () => setIsHovered(true)),
|
|
906
|
+
onMouseLeave: composeEventHandlers(props.onMouseLeave, () => setIsHovered(false))
|
|
907
|
+
}));
|
|
908
|
+
const onSelectKeyDown = composeEventHandlers(props.onKeyDown, onKeyDown);
|
|
909
|
+
const isContainerHovered = isLabelHovered && !isOpen;
|
|
910
|
+
const isContainerFocused = isOpen || isFocused;
|
|
911
|
+
useEffect(() => {
|
|
1202
912
|
setDropdownType('autocomplete');
|
|
1203
913
|
}, [setDropdownType]);
|
|
1204
|
-
return React__default.createElement(Reference, null,
|
|
1205
|
-
|
|
914
|
+
return React__default.createElement(Reference, null, _ref2 => {
|
|
915
|
+
let {
|
|
916
|
+
ref: popperReference
|
|
917
|
+
} = _ref2;
|
|
1206
918
|
return React__default.createElement(StyledFauxInput, _extends$5({
|
|
1207
919
|
isHovered: isContainerHovered,
|
|
1208
920
|
isFocused: isContainerFocused,
|
|
1209
921
|
tabIndex: null,
|
|
1210
922
|
onKeyDown: onSelectKeyDown
|
|
1211
923
|
}, selectProps, {
|
|
1212
|
-
ref:
|
|
924
|
+
ref: selectRef => {
|
|
1213
925
|
popperReference(selectRef);
|
|
1214
|
-
mergeRefs([triggerRef,
|
|
926
|
+
mergeRefs([triggerRef, ref])(selectRef);
|
|
1215
927
|
popperReferenceElementRef.current = selectRef;
|
|
1216
928
|
}
|
|
1217
929
|
}), start && React__default.createElement(StyledFauxInput.StartIcon, {
|
|
@@ -1221,13 +933,13 @@ var Autocomplete = forwardRef(function (_ref, _ref3) {
|
|
|
1221
933
|
}, start), !isOpen && React__default.createElement(StyledSelect, null, children), React__default.createElement(StyledInput, getInputProps({
|
|
1222
934
|
isHidden: !isOpen,
|
|
1223
935
|
disabled: props.disabled,
|
|
1224
|
-
onFocus:
|
|
936
|
+
onFocus: () => {
|
|
1225
937
|
setIsFocused(true);
|
|
1226
938
|
},
|
|
1227
|
-
onBlur:
|
|
939
|
+
onBlur: () => {
|
|
1228
940
|
setIsFocused(false);
|
|
1229
941
|
},
|
|
1230
|
-
onClick:
|
|
942
|
+
onClick: e => {
|
|
1231
943
|
if (isOpen) {
|
|
1232
944
|
e.nativeEvent.preventDownshiftDefault = true;
|
|
1233
945
|
}
|
|
@@ -1251,72 +963,76 @@ Autocomplete.propTypes = {
|
|
|
1251
963
|
validation: PropTypes.oneOf(VALIDATION)
|
|
1252
964
|
};
|
|
1253
965
|
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
getToggleButtonProps
|
|
1271
|
-
getInputProps
|
|
1272
|
-
getRootProps
|
|
1273
|
-
isOpen
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
966
|
+
const Combobox = forwardRef((_ref, ref) => {
|
|
967
|
+
let {
|
|
968
|
+
isCompact,
|
|
969
|
+
isBare,
|
|
970
|
+
disabled,
|
|
971
|
+
focusInset,
|
|
972
|
+
placeholder,
|
|
973
|
+
validation,
|
|
974
|
+
inputRef: inputRefProp = null,
|
|
975
|
+
start,
|
|
976
|
+
end,
|
|
977
|
+
...props
|
|
978
|
+
} = _ref;
|
|
979
|
+
const {
|
|
980
|
+
popperReferenceElementRef,
|
|
981
|
+
downshift: {
|
|
982
|
+
getToggleButtonProps,
|
|
983
|
+
getInputProps,
|
|
984
|
+
getRootProps,
|
|
985
|
+
isOpen
|
|
986
|
+
},
|
|
987
|
+
setDropdownType
|
|
988
|
+
} = useDropdownContext();
|
|
989
|
+
const wrapperRef = useRef();
|
|
990
|
+
const inputRef = useRef();
|
|
991
|
+
const isOpenRef = useRef(isOpen);
|
|
992
|
+
const wrapperProps = getToggleButtonProps(getRootProps({
|
|
1279
993
|
role: null,
|
|
1280
994
|
type: null,
|
|
1281
|
-
onClick:
|
|
995
|
+
onClick: event => {
|
|
1282
996
|
event.nativeEvent.preventDownshiftDefault = true;
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
onKeyDown:
|
|
997
|
+
},
|
|
998
|
+
...props,
|
|
999
|
+
onKeyDown: event => {
|
|
1286
1000
|
event.nativeEvent.preventDownshiftDefault = true;
|
|
1287
1001
|
}
|
|
1288
|
-
}))
|
|
1289
|
-
|
|
1290
|
-
isCompact
|
|
1291
|
-
isBare
|
|
1292
|
-
disabled
|
|
1293
|
-
focusInset
|
|
1294
|
-
placeholder
|
|
1295
|
-
validation
|
|
1296
|
-
start
|
|
1297
|
-
end
|
|
1002
|
+
}));
|
|
1003
|
+
const inputProps = getInputProps({
|
|
1004
|
+
isCompact,
|
|
1005
|
+
isBare,
|
|
1006
|
+
disabled,
|
|
1007
|
+
focusInset,
|
|
1008
|
+
placeholder,
|
|
1009
|
+
validation,
|
|
1010
|
+
start,
|
|
1011
|
+
end,
|
|
1298
1012
|
role: 'combobox',
|
|
1299
|
-
onKeyDown:
|
|
1013
|
+
onKeyDown: event => {
|
|
1300
1014
|
if (event.keyCode === KEY_CODES.SPACE || !isOpen && [KEY_CODES.DOWN, KEY_CODES.UP].includes(event.keyCode)) {
|
|
1301
1015
|
event.nativeEvent.preventDownshiftDefault = true;
|
|
1302
1016
|
}
|
|
1303
1017
|
},
|
|
1304
|
-
onClick:
|
|
1018
|
+
onClick: event => {
|
|
1305
1019
|
event.nativeEvent.preventDownshiftDefault = true;
|
|
1306
1020
|
}
|
|
1307
1021
|
});
|
|
1308
|
-
useEffect(
|
|
1022
|
+
useEffect(() => {
|
|
1309
1023
|
if (inputRef.current && isOpen !== isOpenRef.current) {
|
|
1310
1024
|
inputRef.current.focus();
|
|
1311
1025
|
}
|
|
1312
1026
|
isOpenRef.current = isOpen;
|
|
1313
1027
|
}, [inputRef, isOpen]);
|
|
1314
|
-
useEffect(
|
|
1028
|
+
useEffect(() => {
|
|
1315
1029
|
setDropdownType('combobox');
|
|
1316
1030
|
}, [setDropdownType]);
|
|
1317
|
-
return React__default.createElement(Reference, null,
|
|
1318
|
-
|
|
1319
|
-
|
|
1031
|
+
return React__default.createElement(Reference, null, _ref2 => {
|
|
1032
|
+
let {
|
|
1033
|
+
ref: popperReference
|
|
1034
|
+
} = _ref2;
|
|
1035
|
+
const wrapperRefProp = element => {
|
|
1320
1036
|
popperReference(element);
|
|
1321
1037
|
mergeRefs([wrapperRef, ref])(element);
|
|
1322
1038
|
popperReferenceElementRef.current = element;
|
|
@@ -1338,73 +1054,66 @@ Combobox.propTypes = {
|
|
|
1338
1054
|
validation: PropTypes.oneOf(VALIDATION)
|
|
1339
1055
|
};
|
|
1340
1056
|
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
focusedItem = _useState6[0],
|
|
1387
|
-
setFocusedItem = _useState6[1];
|
|
1388
|
-
var themeContext = useContext(ThemeContext);
|
|
1389
|
-
var environment = useDocument(themeContext);
|
|
1390
|
-
var _useSelection = useSelection({
|
|
1057
|
+
const Multiselect = React__default.forwardRef((_ref, ref) => {
|
|
1058
|
+
let {
|
|
1059
|
+
renderItem,
|
|
1060
|
+
placeholder,
|
|
1061
|
+
maxItems,
|
|
1062
|
+
renderShowMore,
|
|
1063
|
+
inputRef: externalInputRef = null,
|
|
1064
|
+
start,
|
|
1065
|
+
onKeyDown,
|
|
1066
|
+
...props
|
|
1067
|
+
} = _ref;
|
|
1068
|
+
const {
|
|
1069
|
+
popperReferenceElementRef,
|
|
1070
|
+
selectedItems = [],
|
|
1071
|
+
containsMultiselectRef,
|
|
1072
|
+
previousIndexRef,
|
|
1073
|
+
downshift: {
|
|
1074
|
+
getToggleButtonProps,
|
|
1075
|
+
getRootProps,
|
|
1076
|
+
getInputProps,
|
|
1077
|
+
isOpen,
|
|
1078
|
+
closeMenu,
|
|
1079
|
+
inputValue,
|
|
1080
|
+
setState: setDownshiftState,
|
|
1081
|
+
itemToString
|
|
1082
|
+
},
|
|
1083
|
+
setDropdownType
|
|
1084
|
+
} = useDropdownContext();
|
|
1085
|
+
const {
|
|
1086
|
+
isLabelHovered
|
|
1087
|
+
} = useFieldContext();
|
|
1088
|
+
const inputRef = useRef();
|
|
1089
|
+
const triggerRef = useRef();
|
|
1090
|
+
const blurTimeoutRef = useRef();
|
|
1091
|
+
const previousIsOpenRef = useRef(undefined);
|
|
1092
|
+
const previousIsFocusedRef = useRef(undefined);
|
|
1093
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
1094
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
1095
|
+
const [focusedItem, setFocusedItem] = useState(undefined);
|
|
1096
|
+
const themeContext = useContext(ThemeContext);
|
|
1097
|
+
const environment = useDocument(themeContext);
|
|
1098
|
+
const {
|
|
1099
|
+
getContainerProps,
|
|
1100
|
+
getItemProps
|
|
1101
|
+
} = useSelection({
|
|
1391
1102
|
rtl: themeContext.rtl,
|
|
1392
|
-
focusedItem
|
|
1103
|
+
focusedItem,
|
|
1393
1104
|
selectedItem: undefined,
|
|
1394
|
-
onFocus:
|
|
1105
|
+
onFocus: item => {
|
|
1395
1106
|
setFocusedItem(item);
|
|
1396
1107
|
}
|
|
1397
|
-
})
|
|
1398
|
-
|
|
1399
|
-
getItemProps = _useSelection.getItemProps;
|
|
1400
|
-
useEffect(function () {
|
|
1108
|
+
});
|
|
1109
|
+
useEffect(() => {
|
|
1401
1110
|
containsMultiselectRef.current = true;
|
|
1402
|
-
|
|
1403
|
-
return
|
|
1111
|
+
const tempRef = blurTimeoutRef;
|
|
1112
|
+
return () => {
|
|
1404
1113
|
clearTimeout(tempRef.current);
|
|
1405
1114
|
};
|
|
1406
1115
|
}, []);
|
|
1407
|
-
useEffect(
|
|
1116
|
+
useEffect(() => {
|
|
1408
1117
|
if (inputRef.current) {
|
|
1409
1118
|
if (isOpen && !previousIsOpenRef.current) {
|
|
1410
1119
|
inputRef.current.focus();
|
|
@@ -1415,14 +1124,17 @@ var Multiselect = React__default.forwardRef(function (_ref, _ref3) {
|
|
|
1415
1124
|
previousIsOpenRef.current = isOpen;
|
|
1416
1125
|
previousIsFocusedRef.current = isFocused;
|
|
1417
1126
|
}, [isOpen, inputRef, isFocused, focusedItem]);
|
|
1418
|
-
useEffect(
|
|
1127
|
+
useEffect(() => {
|
|
1419
1128
|
if (focusedItem !== undefined && isOpen) {
|
|
1420
1129
|
closeMenu();
|
|
1421
1130
|
}
|
|
1422
1131
|
}, [focusedItem, isOpen, closeMenu]);
|
|
1423
|
-
|
|
1132
|
+
const {
|
|
1133
|
+
type,
|
|
1134
|
+
...selectProps
|
|
1135
|
+
} = getToggleButtonProps(getRootProps({
|
|
1424
1136
|
tabIndex: props.disabled ? undefined : -1,
|
|
1425
|
-
onKeyDown: composeEventHandlers(onKeyDown,
|
|
1137
|
+
onKeyDown: composeEventHandlers(onKeyDown, e => {
|
|
1426
1138
|
if (isOpen) {
|
|
1427
1139
|
e.nativeEvent.preventDownshiftDefault = true;
|
|
1428
1140
|
} else if (!inputValue && e.keyCode === KEY_CODES.HOME) {
|
|
@@ -1430,92 +1142,88 @@ var Multiselect = React__default.forwardRef(function (_ref, _ref3) {
|
|
|
1430
1142
|
e.preventDefault();
|
|
1431
1143
|
}
|
|
1432
1144
|
}),
|
|
1433
|
-
onFocus:
|
|
1145
|
+
onFocus: () => {
|
|
1434
1146
|
setIsFocused(true);
|
|
1435
1147
|
},
|
|
1436
|
-
onBlur:
|
|
1437
|
-
|
|
1438
|
-
blurTimeoutRef.current = setTimeout(
|
|
1148
|
+
onBlur: e => {
|
|
1149
|
+
const currentTarget = e.currentTarget;
|
|
1150
|
+
blurTimeoutRef.current = setTimeout(() => {
|
|
1439
1151
|
if (environment && !currentTarget.contains(environment.activeElement)) {
|
|
1440
1152
|
setIsFocused(false);
|
|
1441
1153
|
}
|
|
1442
1154
|
}, 0);
|
|
1443
1155
|
},
|
|
1444
|
-
onMouseEnter: composeEventHandlers(props.onMouseEnter,
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
}, props)));
|
|
1452
|
-
_getToggleButtonProps.type;
|
|
1453
|
-
var selectProps = _objectWithoutProperties(_getToggleButtonProps, _excluded2$3);
|
|
1454
|
-
var renderSelectableItem = useCallback(function (item, index) {
|
|
1455
|
-
var removeValue = function removeValue() {
|
|
1156
|
+
onMouseEnter: composeEventHandlers(props.onMouseEnter, () => setIsHovered(true)),
|
|
1157
|
+
onMouseLeave: composeEventHandlers(props.onMouseLeave, () => setIsHovered(false)),
|
|
1158
|
+
role: null,
|
|
1159
|
+
...props
|
|
1160
|
+
}));
|
|
1161
|
+
const renderSelectableItem = useCallback((item, index) => {
|
|
1162
|
+
const removeValue = () => {
|
|
1456
1163
|
setDownshiftState({
|
|
1457
1164
|
type: REMOVE_ITEM_STATE_TYPE,
|
|
1458
1165
|
selectedItem: item
|
|
1459
1166
|
});
|
|
1460
1167
|
inputRef.current && inputRef.current.focus();
|
|
1461
1168
|
};
|
|
1462
|
-
|
|
1169
|
+
const renderedItem = renderItem({
|
|
1463
1170
|
value: item,
|
|
1464
|
-
removeValue
|
|
1171
|
+
removeValue
|
|
1465
1172
|
});
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
e.
|
|
1473
|
-
removeValue();
|
|
1474
|
-
}
|
|
1475
|
-
if (e.keyCode === KEY_CODES.END && !inputValue) {
|
|
1476
|
-
inputRef.current && inputRef.current.focus();
|
|
1477
|
-
e.preventDefault();
|
|
1478
|
-
}
|
|
1479
|
-
if (themeContext.rtl) {
|
|
1480
|
-
if (e.keyCode === KEY_CODES.RIGHT && index === 0) {
|
|
1173
|
+
const focusRef = React__default.createRef();
|
|
1174
|
+
const clonedChild = React__default.cloneElement(renderedItem, {
|
|
1175
|
+
...getItemProps({
|
|
1176
|
+
item,
|
|
1177
|
+
focusRef,
|
|
1178
|
+
onKeyDown: e => {
|
|
1179
|
+
if (e.keyCode === KEY_CODES.DELETE || e.keyCode === KEY_CODES.BACKSPACE) {
|
|
1481
1180
|
e.preventDefault();
|
|
1181
|
+
removeValue();
|
|
1482
1182
|
}
|
|
1483
|
-
if (e.keyCode === KEY_CODES.
|
|
1484
|
-
e.preventDefault();
|
|
1183
|
+
if (e.keyCode === KEY_CODES.END && !inputValue) {
|
|
1485
1184
|
inputRef.current && inputRef.current.focus();
|
|
1486
|
-
}
|
|
1487
|
-
} else {
|
|
1488
|
-
if (e.keyCode === KEY_CODES.LEFT && index === 0) {
|
|
1489
1185
|
e.preventDefault();
|
|
1490
1186
|
}
|
|
1491
|
-
if (
|
|
1492
|
-
e.
|
|
1493
|
-
|
|
1187
|
+
if (themeContext.rtl) {
|
|
1188
|
+
if (e.keyCode === KEY_CODES.RIGHT && index === 0) {
|
|
1189
|
+
e.preventDefault();
|
|
1190
|
+
}
|
|
1191
|
+
if (e.keyCode === KEY_CODES.LEFT && index === selectedItems.length - 1) {
|
|
1192
|
+
e.preventDefault();
|
|
1193
|
+
inputRef.current && inputRef.current.focus();
|
|
1194
|
+
}
|
|
1195
|
+
} else {
|
|
1196
|
+
if (e.keyCode === KEY_CODES.LEFT && index === 0) {
|
|
1197
|
+
e.preventDefault();
|
|
1198
|
+
}
|
|
1199
|
+
if (e.keyCode === KEY_CODES.RIGHT && index === selectedItems.length - 1) {
|
|
1200
|
+
e.preventDefault();
|
|
1201
|
+
inputRef.current && inputRef.current.focus();
|
|
1202
|
+
}
|
|
1494
1203
|
}
|
|
1495
|
-
}
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
})), {}, {
|
|
1204
|
+
},
|
|
1205
|
+
onClick: e => {
|
|
1206
|
+
e.nativeEvent.preventDownshiftDefault = true;
|
|
1207
|
+
},
|
|
1208
|
+
tabIndex: -1
|
|
1209
|
+
}),
|
|
1502
1210
|
size: props.isCompact ? 'medium' : 'large'
|
|
1503
|
-
})
|
|
1504
|
-
|
|
1211
|
+
});
|
|
1212
|
+
const key = `${itemToString(item)}-${index}`;
|
|
1505
1213
|
return React__default.createElement(StyledMultiselectItemWrapper, {
|
|
1506
1214
|
key: key
|
|
1507
1215
|
}, clonedChild);
|
|
1508
1216
|
}, [getItemProps, inputValue, renderItem, setDownshiftState, itemToString, selectedItems, props, inputRef, themeContext.rtl]);
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
for (
|
|
1513
|
-
|
|
1217
|
+
const items = useMemo(() => {
|
|
1218
|
+
const itemValues = selectedItems || [];
|
|
1219
|
+
const output = [];
|
|
1220
|
+
for (let x = 0; x < itemValues.length; x++) {
|
|
1221
|
+
const item = itemValues[x];
|
|
1514
1222
|
if (x < maxItems) {
|
|
1515
1223
|
if (props.disabled) {
|
|
1516
|
-
|
|
1224
|
+
const renderedItem = React__default.cloneElement(renderItem({
|
|
1517
1225
|
value: item,
|
|
1518
|
-
removeValue:
|
|
1226
|
+
removeValue: () => {
|
|
1519
1227
|
return undefined;
|
|
1520
1228
|
}
|
|
1521
1229
|
}), {
|
|
@@ -1533,7 +1241,7 @@ var Multiselect = React__default.forwardRef(function (_ref, _ref3) {
|
|
|
1533
1241
|
}, React__default.createElement(StyledMultiselectMoreAnchor, {
|
|
1534
1242
|
isCompact: props.isCompact,
|
|
1535
1243
|
isDisabled: props.disabled
|
|
1536
|
-
}, renderShowMore ? renderShowMore(itemValues.length - x) :
|
|
1244
|
+
}, renderShowMore ? renderShowMore(itemValues.length - x) : `+ ${itemValues.length - x} more`)));
|
|
1537
1245
|
break;
|
|
1538
1246
|
} else {
|
|
1539
1247
|
output.push(renderSelectableItem(item, x));
|
|
@@ -1541,21 +1249,24 @@ var Multiselect = React__default.forwardRef(function (_ref, _ref3) {
|
|
|
1541
1249
|
}
|
|
1542
1250
|
return output;
|
|
1543
1251
|
}, [isFocused, props.disabled, renderSelectableItem, selectedItems, renderItem, inputValue, maxItems, renderShowMore, props.isCompact]);
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
useEffect(
|
|
1252
|
+
const isContainerHovered = isLabelHovered && !isOpen;
|
|
1253
|
+
const isContainerFocused = isOpen || isFocused;
|
|
1254
|
+
useEffect(() => {
|
|
1547
1255
|
setDropdownType('multiselect');
|
|
1548
1256
|
}, [setDropdownType]);
|
|
1549
|
-
return React__default.createElement(Reference, null,
|
|
1550
|
-
|
|
1551
|
-
|
|
1257
|
+
return React__default.createElement(Reference, null, _ref2 => {
|
|
1258
|
+
let {
|
|
1259
|
+
ref: popperReference
|
|
1260
|
+
} = _ref2;
|
|
1261
|
+
return React__default.createElement(StyledFauxInput, getContainerProps({
|
|
1262
|
+
...selectProps,
|
|
1552
1263
|
isHovered: isContainerHovered,
|
|
1553
1264
|
isFocused: isContainerFocused,
|
|
1554
|
-
ref:
|
|
1265
|
+
ref: selectRef => {
|
|
1555
1266
|
popperReference(selectRef);
|
|
1556
|
-
mergeRefs([triggerRef, popperReferenceElementRef,
|
|
1267
|
+
mergeRefs([triggerRef, popperReferenceElementRef, ref])(selectRef);
|
|
1557
1268
|
}
|
|
1558
|
-
})
|
|
1269
|
+
}), start && React__default.createElement(StyledFauxInput.StartIcon, {
|
|
1559
1270
|
isHovered: isHovered || isLabelHovered && !isOpen,
|
|
1560
1271
|
isFocused: isContainerFocused,
|
|
1561
1272
|
isDisabled: props.disabled
|
|
@@ -1564,15 +1275,15 @@ var Multiselect = React__default.forwardRef(function (_ref, _ref3) {
|
|
|
1564
1275
|
isCompact: props.isCompact
|
|
1565
1276
|
}, items, React__default.createElement(StyledMultiselectInput, getInputProps({
|
|
1566
1277
|
disabled: props.disabled,
|
|
1567
|
-
onFocus:
|
|
1278
|
+
onFocus: () => {
|
|
1568
1279
|
setFocusedItem(undefined);
|
|
1569
1280
|
},
|
|
1570
|
-
onClick:
|
|
1281
|
+
onClick: e => {
|
|
1571
1282
|
if (inputValue && inputValue.length > 0 && isOpen) {
|
|
1572
1283
|
e.nativeEvent.preventDownshiftDefault = true;
|
|
1573
1284
|
}
|
|
1574
1285
|
},
|
|
1575
|
-
onKeyDown:
|
|
1286
|
+
onKeyDown: e => {
|
|
1576
1287
|
if (!inputValue) {
|
|
1577
1288
|
if (themeContext.rtl && e.keyCode === KEY_CODES.RIGHT && selectedItems.length > 0 && previousIndexRef.current === undefined) {
|
|
1578
1289
|
setFocusedItem(selectedItems[selectedItems.length - 1]);
|
|
@@ -1616,43 +1327,37 @@ Multiselect.defaultProps = {
|
|
|
1616
1327
|
};
|
|
1617
1328
|
Multiselect.displayName = 'Multiselect';
|
|
1618
1329
|
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
getToggleButtonProps
|
|
1630
|
-
getInputProps
|
|
1631
|
-
isOpen
|
|
1632
|
-
highlightedIndex
|
|
1633
|
-
setHighlightedIndex
|
|
1634
|
-
selectItemAtIndex
|
|
1635
|
-
closeMenu
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
1651
|
-
searchString = _useState6[0],
|
|
1652
|
-
setSearchString = _useState6[1];
|
|
1653
|
-
var searchTimeoutRef = useRef();
|
|
1654
|
-
var currentSearchIndexRef = useRef(0);
|
|
1655
|
-
useEffect(function () {
|
|
1330
|
+
const Select = React__default.forwardRef((_ref, ref) => {
|
|
1331
|
+
let {
|
|
1332
|
+
children,
|
|
1333
|
+
start,
|
|
1334
|
+
...props
|
|
1335
|
+
} = _ref;
|
|
1336
|
+
const {
|
|
1337
|
+
popperReferenceElementRef,
|
|
1338
|
+
itemSearchRegistry,
|
|
1339
|
+
downshift: {
|
|
1340
|
+
getToggleButtonProps,
|
|
1341
|
+
getInputProps,
|
|
1342
|
+
isOpen,
|
|
1343
|
+
highlightedIndex,
|
|
1344
|
+
setHighlightedIndex,
|
|
1345
|
+
selectItemAtIndex,
|
|
1346
|
+
closeMenu
|
|
1347
|
+
}
|
|
1348
|
+
} = useDropdownContext();
|
|
1349
|
+
const {
|
|
1350
|
+
isLabelHovered
|
|
1351
|
+
} = useFieldContext();
|
|
1352
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
1353
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
1354
|
+
const hiddenInputRef = useRef();
|
|
1355
|
+
const triggerRef = useRef();
|
|
1356
|
+
const previousIsOpenRef = useRef(undefined);
|
|
1357
|
+
const [searchString, setSearchString] = useState('');
|
|
1358
|
+
const searchTimeoutRef = useRef();
|
|
1359
|
+
const currentSearchIndexRef = useRef(0);
|
|
1360
|
+
useEffect(() => {
|
|
1656
1361
|
if (hiddenInputRef.current && isOpen && !previousIsOpenRef.current) {
|
|
1657
1362
|
hiddenInputRef.current.focus();
|
|
1658
1363
|
}
|
|
@@ -1661,27 +1366,27 @@ var Select = React__default.forwardRef(function (_ref, _ref3) {
|
|
|
1661
1366
|
}
|
|
1662
1367
|
previousIsOpenRef.current = isOpen;
|
|
1663
1368
|
}, [isOpen, triggerRef]);
|
|
1664
|
-
useEffect(
|
|
1369
|
+
useEffect(() => {
|
|
1665
1370
|
if (searchTimeoutRef.current) {
|
|
1666
1371
|
clearTimeout(searchTimeoutRef.current);
|
|
1667
1372
|
}
|
|
1668
|
-
searchTimeoutRef.current = window.setTimeout(
|
|
1373
|
+
searchTimeoutRef.current = window.setTimeout(() => {
|
|
1669
1374
|
setSearchString('');
|
|
1670
1375
|
}, 500);
|
|
1671
|
-
return
|
|
1376
|
+
return () => {
|
|
1672
1377
|
clearTimeout(searchTimeoutRef.current);
|
|
1673
1378
|
};
|
|
1674
1379
|
}, [searchString]);
|
|
1675
|
-
|
|
1676
|
-
for (
|
|
1677
|
-
|
|
1380
|
+
const searchItems = useCallback((searchValue, startIndex, endIndex) => {
|
|
1381
|
+
for (let index = startIndex; index < endIndex; index++) {
|
|
1382
|
+
const itemTextValue = itemSearchRegistry.current[index];
|
|
1678
1383
|
if (itemTextValue && itemTextValue.toUpperCase().indexOf(searchValue.toUpperCase()) === 0) {
|
|
1679
1384
|
return index;
|
|
1680
1385
|
}
|
|
1681
1386
|
}
|
|
1682
1387
|
return undefined;
|
|
1683
1388
|
}, [itemSearchRegistry]);
|
|
1684
|
-
|
|
1389
|
+
const onInputKeyDown = useCallback(e => {
|
|
1685
1390
|
if (e.keyCode === KEY_CODES.SPACE) {
|
|
1686
1391
|
if (searchString) {
|
|
1687
1392
|
e.preventDefault();
|
|
@@ -1696,7 +1401,7 @@ var Select = React__default.forwardRef(function (_ref, _ref3) {
|
|
|
1696
1401
|
if ((e.keyCode < 48 || e.keyCode > 57) && (e.keyCode < 65 || e.keyCode > 90) && e.keyCode !== KEY_CODES.SPACE) {
|
|
1697
1402
|
return;
|
|
1698
1403
|
}
|
|
1699
|
-
|
|
1404
|
+
const character = String.fromCharCode(e.which || e.keyCode);
|
|
1700
1405
|
if (!character || character.length === 0) {
|
|
1701
1406
|
return;
|
|
1702
1407
|
}
|
|
@@ -1707,9 +1412,9 @@ var Select = React__default.forwardRef(function (_ref, _ref3) {
|
|
|
1707
1412
|
currentSearchIndexRef.current = highlightedIndex;
|
|
1708
1413
|
}
|
|
1709
1414
|
}
|
|
1710
|
-
|
|
1415
|
+
const newSearchString = searchString + character;
|
|
1711
1416
|
setSearchString(newSearchString);
|
|
1712
|
-
|
|
1417
|
+
let matchingIndex = searchItems(newSearchString, currentSearchIndexRef.current + 1, itemSearchRegistry.current.length);
|
|
1713
1418
|
if (matchingIndex === undefined) {
|
|
1714
1419
|
matchingIndex = searchItems(newSearchString, 0, currentSearchIndexRef.current);
|
|
1715
1420
|
}
|
|
@@ -1717,35 +1422,31 @@ var Select = React__default.forwardRef(function (_ref, _ref3) {
|
|
|
1717
1422
|
setHighlightedIndex(matchingIndex);
|
|
1718
1423
|
}
|
|
1719
1424
|
}, [searchString, searchItems, itemSearchRegistry, highlightedIndex, selectItemAtIndex, closeMenu, setHighlightedIndex]);
|
|
1720
|
-
|
|
1425
|
+
const {
|
|
1426
|
+
type,
|
|
1427
|
+
...selectProps
|
|
1428
|
+
} = getToggleButtonProps({
|
|
1721
1429
|
tabIndex: props.disabled ? undefined : 0,
|
|
1722
|
-
onMouseEnter: composeEventHandlers(props.onMouseEnter,
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
}
|
|
1734
|
-
}, props));
|
|
1735
|
-
_getToggleButtonProps.type;
|
|
1736
|
-
var selectProps = _objectWithoutProperties(_getToggleButtonProps, _excluded2$2);
|
|
1737
|
-
var isContainerHovered = isLabelHovered && !isOpen;
|
|
1738
|
-
var isContainerFocused = isFocused || isOpen;
|
|
1739
|
-
return React__default.createElement(Reference, null, function (_ref2) {
|
|
1740
|
-
var popperReference = _ref2.ref;
|
|
1430
|
+
onMouseEnter: composeEventHandlers(props.onMouseEnter, () => setIsHovered(true)),
|
|
1431
|
+
onMouseLeave: composeEventHandlers(props.onMouseLeave, () => setIsHovered(false)),
|
|
1432
|
+
onFocus: composeEventHandlers(props.onFocus, () => setIsFocused(true)),
|
|
1433
|
+
onBlur: composeEventHandlers(props.onBlur, () => setIsFocused(false)),
|
|
1434
|
+
...props
|
|
1435
|
+
});
|
|
1436
|
+
const isContainerHovered = isLabelHovered && !isOpen;
|
|
1437
|
+
const isContainerFocused = isFocused || isOpen;
|
|
1438
|
+
return React__default.createElement(Reference, null, _ref2 => {
|
|
1439
|
+
let {
|
|
1440
|
+
ref: popperReference
|
|
1441
|
+
} = _ref2;
|
|
1741
1442
|
return React__default.createElement(StyledFauxInput, _extends$5({
|
|
1742
1443
|
isHovered: isContainerHovered,
|
|
1743
1444
|
isFocused: isContainerFocused
|
|
1744
1445
|
}, selectProps, {
|
|
1745
1446
|
role: "none",
|
|
1746
|
-
ref:
|
|
1447
|
+
ref: selectRef => {
|
|
1747
1448
|
popperReference(selectRef);
|
|
1748
|
-
mergeRefs([triggerRef,
|
|
1449
|
+
mergeRefs([triggerRef, ref, popperReferenceElementRef])(selectRef);
|
|
1749
1450
|
}
|
|
1750
1451
|
}), start && React__default.createElement(StyledFauxInput.StartIcon, {
|
|
1751
1452
|
isHovered: isHovered || isLabelHovered && !isOpen,
|
|
@@ -1757,7 +1458,7 @@ var Select = React__default.forwardRef(function (_ref, _ref3) {
|
|
|
1757
1458
|
tabIndex: -1,
|
|
1758
1459
|
ref: hiddenInputRef,
|
|
1759
1460
|
value: '',
|
|
1760
|
-
onClick:
|
|
1461
|
+
onClick: e => {
|
|
1761
1462
|
if (isOpen) {
|
|
1762
1463
|
e.nativeEvent.preventDownshiftDefault = true;
|
|
1763
1464
|
}
|
|
@@ -1781,21 +1482,20 @@ Select.propTypes = {
|
|
|
1781
1482
|
start: PropTypes.any
|
|
1782
1483
|
};
|
|
1783
1484
|
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
}, [isLabelHovered, setIsLabelHovered]);
|
|
1485
|
+
const Field = forwardRef((props, fieldRef) => {
|
|
1486
|
+
const {
|
|
1487
|
+
downshift: {
|
|
1488
|
+
getRootProps
|
|
1489
|
+
}
|
|
1490
|
+
} = useDropdownContext();
|
|
1491
|
+
const [isLabelHovered, setIsLabelHovered] = useState(false);
|
|
1492
|
+
const {
|
|
1493
|
+
ref
|
|
1494
|
+
} = getRootProps();
|
|
1495
|
+
const value = useMemo(() => ({
|
|
1496
|
+
isLabelHovered,
|
|
1497
|
+
setIsLabelHovered
|
|
1498
|
+
}), [isLabelHovered, setIsLabelHovered]);
|
|
1799
1499
|
return React__default.createElement(FieldContext.Provider, {
|
|
1800
1500
|
value: value
|
|
1801
1501
|
}, React__default.createElement(Field$1, _extends$5({
|
|
@@ -1804,30 +1504,34 @@ var Field = forwardRef(function (props, fieldRef) {
|
|
|
1804
1504
|
});
|
|
1805
1505
|
Field.displayName = 'Field';
|
|
1806
1506
|
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
}, props));
|
|
1811
|
-
});
|
|
1507
|
+
const Hint = React__default.forwardRef((props, ref) => React__default.createElement(Hint$1, _extends$5({
|
|
1508
|
+
ref: ref
|
|
1509
|
+
}, props)));
|
|
1812
1510
|
Hint.displayName = 'Hint';
|
|
1813
1511
|
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1512
|
+
const Label = React__default.forwardRef((_ref, ref) => {
|
|
1513
|
+
let {
|
|
1514
|
+
onMouseEnter,
|
|
1515
|
+
onMouseLeave,
|
|
1516
|
+
...other
|
|
1517
|
+
} = _ref;
|
|
1518
|
+
const {
|
|
1519
|
+
downshift: {
|
|
1520
|
+
getLabelProps
|
|
1521
|
+
}
|
|
1522
|
+
} = useDropdownContext();
|
|
1523
|
+
const {
|
|
1524
|
+
setIsLabelHovered
|
|
1525
|
+
} = useFieldContext();
|
|
1526
|
+
const labelProps = getLabelProps({
|
|
1527
|
+
onMouseEnter: composeEventHandlers(onMouseEnter, () => {
|
|
1825
1528
|
setIsLabelHovered(true);
|
|
1826
1529
|
}),
|
|
1827
|
-
onMouseLeave: composeEventHandlers(onMouseLeave,
|
|
1530
|
+
onMouseLeave: composeEventHandlers(onMouseLeave, () => {
|
|
1828
1531
|
setIsLabelHovered(false);
|
|
1829
|
-
})
|
|
1830
|
-
|
|
1532
|
+
}),
|
|
1533
|
+
...other
|
|
1534
|
+
});
|
|
1831
1535
|
return React__default.createElement(Label$1, _extends$5({
|
|
1832
1536
|
ref: ref
|
|
1833
1537
|
}, labelProps));
|
|
@@ -1837,111 +1541,109 @@ Label.propTypes = {
|
|
|
1837
1541
|
isRegular: PropTypes.bool
|
|
1838
1542
|
};
|
|
1839
1543
|
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
}, props));
|
|
1844
|
-
});
|
|
1544
|
+
const Message = React__default.forwardRef((props, ref) => React__default.createElement(Message$1, _extends$5({
|
|
1545
|
+
ref: ref
|
|
1546
|
+
}, props)));
|
|
1845
1547
|
Message.displayName = 'Message';
|
|
1846
1548
|
Message.propTypes = {
|
|
1847
1549
|
validation: PropTypes.oneOf(VALIDATION)
|
|
1848
1550
|
};
|
|
1849
1551
|
|
|
1850
|
-
|
|
1851
|
-
|
|
1552
|
+
const SHARED_PLACEMENT = ['auto', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end'];
|
|
1553
|
+
const PLACEMENT = [...SHARED_PLACEMENT, 'end', 'end-top', 'end-bottom', 'start', 'start-top', 'start-bottom'];
|
|
1852
1554
|
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1555
|
+
const MenuContext = React__default.createContext(undefined);
|
|
1556
|
+
const useMenuContext = () => {
|
|
1557
|
+
const menuContext = useContext(MenuContext);
|
|
1856
1558
|
if (!menuContext) {
|
|
1857
1559
|
throw new Error('This component must be rendered within a `Menu` component.');
|
|
1858
1560
|
}
|
|
1859
1561
|
return menuContext;
|
|
1860
1562
|
};
|
|
1861
1563
|
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1564
|
+
const Menu = forwardRef((props, menuRef) => {
|
|
1565
|
+
const {
|
|
1566
|
+
placement,
|
|
1567
|
+
popperModifiers,
|
|
1568
|
+
eventsEnabled,
|
|
1569
|
+
isAnimated,
|
|
1570
|
+
maxHeight,
|
|
1571
|
+
style: menuStyle,
|
|
1572
|
+
zIndex,
|
|
1573
|
+
isCompact,
|
|
1574
|
+
children,
|
|
1575
|
+
appendToNode,
|
|
1576
|
+
...otherProps
|
|
1577
|
+
} = props;
|
|
1578
|
+
const {
|
|
1579
|
+
hasMenuRef,
|
|
1580
|
+
itemIndexRef,
|
|
1581
|
+
previousIndexRef,
|
|
1582
|
+
nextItemsHashRef,
|
|
1583
|
+
popperReferenceElementRef,
|
|
1584
|
+
itemSearchRegistry,
|
|
1585
|
+
downshift: {
|
|
1586
|
+
isOpen,
|
|
1587
|
+
getMenuProps
|
|
1588
|
+
}
|
|
1589
|
+
} = useDropdownContext();
|
|
1590
|
+
const scheduleUpdateRef = useRef(undefined);
|
|
1591
|
+
useEffect(() => {
|
|
1887
1592
|
if (scheduleUpdateRef.current && isOpen) {
|
|
1888
1593
|
scheduleUpdateRef.current();
|
|
1889
1594
|
}
|
|
1890
1595
|
});
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
setIsVisible = _useState2[1];
|
|
1895
|
-
useEffect(function () {
|
|
1896
|
-
var timeout;
|
|
1596
|
+
const [isVisible, setIsVisible] = useState(isOpen);
|
|
1597
|
+
useEffect(() => {
|
|
1598
|
+
let timeout;
|
|
1897
1599
|
if (isOpen) {
|
|
1898
1600
|
setIsVisible(true);
|
|
1899
1601
|
} else if (isAnimated) {
|
|
1900
|
-
timeout = setTimeout(
|
|
1901
|
-
return setIsVisible(false);
|
|
1902
|
-
}, 200);
|
|
1602
|
+
timeout = setTimeout(() => setIsVisible(false), 200);
|
|
1903
1603
|
} else {
|
|
1904
1604
|
setIsVisible(false);
|
|
1905
1605
|
}
|
|
1906
|
-
return
|
|
1907
|
-
return clearTimeout(timeout);
|
|
1908
|
-
};
|
|
1606
|
+
return () => clearTimeout(timeout);
|
|
1909
1607
|
}, [isOpen, isAnimated]);
|
|
1910
|
-
|
|
1608
|
+
const themeContext = useContext(ThemeContext);
|
|
1911
1609
|
itemIndexRef.current = 0;
|
|
1912
1610
|
nextItemsHashRef.current = {};
|
|
1913
1611
|
previousIndexRef.current = undefined;
|
|
1914
1612
|
itemSearchRegistry.current = [];
|
|
1915
|
-
|
|
1613
|
+
const popperPlacement = themeContext.rtl ? getRtlPopperPlacement(placement) : getPopperPlacement(placement);
|
|
1916
1614
|
return (
|
|
1917
1615
|
React__default.createElement(MenuContext.Provider, {
|
|
1918
1616
|
value: {
|
|
1919
|
-
itemIndexRef
|
|
1920
|
-
isCompact
|
|
1617
|
+
itemIndexRef,
|
|
1618
|
+
isCompact
|
|
1921
1619
|
}
|
|
1922
1620
|
}, React__default.createElement(Popper, {
|
|
1923
1621
|
placement: popperPlacement,
|
|
1924
1622
|
modifiers: popperModifiers
|
|
1925
1623
|
,
|
|
1926
1624
|
eventsEnabled: isOpen && eventsEnabled
|
|
1927
|
-
},
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1625
|
+
}, _ref => {
|
|
1626
|
+
let {
|
|
1627
|
+
ref,
|
|
1628
|
+
style,
|
|
1629
|
+
scheduleUpdate,
|
|
1630
|
+
placement: currentPlacement
|
|
1631
|
+
} = _ref;
|
|
1632
|
+
let computedStyle = menuStyle;
|
|
1933
1633
|
scheduleUpdateRef.current = scheduleUpdate;
|
|
1934
1634
|
if ((isOpen || isVisible) && popperReferenceElementRef.current && popperReferenceElementRef.current.getBoundingClientRect) {
|
|
1935
|
-
computedStyle =
|
|
1936
|
-
width: popperReferenceElementRef.current.getBoundingClientRect().width
|
|
1937
|
-
|
|
1635
|
+
computedStyle = {
|
|
1636
|
+
width: popperReferenceElementRef.current.getBoundingClientRect().width,
|
|
1637
|
+
...menuStyle
|
|
1638
|
+
};
|
|
1938
1639
|
}
|
|
1939
|
-
|
|
1640
|
+
const menuProps = getMenuProps({
|
|
1940
1641
|
role: hasMenuRef.current ? 'menu' : 'listbox',
|
|
1941
1642
|
placement: currentPlacement,
|
|
1942
|
-
isAnimated: isAnimated && (isOpen || isVisible)
|
|
1943
|
-
|
|
1944
|
-
|
|
1643
|
+
isAnimated: isAnimated && (isOpen || isVisible),
|
|
1644
|
+
...otherProps
|
|
1645
|
+
});
|
|
1646
|
+
const menu = React__default.createElement(StyledMenuWrapper, {
|
|
1945
1647
|
ref: isOpen ? ref : undefined,
|
|
1946
1648
|
hasArrow: menuProps.hasArrow,
|
|
1947
1649
|
placement: menuProps.placement,
|
|
@@ -1979,11 +1681,9 @@ Menu.defaultProps = {
|
|
|
1979
1681
|
zIndex: 1000
|
|
1980
1682
|
};
|
|
1981
1683
|
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
}, props));
|
|
1986
|
-
});
|
|
1684
|
+
const Separator = React__default.forwardRef((props, ref) => React__default.createElement(StyledSeparator, _extends$5({
|
|
1685
|
+
ref: ref
|
|
1686
|
+
}, props)));
|
|
1987
1687
|
Separator.displayName = 'Separator';
|
|
1988
1688
|
|
|
1989
1689
|
var _path$1;
|
|
@@ -1997,7 +1697,8 @@ var SvgPlusStroke = function SvgPlusStroke(props) {
|
|
|
1997
1697
|
height: 16,
|
|
1998
1698
|
focusable: "false",
|
|
1999
1699
|
viewBox: "0 0 16 16",
|
|
2000
|
-
"aria-hidden": "true"
|
|
1700
|
+
"aria-hidden": "true",
|
|
1701
|
+
role: "img"
|
|
2001
1702
|
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
2002
1703
|
stroke: "currentColor",
|
|
2003
1704
|
strokeLinecap: "round",
|
|
@@ -2016,7 +1717,8 @@ var SvgCheckLgStroke = function SvgCheckLgStroke(props) {
|
|
|
2016
1717
|
height: 16,
|
|
2017
1718
|
focusable: "false",
|
|
2018
1719
|
viewBox: "0 0 16 16",
|
|
2019
|
-
"aria-hidden": "true"
|
|
1720
|
+
"aria-hidden": "true",
|
|
1721
|
+
role: "img"
|
|
2020
1722
|
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
2021
1723
|
fill: "none",
|
|
2022
1724
|
stroke: "currentColor",
|
|
@@ -2026,49 +1728,52 @@ var SvgCheckLgStroke = function SvgCheckLgStroke(props) {
|
|
|
2026
1728
|
})));
|
|
2027
1729
|
};
|
|
2028
1730
|
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
1731
|
+
const ItemContext = React__default.createContext(undefined);
|
|
1732
|
+
const useItemContext = () => {
|
|
1733
|
+
const context = useContext(ItemContext);
|
|
2032
1734
|
if (!context) {
|
|
2033
1735
|
throw new Error('This component must be rendered within an `Item` component.');
|
|
2034
1736
|
}
|
|
2035
1737
|
return context;
|
|
2036
1738
|
};
|
|
2037
1739
|
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
isOpen
|
|
2053
|
-
selectedItem
|
|
2054
|
-
highlightedIndex
|
|
2055
|
-
getItemProps
|
|
2056
|
-
setHighlightedIndex
|
|
2057
|
-
itemToString
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
1740
|
+
const Item = React__default.forwardRef((_ref, forwardRef) => {
|
|
1741
|
+
let {
|
|
1742
|
+
value,
|
|
1743
|
+
disabled,
|
|
1744
|
+
isDanger,
|
|
1745
|
+
component = StyledItem,
|
|
1746
|
+
children,
|
|
1747
|
+
...props
|
|
1748
|
+
} = _ref;
|
|
1749
|
+
const {
|
|
1750
|
+
selectedItems,
|
|
1751
|
+
hasMenuRef,
|
|
1752
|
+
itemSearchRegistry,
|
|
1753
|
+
downshift: {
|
|
1754
|
+
isOpen,
|
|
1755
|
+
selectedItem,
|
|
1756
|
+
highlightedIndex,
|
|
1757
|
+
getItemProps,
|
|
1758
|
+
setHighlightedIndex,
|
|
1759
|
+
itemToString
|
|
1760
|
+
}
|
|
1761
|
+
} = useDropdownContext();
|
|
1762
|
+
const {
|
|
1763
|
+
itemIndexRef,
|
|
1764
|
+
isCompact
|
|
1765
|
+
} = useMenuContext();
|
|
1766
|
+
const itemRef = useRef();
|
|
1767
|
+
const Component = component;
|
|
2063
1768
|
if ((value === undefined || value === null) && !disabled) {
|
|
2064
1769
|
throw new Error('All Item components require a `value` prop');
|
|
2065
1770
|
}
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
useEffect(
|
|
1771
|
+
const currentIndex = itemIndexRef.current;
|
|
1772
|
+
const isFocused = highlightedIndex === currentIndex;
|
|
1773
|
+
let isSelected;
|
|
1774
|
+
useEffect(() => {
|
|
2070
1775
|
if (!disabled && itemRef.current) {
|
|
2071
|
-
|
|
1776
|
+
const itemTextValue = itemRef.current.innerText;
|
|
2072
1777
|
if (itemTextValue) {
|
|
2073
1778
|
itemSearchRegistry.current[currentIndex] = itemTextValue;
|
|
2074
1779
|
}
|
|
@@ -2076,7 +1781,7 @@ var Item = React__default.forwardRef(function (_ref, forwardRef) {
|
|
|
2076
1781
|
});
|
|
2077
1782
|
if (value) {
|
|
2078
1783
|
if (selectedItems) {
|
|
2079
|
-
isSelected = selectedItems.some(
|
|
1784
|
+
isSelected = selectedItems.some(item => {
|
|
2080
1785
|
return itemToString(item) === itemToString(value);
|
|
2081
1786
|
});
|
|
2082
1787
|
} else {
|
|
@@ -2085,17 +1790,15 @@ var Item = React__default.forwardRef(function (_ref, forwardRef) {
|
|
|
2085
1790
|
} else {
|
|
2086
1791
|
isSelected = false;
|
|
2087
1792
|
}
|
|
2088
|
-
useEffect(
|
|
1793
|
+
useEffect(() => {
|
|
2089
1794
|
if (isOpen && !disabled && !selectedItems && isSelected) {
|
|
2090
1795
|
setHighlightedIndex(currentIndex);
|
|
2091
1796
|
}
|
|
2092
1797
|
}, [currentIndex, disabled, isOpen, isSelected, selectedItems, setHighlightedIndex]);
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
}, [disabled]);
|
|
2098
|
-
var ref = mergeRefs([itemRef, forwardRef]);
|
|
1798
|
+
const contextValue = useMemo(() => ({
|
|
1799
|
+
isDisabled: disabled
|
|
1800
|
+
}), [disabled]);
|
|
1801
|
+
const ref = mergeRefs([itemRef, forwardRef]);
|
|
2099
1802
|
if (disabled) {
|
|
2100
1803
|
return React__default.createElement(ItemContext.Provider, {
|
|
2101
1804
|
value: contextValue
|
|
@@ -2113,16 +1816,18 @@ var Item = React__default.forwardRef(function (_ref, forwardRef) {
|
|
|
2113
1816
|
itemIndexRef.current++;
|
|
2114
1817
|
return React__default.createElement(ItemContext.Provider, {
|
|
2115
1818
|
value: contextValue
|
|
2116
|
-
}, React__default.createElement(Component, getItemProps(
|
|
1819
|
+
}, React__default.createElement(Component, getItemProps({
|
|
2117
1820
|
item: value,
|
|
2118
|
-
isFocused
|
|
2119
|
-
ref
|
|
2120
|
-
isCompact
|
|
2121
|
-
isDanger
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
1821
|
+
isFocused,
|
|
1822
|
+
ref,
|
|
1823
|
+
isCompact,
|
|
1824
|
+
isDanger,
|
|
1825
|
+
...(hasMenuRef.current && {
|
|
1826
|
+
role: 'menuitem',
|
|
1827
|
+
'aria-selected': null
|
|
1828
|
+
}),
|
|
1829
|
+
...props
|
|
1830
|
+
}), isSelected && React__default.createElement(StyledItemIcon, {
|
|
2126
1831
|
isCompact: isCompact,
|
|
2127
1832
|
isVisible: isSelected
|
|
2128
1833
|
}, React__default.createElement(SvgCheckLgStroke, null)), children));
|
|
@@ -2133,13 +1838,15 @@ Item.propTypes = {
|
|
|
2133
1838
|
disabled: PropTypes.bool
|
|
2134
1839
|
};
|
|
2135
1840
|
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
1841
|
+
const AddItemComponent = React__default.forwardRef((_ref, ref) => {
|
|
1842
|
+
let {
|
|
1843
|
+
children,
|
|
1844
|
+
disabled,
|
|
1845
|
+
...props
|
|
1846
|
+
} = _ref;
|
|
1847
|
+
const {
|
|
1848
|
+
isCompact
|
|
1849
|
+
} = useMenuContext();
|
|
2143
1850
|
return React__default.createElement(StyledAddItem, _extends$5({
|
|
2144
1851
|
ref: ref,
|
|
2145
1852
|
disabled: disabled
|
|
@@ -2149,21 +1856,20 @@ var AddItemComponent = React__default.forwardRef(function (_ref, ref) {
|
|
|
2149
1856
|
isDisabled: disabled
|
|
2150
1857
|
}, React__default.createElement(SvgPlusStroke, null)), children);
|
|
2151
1858
|
});
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
}, props));
|
|
2157
|
-
});
|
|
1859
|
+
const AddItem = React__default.forwardRef((props, ref) => React__default.createElement(Item, _extends$5({
|
|
1860
|
+
component: AddItemComponent,
|
|
1861
|
+
ref: ref
|
|
1862
|
+
}, props)));
|
|
2158
1863
|
AddItem.displayName = 'AddItem';
|
|
2159
1864
|
AddItem.propTypes = {
|
|
2160
1865
|
value: PropTypes.any,
|
|
2161
1866
|
disabled: PropTypes.bool
|
|
2162
1867
|
};
|
|
2163
1868
|
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
1869
|
+
const HeaderIcon = React__default.forwardRef((props, ref) => {
|
|
1870
|
+
const {
|
|
1871
|
+
isCompact
|
|
1872
|
+
} = useMenuContext();
|
|
2167
1873
|
return React__default.createElement(StyledHeaderIcon, _extends$5({
|
|
2168
1874
|
ref: ref,
|
|
2169
1875
|
isCompact: isCompact
|
|
@@ -2171,9 +1877,10 @@ var HeaderIcon = React__default.forwardRef(function (props, ref) {
|
|
|
2171
1877
|
});
|
|
2172
1878
|
HeaderIcon.displayName = 'HeaderIcon';
|
|
2173
1879
|
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
1880
|
+
const HeaderItem = React__default.forwardRef((props, ref) => {
|
|
1881
|
+
const {
|
|
1882
|
+
isCompact
|
|
1883
|
+
} = useMenuContext();
|
|
2177
1884
|
return React__default.createElement(StyledHeaderItem, _extends$5({
|
|
2178
1885
|
ref: ref,
|
|
2179
1886
|
isCompact: isCompact
|
|
@@ -2181,11 +1888,13 @@ var HeaderItem = React__default.forwardRef(function (props, ref) {
|
|
|
2181
1888
|
});
|
|
2182
1889
|
HeaderItem.displayName = 'HeaderItem';
|
|
2183
1890
|
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
1891
|
+
const ItemMeta = React__default.forwardRef((props, ref) => {
|
|
1892
|
+
const {
|
|
1893
|
+
isCompact
|
|
1894
|
+
} = useMenuContext();
|
|
1895
|
+
const {
|
|
1896
|
+
isDisabled
|
|
1897
|
+
} = useItemContext();
|
|
2189
1898
|
return React__default.createElement(StyledItemMeta, _extends$5({
|
|
2190
1899
|
ref: ref,
|
|
2191
1900
|
isCompact: isCompact,
|
|
@@ -2194,9 +1903,10 @@ var ItemMeta = React__default.forwardRef(function (props, ref) {
|
|
|
2194
1903
|
});
|
|
2195
1904
|
ItemMeta.displayName = 'ItemMeta';
|
|
2196
1905
|
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
1906
|
+
const MediaBody = React__default.forwardRef((props, ref) => {
|
|
1907
|
+
const {
|
|
1908
|
+
isCompact
|
|
1909
|
+
} = useMenuContext();
|
|
2200
1910
|
return React__default.createElement(StyledMediaBody, _extends$5({
|
|
2201
1911
|
ref: ref,
|
|
2202
1912
|
isCompact: isCompact
|
|
@@ -2204,34 +1914,34 @@ var MediaBody = React__default.forwardRef(function (props, ref) {
|
|
|
2204
1914
|
});
|
|
2205
1915
|
MediaBody.displayName = 'MediaBody';
|
|
2206
1916
|
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
1917
|
+
const MediaFigure = props => {
|
|
1918
|
+
const {
|
|
1919
|
+
isCompact
|
|
1920
|
+
} = useMenuContext();
|
|
2210
1921
|
return React__default.createElement(StyledMediaFigure, _extends$5({
|
|
2211
1922
|
isCompact: isCompact
|
|
2212
1923
|
}, props));
|
|
2213
1924
|
};
|
|
2214
1925
|
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
}, props));
|
|
2220
|
-
});
|
|
1926
|
+
const MediaItem = React__default.forwardRef((props, ref) => React__default.createElement(Item, _extends$5({
|
|
1927
|
+
component: StyledMediaItem,
|
|
1928
|
+
ref: ref
|
|
1929
|
+
}, props)));
|
|
2221
1930
|
MediaItem.displayName = 'MediaItem';
|
|
2222
1931
|
MediaItem.propTypes = {
|
|
2223
1932
|
value: PropTypes.any,
|
|
2224
1933
|
disabled: PropTypes.bool
|
|
2225
1934
|
};
|
|
2226
1935
|
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
1936
|
+
const NextItemComponent = React__default.forwardRef((_ref, ref) => {
|
|
1937
|
+
let {
|
|
1938
|
+
children,
|
|
1939
|
+
disabled,
|
|
1940
|
+
...props
|
|
1941
|
+
} = _ref;
|
|
1942
|
+
const {
|
|
1943
|
+
isCompact
|
|
1944
|
+
} = useMenuContext();
|
|
2235
1945
|
return React__default.createElement(StyledNextItem, _extends$5({
|
|
2236
1946
|
ref: ref,
|
|
2237
1947
|
disabled: disabled
|
|
@@ -2243,15 +1953,21 @@ var NextItemComponent = React__default.forwardRef(function (_ref, ref) {
|
|
|
2243
1953
|
isDisabled: disabled
|
|
2244
1954
|
})), children);
|
|
2245
1955
|
});
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
1956
|
+
const NextItem = React__default.forwardRef((_ref2, ref) => {
|
|
1957
|
+
let {
|
|
1958
|
+
value,
|
|
1959
|
+
disabled,
|
|
1960
|
+
...props
|
|
1961
|
+
} = _ref2;
|
|
1962
|
+
const {
|
|
1963
|
+
nextItemsHashRef,
|
|
1964
|
+
downshift: {
|
|
1965
|
+
itemToString
|
|
1966
|
+
}
|
|
1967
|
+
} = useDropdownContext();
|
|
1968
|
+
const {
|
|
1969
|
+
itemIndexRef
|
|
1970
|
+
} = useMenuContext();
|
|
2255
1971
|
if (!disabled) {
|
|
2256
1972
|
nextItemsHashRef.current[itemToString(value)] = itemIndexRef.current;
|
|
2257
1973
|
}
|
|
@@ -2269,14 +1985,15 @@ NextItem.propTypes = {
|
|
|
2269
1985
|
disabled: PropTypes.bool
|
|
2270
1986
|
};
|
|
2271
1987
|
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
1988
|
+
const PreviousItemComponent = React__default.forwardRef((_ref, ref) => {
|
|
1989
|
+
let {
|
|
1990
|
+
children,
|
|
1991
|
+
disabled,
|
|
1992
|
+
...props
|
|
1993
|
+
} = _ref;
|
|
1994
|
+
const {
|
|
1995
|
+
isCompact
|
|
1996
|
+
} = useMenuContext();
|
|
2280
1997
|
return React__default.createElement(StyledPreviousItem, _extends$5({
|
|
2281
1998
|
ref: ref,
|
|
2282
1999
|
disabled: disabled
|
|
@@ -2288,14 +2005,18 @@ var PreviousItemComponent = React__default.forwardRef(function (_ref, ref) {
|
|
|
2288
2005
|
isDisabled: disabled
|
|
2289
2006
|
})), children);
|
|
2290
2007
|
});
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2008
|
+
const PreviousItem = React__default.forwardRef((_ref2, ref) => {
|
|
2009
|
+
let {
|
|
2010
|
+
value,
|
|
2011
|
+
disabled,
|
|
2012
|
+
...props
|
|
2013
|
+
} = _ref2;
|
|
2014
|
+
const {
|
|
2015
|
+
previousIndexRef
|
|
2016
|
+
} = useDropdownContext();
|
|
2017
|
+
const {
|
|
2018
|
+
itemIndexRef
|
|
2019
|
+
} = useMenuContext();
|
|
2299
2020
|
if (!disabled) {
|
|
2300
2021
|
previousIndexRef.current = itemIndexRef.current;
|
|
2301
2022
|
}
|