@khanacademy/wonder-blocks-dropdown 2.7.4 → 2.8.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.
Files changed (31) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/es/index.js +167 -167
  3. package/dist/index.js +389 -360
  4. package/package.json +7 -7
  5. package/src/components/__docs__/action-menu.argtypes.js +44 -0
  6. package/src/components/__docs__/action-menu.stories.js +435 -0
  7. package/src/components/__docs__/base-select.argtypes.js +54 -0
  8. package/src/components/__docs__/multi-select.stories.js +509 -0
  9. package/src/components/__docs__/single-select.accessibility.stories.mdx +59 -0
  10. package/src/components/__docs__/single-select.argtypes.js +54 -0
  11. package/src/components/__docs__/single-select.stories.js +464 -0
  12. package/src/components/__tests__/dropdown-core-virtualized.test.js +0 -15
  13. package/src/components/__tests__/dropdown-core.test.js +113 -209
  14. package/src/components/__tests__/multi-select.test.js +49 -3
  15. package/src/components/__tests__/single-select.test.js +43 -50
  16. package/src/components/action-menu.js +11 -0
  17. package/src/components/dropdown-core-virtualized.js +0 -5
  18. package/src/components/dropdown-core.js +224 -130
  19. package/src/components/multi-select.js +18 -33
  20. package/src/components/single-select.js +16 -30
  21. package/src/util/__tests__/dropdown-menu-styles.test.js +0 -26
  22. package/src/util/__tests__/helpers.test.js +73 -0
  23. package/src/util/constants.js +0 -11
  24. package/src/util/dropdown-menu-styles.js +0 -5
  25. package/src/util/helpers.js +44 -0
  26. package/src/util/types.js +2 -5
  27. package/src/components/__tests__/search-text-input.test.js +0 -212
  28. package/src/components/action-menu.stories.js +0 -48
  29. package/src/components/multi-select.stories.js +0 -124
  30. package/src/components/search-text-input.js +0 -115
  31. package/src/components/single-select.stories.js +0 -247
package/dist/index.js CHANGED
@@ -93,18 +93,22 @@ module.exports = require("react");
93
93
 
94
94
  /***/ }),
95
95
  /* 1 */
96
+ /***/ (function(module, exports) {
97
+
98
+ module.exports = require("@khanacademy/wonder-blocks-color");
99
+
100
+ /***/ }),
101
+ /* 2 */
96
102
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
97
103
 
98
104
  "use strict";
99
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return keyCodes; });
100
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return selectDropdownStyle; });
101
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return filterableDropdownStyle; });
102
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return searchInputStyle; });
105
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return keyCodes; });
106
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return selectDropdownStyle; });
107
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return filterableDropdownStyle; });
103
108
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DROPDOWN_ITEM_HEIGHT; });
104
109
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MAX_VISIBLE_ITEMS; });
105
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return SEPARATOR_ITEM_HEIGHT; });
106
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return SEARCH_ITEM_HEIGHT; });
107
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return defaultLabels; });
110
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return SEPARATOR_ITEM_HEIGHT; });
111
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return defaultLabels; });
108
112
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
109
113
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0__);
110
114
 
@@ -124,13 +128,6 @@ const selectDropdownStyle = {
124
128
 
125
129
  const filterableDropdownStyle = {
126
130
  minHeight: 100
127
- };
128
- const searchInputStyle = {
129
- margin: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.xSmall_8,
130
- marginTop: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.xxxSmall_4,
131
- // Set `minHeight` to "auto" to stop the search field from having
132
- // a height of 0 and being cut off.
133
- minHeight: "auto"
134
131
  }; // The default item height
135
132
 
136
133
  const DROPDOWN_ITEM_HEIGHT = 40;
@@ -141,8 +138,7 @@ const DROPDOWN_ITEM_HEIGHT = 40;
141
138
  */
142
139
 
143
140
  const MAX_VISIBLE_ITEMS = 9;
144
- const SEPARATOR_ITEM_HEIGHT = 9;
145
- const SEARCH_ITEM_HEIGHT = DROPDOWN_ITEM_HEIGHT + searchInputStyle.margin + searchInputStyle.marginTop; // The default labels that will be used by different components
141
+ const SEPARATOR_ITEM_HEIGHT = 9; // The default labels that will be used by different components
146
142
 
147
143
  const defaultLabels = {
148
144
  clearSearch: "Clear search",
@@ -155,12 +151,6 @@ const defaultLabels = {
155
151
  allSelected: "All items"
156
152
  };
157
153
 
158
- /***/ }),
159
- /* 2 */
160
- /***/ (function(module, exports) {
161
-
162
- module.exports = require("@khanacademy/wonder-blocks-color");
163
-
164
154
  /***/ }),
165
155
  /* 3 */
166
156
  /***/ (function(module, exports) {
@@ -189,7 +179,7 @@ module.exports = require("@khanacademy/wonder-blocks-core");
189
179
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
190
180
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
191
181
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_1__);
192
- /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
182
+ /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
193
183
  /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2__);
194
184
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3);
195
185
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_3__);
@@ -242,92 +232,24 @@ module.exports = require("react-dom");
242
232
 
243
233
  /***/ }),
244
234
  /* 8 */
245
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
246
-
247
- "use strict";
248
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SearchTextInput; });
249
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
250
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
251
- /* harmony import */ var _khanacademy_wonder_blocks_search_field__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(29);
252
- /* harmony import */ var _khanacademy_wonder_blocks_search_field__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_search_field__WEBPACK_IMPORTED_MODULE_1__);
253
- /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
254
- // A TextField with a search icon on its left side and X icon on its right side
255
-
256
-
257
-
258
- class SearchTextInput extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
259
- static isClassOf(instance) {
260
- return instance && instance.type && instance.type.__IS_SEARCH_TEXT_INPUT__;
261
- }
262
-
263
- // TODO(WB-1310): Remove `componentDidMount` autofocus on the search field
264
- // after making the search field sticky.
265
- componentDidMount() {
266
- // We need to re-focus on the text input after it mounts because of
267
- // the case in which the dropdown switches between virtualized and
268
- // non-virtualized. It can rerender the search field as the user is
269
- // typing based on the number of search results, which results
270
- // in losing focus on the field so the user can't type anymore.
271
- // To work around this issue, this temporary fix auto-focuses on the
272
- // search field on mount.
273
- if (this.props.autofocus) {
274
- var _this$props$itemRef;
275
-
276
- (_this$props$itemRef = this.props.itemRef) == null ? void 0 : _this$props$itemRef.current.focus();
277
- }
278
- }
279
-
280
- render() {
281
- const {
282
- labels,
283
- onChange,
284
- onClick,
285
- itemRef,
286
- searchText,
287
- style,
288
- testId
289
- } = this.props;
290
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_search_field__WEBPACK_IMPORTED_MODULE_1___default.a, {
291
- clearAriaLabel: labels.clearSearch,
292
- onChange: onChange,
293
- onClick: onClick,
294
- placeholder: labels.filter,
295
- ref: itemRef,
296
- style: style,
297
- testId: testId,
298
- value: searchText
299
- });
300
- }
301
-
302
- }
303
- SearchTextInput.defaultProps = {
304
- labels: {
305
- clearSearch: _util_constants_js__WEBPACK_IMPORTED_MODULE_2__[/* defaultLabels */ "e"].clearSearch,
306
- filter: _util_constants_js__WEBPACK_IMPORTED_MODULE_2__[/* defaultLabels */ "e"].filter
307
- }
308
- };
309
- SearchTextInput.__IS_SEARCH_TEXT_INPUT__ = true;
310
-
311
- /***/ }),
312
- /* 9 */
313
235
  /***/ (function(module, exports) {
314
236
 
315
237
  module.exports = require("@khanacademy/wonder-blocks-icon");
316
238
 
317
239
  /***/ }),
318
- /* 10 */
240
+ /* 9 */
319
241
  /***/ (function(module, exports) {
320
242
 
321
243
  module.exports = require("@khanacademy/wonder-blocks-typography");
322
244
 
323
245
  /***/ }),
324
- /* 11 */
246
+ /* 10 */
325
247
  /***/ (function(module, exports) {
326
248
 
327
249
  module.exports = require("@khanacademy/wonder-blocks-clickable");
328
250
 
329
251
  /***/ }),
