@khanacademy/wonder-blocks-dropdown 2.4.4 → 2.6.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/es/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import _extends from '@babel/runtime/helpers/extends';
2
- import { Component, createElement, Fragment, cloneElement, Children, createRef } from 'react';
2
+ import * as React from 'react';
3
3
  import { StyleSheet, css } from 'aphrodite';
4
4
  import { Link } from 'react-router-dom';
5
- import { any } from 'prop-types';
5
+ import { __RouterContext } from 'react-router';
6
6
  import Color, { mix, fade, SemanticColor } from '@khanacademy/wonder-blocks-color';
7
7
  import Spacing from '@khanacademy/wonder-blocks-spacing';
8
8
  import { LabelMedium, styles as styles$a, LabelLarge } from '@khanacademy/wonder-blocks-typography';
@@ -57,13 +57,13 @@ const defaultLabels = {
57
57
  };
58
58
 
59
59
  const {
60
- blue,
61
- white,
62
- offBlack,
63
- offBlack32
60
+ blue: blue$3,
61
+ white: white$4,
62
+ offBlack: offBlack$3,
63
+ offBlack32: offBlack32$4
64
64
  } = Color;
65
65
  const StyledAnchor = addStyle("a");
66
- const StyledButton = addStyle("button");
66
+ const StyledButton$2 = addStyle("button");
67
67
  const StyledLink = addStyle(Link);
68
68
  /**
69
69
  * The action item trigger actions, such as navigating to a different page or
@@ -71,12 +71,12 @@ const StyledLink = addStyle(Link);
71
71
  * ActionMenu.
72
72
  */
73
73
 
