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