330
- /* 12 */
252
+ /* 11 */
331
253
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
332
254
 
333
255
  "use strict";
@@ -338,19 +260,19 @@ module.exports = require("@khanacademy/wonder-blocks-clickable");
338
260
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_1__);
339
261
  /* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(24);
340
262
  /* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_router_dom__WEBPACK_IMPORTED_MODULE_2__);
341
- /* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(17);
263
+ /* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(16);
342
264
  /* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_router__WEBPACK_IMPORTED_MODULE_3__);
343
- /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2);
265
+ /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1);
344
266
  /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_4__);
345
267
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3);
346
268
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_5__);
347
- /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(10);
269
+ /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(9);
348
270
  /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_6__);
349
- /* harmony import */ var _khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11);
271
+ /* harmony import */ var _khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(10);
350
272
  /* harmony import */ var _khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_7__);
351
273
  /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(5);
352
274
  /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_8__);
353
- /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(1);
275
+ /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(2);
354
276
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
355
277
 
356
278
 
@@ -495,7 +417,7 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_1__["StyleSheet"].create({
495
417
  });
496
418
 
497
419
  /***/ }),
498
- /* 13 */
420
+ /* 12 */
499
421
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
500
422
 
501
423
  "use strict";
@@ -504,17 +426,17 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_1__["StyleSheet"].create({
504
426
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
505
427
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
506
428
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_1__);
507
- /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
429
+ /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
508
430
  /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2__);
509
431
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3);
510
432
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_3__);
511
- /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(10);
433
+ /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9);
512
434
  /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_4__);
513
435
  /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5);
514
436
  /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_5__);
515
- /* harmony import */ var _khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(11);
437
+ /* harmony import */ var _khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(10);
516
438
  /* harmony import */ var _khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_6__);
517
- /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1);
439
+ /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2);
518
440
  /* harmony import */ var _check_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(25);
519
441
  /* harmony import */ var _checkbox_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(26);
520
442
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -670,13 +592,13 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_1__["StyleSheet"].create({
670
592
  });
671
593
 
672
594
  /***/ }),
673
- /* 14 */
595
+ /* 13 */
674
596
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
675
597
 
676
598
  "use strict";
677
599
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
678
600
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
679
- /* harmony import */ var _khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11);
601
+ /* harmony import */ var _khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10);
680
602
  /* harmony import */ var _khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_1__);
681
603
 
682
604
 
@@ -731,7 +653,7 @@ DropdownOpener.defaultProps = {
731
653
  /* harmony default export */ __webpack_exports__["a"] = (DropdownOpener);
732
654
 
733
655
  /***/ }),
734
- /* 15 */
656
+ /* 14 */
735
657
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
736
658
 
737
659
  "use strict";
@@ -741,24 +663,27 @@ DropdownOpener.defaultProps = {
741
663
  /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
742
664
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
743
665
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_2__);
744
- /* harmony import */ var react_window__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(20);
666
+ /* harmony import */ var react_window__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(19);
745
667
  /* harmony import */ var react_window__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react_window__WEBPACK_IMPORTED_MODULE_3__);
746
- /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2);
668
+ /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1);
747
669
  /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_4__);
748
670
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3);
749
671
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_5__);
750
672
  /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5);
751
673
  /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_6__);
752
- /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(10);
753
- /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_7__);
754
- /* harmony import */ var _khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(18);
755
- /* harmony import */ var _khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_8__);
756
- /* harmony import */ var _dropdown_core_virtualized_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(27);
757
- /* harmony import */ var _separator_item_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(6);
758
- /* harmony import */ var _search_text_input_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(8);
759
- /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(1);
674
+ /* harmony import */ var _khanacademy_wonder_blocks_search_field__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(27);
675
+ /* harmony import */ var _khanacademy_wonder_blocks_search_field__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_search_field__WEBPACK_IMPORTED_MODULE_7__);
676
+ /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9);
677
+ /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_8__);
678
+ /* harmony import */ var _khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(17);
679
+ /* harmony import */ var _khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_9__);
680
+ /* harmony import */ var _dropdown_core_virtualized_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(28);
681
+ /* harmony import */ var _separator_item_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(6);
682
+ /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(2);
760
683
  /* harmony import */ var _dropdown_popper_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(30);
761
- /* harmony import */ var _util_dropdown_menu_styles_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(16);
684
+ /* harmony import */ var _util_helpers_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(20);
685
+ /* harmony import */ var _util_dropdown_menu_styles_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(15);
686
+ /* eslint-disable max-lines */
762
687
  // A menu that consists of action items
763
688
 
764
689
 
@@ -775,6 +700,7 @@ DropdownOpener.defaultProps = {
775
700
 
776
701
 
777
702
 
703
+
778
704
  /**
779
705
  * The number of options to apply the virtualized list to.
780
706
  *
@@ -851,6 +777,8 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
851
777
  constructor(props) {
852
778
  super(props); // Apply our initial focus index
853
779
 
780
+ this.searchFieldRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createRef"]();
781
+
854
782
  this.handleInteract = event => {
855
783
  const {
856
784
  open,
@@ -870,10 +798,18 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
870
798
  open,
871
799
  searchText
872
800
  } = this.props;
873
- const keyCode = event.which || event.keyCode; // If menu isn't open and user presses down, open the menu
801
+ const keyCode = event.which || event.keyCode; // Listen for the keydown events if we are using ASCII characters.
802
+
803
+ if (Object(_util_helpers_js__WEBPACK_IMPORTED_MODULE_14__[/* getStringForKey */ "b"])(event.key)) {
804
+ event.stopPropagation();
805
+ this.textSuggestion += event.key; // Trigger the filter logic only after the debounce is resolved.
806
+
807
+ this.handleKeyDownDebounced(this.textSuggestion);
808
+ } // If menu isn't open and user presses down, open the menu
809
+
874
810
 
875
811
  if (!open) {
876
- if (keyCode === _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "g"].down) {
812
+ if (keyCode === _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "f"].down) {
877
813
  event.preventDefault();
878
814
  onOpenChanged(true);
879
815
  return;
@@ -884,12 +820,12 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
884
820
 
885
821
 
886
822
  switch (keyCode) {
887
- case _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "g"].tab:
888
- // When we show SearchTextInput and that is focused and the
823
+ case _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "f"].tab:
824
+ // When we show SearchField and that is focused and the
889
825
  // searchText is entered at least one character, dismiss button
890
- // is displayed. When user presses tab, we should move focus
891
- // to the dismiss button.
892
- if (this.hasSearchBox() && this.focusedIndex === 0 && searchText) {
826
+ // is displayed. When user presses tab, we should move focus to
827
+ // the dismiss button.
828
+ if (this.isSearchFieldFocused() && searchText) {
893
829
  return;
894
830
  }
895
831
 
@@ -897,10 +833,10 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
897
833
  onOpenChanged(false);
898
834
  return;
899
835
 
900
- case _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "g"].space:
901
- // When we display SearchTextInput and the focus is on it,
902
- // we should let the user type space.
903
- if (this.hasSearchBox() && this.focusedIndex === 0) {
836
+ case _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "f"].space:
837
+ // When we display SearchField and the focus is on it, we should
838
+ // let the user type space.
839
+ if (this.isSearchFieldFocused()) {
904
840
  return;
905
841
  } // Prevent space from scrolling down the page
906
842
 
@@ -908,12 +844,12 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
908
844
  event.preventDefault();
909
845
  return;
910
846
 
911
- case _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "g"].up:
847
+ case _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "f"].up:
912
848
  event.preventDefault();
913
849
  this.focusPreviousItem();
914
850
  return;
915
851
 
916
- case _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "g"].down:
852
+ case _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "f"].down:
917
853
  event.preventDefault();
918
854
  this.focusNextItem();
919
855
  return;
@@ -928,10 +864,10 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
928
864
  const keyCode = event.which || event.keyCode;
929
865
 
930
866
  switch (keyCode) {
931
- case _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "g"].space:
932
- // When we display SearchTextInput and the focus is on it,
933
- // we should let the user type space.
934
- if (this.hasSearchBox() && this.focusedIndex === 0) {
867
+ case _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "f"].space:
868
+ // When we display SearchField and the focus is on it, we should
869
+ // let the user type space.
870
+ if (this.isSearchFieldFocused()) {
935
871
  return;
936
872
  } // Prevent space from scrolling down the page