74
- class ActionItem extends Component {
74
+ class ActionItem extends React.Component {
75
75
  static isClassOf(instance) {
76
76
  return instance && instance.type && instance.type.__IS_ACTION_ITEM__;
77
77
  }
78
78
 
79
- render() {
79
+ renderClickableBehavior(router) {
80
80
  const {
81
81
  skipClientNav,
82
82
  disabled,
@@ -84,16 +84,14 @@ class ActionItem extends Component {
84
84
  target,
85
85
  indent,
86
86
  label,
87
+ lang,
87
88
  onClick,
88
89
  role,
89
90
  style,
90
91
  testId
91
92
  } = this.props;
92
- const {
93
- router
94
- } = this.context;
95
93
  const ClickableBehavior = getClickableBehavior(href, skipClientNav, router);
96
- return /*#__PURE__*/createElement(ClickableBehavior, {
94
+ return /*#__PURE__*/React.createElement(ClickableBehavior, {
97
95
  disabled: disabled,
98
96
  onClick: onClick,
99
97
  href: href,
@@ -105,7 +103,7 @@ class ActionItem extends Component {
105
103
  hovered,
106
104
  focused
107
105
  } = state;
108
- const defaultStyle = [styles.shared, disabled && styles.disabled, !disabled && (pressed ? styles.active : (hovered || focused) && styles.focus), // pass optional styles from react-window (if applies)
106
+ const defaultStyle = [styles$9.shared, disabled && styles$9.disabled, !disabled && (pressed ? styles$9.active : (hovered || focused) && styles$9.focus), // pass optional styles from react-window (if applies)
109
107
  style];
110
108
 
111
109
  const props = _extends({
@@ -115,19 +113,20 @@ class ActionItem extends Component {
115
113
  style: [defaultStyle]
116
114
  }, childrenProps);
117
115
 
118
- const children = /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(LabelMedium, {
119
- style: [indent && styles.indent, styles.label]
116
+ const children = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LabelMedium, {
117
+ lang: lang,
118
+ style: [indent && styles$9.indent, styles$9.label]
120
119
  }, label));
121
120
 
122
121
  if (href && !disabled) {
123
- return router && !skipClientNav && isClientSideUrl(href) ? /*#__PURE__*/createElement(StyledLink, _extends({}, props, {
122
+ return router && !skipClientNav && isClientSideUrl(href) ? /*#__PURE__*/React.createElement(StyledLink, _extends({}, props, {
124
123
  to: href
125
- }), children) : /*#__PURE__*/createElement(StyledAnchor, _extends({}, props, {
124
+ }), children) : /*#__PURE__*/React.createElement(StyledAnchor, _extends({}, props, {
126
125
  href: href,
127
126
  target: target
128
127
  }), children);
129
128
  } else {
130
- return /*#__PURE__*/createElement(StyledButton, _extends({
129
+ return /*#__PURE__*/React.createElement(StyledButton$2, _extends({
131
130
  type: "button"
132
131
  }, props, {
133
132
  disabled: disabled
@@ -136,20 +135,21 @@ class ActionItem extends Component {
136
135
  });
137
136
  }
138
137
 
138
+ render() {
139
+ return /*#__PURE__*/React.createElement(__RouterContext.Consumer, null, router => this.renderClickableBehavior(router));
140
+ }
141
+
139
142
  }
140
- ActionItem.contextTypes = {
141
- router: any
142
- };
143
143
  ActionItem.defaultProps = {
144
144
  disabled: false,
145
145
  indent: false,
146
146
  role: "menuitem"
147
147
  };
148
148
  ActionItem.__IS_ACTION_ITEM__ = true;
149
- const styles = StyleSheet.create({
149
+ const styles$9 = StyleSheet.create({
150
150
  shared: {
151
- background: white,
152
- color: offBlack,
151
+ background: white$4,
152
+ color: offBlack$3,
153
153
  textDecoration: "none",
154
154
  border: "none",
155
155
  outline: "none",
@@ -173,25 +173,25 @@ const styles = StyleSheet.create({
173
173
  },
174
174
  // hover and focus states
175
175
  focus: {
176
- color: white,
177
- background: blue
176
+ color: white$4,
177
+ background: blue$3
178
178
  },
179
179
  // active and pressed states
180
180
  active: {
181
- color: mix(fade(blue, 0.32), white),
182
- background: mix(offBlack32, blue)
181
+ color: mix(fade(blue$3, 0.32), white$4),
182
+ background: mix(offBlack32$4, blue$3)
183
183
  },
184
184
  // disabled state
185
185
  disabled: {
186
- color: offBlack32,
186
+ color: offBlack32$4,
187
187
  cursor: "default"
188
188
  }
189
189
  });
190
190
 
191
191
  const {
192
- offBlack: offBlack$1,
193
- offBlack32: offBlack32$1,
194
- white: white$1
192
+ offBlack: offBlack$2,
193
+ offBlack32: offBlack32$3,
194
+ white: white$3
195
195
  } = Color;
196
196
  /**
197
197
  * Props describing the state of the OptionItem, shared by the checkbox
@@ -209,14 +209,14 @@ function Check(props) {
209
209
  hovered,
210
210
  focused
211
211
  } = props;
212
- return /*#__PURE__*/createElement(Icon, {
212
+ return /*#__PURE__*/React.createElement(Icon, {
213
213
  icon: icons.check,
214
214
  size: "small",
215
- color: disabled ? offBlack32$1 : pressed || hovered || focused ? white$1 : offBlack$1,
216
- style: [styles$1.bounds, !selected && styles$1.hide]
215
+ color: disabled ? offBlack32$3 : pressed || hovered || focused ? white$3 : offBlack$2,
216
+ style: [styles$8.bounds, !selected && styles$8.hide]
217
217
  });
218
218
  }
219
- const styles$1 = StyleSheet.create({
219
+ const styles$8 = StyleSheet.create({
220
220
  bounds: {
221
221
  // Semantically, this are the constants for a small-sized icon
222
222
  minHeight: 16,
@@ -235,9 +235,9 @@ const checkboxCheck = {
235
235
  small: "M11.263 4.324a1 1 0 1 1 1.474 1.352l-5.5 6a1 1 0 0 1-1.505-.036l-2.5-3a1 1 0 1 1 1.536-1.28L6.536 9.48l4.727-5.157z"
236
236
  };
237
237
  const {
238
- blue: blue$1,
238
+ blue: blue$2,
239
239
  white: white$2,
240
- offBlack16,
240
+ offBlack16: offBlack16$1,
241
241
  offBlack32: offBlack32$2,
242
242
  offBlack50,
243
243
  offWhite
@@ -258,22 +258,22 @@ function Checkbox(props) {
258
258
  hovered,
259
259
  focused
260
260
  } = props;
261
- const activeBlue = mix(offBlack32$2, blue$1);
261
+ const activeBlue = mix(offBlack32$2, blue$2);
262
262
  const clickInteraction = pressed || hovered || focused;
263
- const bgColor = disabled ? offWhite : selected && !clickInteraction ? blue$1 : white$2;
264
- const checkColor = disabled ? offBlack32$2 : clickInteraction ? pressed ? activeBlue : blue$1 : white$2;
265
- return /*#__PURE__*/createElement(View, {
266
- style: [styles$2.checkbox, (clickInteraction || selected && !disabled) && styles$2.noBorder, disabled && styles$2.disabledCheckbox, {
263
+ const bgColor = disabled ? offWhite : selected && !clickInteraction ? blue$2 : white$2;
264
+ const checkColor = disabled ? offBlack32$2 : clickInteraction ? pressed ? activeBlue : blue$2 : white$2;
265
+ return /*#__PURE__*/React.createElement(View, {
266
+ style: [styles$7.checkbox, (clickInteraction || selected && !disabled) && styles$7.noBorder, disabled && styles$7.disabledCheckbox, {
267
267
  backgroundColor: bgColor
268
268
  }]
269
- }, selected && /*#__PURE__*/createElement(Icon, {
269
+ }, selected && /*#__PURE__*/React.createElement(Icon, {
270
270
  icon: checkboxCheck,
271
271
  size: "small",
272
272
  color: checkColor,
273
- style: [disabled && selected && styles$2.disabledCheckFormatting]
273
+ style: [disabled && selected && styles$7.disabledCheckFormatting]
274
274
  }));
275
275
  }
276
- const styles$2 = StyleSheet.create({
276
+ const styles$7 = StyleSheet.create({
277
277
  checkbox: {
278
278
  // Semantically, this are the constants for a small-sized icon
279
279
  minHeight: 16,
@@ -287,7 +287,7 @@ const styles$2 = StyleSheet.create({
287
287
  borderWidth: 0
288
288
  },
289
289
  disabledCheckbox: {
290
- borderColor: offBlack16,
290
+ borderColor: offBlack16$1,
291
291
  backgroundColor: offWhite
292
292
  },
293
293
  // The border of 1px on the selected, disabled checkbox pushes the check out
@@ -299,14 +299,14 @@ const styles$2 = StyleSheet.create({
299
299
  }
300
300
  });
301
301
 
302
- const _excluded = ["disabled", "label", "role", "selected", "testId", "style", "value", "onClick", "onToggle", "variant"];
302
+ const _excluded$6 = ["disabled", "label", "role", "selected", "testId", "style", "value", "onClick", "onToggle", "variant"];
303
303
 
304
304
  /**
305
305
  * For option items that can be selected in a dropdown, selection denoted either
306
306
  * with a check ✔️ or a checkbox ☑️. Use as children in SingleSelect or
307
307
  * MultiSelect.
308
308
  */
309
- class OptionItem extends Component {
309
+ class OptionItem extends React.Component {
310
310
  constructor(...args) {
311
311
  super(...args);
312
312
 
@@ -346,11 +346,11 @@ class OptionItem extends Component {
346
346
  testId,
347
347
  style
348
348
  } = _this$props,
349
- sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
349
+ sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded$6);
350
350
 
351
351
  const ClickableBehavior = getClickableBehavior();
352
352
  const CheckComponent = this.getCheckComponent();
353
- return /*#__PURE__*/createElement(ClickableBehavior, {
353
+ return /*#__PURE__*/React.createElement(ClickableBehavior, {
354
354
  disabled: disabled,
355
355
  onClick: this.handleClick,
356
356
  role: role
@@ -360,29 +360,26 @@ class OptionItem extends Component {
360
360
  hovered,
361
361
  focused
362
362
  } = state;
363
- const defaultStyle = [styles$3.itemContainer, pressed ? styles$3.active : (hovered || focused) && styles$3.focus, disabled && styles$3.disabled, // pass optional styles from react-window (if applies)
363
+ const defaultStyle = [styles$6.itemContainer, pressed ? styles$6.active : (hovered || focused) && styles$6.focus, disabled && styles$6.disabled, // pass optional styles from react-window (if applies)
364
364
  style];
365
- return /*#__PURE__*/createElement(View, _extends({}, sharedProps, {
365
+ return /*#__PURE__*/React.createElement(View, _extends({}, sharedProps, {
366
366
  testId: testId,
367
367
  style: defaultStyle,
368
368
  "aria-selected": selected ? "true" : "false",
369
369
  role: role
370
- }, childrenProps), /*#__PURE__*/createElement(CheckComponent, {
370
+ }, childrenProps), /*#__PURE__*/React.createElement(CheckComponent, {
371
371
  disabled: disabled,
372
372
  selected: selected,
373
373
  pressed: pressed,
374
374
  hovered: hovered,
375
375
  focused: focused
376
- }), /*#__PURE__*/createElement(LabelMedium, {
377
- style: styles$3.label
376
+ }), /*#__PURE__*/React.createElement(LabelMedium, {
377
+ style: styles$6.label
378
378
  }, label));
379
379
  });
380
380
  }
381
381
 
382
382
  }
383
- OptionItem.contextTypes = {
384
- router: any
385
- };
386
383
  OptionItem.defaultProps = {
387
384
  disabled: false,
388
385
  onToggle: () => void 0,
@@ -391,16 +388,16 @@ OptionItem.defaultProps = {
391
388
  };
392
389
  OptionItem.__IS_OPTION_ITEM__ = true;
393
390
  const {
394
- blue: blue$2,
395
- white: white$3,
396
- offBlack: offBlack$2,
397
- offBlack32: offBlack32$3
391
+ blue: blue$1,
392
+ white: white$1,
393
+ offBlack: offBlack$1,
394
+ offBlack32: offBlack32$1
398
395
  } = Color;
399
- const styles$3 = StyleSheet.create({
396
+ const styles$6 = StyleSheet.create({
400
397
  itemContainer: {
401
398
  flexDirection: "row",
402
- backgroundColor: white$3,
403
- color: offBlack$2,
399
+ backgroundColor: white$1,
400
+ color: offBlack$1,
404
401
  alignItems: "center",
405
402
  height: DROPDOWN_ITEM_HEIGHT,
406
403
  minHeight: DROPDOWN_ITEM_HEIGHT,
@@ -412,16 +409,16 @@ const styles$3 = StyleSheet.create({
412
409
  cursor: "default"
413
410
  },
414
411
  focus: {
415
- color: white$3,
416
- background: blue$2
412
+ color: white$1,
413
+ background: blue$1
417
414
  },
418
415
  active: {
419
- color: mix(fade(blue$2, 0.32), white$3),
420
- background: mix(offBlack32$3, blue$2)
416
+ color: mix(fade(blue$1, 0.32), white$1),
417
+ background: mix(offBlack32$1, blue$1)
421
418
  },
422
419
  disabled: {
423
- color: offBlack32$3,
424
- background: white$3
420
+ color: offBlack32$1,
421
+ background: white$1
425
422
  },
426
423
  label: {
427
424
  whiteSpace: "nowrap",
@@ -441,7 +438,7 @@ const styles$3 = StyleSheet.create({
441
438
  /**
442
439
  * A separator used in a dropdown menu.
443
440
  */
444
- class SeparatorItem extends Component {
441
+ class SeparatorItem extends React.Component {
445
442
  static isClassOf(instance) {
446
443
  return instance && instance.type && instance.type.__IS_SEPARATOR_ITEM__;
447
444
  }
@@ -450,8 +447,8 @@ class SeparatorItem extends Component {
450
447
  return (
451
448
  /*#__PURE__*/
452
449
  // pass optional styles from react-window (if applies)
453
- createElement(View, {
454
- style: [styles$4.separator, this.props.style],
450
+ React.createElement(View, {
451
+ style: [styles$5.separator, this.props.style],
455
452
  "aria-hidden": "true"
456
453
  })
457
454
  );
@@ -459,7 +456,7 @@ class SeparatorItem extends Component {
459
456
 
460
457
  }
461
458
  SeparatorItem.__IS_SEPARATOR_ITEM__ = true;
462
- const styles$4 = StyleSheet.create({
459
+ const styles$5 = StyleSheet.create({
463
460
  separator: {
464
461
  boxShadow: `0 -1px ${Color.offBlack16}`,
465
462
  height: 1,
@@ -469,7 +466,7 @@ const styles$4 = StyleSheet.create({
469
466
  }
470
467
  });
471
468
 
472
- class DropdownOpener extends Component {
469
+ class DropdownOpener extends React.Component {
473
470
  constructor(...args) {
474
471
  super(...args);
475
472
 
@@ -489,7 +486,7 @@ class DropdownOpener extends Component {
489
486
  }));
490
487
  const childrenProps = renderedChildren.props;
491
488
  const childrenTestId = this.getTestIdFromProps(childrenProps);
492
- return /*#__PURE__*/cloneElement(renderedChildren, _extends({}, clickableChildrenProps, {
489
+ return /*#__PURE__*/React.cloneElement(renderedChildren, _extends({}, clickableChildrenProps, {
493
490
  disabled,
494
491
  onClick: childrenProps.onClick ? e => {
495
492
  // This is done to avoid overriding a
@@ -505,7 +502,7 @@ class DropdownOpener extends Component {
505
502
  }
506
503
 
507
504
  render() {
508
- return /*#__PURE__*/createElement(ClickableBehavior, {
505
+ return /*#__PURE__*/React.createElement(ClickableBehavior, {
509
506
  onClick: this.props.onClick,
510
507
  disabled: this.props.disabled
511
508
  }, (eventState, handlers) => this.renderAnchorChildren(eventState, handlers));
@@ -522,7 +519,7 @@ DropdownOpener.defaultProps = {
522
519
  * (ActionItem, OptionItem, SeparatorItem) with custom styles to let
523
520
  * react-window make its own calculations.
524
521
  */
525
- class DropdownVirtualizedItem extends Component {
522
+ class DropdownVirtualizedItem extends React.Component {
526
523
  render() {
527
524
  const {
528
525
  data,
@@ -534,7 +531,7 @@ class DropdownVirtualizedItem extends Component {
534
531
  if (SeparatorItem.isClassOf(item.component)) {
535
532
  // add react-window style to the separator to preserve the correct
536
533
  // position
537
- return /*#__PURE__*/cloneElement(item.component, {
534
+ return /*#__PURE__*/React.cloneElement(item.component, {
538
535
  style
539
536
  });
540
537
  } else {
@@ -545,7 +542,7 @@ class DropdownVirtualizedItem extends Component {
545
542
  role,
546
543
  ref
547
544
  } = item;
548
- return /*#__PURE__*/cloneElement(component, _extends({
545
+ return /*#__PURE__*/React.cloneElement(component, _extends({
549
546
  style
550
547
  }, populatedProps, {
551
548
  key: index,
@@ -558,7 +555,7 @@ class DropdownVirtualizedItem extends Component {
558
555
 
559
556
  }
560
557
 
561
- class SearchTextInput extends Component {
558
+ class SearchTextInput extends React.Component {
562
559
  constructor(...args) {
563
560
  super(...args);
564
561
  this.state = {
@@ -622,11 +619,11 @@ class SearchTextInput extends Component {
622
619
  } = this.state.labels;
623
620
 
624
621
  if (searchText.length > 0) {
625
- return /*#__PURE__*/createElement(IconButton, {
622
+ return /*#__PURE__*/React.createElement(IconButton, {
626
623
  icon: icons.dismiss,
627
624
  kind: "tertiary",
628
625
  onClick: this.handleDismiss,
629
- style: styles$5.dismissIcon,
626
+ style: styles$4.dismissIcon,
630
627
  "aria-label": clearSearch
631
628
  });
632
629
  }
@@ -645,16 +642,16 @@ class SearchTextInput extends Component {
645
642
  const {
646
643
  filter
647
644
  } = this.state.labels;
648
- return /*#__PURE__*/createElement(View, {
645
+ return /*#__PURE__*/React.createElement(View, {
649
646
  onClick: onClick,
650
- style: [styles$5.inputContainer, this.state.focused && styles$5.focused, style]
651
- }, /*#__PURE__*/createElement(Icon, {
647
+ style: [styles$4.inputContainer, this.state.focused && styles$4.focused, style]
648
+ }, /*#__PURE__*/React.createElement(Icon, {
652
649
  icon: icons.search,
653
650
  size: "medium",
654
651
  color: Color.offBlack64,
655
- style: styles$5.searchIcon,
652
+ style: styles$4.searchIcon,
656
653
  "aria-hidden": "true"
657
- }), /*#__PURE__*/createElement("input", {
654
+ }), /*#__PURE__*/React.createElement("input", {
658
655
  type: "text",
659
656
  onChange: this.handleChange,
660
657
  onFocus: this.handleFocus,
@@ -662,7 +659,7 @@ class SearchTextInput extends Component {
662
659
  ref: itemRef,
663
660
  placeholder: filter,
664
661
  value: searchText,
665
- className: css(styles$5.inputStyleReset, styles$a.LabelMedium),
662
+ className: css(styles$4.inputStyleReset, styles$a.LabelMedium),
666
663
  "data-test-id": testId
667
664
  }), this.maybeRenderDismissIconButton());
668
665
  }
@@ -675,7 +672,7 @@ SearchTextInput.defaultProps = {
675
672
  }
676
673
  };
677
674
  SearchTextInput.__IS_SEARCH_TEXT_INPUT__ = true;
678
- const styles$5 = StyleSheet.create({
675
+ const styles$4 = StyleSheet.create({
679
676
  inputContainer: {
680
677
  flexDirection: "row",
681
678
  border: `1px solid ${Color.offBlack16}`,
@@ -727,7 +724,7 @@ const MAX_VISIBLE_ITEMS = 9;
727
724
  * dynamically calculates the item height depending on the type
728
725
  */
729
726
 
730
- class DropdownCoreVirtualized extends Component {
727
+ class DropdownCoreVirtualized extends React.Component {
731
728
  constructor(...args) {
732
729
  super(...args);
733
730
  this.state = {
@@ -844,7 +841,7 @@ class DropdownCoreVirtualized extends Component {
844
841
  const allComponents = data.map(e => e.component); // 1. get the children opaque data structure to sort each item by its
845
842
  // label length
846
843
 
847
- const longestItems = Children.toArray(allComponents).filter(Boolean).sort((a, b) => {
844
+ const longestItems = React.Children.toArray(allComponents).filter(Boolean).sort((a, b) => {
848
845
  // 2. only sort elements that contain a `label` prop
849
846
  if (b.props.label && a.props.label) {
850
847
  return b.props.label.length - a.props.label.length;
@@ -856,7 +853,7 @@ class DropdownCoreVirtualized extends Component {
856
853
  .slice(0, MAX_VISIBLE_ITEMS); // Append longest items to calculate the container width.
857
854
  // We need to hide these sorted elements to avoid any FOUC.
858
855
 
859
- return longestItems.map(item => /*#__PURE__*/cloneElement(item, {
856
+ return longestItems.map(item => /*#__PURE__*/React.cloneElement(item, {
860
857
  style: {
861
858
  visibility: "hidden"
862
859
  }
@@ -876,7 +873,7 @@ class DropdownCoreVirtualized extends Component {
876
873
  /*#__PURE__*/
877
874
  // react-window has some issues for typing lists when passing refs
878
875
  // $FlowIgnore
879
- createElement(VariableSizeList // react-window doesn't accept maybe numbers. It wants numbers
876
+ React.createElement(VariableSizeList // react-window doesn't accept maybe numbers. It wants numbers
880
877
  // or strings.
881
878
  // $FlowFixMe
882
879
  , {
@@ -912,14 +909,14 @@ class DropdownCoreVirtualized extends Component {
912
909
 
913
910
  var DropdownCoreVirtualized$1 = withActionScheduler(DropdownCoreVirtualized);
914
911
 
915
- const _excluded$1 = ["pointerEvents"];
912
+ const _excluded$5 = ["pointerEvents"];
916
913
 
917
914
  /**
918
915
  * A core dropdown component that takes an opener and children to display as
919
916
  * part of the dropdown menu. Renders the dropdown as a portal to avoid clipping
920
917
  * in overflow: auto containers.
921
918
  */
922
- class DropdownCore extends Component {
919
+ class DropdownCore extends React.Component {
923
920
  // Keeps track of the index of the focused item, out of a list of focusable items
924
921
  // Keeps track of the index of the focused item in the context of all the
925
922
  // items contained by this menu, whether focusable or not, used for figuring
@@ -952,7 +949,7 @@ class DropdownCore extends Component {
952
949
 
953
950
  for (let i = 0; i < props.items.length; i++) {
954
951
  if (props.items[i].focusable) {
955
- const ref = /*#__PURE__*/createRef();
952
+ const ref = /*#__PURE__*/React.createRef();
956
953
  itemRefs.push({
957
954
  ref,
958
955
  originalIndex: i
@@ -1104,7 +1101,7 @@ class DropdownCore extends Component {
1104
1101
  noResults: defaultLabels.noResults
1105
1102
  }, props.labels)
1106
1103
  };
1107
- this.listRef = /*#__PURE__*/createRef();
1104
+ this.listRef = /*#__PURE__*/React.createRef();
1108
1105
  }
1109
1106
 
1110
1107
  componentDidMount() {
@@ -1318,8 +1315,8 @@ class DropdownCore extends Component {
1318
1315
  const numResults = items.length - includeSearchCount;
1319
1316
 
1320
1317
  if (numResults === 0) {
1321
- return /*#__PURE__*/createElement(LabelMedium, {
1322
- style: styles$6.noResult,
1318
+ return /*#__PURE__*/React.createElement(LabelMedium, {
1319
+ style: styles$3.noResult,
1323
1320
  testId: "dropdown-core-no-results"
1324
1321
  }, noResults);
1325
1322
  }
@@ -1387,15 +1384,15 @@ class DropdownCore extends Component {
1387
1384
  const minDropdownWidth = openerStyle ? openerStyle.getPropertyValue("width") : 0; // preprocess items data to pass it to the renderer
1388
1385
 
1389
1386
  const itemsList = this.parseItemsList();
1390
- return /*#__PURE__*/createElement(View // Stop propagation to prevent the mouseup listener on the
1387
+ return /*#__PURE__*/React.createElement(View // Stop propagation to prevent the mouseup listener on the
1391
1388
  // document from closing the menu.
1392
1389
  , {
1393
1390
  onMouseUp: this.handleDropdownMouseUp,
1394
1391
  role: this.props.role,
1395
- style: [styles$6.dropdown, light && styles$6.light, isReferenceHidden && styles$6.hidden, {
1392
+ style: [styles$3.dropdown, light && styles$3.light, isReferenceHidden && styles$3.hidden, {
1396
1393
  minWidth: minDropdownWidth
1397
1394
  }, dropdownStyle]
1398
- }, /*#__PURE__*/createElement(DropdownCoreVirtualized$1, {
1395
+ }, /*#__PURE__*/React.createElement(DropdownCoreVirtualized$1, {
1399
1396
  data: itemsList,
1400
1397
  listRef: this.listRef
1401
1398
  }), this.maybeRenderNoResults());
@@ -1413,7 +1410,7 @@ class DropdownCore extends Component {
1413
1410
  const modalHost = maybeGetPortalMountedModalHostElement(openerElement) || document.querySelector("body");
1414
1411
 
1415
1412
  if (modalHost) {
1416
- return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/createElement(Popper, {
1413
+ return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(Popper, {
1417
1414
  innerRef: node => {
1418
1415
  if (node) {
1419
1416
  this.popperElement = node;
@@ -1444,9 +1441,9 @@ class DropdownCore extends Component {
1444
1441
  }) => {
1445
1442
  // For some reason react-popper includes `pointerEvents: "none"`
1446
1443
  // in the `style` it passes to us, but only when running the tests.
1447
- const restStyle = _objectWithoutPropertiesLoose(style, _excluded$1);
1444
+ const restStyle = _objectWithoutPropertiesLoose(style, _excluded$5);
1448
1445
 
1449
- return /*#__PURE__*/createElement("div", {
1446
+ return /*#__PURE__*/React.createElement("div", {
1450
1447
  ref: ref,
1451
1448
  style: restStyle,
1452
1449
  "data-placement": placement
@@ -1464,10 +1461,10 @@ class DropdownCore extends Component {
1464
1461
  style,
1465
1462
  className
1466
1463
  } = this.props;
1467
- return /*#__PURE__*/createElement(View, {
1464
+ return /*#__PURE__*/React.createElement(View, {
1468
1465
  onKeyDown: this.handleKeyDown,
1469
1466
  onKeyUp: this.handleKeyUp,
1470
- style: [styles$6.menuWrapper, style],
1467
+ style: [styles$3.menuWrapper, style],
1471
1468
  className: className
1472
1469
  }, opener, open && this.renderDropdown());
1473
1470
  }
@@ -1481,7 +1478,7 @@ DropdownCore.defaultProps = {
1481
1478
  },
1482
1479
  light: false
1483
1480
  };
1484
- const styles$6 = StyleSheet.create({
1481
+ const styles$3 = StyleSheet.create({
1485
1482
  menuWrapper: {
1486
1483
  width: "fit-content"
1487
1484
  },
@@ -1510,7 +1507,7 @@ const styles$6 = StyleSheet.create({
1510
1507
  });
1511
1508
  var DropdownCore$1 = withActionScheduler(DropdownCore);
1512
1509
 
1513
- const _excluded$2 = ["children", "disabled", "focused", "hovered", "pressed", "waiting", "testId", "opened", "aria-label"];
1510
+ const _excluded$4 = ["children", "disabled", "focused", "hovered", "pressed", "waiting", "testId", "opened", "aria-label"];
1514
1511
  const StyledButton$1 = addStyle("button");
1515
1512
  /**
1516
1513
  * Although this component shares a lot with ButtonCore there are a couple
@@ -1519,7 +1516,7 @@ const StyledButton$1 = addStyle("button");
1519
1516
  * - the down caret icon is smaller that the one that would be used by ButtonCore
1520
1517
  */
1521
1518
 
1522
- class ActionMenuOpenerCore extends Component {
1519
+ class ActionMenuOpenerCore extends React.Component {
1523
1520
  render() {
1524
1521
  const _this$props = this.props,
1525
1522
  {
@@ -1532,18 +1529,18 @@ class ActionMenuOpenerCore extends Component {
1532
1529
  opened,
1533
1530
  "aria-label": ariaLabel
1534
1531
  } = _this$props,
1535
- restProps = _objectWithoutPropertiesLoose(_this$props, _excluded$2);
1532
+ restProps = _objectWithoutPropertiesLoose(_this$props, _excluded$4);
1536
1533
 
1537
1534
  const buttonColor = SemanticColor.controlDefault;
1538
1535
 
1539
- const buttonStyles = _generateStyles(buttonColor);
1536
+ const buttonStyles = _generateStyles$1(buttonColor);
1540
1537
 
1541
1538
  const disabled = disabledProp;
1542
1539
  const defaultStyle = [sharedStyles.shared, disabled && sharedStyles.disabled, buttonStyles.default, disabled && buttonStyles.disabled, !disabled && pressed && buttonStyles.active];
1543
- const label = /*#__PURE__*/createElement(LabelLarge, {
1540
+ const label = /*#__PURE__*/React.createElement(LabelLarge, {
1544
1541
  style: sharedStyles.text
1545
1542
  }, children);
1546
- return /*#__PURE__*/createElement(StyledButton$1, _extends({
1543
+ return /*#__PURE__*/React.createElement(StyledButton$1, _extends({
1547
1544
  "aria-expanded": opened ? "true" : "false",
1548
1545
  "aria-haspopup": "menu",
1549
1546
  "aria-label": ariaLabel,
@@ -1552,11 +1549,11 @@ class ActionMenuOpenerCore extends Component {
1552
1549
  type: "button"
1553
1550
  }, restProps, {
1554
1551
  "data-test-id": testId
1555
- }), /*#__PURE__*/createElement(View, {
1552
+ }), /*#__PURE__*/React.createElement(View, {
1556
1553
  style: !disabled && (hovered || focused) && buttonStyles.focus
1557
- }, label), /*#__PURE__*/createElement(Strut, {
1554
+ }, label), /*#__PURE__*/React.createElement(Strut, {
1558
1555
  size: Spacing.xxxSmall_4
1559
- }), /*#__PURE__*/createElement(Icon, {
1556
+ }), /*#__PURE__*/React.createElement(Icon, {
1560
1557
  size: "small",
1561
1558
  color: "currentColor",
1562
1559
  icon: icons.caretDown
@@ -1564,9 +1561,6 @@ class ActionMenuOpenerCore extends Component {
1564
1561
  }
1565
1562
 
1566
1563
  }
1567
- ActionMenuOpenerCore.contextTypes = {
1568
- router: any
1569
- };
1570
1564
  const sharedStyles = StyleSheet.create({
1571
1565
  shared: {
1572
1566
  position: "relative",
@@ -1613,13 +1607,13 @@ const sharedStyles = StyleSheet.create({
1613
1607
  position: "absolute"
1614
1608
  }
1615
1609
  });
1616
- const styles$7 = {};
1610
+ const styles$2 = {};
1617
1611
 
1618
- const _generateStyles = color => {
1612
+ const _generateStyles$1 = color => {
1619
1613
  const buttonType = color;
1620
1614
 
1621
- if (styles$7[buttonType]) {
1622
- return styles$7[buttonType];
1615
+ if (styles$2[buttonType]) {
1616
+ return styles$2[buttonType];
1623
1617
  }
1624
1618
 
1625
1619
  const {
@@ -1652,8 +1646,8 @@ const _generateStyles = color => {
1652
1646
  cursor: "default"
1653
1647
  }
1654
1648
  };
1655
- styles$7[buttonType] = StyleSheet.create(newStyles);
1656
- return styles$7[buttonType];
1649
+ styles$2[buttonType] = StyleSheet.create(newStyles);
1650
+ return styles$2[buttonType];
1657
1651
  };
1658
1652
 
1659
1653
  const _excluded$3 = ["text"];
@@ -1661,7 +1655,7 @@ const _excluded$3 = ["text"];
1661
1655
  /**
1662
1656
  * A menu that consists of various types of items.
1663
1657
  */
1664
- class ActionMenu extends Component {
1658
+ class ActionMenu extends React.Component {
1665
1659
  constructor(...args) {
1666
1660
  super(...args);
1667
1661
  this.state = {
@@ -1733,7 +1727,7 @@ class ActionMenu extends Component {
1733
1727
  children,
1734
1728
  selectedValues
1735
1729
  } = this.props;
1736
- const allChildren = Children.toArray(children).filter(Boolean); // verify if there's at least one OptionItem element to indent the
1730
+ const allChildren = React.Children.toArray(children).filter(Boolean); // verify if there's at least one OptionItem element to indent the
1737
1731
  // possible Action items
1738
1732
 
1739
1733
  const isOptionItemIncluded = allChildren.some(item => OptionItem.isClassOf(item));
@@ -1779,7 +1773,7 @@ class ActionMenu extends Component {
1779
1773
  const {
1780
1774
  opened
1781
1775
  } = this.state;
1782
- return /*#__PURE__*/createElement(DropdownOpener, {
1776
+ return /*#__PURE__*/React.createElement(DropdownOpener, {
1783
1777
  onClick: this.handleClick,
1784
1778
  disabled: numItems === 0 || disabled,
1785
1779
  text: menuText,
@@ -1788,7 +1782,7 @@ class ActionMenu extends Component {
1788
1782
  }, opener ? opener : openerProps => {
1789
1783
  const eventState = _objectWithoutPropertiesLoose(openerProps, _excluded$3);
1790
1784
 
1791
- return /*#__PURE__*/createElement(ActionMenuOpenerCore, _extends({}, eventState, {
1785
+ return /*#__PURE__*/React.createElement(ActionMenuOpenerCore, _extends({}, eventState, {
1792
1786
  disabled: disabled,
1793
1787
  opened: !!opened,
1794
1788
  testId: testId
@@ -1805,7 +1799,7 @@ class ActionMenu extends Component {
1805
1799
  } = this.props;
1806
1800
  const items = this.getMenuItems();
1807
1801
  const dropdownOpener = this.renderOpener(items.length);
1808
- return /*#__PURE__*/createElement(DropdownCore$1, {
1802
+ return /*#__PURE__*/React.createElement(DropdownCore$1, {
1809
1803
  role: "menu",
1810
1804
  style: style,
1811
1805
  className: className,
@@ -1815,7 +1809,7 @@ class ActionMenu extends Component {
1815
1809
  items: items,
1816
1810
  openerElement: this.openerElement,
1817
1811
  onOpenChanged: this.handleOpenChanged,
1818
- dropdownStyle: [styles$8.menuTopSpace, dropdownStyle]
1812
+ dropdownStyle: [styles$1.menuTopSpace, dropdownStyle]
1819
1813
  });
1820
1814
  }
1821
1815
 
@@ -1824,7 +1818,7 @@ ActionMenu.defaultProps = {
1824
1818
  alignment: "left",
1825
1819
  disabled: false
1826
1820
  };
1827
- const styles$8 = StyleSheet.create({
1821
+ const styles$1 = StyleSheet.create({
1828
1822
  caret: {
1829
1823
  marginLeft: 4
1830
1824
  },
@@ -1841,22 +1835,22 @@ const styles$8 = StyleSheet.create({
1841
1835
  }
1842
1836
  });
1843
1837
 
1844
- const _excluded$4 = ["children", "disabled", "id", "isPlaceholder", "light", "open", "testId", "onOpenChanged"];
1845
- const StyledButton$2 = addStyle("button");
1838
+ const _excluded$2 = ["children", "disabled", "id", "isPlaceholder", "light", "open", "testId", "onOpenChanged"];
1839
+ const StyledButton = addStyle("button");
1846
1840
  const {
1847
- blue: blue$3,
1848
- white: white$4,
1841
+ blue,
1842
+ white,
1849
1843
  white50,
1850
- offBlack: offBlack$3,
1851
- offBlack16: offBlack16$1,
1852
- offBlack32: offBlack32$4,
1844
+ offBlack,
1845
+ offBlack16,
1846
+ offBlack32,
1853
1847
  offBlack64
1854
1848
  } = Color;
1855
1849
 
1856
1850
  /**
1857
1851
  * An opener that opens select boxes.
1858
1852
  */
1859
- class SelectOpener extends Component {
1853
+ class SelectOpener extends React.Component {
1860
1854
  constructor(...args) {
1861
1855
  super(...args);
1862
1856
 
@@ -1868,7 +1862,7 @@ class SelectOpener extends Component {
1868
1862
  };
1869
1863
  }
1870
1864
 
1871
- render() {
1865
+ renderClickableBehavior(router) {
1872
1866
  const _this$props = this.props,
1873
1867
  {
1874
1868
  children,
@@ -1879,14 +1873,14 @@ class SelectOpener extends Component {
1879
1873
  open,
1880
1874
  testId
1881
1875
  } = _this$props,
1882
- sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded$4);
1876
+ sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded$2);
1883
1877
 
1884
- const ClickableBehavior = getClickableBehavior(this.context.router);
1885
- return /*#__PURE__*/createElement(ClickableBehavior, {
1878
+ const ClickableBehavior = getClickableBehavior(router);
1879
+ return /*#__PURE__*/React.createElement(ClickableBehavior, {
1886
1880
  disabled: disabled,
1887
1881
  onClick: this.handleClick
1888
1882
  }, (state, childrenProps) => {
1889
- const stateStyles = _generateStyles$1(light, isPlaceholder);
1883
+ const stateStyles = _generateStyles(light, isPlaceholder);
1890
1884
 
1891
1885
  const {
1892
1886
  hovered,
@@ -1895,9 +1889,9 @@ class SelectOpener extends Component {
1895
1889
  } = state; // The icon colors are kind of fickle. This is just logic
1896
1890
  // based on the zeplin design.
1897
1891
 
1898
- const iconColor = light ? disabled || pressed ? "currentColor" : white$4 : disabled ? offBlack32$4 : offBlack64;
1899
- const style = [styles$9.shared, stateStyles.default, disabled && stateStyles.disabled, !disabled && (pressed ? stateStyles.active : (hovered || focused) && stateStyles.focus)];
1900
- return /*#__PURE__*/createElement(StyledButton$2, _extends({}, sharedProps, {
1892
+ const iconColor = light ? disabled || pressed ? "currentColor" : white : disabled ? offBlack32 : offBlack64;
1893
+ const style = [styles.shared, stateStyles.default, disabled && stateStyles.disabled, !disabled && (pressed ? stateStyles.active : (hovered || focused) && stateStyles.focus)];
1894
+ return /*#__PURE__*/React.createElement(StyledButton, _extends({}, sharedProps, {
1901
1895
  "aria-expanded": open ? "true" : "false",
1902
1896
  "aria-haspopup": "listbox",
1903
1897
  "data-test-id": testId,
@@ -1905,36 +1899,37 @@ class SelectOpener extends Component {
1905
1899
  id: id,
1906
1900
  style: style,
1907
1901
  type: "button"
1908
- }, childrenProps), /*#__PURE__*/createElement(LabelMedium, {
1909
- style: styles$9.text
1910
- }, children), /*#__PURE__*/createElement(Icon, {
1902
+ }, childrenProps), /*#__PURE__*/React.createElement(LabelMedium, {
1903
+ style: styles.text
1904
+ }, children), /*#__PURE__*/React.createElement(Icon, {
1911
1905
  icon: icons.caretDown,
1912
1906
  color: iconColor,
1913
1907
  size: "small",
1914
- style: styles$9.caret,
1908
+ style: styles.caret,
1915
1909
  "aria-hidden": "true"
1916
1910
  }));
1917
1911
  });
1918
1912
  }
1919
1913
 
1914
+ render() {
1915
+ return /*#__PURE__*/React.createElement(__RouterContext.Consumer, null, router => this.renderClickableBehavior(router));
1916
+ }
1917
+
1920
1918
  }
1921
- SelectOpener.contextTypes = {
1922
- router: any
1923
- };
1924
1919
  SelectOpener.defaultProps = {
1925
1920
  disabled: false,
1926
1921
  light: false,
1927
1922
  isPlaceholder: false
1928
1923
  };
1929
1924
  const buttonRadius = 4;
1930
- const styles$9 = StyleSheet.create({
1925
+ const styles = StyleSheet.create({
1931
1926
  // TODO: Dedupe with Button styles
1932
1927
  shared: {
1933
1928
  position: "relative",
1934
1929
  display: "inline-flex",
1935
1930
  alignItems: "center",
1936
1931
  justifyContent: "space-between",
1937
- color: offBlack$3,
1932
+ color: offBlack,
1938
1933
  height: DROPDOWN_ITEM_HEIGHT,
1939
1934
  // This asymmetry arises from the Icon on the right side, which has
1940
1935
  // extra padding built in. To have the component look more balanced,
@@ -1970,7 +1965,7 @@ const adjustedPaddingLeft = 16 - 1;
1970
1965
  const adjustedPaddingRight = 12 - 1;
1971
1966
  const stateStyles = {};
1972
1967
 
1973
- const _generateStyles$1 = (light, placeholder) => {
1968
+ const _generateStyles = (light, placeholder) => {
1974
1969
  // "hash" the parameters
1975
1970
  const styleKey = `${String(light)}-${String(placeholder)}`;
1976
1971
 
@@ -1984,12 +1979,12 @@ const _generateStyles$1 = (light, placeholder) => {
1984
1979
  newStyles = {
1985
1980
  default: {
1986
1981
  backgroundColor: "transparent",
1987
- color: placeholder ? white50 : white$4,
1982
+ color: placeholder ? white50 : white,
1988
1983
  borderColor: white50,
1989
1984
  borderWidth: 1
1990
1985
  },
1991
1986
  focus: {
1992
- borderColor: white$4,
1987
+ borderColor: white,
1993
1988
  borderWidth: 2,
1994
1989
  paddingLeft: adjustedPaddingLeft,
1995
1990
  paddingRight: adjustedPaddingRight
@@ -1997,41 +1992,41 @@ const _generateStyles$1 = (light, placeholder) => {
1997
1992
  active: {
1998
1993
  paddingLeft: adjustedPaddingLeft,
1999
1994
  paddingRight: adjustedPaddingRight,
2000
- borderColor: mix(fade(blue$3, 0.32), white$4),
1995
+ borderColor: mix(fade(blue, 0.32), white),
2001
1996
  borderWidth: 2,
2002
- color: placeholder ? mix(fade(white$4, 0.32), blue$3) : mix(fade(blue$3, 0.32), white$4),
2003
- backgroundColor: mix(offBlack32$4, blue$3)
1997
+ color: placeholder ? mix(fade(white, 0.32), blue) : mix(fade(blue, 0.32), white),
1998
+ backgroundColor: mix(offBlack32, blue)
2004
1999
  },
2005
2000
  disabled: {
2006
- borderColor: mix(fade(white$4, 0.32), blue$3),
2007
- color: mix(fade(white$4, 0.32), blue$3),
2001
+ borderColor: mix(fade(white, 0.32), blue),
2002
+ color: mix(fade(white, 0.32), blue),
2008
2003
  cursor: "auto"
2009
2004
  }
2010
2005
  };
2011
2006
  } else {
2012
2007
  newStyles = {
2013
2008
  default: {
2014
- backgroundColor: white$4,
2015
- borderColor: offBlack16$1,
2009
+ backgroundColor: white,
2010
+ borderColor: offBlack16,
2016
2011
  borderWidth: 1,
2017
- color: placeholder ? offBlack64 : offBlack$3
2012
+ color: placeholder ? offBlack64 : offBlack
2018
2013
  },
2019
2014
  focus: {
2020
- borderColor: blue$3,
2015
+ borderColor: blue,
2021
2016
  borderWidth: 2,
2022
2017
  paddingLeft: adjustedPaddingLeft,
2023
2018
  paddingRight: adjustedPaddingRight
2024
2019
  },
2025
2020
  active: {
2026
- background: mix(fade(blue$3, 0.32), white$4),
2027
- borderColor: mix(offBlack32$4, blue$3),
2021
+ background: mix(fade(blue, 0.32), white),
2022
+ borderColor: mix(offBlack32, blue),
2028
2023
  borderWidth: 2,
2029
2024
  paddingLeft: adjustedPaddingLeft,
2030
2025
  paddingRight: adjustedPaddingRight
2031
2026
  },
2032
2027
  disabled: {
2033
2028
  backgroundColor: "transparent",
2034
- borderColor: offBlack16$1,
2029
+ borderColor: offBlack16,
2035
2030
  color: offBlack64,
2036
2031
  cursor: "auto"
2037
2032
  }
@@ -2042,7 +2037,7 @@ const _generateStyles$1 = (light, placeholder) => {
2042
2037
  return stateStyles[styleKey];
2043
2038
  };
2044
2039
 
2045
- const _excluded$5 = ["children", "disabled", "id", "light", "opener", "placeholder", "selectedValue", "testId", "alignment", "dropdownStyle", "isFilterable", "onChange", "onToggle", "opened", "style", "className"];
2040
+ const _excluded$1 = ["children", "disabled", "id", "light", "opener", "placeholder", "selectedValue", "testId", "alignment", "dropdownStyle", "isFilterable", "onChange", "onToggle", "opened", "style", "className"];
2046
2041
 
2047
2042
  /**
2048
2043
  * The single select allows the selection of one item. Clients are responsible
@@ -2057,7 +2052,7 @@ const _excluded$5 = ["children", "disabled", "id", "light", "opener", "placehold
2057
2052
  * hundreds of items without performance problems.
2058
2053
  *
2059
2054
  */
2060
- class SingleSelect extends Component {
2055
+ class SingleSelect extends React.Component {
2061
2056
  constructor(props) {
2062
2057
  super(props);
2063
2058
 
@@ -2190,7 +2185,7 @@ class SingleSelect extends Component {
2190
2185
  }
2191
2186
 
2192
2187
  return {
2193
- component: /*#__PURE__*/createElement(SearchTextInput, {
2188
+ component: /*#__PURE__*/React.createElement(SearchTextInput, {
2194
2189
  key: "search-text-input",
2195
2190
  onChange: this.handleSearchTextChanged,
2196
2191
  searchText: this.state.searchText,
@@ -2216,18 +2211,18 @@ class SingleSelect extends Component {
2216
2211
  selectedValue,
2217
2212
  testId
2218
2213
  } = _this$props,
2219
- sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded$5);
2214
+ sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded$1);
2220
2215
 
2221
- const selectedItem = Children.toArray(children).find(option => option.props.value === selectedValue); // If nothing is selected, or if the selectedValue doesn't match any
2216
+ const selectedItem = React.Children.toArray(children).find(option => option.props.value === selectedValue); // If nothing is selected, or if the selectedValue doesn't match any
2222
2217
  // item in the menu, use the placeholder.
2223
2218
 
2224
2219
  const menuText = selectedItem ? selectedItem.props.label : placeholder;
2225
- const dropdownOpener = opener ? /*#__PURE__*/createElement(DropdownOpener, {
2220
+ const dropdownOpener = opener ? /*#__PURE__*/React.createElement(DropdownOpener, {
2226
2221
  onClick: this.handleClick,
2227
2222
  disabled: numItems === 0 || disabled,
2228
2223
  ref: this.handleOpenerRef,
2229
2224
  text: menuText
2230
- }, opener) : /*#__PURE__*/createElement(SelectOpener, _extends({}, sharedProps, {
2225
+ }, opener) : /*#__PURE__*/React.createElement(SelectOpener, _extends({}, sharedProps, {
2231
2226
  disabled: numItems === 0 || disabled,
2232
2227
  id: id,
2233
2228
  isPlaceholder: !selectedItem,
@@ -2253,12 +2248,12 @@ class SingleSelect extends Component {
2253
2248
  const {
2254
2249
  searchText
2255
2250
  } = this.state;
2256
- const allChildren = Children.toArray(children).filter(Boolean);
2251
+ const allChildren = React.Children.toArray(children).filter(Boolean);
2257
2252
  const filteredItems = this.getMenuItems(allChildren);
2258
2253
  const opener = this.renderOpener(allChildren.length);
2259
2254
  const searchField = this.getSearchField();
2260
2255
  const items = searchField ? [searchField].concat(filteredItems) : filteredItems;
2261
- return /*#__PURE__*/createElement(DropdownCore$1, {
2256
+ return /*#__PURE__*/React.createElement(DropdownCore$1, {
2262
2257
  role: "listbox",
2263
2258
  alignment: alignment,
2264
2259
  dropdownStyle: [isFilterable && filterableDropdownStyle, selectDropdownStyle, dropdownStyle],
@@ -2283,7 +2278,7 @@ SingleSelect.defaultProps = {
2283
2278
  light: false
2284
2279
  };
2285
2280
 
2286
- const _excluded$6 = ["disabled", "id", "light", "opener", "testId", "alignment", "dropdownStyle", "implicitAllEnabled", "isFilterable", "labels", "onChange", "onToggle", "opened", "selectedValues", "shortcuts", "style", "className"];
2281
+ const _excluded = ["disabled", "id", "light", "opener", "testId", "alignment", "dropdownStyle", "implicitAllEnabled", "isFilterable", "labels", "onChange", "onToggle", "opened", "selectedValues", "shortcuts", "style", "className"];
2287
2282
 
2288
2283
  /**
2289
2284
  * A dropdown that consists of multiple selection items. This select allows
@@ -2293,7 +2288,7 @@ const _excluded$6 = ["disabled", "id", "light", "opener", "testId", "alignment",
2293
2288
  * The multi select stays open until closed by the user. The onChange callback
2294
2289
  * happens every time there is a change in the selection of the items.
2295
2290
  */
2296
- class MultiSelect extends Component {
2291
+ class MultiSelect extends React.Component {
2297
2292
  constructor(props) {
2298
2293
  super(props);
2299
2294
 
@@ -2330,7 +2325,7 @@ class MultiSelect extends Component {
2330
2325
  children,
2331
2326
  onChange
2332
2327
  } = this.props;
2333
- const selected = Children.toArray(children).filter(Boolean).map(option => option.props.value);
2328
+ const selected = React.Children.toArray(children).filter(Boolean).map(option => option.props.value);
2334
2329
  onChange(selected);
2335
2330
  };
2336
2331
 
@@ -2452,7 +2447,7 @@ class MultiSelect extends Component {
2452
2447
  filter
2453
2448
  } = this.state.labels;
2454
2449
  return [{
2455
- component: /*#__PURE__*/createElement(SearchTextInput, {
2450
+ component: /*#__PURE__*/React.createElement(SearchTextInput, {
2456
2451
  key: "search-text-input",
2457
2452
  onChange: this.handleSearchTextChanged,
2458
2453
  searchText: this.state.searchText,
@@ -2479,7 +2474,7 @@ class MultiSelect extends Component {
2479
2474
  if (shortcuts && !this.state.searchText) {
2480
2475
  const selectAllDisabled = numOptions === selectedValues.length;
2481
2476
  const selectAll = {
2482
- component: /*#__PURE__*/createElement(ActionItem, {
2477
+ component: /*#__PURE__*/React.createElement(ActionItem, {
2483
2478
  disabled: selectAllDisabled,
2484
2479
  label: selectAllLabel(numOptions),
2485
2480
  indent: true,
@@ -2490,7 +2485,7 @@ class MultiSelect extends Component {
2490
2485
  };
2491
2486
  const selectNoneDisabled = selectedValues.length === 0;
2492
2487
  const selectNone = {
2493
- component: /*#__PURE__*/createElement(ActionItem, {
2488
+ component: /*#__PURE__*/React.createElement(ActionItem, {
2494
2489
  disabled: selectNoneDisabled,
2495
2490
  label: selectNoneLabel,
2496
2491
  indent: true,
@@ -2500,7 +2495,7 @@ class MultiSelect extends Component {
2500
2495
  populatedProps: {}
2501
2496
  };
2502
2497
  const separator = {
2503
- component: /*#__PURE__*/createElement(SeparatorItem, {
2498
+ component: /*#__PURE__*/React.createElement(SeparatorItem, {
2504
2499
  key: "shortcuts-separator"
2505
2500
  }),
2506
2501
  focusable: false,
@@ -2547,7 +2542,7 @@ class MultiSelect extends Component {
2547
2542
 
2548
2543
  if (lastSelectedChildren.length && restOfTheChildren.length) {
2549
2544
  lastSelectedItems.push({
2550
- component: /*#__PURE__*/createElement(SeparatorItem, {
2545
+ component: /*#__PURE__*/React.createElement(SeparatorItem, {
2551
2546
  key: "selected-separator"
2552
2547
  }),
2553
2548
  focusable: false,
@@ -2567,19 +2562,19 @@ class MultiSelect extends Component {
2567
2562
  opener,
2568
2563
  testId
2569
2564
  } = _this$props,
2570
- sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded$6);
2565
+ sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
2571
2566
 
2572
2567
  const {
2573
2568
  noneSelected
2574
2569
  } = this.state.labels;
2575
2570
  const menuText = this.getMenuText(allChildren);
2576
2571
  const numOptions = allChildren.length;
2577
- const dropdownOpener = opener ? /*#__PURE__*/createElement(DropdownOpener, {
2572
+ const dropdownOpener = opener ? /*#__PURE__*/React.createElement(DropdownOpener, {
2578
2573
  onClick: this.handleClick,
2579
2574
  disabled: numOptions === 0 || disabled,
2580
2575
  ref: this.handleOpenerRef,
2581
2576
  text: menuText
2582
- }, opener) : /*#__PURE__*/createElement(SelectOpener, _extends({}, sharedProps, {
2577
+ }, opener) : /*#__PURE__*/React.createElement(SelectOpener, _extends({}, sharedProps, {
2583
2578
  disabled: numOptions === 0 || disabled,
2584
2579
  id: id,
2585
2580
  isPlaceholder: menuText === noneSelected,
@@ -2609,11 +2604,11 @@ class MultiSelect extends Component {
2609
2604
  const {
2610
2605
  noResults
2611
2606
  } = this.state.labels;
2612
- const allChildren = Children.toArray(children).filter(Boolean);
2607
+ const allChildren = React.Children.toArray(children).filter(Boolean);
2613
2608
  const numOptions = allChildren.length;
2614
2609
  const filteredItems = this.getMenuItems(allChildren);
2615
2610
  const opener = this.renderOpener(allChildren);
2616
- return /*#__PURE__*/createElement(DropdownCore$1, {
2611
+ return /*#__PURE__*/React.createElement(DropdownCore$1, {
2617
2612
  role: "listbox",
2618
2613
  alignment: alignment,
2619
2614
  dropdownStyle: [isFilterable && filterableDropdownStyle, selectDropdownStyle, dropdownStyle],