937
873
 
@@ -939,7 +875,7 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
939
875
  event.preventDefault();
940
876
  return;
941
877
 
942
- case _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "g"].escape:
878
+ case _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* keyCodes */ "f"].escape:
943
879
  // Close only the dropdown, not other elements that are
944
880
  // listening for an escape press
945
881
  if (open) {
@@ -952,6 +888,47 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
952
888
  }
953
889
  };
954
890
 
891
+ this.handleKeyDownDebounceResult = key => {
892
+ const foundIndex = this.props.items.filter(item => item.focusable).findIndex(({
893
+ component
894
+ }) => {
895
+ var _component$props;
896
+
897
+ if (_separator_item_js__WEBPACK_IMPORTED_MODULE_11__[/* default */ "a"].isClassOf(component)) {
898
+ return false;
899
+ } // Flow doesn't know that the component is an OptionItem
900
+ // $FlowIgnore[incompatible-use]
901
+
902
+
903
+ const label = (_component$props = component.props) == null ? void 0 : _component$props.label.toLowerCase();
904
+ return label.startsWith(key.toLowerCase());
905
+ });
906
+
907
+ if (foundIndex >= 0) {
908
+ const isClosed = !this.props.open;
909
+
910
+ if (isClosed) {
911
+ // Open the menu to be able to focus on the item that matches
912
+ // the text suggested.
913
+ this.props.onOpenChanged(true);
914
+ } // Update the focus reference.
915
+
916
+
917
+ this.focusedIndex = foundIndex;
918
+ this.scheduleToFocusCurrentItem(node => {
919
+ // Force click only if the dropdown is closed and we are using
920
+ // the SingleSelect component.
921
+ if (this.props.selectionType === "single" && isClosed && node) {
922
+ node.click();
923
+ this.props.onOpenChanged(false);
924
+ }
925
+ });
926
+ } // Otherwise, reset current text
927
+
928
+
929
+ this.textSuggestion = "";
930
+ };
931
+
955
932
  this.handleClickFocus = index => {
956
933
  // Turn itemsClicked on so pressing up or down would focus the
957
934
  // appropriate item in handleKeyDown
@@ -982,17 +959,32 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
982
959
  }
983
960
  };
984
961
 
962
+ this.handleSearchTextChanged = searchText => {
963
+ const {
964
+ onSearchTextChanged
965
+ } = this.props;
966
+
967
+ if (onSearchTextChanged) {
968
+ onSearchTextChanged(searchText);
969
+ }
970
+ };
971
+
985
972
  this.resetFocusedIndex();
986
973
  this.state = {
987
974
  prevItems: this.props.items,
988
975
  itemRefs: [],
989
976
  sameItemsFocusable: false,
990
977
  labels: {
991
- noResults: _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* defaultLabels */ "e"].noResults,
978
+ noResults: _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* defaultLabels */ "d"].noResults,
992
979
  ...props.labels
993
980
  }
994
981
  };
995
- this.virtualizedListRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createRef"]();
982
+ this.virtualizedListRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createRef"](); // We debounce the keydown handler to get the ASCII chars because it's
983
+ // called on every keydown
984
+
985
+ this.handleKeyDownDebounced = Object(_util_helpers_js__WEBPACK_IMPORTED_MODULE_14__[/* debounce */ "a"])(this.handleKeyDownDebounceResult, // Leaving enough time for the user to type a valid query (e.g. jul)
986
+ 500);
987
+ this.textSuggestion = "";
996
988
  }
997
989
 
998
990
  componentDidMount() {
@@ -1057,29 +1049,20 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
1057
1049
  this.removeEventListeners();
1058
1050
  }
1059
1051
 
1060
- hasSearchBox() {
1061
- return !!this.props.onSearchTextChanged && typeof this.props.searchText === "string";
1062
- } // Resets our initial focus index to what was passed in
1063
- // via the props
1064
-
1065
-
1052
+ // Resets our initial focus index to what was passed in via the props
1066
1053
  resetFocusedIndex() {
1067
1054
  const {
1068
1055
  initialFocusedIndex
1069
- } = this.props; // If we are given an initial focus index, select it. Otherwise
1070
- // default to the first item
1071
-
1072
- if (initialFocusedIndex) {
1073
- // If we have a search box visible, then our focus
1074
- // index is going to be offset by 1, since the orginal
1075
- // index doesn't account for the search box's
1076
- // existence.
1077
- if (this.hasSearchBox()) {
1078
- this.focusedIndex = initialFocusedIndex + 1;
1079
- } else {
1080
- this.focusedIndex = initialFocusedIndex;
1081
- }
1056
+ } = this.props; // If we are given an initial focus index, select it. Otherwise default
1057
+ // to the first item
1058
+
1059
+ if (typeof initialFocusedIndex !== "undefined") {
1060
+ this.focusedIndex = initialFocusedIndex;
1082
1061
  } else {
1062
+ if (this.hasSearchField() && !this.isSearchFieldFocused()) {
1063
+ return this.focusSearchField();
1064
+ }
1065
+
1083
1066
  this.focusedIndex = 0;
1084
1067
  }
1085
1068
  } // Figure out focus states for the dropdown after it has changed from open
@@ -1117,42 +1100,73 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
1117
1100
  document.removeEventListener("touchend", this.handleInteract);
1118
1101
  }
1119
1102
 
1120
- scheduleToFocusCurrentItem() {
1103
+ scheduleToFocusCurrentItem(onFocus) {
1121
1104
  if (this.shouldVirtualizeList()) {
1122
1105
  // wait for windowed items to be recalculated
1123
- this.props.schedule.animationFrame(() => this.focusCurrentItem());
1106
+ this.props.schedule.animationFrame(() => {
1107
+ this.focusCurrentItem(onFocus);
1108
+ });
1124
1109
  } else {
1125
1110
  // immediately focus the current item if we're not virtualizing
1126
- this.focusCurrentItem();
1111
+ this.focusCurrentItem(onFocus);
1127
1112
  }
1128
1113
  }
1114
+ /**
1115
+ * Focus on the current item.
1116
+ * @param [onFocus] - Callback to be called when the item is focused.
1117
+ */
1129
1118
 
1130
- focusCurrentItem() {
1131
- const fousedItemRef = this.state.itemRefs[this.focusedIndex];
1132
1119
 
1133
- if (fousedItemRef) {
1120
+ focusCurrentItem(onFocus) {
1121
+ const focusedItemRef = this.state.itemRefs[this.focusedIndex];
1122
+
1123
+ if (focusedItemRef) {
1134
1124
  // force react-window to scroll to ensure the focused item is visible
1135
1125
  if (this.virtualizedListRef.current) {
1136
1126
  // Our focused index does not include disabled items, but the
1137
1127
  // react-window index system does include the disabled items
1138
1128
  // in the count. So we need to use "originalIndex", which
1139
1129
  // does account for disabled items.
1140
- this.virtualizedListRef.current.scrollToItem(fousedItemRef.originalIndex);
1130
+ this.virtualizedListRef.current.scrollToItem(focusedItemRef.originalIndex);
1141
1131
  }
1142
1132
 
1143
- const node = react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.findDOMNode(fousedItemRef.ref.current);
1133
+ const node = react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.findDOMNode(focusedItemRef.ref.current);
1144
1134
 
1145
1135
  if (node) {
1146
1136
  node.focus(); // Keep track of the original index of the newly focused item.
1147
1137
  // To be used if the set of focusable items in the menu changes
1148
1138
 
1149
- this.focusedOriginalIndex = fousedItemRef.originalIndex;
1139
+ this.focusedOriginalIndex = focusedItemRef.originalIndex;
1140
+
1141
+ if (onFocus) {
1142
+ // Call the callback with the node that was focused.
1143
+ onFocus(node);
1144
+ }
1150
1145
  }
1151
1146
  }
1152
1147
  }
1153
1148
 
1149
+ focusSearchField() {
1150
+ if (this.searchFieldRef.current) {
1151
+ this.searchFieldRef.current.focus();
1152
+ }
1153
+ }
1154
+
1155
+ hasSearchField() {
1156
+ return !!this.props.isFilterable;
1157
+ }
1158
+
1159
+ isSearchFieldFocused() {
1160
+ return this.hasSearchField() && document.activeElement === this.searchFieldRef.current;
1161
+ }
1162
+
1154
1163
  focusPreviousItem() {
1155
1164
  if (this.focusedIndex === 0) {
1165
+ // Move the focus to the search field if it is the first item.
1166
+ if (this.hasSearchField() && !this.isSearchFieldFocused()) {
1167
+ return this.focusSearchField();
1168
+ }
1169
+
1156
1170
  this.focusedIndex = this.state.itemRefs.length - 1;
1157
1171
  } else {
1158
1172
  this.focusedIndex -= 1;
@@ -1163,6 +1177,11 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
1163
1177
 
1164
1178
  focusNextItem() {
1165
1179
  if (this.focusedIndex === this.state.itemRefs.length - 1) {
1180
+ // Move the focus to the search field if it is the last item.
1181
+ if (this.hasSearchField() && !this.isSearchFieldFocused()) {
1182
+ return this.focusSearchField();
1183
+ }
1184
+
1166
1185
  this.focusedIndex = 0;
1167
1186
  } else {
1168
1187
  this.focusedIndex += 1;
@@ -1201,19 +1220,15 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
1201
1220
  maybeRenderNoResults() {
1202
1221
  const {
1203
1222
  items,
1204
- onSearchTextChanged,
1205
- searchText,
1206
1223
  labels: {
1207
1224
  noResults
1208
1225
  }
1209
- } = this.props;
1210
- const showSearchTextInput = !!onSearchTextChanged && typeof searchText === "string";
1211
- const includeSearchCount = showSearchTextInput ? 1 : 0; // Verify if there are items to be rendered or not
1226
+ } = this.props; // Verify if there are items to be rendered or not
1212
1227
 
1213
- const numResults = items.length - includeSearchCount;
1228
+ const numResults = items.length;
1214
1229
 
1215
1230
  if (numResults === 0) {
1216
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_7__["LabelMedium"], {
1231
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_8__["LabelMedium"], {
1217
1232
  style: styles.noResult,
1218
1233
  testId: "dropdown-core-no-results"
1219
1234
  }, noResults);
@@ -1245,7 +1260,7 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
1245
1260
  const itemRole = this.getItemRole(); // if we don't need to virtualize, we can render the list directly
1246
1261
 
1247
1262
  return this.props.items.map((item, index) => {
1248
- if (_separator_item_js__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"].isClassOf(item.component)) {
1263
+ if (_separator_item_js__WEBPACK_IMPORTED_MODULE_11__[/* default */ "a"].isClassOf(item.component)) {
1249
1264
  return item.component;
1250
1265
  }
1251
1266
 
@@ -1261,29 +1276,7 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
1261
1276
 
1262
1277
  const focusIndex = focusCounter - 1; // The reference to the item is used to restore focus.
1263
1278
 
1264
- const currentRef = this.state.itemRefs[focusIndex] ? this.state.itemRefs[focusIndex].ref : null; // Render the SearchField component.
1265
-
1266
- if (_search_text_input_js__WEBPACK_IMPORTED_MODULE_11__[/* default */ "a"].isClassOf(component)) {
1267
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["cloneElement"](component, { ...populatedProps,
1268
- key: "search-text-input",
1269
- // pass the current ref down to the input element
1270
- itemRef: currentRef,
1271
- // override to avoid losing focus when pressing a key
1272
- onClick: () => {
1273
- this.handleClickFocus(0);
1274
- this.focusCurrentItem();
1275
- },
1276
- // apply custom styles
1277
- style: _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* searchInputStyle */ "h"],
1278
- // TODO(WB-1310): Remove the autofocus prop after making
1279
- // the search field sticky.
1280
- // Currently autofocusing on the search field to work
1281
- // around it losing focus on mount when switching between
1282
- // virtualized and non-virtualized dropdown filter results.
1283
- autofocus: this.focusedIndex === 0
1284
- });
1285
- } // Render OptionItem and/or ActionItem elements.
1286
-
1279
+ const currentRef = this.state.itemRefs[focusIndex] ? this.state.itemRefs[focusIndex].ref : null; // Render OptionItem and/or ActionItem elements.
1287
1280
 
1288
1281
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["cloneElement"](component, { ...populatedProps,
1289
1282
  key: index,
@@ -1310,33 +1303,11 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
1310
1303
  let focusCounter = 0;
1311
1304
  const itemRole = this.getItemRole();
1312
1305
  return this.props.items.map((item, index) => {
1313
- if (!_separator_item_js__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"].isClassOf(item.component) && item.focusable) {
1306
+ if (!_separator_item_js__WEBPACK_IMPORTED_MODULE_11__[/* default */ "a"].isClassOf(item.component) && item.focusable) {
1314
1307
  focusCounter += 1;
1315
1308
  }
1316
1309
 
1317
1310
  const focusIndex = focusCounter - 1;
1318
-
1319
- if (_search_text_input_js__WEBPACK_IMPORTED_MODULE_11__[/* default */ "a"].isClassOf(item.component)) {
1320
- return { ...item,
1321
- // override to avoid losing focus when pressing a key
1322
- onClick: () => {
1323
- this.handleClickFocus(0);
1324
- this.focusCurrentItem();
1325
- },
1326
- populatedProps: {
1327
- style: _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* searchInputStyle */ "h"],
1328
- // pass the current ref down to the input element
1329
- itemRef: this.state.itemRefs[focusIndex] ? this.state.itemRefs[focusIndex].ref : null,
1330
- // TODO(WB-1310): Remove the autofocus prop after making
1331
- // the search field sticky.
1332
- // Currently autofocusing on the search field to work
1333
- // around it losing focus on mount when switching between
1334
- // virtualized and non-virtualized dropdown filter results.
1335
- autofocus: this.focusedIndex === 0
1336
- }
1337
- };
1338
- }
1339
-
1340
1311
  return { ...item,
1341
1312
  role: itemRole,
1342
1313
  ref: item.focusable ? this.state.itemRefs[focusIndex] ? this.state.itemRefs[focusIndex].ref : null : null,
@@ -1354,12 +1325,29 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
1354
1325
  renderVirtualizedList() {
1355
1326
  // preprocess items data to pass it to the renderer
1356
1327
  const virtualizedItems = this.parseVirtualizedItems();
1357
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_dropdown_core_virtualized_js__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"], {
1328
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_dropdown_core_virtualized_js__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"], {
1358
1329
  data: virtualizedItems,
1359
1330
  listRef: this.virtualizedListRef
1360
1331
  });
1361
1332
  }
1362
1333
 
1334
+ renderSearchField() {
1335
+ const {
1336
+ searchText
1337
+ } = this.props;
1338
+ const {
1339
+ labels
1340
+ } = this.state;
1341
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_search_field__WEBPACK_IMPORTED_MODULE_7___default.a, {
1342
+ clearAriaLabel: labels.clearSearch,
1343
+ onChange: this.handleSearchTextChanged,
1344
+ placeholder: labels.filter,
1345
+ ref: this.searchFieldRef,
1346
+ style: styles.searchInputStyle,
1347
+ value: searchText || ""
1348
+ });
1349
+ }
1350
+
1363
1351
  renderDropdownMenu(listRenderer, isReferenceHidden) {
1364
1352
  const {
1365
1353
  dropdownStyle,
@@ -1369,17 +1357,18 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
1369
1357
  // It's only used if the element exists in the DOM
1370
1358
 
1371
1359
  const openerStyle = openerElement && window.getComputedStyle(openerElement);
1372
- const minDropdownWidth = openerStyle ? openerStyle.getPropertyValue("width") : 0; // Vertical padding of the dropdown menu + borders
1373
-
1374
- const initialHeight = 12;
1375
- const maxDropdownHeight = Object(_util_dropdown_menu_styles_js__WEBPACK_IMPORTED_MODULE_14__[/* getDropdownMenuHeight */ "b"])(this.props.items, initialHeight);
1360
+ const minDropdownWidth = openerStyle ? openerStyle.getPropertyValue("width") : 0;
1361
+ const maxDropdownHeight = Object(_util_dropdown_menu_styles_js__WEBPACK_IMPORTED_MODULE_15__[/* getDropdownMenuHeight */ "b"])(this.props.items);
1376
1362
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_6__["View"] // Stop propagation to prevent the mouseup listener on the
1377
1363
  // document from closing the menu.
1378
1364
  , {
1379
1365
  onMouseUp: this.handleDropdownMouseUp,
1366
+ style: [styles.dropdown, light && styles.light, isReferenceHidden && styles.hidden, dropdownStyle],
1367
+ testId: "dropdown-core-container"
1368
+ }, this.props.isFilterable && this.renderSearchField(), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_6__["View"], {
1380
1369
  role: this.props.role,
1381
- style: [styles.dropdown, light && styles.light, isReferenceHidden && styles.hidden, Object(_util_dropdown_menu_styles_js__WEBPACK_IMPORTED_MODULE_14__[/* generateDropdownMenuStyles */ "a"])(minDropdownWidth, maxDropdownHeight), dropdownStyle]
1382
- }, listRenderer, this.maybeRenderNoResults());
1370
+ style: [styles.listboxOrMenu, Object(_util_dropdown_menu_styles_js__WEBPACK_IMPORTED_MODULE_15__[/* generateDropdownMenuStyles */ "a"])(minDropdownWidth, maxDropdownHeight)]
1371
+ }, listRenderer), this.maybeRenderNoResults());
1383
1372
  }
1384
1373
 
1385
1374
  renderDropdown() {
@@ -1410,7 +1399,7 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
1410
1399
  const {
1411
1400
  labels
1412
1401
  } = this.state;
1413
- const totalItems = this.hasSearchBox() ? items.length - 1 : items.length;
1402
+ const totalItems = items.length;
1414
1403
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](StyledSpan, {
1415
1404
  "aria-live": "polite",
1416
1405
  "aria-atomic": "true",
@@ -1440,10 +1429,13 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
1440
1429
  DropdownCore.defaultProps = {
1441
1430
  alignment: "left",
1442
1431
  labels: {
1443
- noResults: _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* defaultLabels */ "e"].noResults,
1444
- someSelected: _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* defaultLabels */ "e"].someSelected
1432
+ clearSearch: _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* defaultLabels */ "d"].clearSearch,
1433
+ filter: _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* defaultLabels */ "d"].filter,
1434
+ noResults: _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* defaultLabels */ "d"].noResults,
1435
+ someSelected: _util_constants_js__WEBPACK_IMPORTED_MODULE_12__[/* defaultLabels */ "d"].someSelected
1445
1436
  },
1446
- light: false
1437
+ light: false,
1438
+ selectionType: "single"
1447
1439
  };
1448
1440
  const styles = aphrodite__WEBPACK_IMPORTED_MODULE_2__["StyleSheet"].create({
1449
1441
  menuWrapper: {
@@ -1455,13 +1447,15 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_2__["StyleSheet"].create({
1455
1447
  paddingTop: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_5___default.a.xxxSmall_4,
1456
1448
  paddingBottom: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_5___default.a.xxxSmall_4,
1457
1449
  border: `solid 1px ${_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_4___default.a.offBlack16}`,
1458
- boxShadow: `0px 8px 8px 0px ${Object(_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_4__["fade"])(_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_4___default.a.offBlack, 0.1)}`,
1459
- overflowY: "auto"
1450
+ boxShadow: `0px 8px 8px 0px ${Object(_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_4__["fade"])(_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_4___default.a.offBlack, 0.1)}`
1460
1451
  },
1461
1452
  light: {
1462
1453
  // Pretty much just remove the border
1463
1454
  border: "none"
1464
1455
  },
1456
+ listboxOrMenu: {
1457
+ overflowY: "auto"
1458
+ },
1465
1459
  hidden: {
1466
1460
  pointerEvents: "none",
1467
1461
  visibility: "hidden"
@@ -1471,6 +1465,13 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_2__["StyleSheet"].create({
1471
1465
  alignSelf: "center",
1472
1466
  marginTop: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_5___default.a.xxSmall_6
1473
1467
  },
1468
+ searchInputStyle: {
1469
+ margin: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_5___default.a.xSmall_8,
1470
+ marginTop: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_5___default.a.xxxSmall_4,
1471
+ // Set `minHeight` to "auto" to stop the search field from having
1472
+ // a height of 0 and being cut off.
1473
+ minHeight: "auto"
1474
+ },
1474
1475
  srOnly: {
1475
1476
  border: 0,
1476
1477
  clip: "rect(0,0,0,0)",
@@ -1482,10 +1483,10 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_2__["StyleSheet"].create({
1482
1483
  width: 1
1483
1484
  }
1484
1485
  });
1485
- /* harmony default export */ __webpack_exports__["a"] = (Object(_khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_8__["withActionScheduler"])(DropdownCore));
1486
+ /* harmony default export */ __webpack_exports__["a"] = (Object(_khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_9__["withActionScheduler"])(DropdownCore));
1486
1487
 
1487
1488
  /***/ }),
1488
- /* 16 */
1489
+ /* 15 */
1489
1490
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1490
1491
 
1491
1492
  "use strict";
@@ -1493,10 +1494,8 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_2__["StyleSheet"].create({
1493
1494
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return generateDropdownMenuStyles; });
1494
1495
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
1495
1496
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_0__);
1496
- /* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
1497
+ /* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
1497
1498
  /* harmony import */ var _components_separator_item_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6);
1498
- /* harmony import */ var _components_search_text_input_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8);
1499
-
1500
1499
 
1501
1500
 
1502
1501
 
@@ -1515,10 +1514,7 @@ function getDropdownMenuHeight(items, initialHeight = 0) {
1515
1514
  // this number of elements in the visible area
1516
1515
  return items.slice(0, _constants_js__WEBPACK_IMPORTED_MODULE_1__[/* MAX_VISIBLE_ITEMS */ "b"]).reduce((sum, item) => {
1517
1516
  if (_components_separator_item_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].isClassOf(item.component)) {
1518
- return sum + _constants_js__WEBPACK_IMPORTED_MODULE_1__[/* SEPARATOR_ITEM_HEIGHT */ "d"];
1519
- } else if (_components_search_text_input_js__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].isClassOf(item.component)) {
1520
- // search text input height
1521
- return sum + _constants_js__WEBPACK_IMPORTED_MODULE_1__[/* SEARCH_ITEM_HEIGHT */ "c"];
1517
+ return sum + _constants_js__WEBPACK_IMPORTED_MODULE_1__[/* SEPARATOR_ITEM_HEIGHT */ "c"];
1522
1518
  } else {
1523
1519
  return sum + _constants_js__WEBPACK_IMPORTED_MODULE_1__[/* DROPDOWN_ITEM_HEIGHT */ "a"];
1524
1520
  }
@@ -1544,19 +1540,19 @@ function generateDropdownMenuStyles(minWidth, maxHeight) {
1544
1540
  }
1545
1541
 
1546
1542
  /***/ }),
1547
- /* 17 */
1543
+ /* 16 */
1548
1544
  /***/ (function(module, exports) {
1549
1545
 
1550
1546
  module.exports = require("react-router");
1551
1547
 
1552
1548
  /***/ }),
1553
- /* 18 */
1549
+ /* 17 */
1554
1550
  /***/ (function(module, exports) {
1555
1551
 
1556
1552
  module.exports = require("@khanacademy/wonder-blocks-timing");
1557
1553
 
1558
1554
  /***/ }),
1559
- /* 19 */
1555
+ /* 18 */
1560
1556
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1561
1557
 
1562
1558
  "use strict";
@@ -1565,21 +1561,21 @@ module.exports = require("@khanacademy/wonder-blocks-timing");
1565
1561
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
1566
1562
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
1567
1563
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_1__);
1568
- /* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17);
1564
+ /* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16);
1569
1565
  /* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_router__WEBPACK_IMPORTED_MODULE_2__);
1570
- /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2);
1566
+ /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1);
1571
1567
  /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_3__);
1572
1568
  /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5);
1573
1569
  /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4__);
1574
- /* harmony import */ var _khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(11);
1570
+ /* harmony import */ var _khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(10);
1575
1571
  /* harmony import */ var _khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_clickable__WEBPACK_IMPORTED_MODULE_5__);
1576
- /* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(9);
1572
+ /* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(8);
1577
1573
  /* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_6__);
1578
1574
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3);
1579
1575
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_7__);
1580
- /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(10);
1576
+ /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9);
1581
1577
  /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_8__);
1582
- /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(1);
1578
+ /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(2);
1583
1579
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1584
1580
 
1585
1581
 
@@ -1794,11 +1790,57 @@ const _generateStyles = (light, placeholder) => {
1794
1790
  };
1795
1791
 
1796
1792
  /***/ }),
1797
- /* 20 */
1793
+ /* 19 */
1798
1794
  /***/ (function(module, exports) {
1799
1795
 
1800
1796
  module.exports = require("react-window");
1801
1797
 
1798
+ /***/ }),
1799
+ /* 20 */
1800
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
1801
+
1802
+ "use strict";
1803
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getStringForKey; });
1804
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return debounce; });
1805
+ /**
1806
+ * Checks if a given key is a valid ASCII value.
1807
+ *
1808
+ * @param {string} key The key that is being typed in.
1809
+ * @returns A valid string representation of the given key.
1810
+ */
1811
+ function getStringForKey(key) {
1812
+ // If the key is of length 1, it is an ASCII value.
1813
+ // Otherwise, if there are no ASCII characters in the key name,
1814
+ // it is a Unicode character.
1815
+ // See https://www.w3.org/TR/uievents-key/
1816
+ if (key.length === 1 || !/^[A-Z]/i.test(key)) {
1817
+ return key;
1818
+ }
1819
+
1820
+ return "";
1821
+ }
1822
+ /**
1823
+ *
1824
+ * @param {fn} callback The function that will be executed after the debounce is resolved.
1825
+ * @param {number} wait The period of time that will be executed the debounced
1826
+ * function.
1827
+ * @returns The function that will be executed after the wait period is
1828
+ * fulfilled.
1829
+ */
1830
+
1831
+ function debounce(callback, wait) {
1832
+ let timeout;
1833
+ return function executedFunction(...args) {
1834
+ const later = () => {
1835
+ clearTimeout(timeout);
1836
+ callback.apply(void 0, args);
1837
+ };
1838
+
1839
+ clearTimeout(timeout);
1840
+ timeout = setTimeout(later, wait);
1841
+ };
1842
+ }
1843
+
1802
1844
  /***/ }),
1803
1845
  /* 21 */
1804
1846
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
@@ -1811,10 +1853,10 @@ module.exports = require("react-window");
1811
1853
  /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
1812
1854
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
1813
1855
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_2__);
1814
- /* harmony import */ var _dropdown_opener_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(14);
1815
- /* harmony import */ var _action_item_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(12);
1816
- /* harmony import */ var _option_item_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(13);
1817
- /* harmony import */ var _dropdown_core_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(15);
1856
+ /* harmony import */ var _dropdown_opener_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(13);
1857
+ /* harmony import */ var _action_item_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(11);
1858
+ /* harmony import */ var _option_item_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(12);
1859
+ /* harmony import */ var _dropdown_core_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(14);
1818
1860
  /* harmony import */ var _action_menu_opener_core_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(33);
1819
1861
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1820
1862
 
@@ -1829,6 +1871,17 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
1829
1871
 
1830
1872
  /**
1831
1873
  * A menu that consists of various types of items.
1874
+ *
1875
+ * ## Usage
1876
+ *
1877
+ * ```jsx
1878
+ * import {ActionMenu, ActionItem} from "@khanacademy/wonder-blocks-dropdown";
1879
+ *
1880
+ * <ActionMenu menuText="Menu">
1881
+ * <ActionItem href="/profile" label="Profile" />
1882
+ * <ActionItem label="Settings" onClick={() => {}} />
1883
+ * </ActionMenu>
1884
+ * ```
1832
1885
  */
1833
1886
  class ActionMenu extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
1834
1887
  constructor(...args) {
@@ -2023,11 +2076,10 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_2__["StyleSheet"].create({
2023
2076
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
2024
2077
  /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
2025
2078
  /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
2026
- /* harmony import */ var _dropdown_core_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(15);
2027
- /* harmony import */ var _dropdown_opener_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(14);
2028
- /* harmony import */ var _select_opener_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(19);
2029
- /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1);
2030
- /* harmony import */ var _search_text_input_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(8);
2079
+ /* harmony import */ var _dropdown_core_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14);
2080
+ /* harmony import */ var _dropdown_opener_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(13);
2081
+ /* harmony import */ var _select_opener_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(18);
2082
+ /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2);
2031
2083
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2032
2084
 
2033
2085
 
@@ -2037,7 +2089,6 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2037
2089
 
2038
2090
 
2039
2091
 
2040
-
2041
2092
  /**
2042
2093
  * The single select allows the selection of one item. Clients are responsible
2043
2094
  * for keeping track of the selected item in the select.
@@ -2045,11 +2096,23 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2045
2096
  * The single select dropdown closes after the selection of an item. If the same
2046
2097
  * item is selected, there is no callback.
2047
2098
  *
2048
- * *NOTE:* The component automatically uses
2099
+ * **NOTE:** If there are more than 125 items, the component automatically uses
2049
2100
  * [react-window](https://github.com/bvaughn/react-window) to improve
2050
2101
  * performance when rendering these elements and is capable of handling many
2051
2102
  * hundreds of items without performance problems.
2052
2103
  *
2104
+ * ## Usage
2105
+ *
2106
+ * ```jsx
2107
+ * import {OptionItem, SingleSelect} from "@khanacademy/wonder-blocks-dropdown";
2108
+ *
2109
+ * const [selectedValue, setSelectedValue] = useState("");
2110
+ *
2111
+ * <SingleSelect placeholder="Choose a fruit" onChange={setSelectedValue} selectedValue={selectedValue}>
2112
+ * <OptionItem value="pear">Pear</OptionItem>
2113
+ * <OptionItem value="mango">Mango</OptionItem>
2114
+ * </SingleSelect>
2115
+ * ```
2053
2116
  */
2054
2117
  class SingleSelect extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
2055
2118
  constructor(props) {
@@ -2178,26 +2241,6 @@ class SingleSelect extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
2178
2241
  return this.mapOptionItemsToDropdownItems(isFilterable ? this.filterChildren(children) : children);
2179
2242
  }
2180
2243
 
2181
- getSearchField() {
2182
- if (!this.props.isFilterable) {
2183
- return null;
2184
- }
2185
-
2186
- return {
2187
- component: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_search_text_input_js__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"], {
2188
- key: "search-text-input",
2189
- onChange: this.handleSearchTextChanged,
2190
- searchText: this.state.searchText,
2191
- labels: {
2192
- clearSearch: _util_constants_js__WEBPACK_IMPORTED_MODULE_5__[/* defaultLabels */ "e"].clearSearch,
2193
- filter: _util_constants_js__WEBPACK_IMPORTED_MODULE_5__[/* defaultLabels */ "e"].filter
2194
- }
2195
- }),
2196
- focusable: true,
2197
- populatedProps: {}
2198
- };
2199
- }
2200
-
2201
2244
  renderOpener(numItems) {
2202
2245
  const {
2203
2246
  children,
@@ -2260,14 +2303,13 @@ class SingleSelect extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
2260
2303
  searchText
2261
2304
  } = this.state;
2262
2305
  const allChildren = react__WEBPACK_IMPORTED_MODULE_0__["Children"].toArray(children).filter(Boolean);
2263
- const filteredItems = this.getMenuItems(allChildren);
2306
+ const items = this.getMenuItems(allChildren);
2264
2307
  const opener = this.renderOpener(allChildren.length);
2265
- const searchField = this.getSearchField();
2266
- const items = searchField ? [searchField].concat(filteredItems) : filteredItems;
2267
2308
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_dropdown_core_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"], {
2268
2309
  role: "listbox",
2310
+ selectionType: "single",
2269
2311
  alignment: alignment,
2270
- dropdownStyle: [isFilterable && _util_constants_js__WEBPACK_IMPORTED_MODULE_5__[/* filterableDropdownStyle */ "f"], _util_constants_js__WEBPACK_IMPORTED_MODULE_5__[/* selectDropdownStyle */ "i"], dropdownStyle],
2312
+ dropdownStyle: [isFilterable && _util_constants_js__WEBPACK_IMPORTED_MODULE_5__[/* filterableDropdownStyle */ "e"], _util_constants_js__WEBPACK_IMPORTED_MODULE_5__[/* selectDropdownStyle */ "g"], dropdownStyle],
2271
2313
  initialFocusedIndex: this.selectedIndex,
2272
2314
  items: items,
2273
2315
  light: light,
@@ -2277,6 +2319,7 @@ class SingleSelect extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
2277
2319
  openerElement: this.state.openerElement,
2278
2320
  style: style,
2279
2321
  className: className,
2322
+ isFilterable: isFilterable,
2280
2323
  onSearchTextChanged: isFilterable ? this.handleSearchTextChanged : null,
2281
2324
  searchText: isFilterable ? searchText : ""
2282
2325
  });
@@ -2299,13 +2342,12 @@ SingleSelect.defaultProps = {
2299
2342
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
2300
2343
  /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
2301
2344
  /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
2302
- /* harmony import */ var _action_item_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12);
2303
- /* harmony import */ var _dropdown_core_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(15);
2304
- /* harmony import */ var _dropdown_opener_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(14);
2305
- /* harmony import */ var _search_text_input_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8);
2306
- /* harmony import */ var _select_opener_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(19);
2307
- /* harmony import */ var _separator_item_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6);
2308
- /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1);
2345
+ /* harmony import */ var _action_item_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11);
2346
+ /* harmony import */ var _dropdown_core_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(14);
2347
+ /* harmony import */ var _dropdown_opener_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13);
2348
+ /* harmony import */ var _select_opener_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(18);
2349
+ /* harmony import */ var _separator_item_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6);
2350
+ /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2);
2309
2351
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2310
2352
 
2311
2353
 
@@ -2317,7 +2359,6 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2317
2359
 
2318
2360
 
2319
2361
 
2320
-
2321
2362
  /**
2322
2363
  * A dropdown that consists of multiple selection items. This select allows
2323
2364
  * multiple options to be selected. Clients are responsible for keeping track
@@ -2325,6 +2366,17 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2325
2366
  *
2326
2367
  * The multi select stays open until closed by the user. The onChange callback
2327
2368
  * happens every time there is a change in the selection of the items.
2369
+ *
2370
+ * ## Usage
2371
+ *
2372
+ * ```jsx
2373
+ * import {OptionItem, MultiSelect} from "@khanacademy/wonder-blocks-dropdown";
2374
+ *
2375
+ * <MultiSelect onChange={setSelectedValues} selectedValues={selectedValues}>
2376
+ * <OptionItem value="pear">Pear</OptionItem>
2377
+ * <OptionItem value="mango">Mango</OptionItem>
2378
+ * </MultiSelect>
2379
+ * ```
2328
2380
  */
2329
2381
  class MultiSelect extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
2330
2382
  constructor(props) {
@@ -2415,13 +2467,13 @@ class MultiSelect extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
2415
2467
  searchText: "",
2416
2468
  lastSelectedValues: [],
2417
2469
  // merge custom labels with the default ones
2418
- labels: { ..._util_constants_js__WEBPACK_IMPORTED_MODULE_8__[/* defaultLabels */ "e"],
2470
+ labels: { ..._util_constants_js__WEBPACK_IMPORTED_MODULE_7__[/* defaultLabels */ "d"],
2419
2471
  ...props.labels
2420
2472
  },
2421
2473
  openerElement: null
2422
2474
  }; // merge custom labels with the default ones
2423
2475
 
2424
- this.labels = { ..._util_constants_js__WEBPACK_IMPORTED_MODULE_8__[/* defaultLabels */ "e"],
2476
+ this.labels = { ..._util_constants_js__WEBPACK_IMPORTED_MODULE_7__[/* defaultLabels */ "d"],
2425
2477
  ...props.labels
2426
2478
  };
2427
2479
  }
@@ -2481,30 +2533,6 @@ class MultiSelect extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
2481
2533
  }
2482
2534
  }
2483
2535
 
2484
- getSearchField() {
2485
- if (!this.props.isFilterable) {
2486
- return [];
2487
- }
2488
-
2489
- const {
2490
- clearSearch,
2491
- filter
2492
- } = this.state.labels;
2493
- return [{
2494
- component: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_search_text_input_js__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"], {
2495
- key: "search-text-input",
2496
- onChange: this.handleSearchTextChanged,
2497
- searchText: this.state.searchText,
2498
- labels: {
2499
- clearSearch,
2500
- filter
2501
- }
2502
- }),
2503
- focusable: true,
2504
- populatedProps: {}
2505
- }];
2506
- }
2507
-
2508
2536
  getShortcuts(numOptions) {
2509
2537
  const {
2510
2538
  selectedValues,
@@ -2539,7 +2567,7 @@ class MultiSelect extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
2539
2567
  populatedProps: {}
2540
2568
  };
2541
2569
  const separator = {
2542
- component: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_separator_item_js__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"], {
2570
+ component: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_separator_item_js__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"], {
2543
2571
  key: "shortcuts-separator"
2544
2572
  }),
2545
2573
  focusable: false,
@@ -2586,7 +2614,7 @@ class MultiSelect extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
2586
2614
 
2587
2615
  if (lastSelectedChildren.length && restOfTheChildren.length) {
2588
2616
  lastSelectedItems.push({
2589
- component: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_separator_item_js__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"], {
2617
+ component: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_separator_item_js__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"], {
2590
2618
  key: "selected-separator"
2591
2619
  }),
2592
2620
  focusable: false,
@@ -2634,7 +2662,7 @@ class MultiSelect extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
2634
2662
  disabled: numOptions === 0 || disabled,
2635
2663
  ref: this.handleOpenerRef,
2636
2664
  text: menuText
2637
- }, opener) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_select_opener_js__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"], _extends({}, sharedProps, {
2665
+ }, opener) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_select_opener_js__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"], _extends({}, sharedProps, {
2638
2666
  disabled: numOptions === 0 || disabled,
2639
2667
  id: id,
2640
2668
  isPlaceholder: menuText === noneSelected,
@@ -2662,6 +2690,8 @@ class MultiSelect extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
2662
2690
  searchText
2663
2691
  } = this.state;
2664
2692
  const {
2693
+ clearSearch,
2694
+ filter,
2665
2695
  noResults,
2666
2696
  someSelected
2667
2697
  } = this.state.labels;
@@ -2672,18 +2702,22 @@ class MultiSelect extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
2672
2702
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_dropdown_core_js__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"], {
2673
2703
  role: "listbox",
2674
2704
  alignment: alignment,
2675
- dropdownStyle: [isFilterable && _util_constants_js__WEBPACK_IMPORTED_MODULE_8__[/* filterableDropdownStyle */ "f"], _util_constants_js__WEBPACK_IMPORTED_MODULE_8__[/* selectDropdownStyle */ "i"], dropdownStyle],
2676
- items: [].concat(this.getSearchField(), this.getShortcuts(numOptions), filteredItems),
2705
+ dropdownStyle: [isFilterable && _util_constants_js__WEBPACK_IMPORTED_MODULE_7__[/* filterableDropdownStyle */ "e"], _util_constants_js__WEBPACK_IMPORTED_MODULE_7__[/* selectDropdownStyle */ "g"], dropdownStyle],
2706
+ isFilterable: isFilterable,
2707
+ items: [].concat(this.getShortcuts(numOptions), filteredItems),
2677
2708
  light: light,
2678
2709
  onOpenChanged: this.handleOpenChanged,
2679
2710
  open: open,
2680
2711
  opener: opener,
2681
2712
  openerElement: this.state.openerElement,
2713
+ selectionType: "multi",
2682
2714
  style: style,
2683
2715
  className: className,
2684
2716
  onSearchTextChanged: isFilterable ? this.handleSearchTextChanged : null,
2685
2717
  searchText: isFilterable ? searchText : "",
2686
2718
  labels: {
2719
+ clearSearch,
2720
+ filter,
2687
2721
  noResults,
2688
2722
  someSelected
2689
2723
  }
@@ -2715,9 +2749,9 @@ module.exports = require("react-router-dom");
2715
2749
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
2716
2750
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
2717
2751
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_1__);
2718
- /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
2752
+ /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
2719
2753
  /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2__);
2720
- /* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9);
2754
+ /* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8);
2721
2755
  /* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_3__);
2722
2756
 
2723
2757
 
@@ -2772,11 +2806,11 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_1__["StyleSheet"].create({
2772
2806
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
2773
2807
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
2774
2808
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_1__);
2775
- /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
2809
+ /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
2776
2810
  /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_2__);
2777
2811
  /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5);
2778
2812
  /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_3__);
2779
- /* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9);
2813
+ /* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8);
2780
2814
  /* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_4__);
2781
2815
 
2782
2816
 
@@ -2857,6 +2891,12 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_1__["StyleSheet"].create({
2857
2891
 
2858
2892
  /***/ }),
2859
2893
  /* 27 */
2894
+ /***/ (function(module, exports) {
2895
+
2896
+ module.exports = require("@khanacademy/wonder-blocks-search-field");
2897
+
2898
+ /***/ }),
2899
+ /* 28 */
2860
2900
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2861
2901
 
2862
2902
  "use strict";
@@ -2864,16 +2904,14 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_1__["StyleSheet"].create({
2864
2904
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
2865
2905
  /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
2866
2906
  /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
2867
- /* harmony import */ var react_window__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(20);
2907
+ /* harmony import */ var react_window__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(19);
2868
2908
  /* harmony import */ var react_window__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_window__WEBPACK_IMPORTED_MODULE_2__);
2869
- /* harmony import */ var _khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(18);
2909
+ /* harmony import */ var _khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(17);
2870
2910
  /* harmony import */ var _khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_3__);
2871
- /* harmony import */ var _dropdown_core_virtualized_item_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28);
2872
- /* harmony import */ var _search_text_input_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8);
2873
- /* harmony import */ var _separator_item_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6);
2874
- /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(1);
2875
- /* harmony import */ var _util_dropdown_menu_styles_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(16);
2876
-
2911
+ /* harmony import */ var _dropdown_core_virtualized_item_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29);
2912
+ /* harmony import */ var _separator_item_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6);
2913
+ /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2);
2914
+ /* harmony import */ var _util_dropdown_menu_styles_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(15);
2877
2915
 
2878
2916
 
2879
2917
 
@@ -2895,20 +2933,17 @@ class DropdownCoreVirtualized extends react__WEBPACK_IMPORTED_MODULE_0__["Compon
2895
2933
  // get the current item in the list
2896
2934
  const item = this.props.data[index];
2897
2935
 
2898
- if (_separator_item_js__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].isClassOf(item.component)) {
2936
+ if (_separator_item_js__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].isClassOf(item.component)) {
2899
2937
  // this is the separator's height (1px) + vertical margin (8px)
2900
- return _util_constants_js__WEBPACK_IMPORTED_MODULE_7__[/* SEPARATOR_ITEM_HEIGHT */ "d"];
2901
- } else if (_search_text_input_js__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].isClassOf(item.component)) {
2902
- // search text input height
2903
- return _util_constants_js__WEBPACK_IMPORTED_MODULE_7__[/* SEARCH_ITEM_HEIGHT */ "c"];
2938
+ return _util_constants_js__WEBPACK_IMPORTED_MODULE_6__[/* SEPARATOR_ITEM_HEIGHT */ "c"];
2904
2939
  } else {
2905
2940
  // default dropdown item height
2906
- return _util_constants_js__WEBPACK_IMPORTED_MODULE_7__[/* DROPDOWN_ITEM_HEIGHT */ "a"];
2941
+ return _util_constants_js__WEBPACK_IMPORTED_MODULE_6__[/* DROPDOWN_ITEM_HEIGHT */ "a"];
2907
2942
  }
2908
2943
  };
2909
2944
 
2910
2945
  this.state = {
2911
- height: Object(_util_dropdown_menu_styles_js__WEBPACK_IMPORTED_MODULE_8__[/* getDropdownMenuHeight */ "b"])(props.data),
2946
+ height: Object(_util_dropdown_menu_styles_js__WEBPACK_IMPORTED_MODULE_7__[/* getDropdownMenuHeight */ "b"])(props.data),
2912
2947
  width: props.width
2913
2948
  };
2914
2949
  }
@@ -2964,7 +2999,7 @@ class DropdownCoreVirtualized extends react__WEBPACK_IMPORTED_MODULE_0__["Compon
2964
2999
 
2965
3000
  setHeight() {
2966
3001
  // calculate dropdown's height depending on the type of items
2967
- const height = Object(_util_dropdown_menu_styles_js__WEBPACK_IMPORTED_MODULE_8__[/* getDropdownMenuHeight */ "b"])(this.props.data);
3002
+ const height = Object(_util_dropdown_menu_styles_js__WEBPACK_IMPORTED_MODULE_7__[/* getDropdownMenuHeight */ "b"])(this.props.data);
2968
3003
  this.setState({
2969
3004
  height
2970
3005
  });
@@ -2994,7 +3029,7 @@ class DropdownCoreVirtualized extends react__WEBPACK_IMPORTED_MODULE_0__["Compon
2994
3029
  return -1;
2995
3030
  }) // 3. only render the possible visible items to minimize layout
2996
3031
  // jumps
2997
- .slice(0, _util_constants_js__WEBPACK_IMPORTED_MODULE_7__[/* MAX_VISIBLE_ITEMS */ "b"]); // Append longest items to calculate the container width.
3032
+ .slice(0, _util_constants_js__WEBPACK_IMPORTED_MODULE_6__[/* MAX_VISIBLE_ITEMS */ "b"]); // Append longest items to calculate the container width.
2998
3033
  // We need to hide these sorted elements to avoid any FOUC.
2999
3034
 
3000
3035
  return longestItems.map(item => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["cloneElement"](item, {
@@ -3054,7 +3089,7 @@ class DropdownCoreVirtualized extends react__WEBPACK_IMPORTED_MODULE_0__["Compon
3054
3089
  /* harmony default export */ __webpack_exports__["a"] = (Object(_khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_3__["withActionScheduler"])(DropdownCoreVirtualized));
3055
3090
 
3056
3091
  /***/ }),
3057
- /* 28 */
3092
+ /* 29 */
3058
3093
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3059
3094
 
3060
3095
  "use strict";
@@ -3107,12 +3142,6 @@ class DropdownVirtualizedItem extends react__WEBPACK_IMPORTED_MODULE_0__["Compon
3107
3142
 
3108
3143
  /* harmony default export */ __webpack_exports__["a"] = (DropdownVirtualizedItem);
3109
3144
 
3110
- /***/ }),
3111
- /* 29 */
3112
- /***/ (function(module, exports) {
3113
-
3114
- module.exports = require("@khanacademy/wonder-blocks-search-field");
3115
-
3116
3145
  /***/ }),
3117
3146
  /* 30 */
3118
3147
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
@@ -3211,19 +3240,19 @@ module.exports = require("@khanacademy/wonder-blocks-modal");
3211
3240
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
3212
3241
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
3213
3242
  /* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_1__);
3214
- /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(10);
3243
+ /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9);
3215
3244
  /* harmony import */ var _khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_typography__WEBPACK_IMPORTED_MODULE_2__);
3216
- /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2);
3245
+ /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1);
3217
3246
  /* harmony import */ var _khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_color__WEBPACK_IMPORTED_MODULE_3__);
3218
3247
  /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5);
3219
3248
  /* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4__);
3220
- /* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9);
3249
+ /* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8);
3221
3250
  /* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_5__);
3222
3251
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(3);
3223
3252
  /* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_6__);
3224
3253
  /* harmony import */ var _khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(34);
3225
3254
  /* harmony import */ var _khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_7__);
3226
- /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1);
3255
+ /* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2);
3227
3256
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3228
3257
 
3229
3258
 
@@ -3388,10 +3417,10 @@ module.exports = require("@khanacademy/wonder-blocks-layout");
3388
3417
 
3389
3418
  "use strict";
3390
3419
  __webpack_require__.r(__webpack_exports__);
3391
- /* harmony import */ var _components_action_item_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12);
3420
+ /* harmony import */ var _components_action_item_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
3392
3421
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ActionItem", function() { return _components_action_item_js__WEBPACK_IMPORTED_MODULE_0__["a"]; });
3393
3422
 
3394
- /* harmony import */ var _components_option_item_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(13);
3423
+ /* harmony import */ var _components_option_item_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12);
3395
3424
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OptionItem", function() { return _components_option_item_js__WEBPACK_IMPORTED_MODULE_1__["a"]; });
3396
3425
 
3397
3426
  /* harmony import */ var _components_separator_item_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6);