@splunk/react-ui 4.21.0 → 4.21.1

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 (83) hide show
  1. package/Accordion.js +425 -325
  2. package/Anchor.js +147 -117
  3. package/Animation.js +142 -94
  4. package/AnimationToggle.js +197 -193
  5. package/Box.js +145 -118
  6. package/Breadcrumbs.js +288 -206
  7. package/Button.js +488 -465
  8. package/ButtonGroup.js +160 -128
  9. package/ButtonSimple.js +543 -462
  10. package/CHANGELOG.md +7 -2
  11. package/Calendar.js +1111 -1001
  12. package/Card.js +771 -598
  13. package/CardLayout.js +205 -147
  14. package/Chip.js +509 -488
  15. package/Clickable.js +414 -352
  16. package/CloseButton.js +165 -142
  17. package/Code.js +1808 -2084
  18. package/Code.js.LICENSE.txt +8 -0
  19. package/CollapsiblePanel.js +586 -519
  20. package/Color.js +1066 -1069
  21. package/ColumnLayout.js +402 -363
  22. package/ComboBox.js +891 -794
  23. package/Concertina.js +997 -802
  24. package/ControlGroup.js +687 -594
  25. package/Date.js +567 -547
  26. package/DefinitionList.js +308 -234
  27. package/Divider.js +149 -118
  28. package/Dropdown.js +459 -416
  29. package/DualListbox.js +1479 -1541
  30. package/EventListener.js +94 -97
  31. package/File.js +1051 -969
  32. package/FormRows.js +883 -696
  33. package/Heading.js +216 -193
  34. package/Image.js +446 -402
  35. package/JSONTree.js +690 -551
  36. package/Layer.js +437 -410
  37. package/Link.js +336 -255
  38. package/List.js +213 -161
  39. package/Markdown.js +509 -487
  40. package/Menu.js +1105 -1056
  41. package/Message.js +475 -441
  42. package/MessageBar.js +387 -373
  43. package/Modal.js +810 -634
  44. package/ModalLayer.js +326 -243
  45. package/Monogram.js +308 -276
  46. package/Multiselect.js +3550 -3364
  47. package/Number.js +729 -687
  48. package/Paginator.js +510 -449
  49. package/Paragraph.js +145 -112
  50. package/Popover.js +1459 -1432
  51. package/Progress.js +301 -246
  52. package/RadioBar.js +610 -527
  53. package/RadioList.js +483 -444
  54. package/Resize.js +530 -489
  55. package/ResultsMenu.js +494 -455
  56. package/ScreenReaderContent.js +142 -111
  57. package/Scroll.js +595 -456
  58. package/ScrollContainerContext.js +197 -206
  59. package/Search.js +744 -650
  60. package/Select.js +2442 -2345
  61. package/SidePanel.js +390 -284
  62. package/Slider.js +669 -676
  63. package/SlidingPanels.js +639 -503
  64. package/SplitButton.js +464 -367
  65. package/StaticContent.js +161 -133
  66. package/StepBar.js +386 -358
  67. package/Switch.js +710 -640
  68. package/TabBar.js +726 -680
  69. package/TabLayout.js +406 -322
  70. package/Table.js +4842 -4616
  71. package/Text.js +1170 -1138
  72. package/TextArea.js +1102 -1090
  73. package/Tooltip.js +624 -581
  74. package/TransitionOpen.js +489 -422
  75. package/Typography.js +176 -153
  76. package/WaitSpinner.js +230 -206
  77. package/package.json +5 -5
  78. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  79. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  80. package/useForceUpdate.js +112 -82
  81. package/useKeyPress.js +74 -71
  82. package/usePrevious.js +65 -65
  83. package/useRovingFocus.js +122 -138
package/ComboBox.js CHANGED
@@ -1,816 +1,913 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ // The require scope
4
- /******/ var __webpack_require__ = {};
5
- /******/
6
- /************************************************************************/
7
- /******/ /* webpack/runtime/compat get default export */
8
- /******/ (() => {
9
- /******/ // getDefaultExport function for compatibility with non-harmony modules
10
- /******/ __webpack_require__.n = (module) => {
11
- /******/ var getter = module && module.__esModule ?
12
- /******/ () => (module['default']) :
13
- /******/ () => (module);
14
- /******/ __webpack_require__.d(getter, { a: getter });
15
- /******/ return getter;
16
- /******/ };
17
- /******/ })();
18
- /******/
19
- /******/ /* webpack/runtime/define property getters */
20
- /******/ (() => {
21
- /******/ // define getter functions for harmony exports
22
- /******/ __webpack_require__.d = (exports, definition) => {
23
- /******/ for(var key in definition) {
24
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26
- /******/ }
27
- /******/ }
28
- /******/ };
29
- /******/ })();
30
- /******/
31
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
32
- /******/ (() => {
33
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
34
- /******/ })();
35
- /******/
36
- /******/ /* webpack/runtime/make namespace object */
37
- /******/ (() => {
38
- /******/ // define __esModule on exports
39
- /******/ __webpack_require__.r = (exports) => {
40
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
41
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
42
- /******/ }
43
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
44
- /******/ };
45
- /******/ })();
46
- /******/
47
- /************************************************************************/
48
- var __webpack_exports__ = {};
49
- // ESM COMPAT FLAG
50
- __webpack_require__.r(__webpack_exports__);
51
-
52
- // EXPORTS
53
- __webpack_require__.d(__webpack_exports__, {
54
- Divider: () => (/* reexport */ Menu_namespaceObject.Divider),
55
- Heading: () => (/* reexport */ Menu_namespaceObject.Heading),
56
- Option: () => (/* reexport */ ComboBox_Option),
57
- "default": () => (/* reexport */ ComboBox_ComboBox)
58
- });
59
-
60
- ;// CONCATENATED MODULE: external "react"
61
- const external_react_namespaceObject = require("react");
62
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
63
- ;// CONCATENATED MODULE: external "prop-types"
64
- const external_prop_types_namespaceObject = require("prop-types");
65
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
66
- ;// CONCATENATED MODULE: external "lodash/extend"
67
- const extend_namespaceObject = require("lodash/extend");
68
- var extend_default = /*#__PURE__*/__webpack_require__.n(extend_namespaceObject);
69
- ;// CONCATENATED MODULE: external "lodash/has"
70
- const has_namespaceObject = require("lodash/has");
71
- var has_default = /*#__PURE__*/__webpack_require__.n(has_namespaceObject);
72
- ;// CONCATENATED MODULE: external "lodash/omit"
73
- const omit_namespaceObject = require("lodash/omit");
74
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_namespaceObject);
75
- ;// CONCATENATED MODULE: external "lodash/pick"
76
- const pick_namespaceObject = require("lodash/pick");
77
- var pick_default = /*#__PURE__*/__webpack_require__.n(pick_namespaceObject);
78
- ;// CONCATENATED MODULE: external "lodash/some"
79
- const some_namespaceObject = require("lodash/some");
80
- var some_default = /*#__PURE__*/__webpack_require__.n(some_namespaceObject);
81
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/filter"
82
- const filter_namespaceObject = require("@splunk/ui-utils/filter");
83
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/id"
84
- const id_namespaceObject = require("@splunk/ui-utils/id");
85
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
86
- const i18n_namespaceObject = require("@splunk/ui-utils/i18n");
87
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
88
- const keyboard_namespaceObject = require("@splunk/ui-utils/keyboard");
89
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Menu"
90
- const Menu_namespaceObject = require("@splunk/react-ui/Menu");
91
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Popover"
92
- const Popover_namespaceObject = require("@splunk/react-ui/Popover");
93
- var Popover_default = /*#__PURE__*/__webpack_require__.n(Popover_namespaceObject);
94
- ;// CONCATENATED MODULE: external "@splunk/react-ui/ResultsMenu"
95
- const ResultsMenu_namespaceObject = require("@splunk/react-ui/ResultsMenu");
96
- var ResultsMenu_default = /*#__PURE__*/__webpack_require__.n(ResultsMenu_namespaceObject);
97
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Text"
98
- const Text_namespaceObject = require("@splunk/react-ui/Text");
99
- var Text_default = /*#__PURE__*/__webpack_require__.n(Text_namespaceObject);
100
- ;// CONCATENATED MODULE: ./src/ComboBox/Option.tsx
101
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
102
-
103
- 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); }
104
-
105
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
106
-
107
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
108
-
109
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
110
-
111
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
112
-
113
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
114
-
115
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
116
-
117
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
118
-
119
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
120
-
121
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
122
-
123
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
124
-
125
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
126
-
127
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
128
-
129
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
130
-
131
-
132
-
133
-
134
- var propTypes = {
135
- /** @private */
136
- active: (external_prop_types_default()).bool,
137
- description: (external_prop_types_default()).string,
138
- descriptionPosition: external_prop_types_default().oneOf(['right', 'bottom']),
139
- disabled: (external_prop_types_default()).bool,
140
- icon: (external_prop_types_default()).node,
141
- label: (external_prop_types_default()).string,
142
- matchRanges: external_prop_types_default().arrayOf(external_prop_types_default().shape({
143
- start: (external_prop_types_default()).number.isRequired,
144
- end: (external_prop_types_default()).number.isRequired
145
- })),
146
-
147
- /** @private */
148
- onClick: (external_prop_types_default()).func,
149
- truncate: (external_prop_types_default()).bool,
150
- value: (external_prop_types_default()).string.isRequired
151
- };
152
- var defaultProps = {
153
- active: false,
154
- descriptionPosition: 'bottom',
155
- disabled: false,
156
- truncate: false
157
- };
158
-
159
- /**
160
- * An option within a `ComboBox`. This inherits from
161
- * [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
162
- * so any elements passed to it must also be pure.
163
- */
164
- var Option = /*#__PURE__*/function (_PureComponent) {
165
- _inherits(Option, _PureComponent);
166
-
167
- var _super = _createSuper(Option);
168
-
169
- function Option() {
170
- var _this;
171
-
172
- _classCallCheck(this, Option);
173
-
174
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
175
- args[_key] = arguments[_key];
1
+ /******/ (() => {
2
+ // webpackBootstrap
3
+ /******/ "use strict";
4
+ /******/ // The require scope
5
+ /******/ var e = {};
6
+ /******/
7
+ /************************************************************************/
8
+ /******/ /* webpack/runtime/compat get default export */
9
+ /******/ (() => {
10
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
11
+ /******/ e.n = t => {
12
+ /******/ var n = t && t.__esModule ?
13
+ /******/ () => t["default"]
14
+ /******/ : () => t
15
+ /******/;
16
+ e.d(n, {
17
+ a: n
18
+ });
19
+ /******/ return n;
20
+ /******/ };
21
+ /******/ })();
22
+ /******/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ (() => {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ e.d = (t, n) => {
27
+ /******/ for (var o in n) {
28
+ /******/ if (e.o(n, o) && !e.o(t, o)) {
29
+ /******/ Object.defineProperty(t, o, {
30
+ enumerable: true,
31
+ get: n[o]
32
+ });
33
+ /******/ }
34
+ /******/ }
35
+ /******/ };
36
+ /******/ })();
37
+ /******/
38
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
+ /******/ (() => {
40
+ /******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
41
+ /******/;
42
+ })();
43
+ /******/
44
+ /******/ /* webpack/runtime/make namespace object */
45
+ /******/ (() => {
46
+ /******/ // define __esModule on exports
47
+ /******/ e.r = e => {
48
+ /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
49
+ /******/ Object.defineProperty(e, Symbol.toStringTag, {
50
+ value: "Module"
51
+ });
52
+ /******/ }
53
+ /******/ Object.defineProperty(e, "__esModule", {
54
+ value: true
55
+ });
56
+ /******/ };
57
+ /******/ })();
58
+ /******/
59
+ /************************************************************************/ var t = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(t);
62
+ // EXPORTS
63
+ e.d(t, {
64
+ Divider: () => /* reexport */ O.Divider,
65
+ Heading: () => /* reexport */ O.Heading,
66
+ Option: () => /* reexport */ W,
67
+ default: () => /* reexport */ pe
68
+ });
69
+ // CONCATENATED MODULE: external "react"
70
+ const n = require("react");
71
+ var o = e.n(n);
72
+ // CONCATENATED MODULE: external "prop-types"
73
+ const r = require("prop-types");
74
+ var i = e.n(r);
75
+ // CONCATENATED MODULE: external "lodash/extend"
76
+ const a = require("lodash/extend");
77
+ var l = e.n(a);
78
+ // CONCATENATED MODULE: external "lodash/has"
79
+ const u = require("lodash/has");
80
+ var c = e.n(u);
81
+ // CONCATENATED MODULE: external "lodash/omit"
82
+ const s = require("lodash/omit");
83
+ var f = e.n(s);
84
+ // CONCATENATED MODULE: external "lodash/pick"
85
+ const p = require("lodash/pick");
86
+ var d = e.n(p);
87
+ // CONCATENATED MODULE: external "lodash/some"
88
+ const v = require("lodash/some");
89
+ var h = e.n(v);
90
+ // CONCATENATED MODULE: external "@splunk/ui-utils/filter"
91
+ const y = require("@splunk/ui-utils/filter");
92
+ // CONCATENATED MODULE: external "@splunk/ui-utils/id"
93
+ const b = require("@splunk/ui-utils/id");
94
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
95
+ const m = require("@splunk/ui-utils/i18n");
96
+ // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
97
+ const g = require("@splunk/ui-utils/keyboard");
98
+ // CONCATENATED MODULE: external "@splunk/react-ui/Menu"
99
+ const O = require("@splunk/react-ui/Menu");
100
+ // CONCATENATED MODULE: external "@splunk/react-ui/Popover"
101
+ const I = require("@splunk/react-ui/Popover");
102
+ var S = e.n(I);
103
+ // CONCATENATED MODULE: external "@splunk/react-ui/ResultsMenu"
104
+ const C = require("@splunk/react-ui/ResultsMenu");
105
+ var w = e.n(C);
106
+ // CONCATENATED MODULE: external "@splunk/react-ui/Text"
107
+ const k = require("@splunk/react-ui/Text");
108
+ var P = e.n(k);
109
+ // CONCATENATED MODULE: ./src/ComboBox/Option.tsx
110
+ function j(e) {
111
+ "@babel/helpers - typeof";
112
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
113
+ j = function e(t) {
114
+ return typeof t;
115
+ };
116
+ } else {
117
+ j = function e(t) {
118
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
119
+ };
120
+ }
121
+ return j(e);
176
122
  }
177
-
178
- _this = _super.call.apply(_super, [this].concat(args));
179
-
180
- _defineProperty(_assertThisInitialized(_this), "item", null);
181
-
182
- _defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
183
- var _this$props = _this.props,
184
- disabled = _this$props.disabled,
185
- onClick = _this$props.onClick,
186
- value = _this$props.value;
187
-
188
- if (!disabled) {
189
- onClick === null || onClick === void 0 ? void 0 : onClick(e, {
190
- value: value
123
+ function x() {
124
+ x = Object.assign || function(e) {
125
+ for (var t = 1; t < arguments.length; t++) {
126
+ var n = arguments[t];
127
+ for (var o in n) {
128
+ if (Object.prototype.hasOwnProperty.call(n, o)) {
129
+ e[o] = n[o];
130
+ }
131
+ }
132
+ }
133
+ return e;
134
+ };
135
+ return x.apply(this, arguments);
136
+ }
137
+ function R(e, t) {
138
+ if (e == null) return {};
139
+ var n = M(e, t);
140
+ var o, r;
141
+ if (Object.getOwnPropertySymbols) {
142
+ var i = Object.getOwnPropertySymbols(e);
143
+ for (r = 0; r < i.length; r++) {
144
+ o = i[r];
145
+ if (t.indexOf(o) >= 0) continue;
146
+ if (!Object.prototype.propertyIsEnumerable.call(e, o)) continue;
147
+ n[o] = e[o];
148
+ }
149
+ }
150
+ return n;
151
+ }
152
+ function M(e, t) {
153
+ if (e == null) return {};
154
+ var n = {};
155
+ var o = Object.keys(e);
156
+ var r, i;
157
+ for (i = 0; i < o.length; i++) {
158
+ r = o[i];
159
+ if (t.indexOf(r) >= 0) continue;
160
+ n[r] = e[r];
161
+ }
162
+ return n;
163
+ }
164
+ function V(e, t) {
165
+ if (!(e instanceof t)) {
166
+ throw new TypeError("Cannot call a class as a function");
167
+ }
168
+ }
169
+ function D(e, t) {
170
+ for (var n = 0; n < t.length; n++) {
171
+ var o = t[n];
172
+ o.enumerable = o.enumerable || false;
173
+ o.configurable = true;
174
+ if ("value" in o) o.writable = true;
175
+ Object.defineProperty(e, o.key, o);
176
+ }
177
+ }
178
+ function E(e, t, n) {
179
+ if (t) D(e.prototype, t);
180
+ if (n) D(e, n);
181
+ return e;
182
+ }
183
+ function _(e, t) {
184
+ if (typeof t !== "function" && t !== null) {
185
+ throw new TypeError("Super expression must either be null or a function");
186
+ }
187
+ e.prototype = Object.create(t && t.prototype, {
188
+ constructor: {
189
+ value: e,
190
+ writable: true,
191
+ configurable: true
192
+ }
191
193
  });
192
- }
193
- });
194
-
195
- return _this;
196
- }
197
-
198
- _createClass(Option, [{
199
- key: "scrollIntoViewIfNeeded",
200
- value: function scrollIntoViewIfNeeded() {
201
- var _this$item;
202
-
203
- (_this$item = this.item) === null || _this$item === void 0 ? void 0 : _this$item.scrollIntoViewIfNeeded();
194
+ if (t) q(e, t);
204
195
  }
205
- }, {
206
- key: "render",
207
- value: function render() {
208
- var _this2 = this;
209
-
210
- // eslint-disable-next-line no-unused-vars
211
- var _this$props2 = this.props,
212
- value = _this$props2.value,
213
- label = _this$props2.label,
214
- otherProps = _objectWithoutProperties(_this$props2, ["value", "label"]);
215
-
216
- var displayLabel = label === undefined ? value : label;
217
- return /*#__PURE__*/external_react_default().createElement(Menu_namespaceObject.Item, _extends({
218
- ref: function ref(c) {
219
- _this2.item = c;
220
- },
221
- "data-test": "option",
222
- "data-test-value": value
223
- }, otherProps, {
224
- onClick: this.handleClick,
225
- role: "option",
226
- "aria-selected": false
227
- }), displayLabel);
228
- }
229
- }]);
230
-
231
- return Option;
232
- }(external_react_namespaceObject.PureComponent);
233
-
234
- _defineProperty(Option, "propTypes", propTypes);
235
-
236
- _defineProperty(Option, "defaultProps", defaultProps);
237
-
238
- /* harmony default export */ const ComboBox_Option = (Option);
239
- ;// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
240
- /**
196
+ function q(e, t) {
197
+ q = Object.setPrototypeOf || function e(t, n) {
198
+ t.__proto__ = n;
199
+ return t;
200
+ };
201
+ return q(e, t);
202
+ }
203
+ function A(e) {
204
+ var t = L();
205
+ return function n() {
206
+ var o = F(e), r;
207
+ if (t) {
208
+ var i = F(this).constructor;
209
+ r = Reflect.construct(o, arguments, i);
210
+ } else {
211
+ r = o.apply(this, arguments);
212
+ }
213
+ return B(this, r);
214
+ };
215
+ }
216
+ function B(e, t) {
217
+ if (t && (j(t) === "object" || typeof t === "function")) {
218
+ return t;
219
+ }
220
+ return T(e);
221
+ }
222
+ function T(e) {
223
+ if (e === void 0) {
224
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
225
+ }
226
+ return e;
227
+ }
228
+ function L() {
229
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
230
+ if (Reflect.construct.sham) return false;
231
+ if (typeof Proxy === "function") return true;
232
+ try {
233
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
234
+ return true;
235
+ } catch (e) {
236
+ return false;
237
+ }
238
+ }
239
+ function F(e) {
240
+ F = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
241
+ return t.__proto__ || Object.getPrototypeOf(t);
242
+ };
243
+ return F(e);
244
+ }
245
+ function H(e, t, n) {
246
+ if (t in e) {
247
+ Object.defineProperty(e, t, {
248
+ value: n,
249
+ enumerable: true,
250
+ configurable: true,
251
+ writable: true
252
+ });
253
+ } else {
254
+ e[t] = n;
255
+ }
256
+ return e;
257
+ }
258
+ var K = {
259
+ /** @private */
260
+ active: i().bool,
261
+ description: i().string,
262
+ descriptionPosition: i().oneOf([ "right", "bottom" ]),
263
+ disabled: i().bool,
264
+ icon: i().node,
265
+ label: i().string,
266
+ matchRanges: i().arrayOf(i().shape({
267
+ start: i().number.isRequired,
268
+ end: i().number.isRequired
269
+ })),
270
+ /** @private */
271
+ onClick: i().func,
272
+ truncate: i().bool,
273
+ value: i().string.isRequired
274
+ };
275
+ var N = {
276
+ active: false,
277
+ descriptionPosition: "bottom",
278
+ disabled: false,
279
+ truncate: false
280
+ };
281
+ /**
282
+ * An option within a `ComboBox`. This inherits from
283
+ * [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
284
+ * so any elements passed to it must also be pure.
285
+ */ var z = function(e) {
286
+ _(n, e);
287
+ var t = A(n);
288
+ function n() {
289
+ var e;
290
+ V(this, n);
291
+ for (var o = arguments.length, r = new Array(o), i = 0; i < o; i++) {
292
+ r[i] = arguments[i];
293
+ }
294
+ e = t.call.apply(t, [ this ].concat(r));
295
+ H(T(e), "item", null);
296
+ H(T(e), "handleClick", (function(t) {
297
+ var n = e.props, o = n.disabled, r = n.onClick, i = n.value;
298
+ if (!o) {
299
+ r === null || r === void 0 ? void 0 : r(t, {
300
+ value: i
301
+ });
302
+ }
303
+ }));
304
+ return e;
305
+ }
306
+ E(n, [ {
307
+ key: "scrollIntoViewIfNeeded",
308
+ value: function e() {
309
+ var t;
310
+ (t = this.item) === null || t === void 0 ? void 0 : t.scrollIntoViewIfNeeded();
311
+ }
312
+ }, {
313
+ key: "render",
314
+ value: function e() {
315
+ var t = this;
316
+ // eslint-disable-next-line no-unused-vars
317
+ var n = this.props, r = n.value, i = n.label, a = R(n, [ "value", "label" ]);
318
+ var l = i === undefined ? r : i;
319
+
320
+ return o().createElement(O.Item, x({
321
+ ref: function e(n) {
322
+ t.item = n;
323
+ },
324
+ "data-test": "option",
325
+ "data-test-value": r
326
+ }, a, {
327
+ onClick: this.handleClick,
328
+ role: "option",
329
+ "aria-selected": false
330
+ }), l);
331
+ }
332
+ } ]);
333
+ return n;
334
+ }(n.PureComponent);
335
+ H(z, "propTypes", K);
336
+ H(z, "defaultProps", N);
337
+ /* harmony default export */ const W = z;
338
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
339
+ /**
241
340
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
242
341
  *
243
342
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
244
343
  * @param current - The new value of the ref.
245
344
  */
246
- function updateReactRef(ref, current) {
247
- if (ref) {
248
- if (typeof ref === 'function') {
249
- ref(current);
250
- } else {
251
- // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
252
- // the intention here is to signal "we will take care of setting 'current', not you".
253
- ref.current = current; // eslint-disable-line no-param-reassign
254
- }
255
- }
256
- }
257
-
258
-
259
- ;// CONCATENATED MODULE: ./src/ComboBox/ComboBox.tsx
260
- function ComboBox_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ComboBox_typeof = function _typeof(obj) { return typeof obj; }; } else { ComboBox_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ComboBox_typeof(obj); }
261
-
262
- function ComboBox_extends() { ComboBox_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 ComboBox_extends.apply(this, arguments); }
263
-
264
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
265
-
266
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { ComboBox_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
267
-
268
- function ComboBox_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
269
-
270
- function ComboBox_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
271
-
272
- function ComboBox_createClass(Constructor, protoProps, staticProps) { if (protoProps) ComboBox_defineProperties(Constructor.prototype, protoProps); if (staticProps) ComboBox_defineProperties(Constructor, staticProps); return Constructor; }
273
-
274
- function ComboBox_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ComboBox_setPrototypeOf(subClass, superClass); }
275
-
276
- function ComboBox_setPrototypeOf(o, p) { ComboBox_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ComboBox_setPrototypeOf(o, p); }
277
-
278
- function ComboBox_createSuper(Derived) { var hasNativeReflectConstruct = ComboBox_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = ComboBox_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = ComboBox_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return ComboBox_possibleConstructorReturn(this, result); }; }
279
-
280
- function ComboBox_possibleConstructorReturn(self, call) { if (call && (ComboBox_typeof(call) === "object" || typeof call === "function")) { return call; } return ComboBox_assertThisInitialized(self); }
281
-
282
- function ComboBox_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
283
-
284
- function ComboBox_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
285
-
286
- function ComboBox_getPrototypeOf(o) { ComboBox_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ComboBox_getPrototypeOf(o); }
287
-
288
- function ComboBox_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
289
-
290
-
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
-
304
-
305
-
306
-
307
- var ComboBox_propTypes = {
308
- animateLoading: (external_prop_types_default()).bool,
309
- append: (external_prop_types_default()).bool,
310
- children: (external_prop_types_default()).node,
311
- controlledFilter: (external_prop_types_default()).bool,
312
- defaultPlacement: external_prop_types_default().oneOf(['above', 'below', 'vertical']),
313
- defaultValue: (external_prop_types_default()).string,
314
- describedBy: (external_prop_types_default()).string,
315
- disabled: (external_prop_types_default()).bool,
316
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
317
- error: (external_prop_types_default()).bool,
318
- footerMessage: (external_prop_types_default()).node,
319
- inline: (external_prop_types_default()).bool,
320
- inputRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
321
- isLoadingOptions: (external_prop_types_default()).bool,
322
- labelledBy: (external_prop_types_default()).string,
323
- loadingMessage: (external_prop_types_default()).node,
324
- menuStyle: (external_prop_types_default()).object,
325
- name: (external_prop_types_default()).string,
326
- noOptionsMessage: (external_prop_types_default()).node,
327
- onChange: (external_prop_types_default()).func,
328
- onClose: (external_prop_types_default()).func,
329
- onFocus: (external_prop_types_default()).func,
330
- onKeyDown: (external_prop_types_default()).func,
331
- onOpen: (external_prop_types_default()).func,
332
- onScroll: (external_prop_types_default()).func,
333
- onScrollBottom: (external_prop_types_default()).func,
334
- placeholder: (external_prop_types_default()).string,
335
- prepend: (external_prop_types_default()).bool,
336
- size: external_prop_types_default().oneOf(['small', 'medium', 'large']),
337
- value: (external_prop_types_default()).string
338
- };
339
- var ComboBox_defaultProps = {
340
- animateLoading: false,
341
- controlledFilter: false,
342
- defaultPlacement: 'vertical',
343
- disabled: false,
344
- error: false,
345
- inline: false,
346
- isLoadingOptions: false,
347
- menuStyle: {},
348
- placeholder: (0,i18n_namespaceObject._)('Select...'),
349
- size: 'medium'
350
- };
351
-
352
- function containsEvent(el, _ref) {
353
- var clientX = _ref.clientX,
354
- clientY = _ref.clientY;
355
-
356
- var _el$getBoundingClient = el.getBoundingClientRect(),
357
- top = _el$getBoundingClient.top,
358
- left = _el$getBoundingClient.left,
359
- bottom = _el$getBoundingClient.bottom,
360
- right = _el$getBoundingClient.right;
361
-
362
- return clientX > left && clientX < right && clientY > top && clientY < bottom;
363
- }
364
-
365
- /**
366
- * `ComboBox` allows the user to select a predefined string or enter a new value. Unlike `Select`
367
- * and `Multiselect`, `Option` value must always be a string and `Option` does not have a label
368
- * property.
369
- */
370
- var ComboBox = /*#__PURE__*/function (_Component) {
371
- ComboBox_inherits(ComboBox, _Component);
372
-
373
- var _super = ComboBox_createSuper(ComboBox);
374
-
375
- // @docs-props-type ComboBoxPropsBase
376
- function ComboBox(props) {
377
- var _this;
378
-
379
- ComboBox_classCallCheck(this, ComboBox);
380
-
381
- _this = _super.call(this, props);
382
-
383
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "activeItemId", void 0);
384
-
385
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "activeValue", void 0);
386
-
387
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "availableOptionCount", 0);
388
-
389
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "controlledExternally", void 0);
390
-
391
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "focusCalledInternally", false);
392
-
393
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "options", void 0);
394
-
395
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "popoverId", void 0);
396
-
397
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "previousActiveIndex", null);
398
-
399
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "textInput", null);
400
-
401
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleInputMount", function (el) {
402
- _this.textInput = el;
403
- updateReactRef(_this.props.inputRef, el);
404
- });
405
-
406
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleAnchorMount", function (el) {
407
- _this.setState({
408
- anchor: el
409
- });
410
-
411
- updateReactRef(_this.props.elementRef, el);
412
- });
413
-
414
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleActiveOptionMount", function (c) {
415
- if (_this.previousActiveIndex !== _this.state.activeIndex) {
416
- c === null || c === void 0 ? void 0 : c.scrollIntoViewIfNeeded();
417
- }
418
- });
419
-
420
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleInputFocus", function (e) {
421
- var _this$props$onFocus, _this$props;
422
-
423
- /* SUI-930 On IE 11 this handler is essentially deferred after calling
424
- * this.textInput.focus(). this.focusCalledInternally enables the focus event to be ignored
425
- * when the menu closes. */
426
- if (_this.focusCalledInternally) {
427
- _this.focusCalledInternally = false;
428
- } else {
429
- _this.open();
430
- }
431
-
432
- (_this$props$onFocus = (_this$props = _this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props, e);
433
- });
434
-
435
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleChange", function (e, _ref2) {
436
- var _this$props$onChange, _this$props2;
437
-
438
- var value = _ref2.value,
439
- selectedOption = _ref2.selectedOption;
440
- var name = _this.props.name;
441
- var typedValue = selectedOption ? undefined : value;
442
-
443
- if (_this.isControlled()) {
444
- _this.setState({
445
- activeIndex: 0,
446
- typedValue: typedValue
447
- });
448
- } else {
449
- _this.setState({
450
- value: value,
451
- activeIndex: 0,
452
- typedValue: typedValue
453
- });
454
- }
455
-
456
- (_this$props$onChange = (_this$props2 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props2, e, {
457
- value: value,
458
- name: name
459
- });
460
- });
461
-
462
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleSelectOption", function (e, data) {
463
- _this.handleChange(e, _objectSpread(_objectSpread({}, data), {}, {
464
- selectedOption: true
465
- }));
466
-
467
- _this.focusCalledInternally = true;
468
-
469
- _this.focus();
470
-
471
- _this.close();
472
- });
473
-
474
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleInputKeyDown", function (e) {
475
- var _this$props3 = _this.props,
476
- children = _this$props3.children,
477
- onKeyDown = _this$props3.onKeyDown,
478
- onScrollBottom = _this$props3.onScrollBottom;
479
- var numOptions = _this.availableOptionCount;
480
- var activeOption = _this.activeValue;
481
- var eventKeyCode = (0,keyboard_namespaceObject.keycode)(e.nativeEvent);
482
-
483
- if (_this.state.open) {
484
- switch (eventKeyCode) {
485
- case 'enter':
486
- {
487
- if (activeOption) {
488
- _this.handleSelectOption(e, {
489
- value: activeOption
490
- });
491
- }
492
-
493
- break;
494
- }
495
-
496
- case 'tab':
497
- _this.close();
498
-
499
- break;
500
-
501
- case 'down':
502
- _this.setState(function (state) {
503
- return {
504
- activeIndex: Math.min(state.activeIndex + 1, numOptions - 1)
505
- };
506
- });
507
-
508
- if (children && onScrollBottom) {
509
- var beforeLastChild = external_react_namespaceObject.Children.count(children) - 2;
510
-
511
- if (_this.state.activeIndex === beforeLastChild) {
512
- _this.handleScrollBottom(e);
513
- }
345
+ function U(e, t) {
346
+ if (e) {
347
+ if (typeof e === "function") {
348
+ e(t);
349
+ } else {
350
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
351
+ // the intention here is to signal "we will take care of setting 'current', not you".
352
+ e.current = t;
353
+ // eslint-disable-line no-param-reassign
354
+ }
355
+ }
356
+ }
357
+ // CONCATENATED MODULE: ./src/ComboBox/ComboBox.tsx
358
+ function X(e) {
359
+ "@babel/helpers - typeof";
360
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
361
+ X = function e(t) {
362
+ return typeof t;
363
+ };
364
+ } else {
365
+ X = function e(t) {
366
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
367
+ };
368
+ }
369
+ return X(e);
370
+ }
371
+ function Y() {
372
+ Y = Object.assign || function(e) {
373
+ for (var t = 1; t < arguments.length; t++) {
374
+ var n = arguments[t];
375
+ for (var o in n) {
376
+ if (Object.prototype.hasOwnProperty.call(n, o)) {
377
+ e[o] = n[o];
378
+ }
379
+ }
514
380
  }
515
-
516
- break;
517
-
518
- case 'up':
519
- _this.setState(function (state) {
520
- return {
521
- activeIndex: Math.max(state.activeIndex - 1, 0)
522
- };
523
- });
524
-
525
- break;
526
-
527
- default: // do nothing
528
-
381
+ return e;
382
+ };
383
+ return Y.apply(this, arguments);
384
+ }
385
+ function G(e, t) {
386
+ var n = Object.keys(e);
387
+ if (Object.getOwnPropertySymbols) {
388
+ var o = Object.getOwnPropertySymbols(e);
389
+ if (t) o = o.filter((function(t) {
390
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
391
+ }));
392
+ n.push.apply(n, o);
529
393
  }
530
- } else if ((0,keyboard_namespaceObject.addsCharacter)(e.nativeEvent) !== false || // Safari 9.0 returns undefined
531
- eventKeyCode === 'enter' || eventKeyCode === 'backspace' || eventKeyCode === 'down' || eventKeyCode === 'up') {
532
- _this.open();
533
- }
534
-
535
- onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
536
- });
537
-
538
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleInputClick", function () {
539
- if (!_this.state.open && !_this.props.disabled) {
540
- _this.open();
541
- }
542
- });
543
-
544
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleRequestClose", function (_ref3) {
545
- var event = _ref3.event,
546
- reason = _ref3.reason;
547
- var shouldClose = reason === 'offScreen' || reason === 'escapeKey' || reason === 'clickAway' && _this.state.anchor && !containsEvent(_this.state.anchor, event);
548
-
549
- if (shouldClose) {
550
- _this.close();
551
- }
552
- });
553
-
554
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleScrollBottom", function (e) {
555
- if (_this.state.open && !_this.props.isLoadingOptions) {
556
- var _this$props$onScrollB, _this$props4;
557
-
558
- (_this$props$onScrollB = (_this$props4 = _this.props).onScrollBottom) === null || _this$props$onScrollB === void 0 ? void 0 : _this$props$onScrollB.call(_this$props4, e);
559
- }
560
- });
561
-
562
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "renderMenu", function (_ref4) {
563
- var anchorWidth = _ref4.anchorWidth,
564
- maxHeight = _ref4.maxHeight;
565
- var _this$props5 = _this.props,
566
- children = _this$props5.children,
567
- controlledFilter = _this$props5.controlledFilter,
568
- isLoadingOptions = _this$props5.isLoadingOptions,
569
- menuStyle = _this$props5.menuStyle,
570
- onScrollBottom = _this$props5.onScrollBottom;
571
- var _this$state = _this.state,
572
- activeIndex = _this$state.activeIndex,
573
- typedValue = _this$state.typedValue;
574
-
575
- var value = _this.getValue();
576
-
577
- var initialOptions = external_react_namespaceObject.Children.toArray(children).filter(external_react_namespaceObject.isValidElement);
578
- var hasExactMatch = some_default()(initialOptions, function (option) {
579
- if (option.type === Menu_namespaceObject.Heading) {
580
- return false;
394
+ return n;
395
+ }
396
+ function J(e) {
397
+ for (var t = 1; t < arguments.length; t++) {
398
+ var n = arguments[t] != null ? arguments[t] : {};
399
+ if (t % 2) {
400
+ G(Object(n), true).forEach((function(t) {
401
+ le(e, t, n[t]);
402
+ }));
403
+ } else if (Object.getOwnPropertyDescriptors) {
404
+ Object.defineProperties(e, Object.getOwnPropertyDescriptors(n));
405
+ } else {
406
+ G(Object(n)).forEach((function(t) {
407
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
408
+ }));
409
+ }
581
410
  }
582
-
583
- if (option.props.label === undefined) {
584
- return option.props.value === value;
411
+ return e;
412
+ }
413
+ function Q(e, t) {
414
+ if (!(e instanceof t)) {
415
+ throw new TypeError("Cannot call a class as a function");
585
416
  }
586
-
587
- if (option.props.label !== undefined && typedValue !== undefined) {
588
- return option.props.label === value;
417
+ }
418
+ function Z(e, t) {
419
+ for (var n = 0; n < t.length; n++) {
420
+ var o = t[n];
421
+ o.enumerable = o.enumerable || false;
422
+ o.configurable = true;
423
+ if ("value" in o) o.writable = true;
424
+ Object.defineProperty(e, o.key, o);
589
425
  }
590
-
591
- return option.props.value === value;
592
- });
593
-
594
- if (!hasExactMatch && value) {
595
- initialOptions.unshift( /*#__PURE__*/external_react_default().createElement(ComboBox_Option, {
596
- description: (0,i18n_namespaceObject._)('(New value)'),
597
- descriptionPosition: "right",
598
- key: "currentValueOption",
599
- value: value,
600
- "data-test-current-value-option": value
601
- }));
602
- } // Highlight Active
603
-
604
-
605
- _this.availableOptionCount = 0;
606
- _this.activeValue = undefined;
607
- var keywords = (0,filter_namespaceObject.stringToKeywords)(typedValue ? value : _this.getDisplayValue());
608
- _this.options = (controlledFilter ? initialOptions : initialOptions.filter(function (option) {
609
- if (option.props.label !== undefined) {
610
- return (0,filter_namespaceObject.testPhrase)(option.props.label, keywords);
426
+ }
427
+ function $(e, t, n) {
428
+ if (t) Z(e.prototype, t);
429
+ if (n) Z(e, n);
430
+ return e;
431
+ }
432
+ function ee(e, t) {
433
+ if (typeof t !== "function" && t !== null) {
434
+ throw new TypeError("Super expression must either be null or a function");
611
435
  }
612
-
613
- if (option.props.value !== undefined) {
614
- return (0,filter_namespaceObject.testPhrase)(option.props.value, keywords);
436
+ e.prototype = Object.create(t && t.prototype, {
437
+ constructor: {
438
+ value: e,
439
+ writable: true,
440
+ configurable: true
441
+ }
442
+ });
443
+ if (t) te(e, t);
444
+ }
445
+ function te(e, t) {
446
+ te = Object.setPrototypeOf || function e(t, n) {
447
+ t.__proto__ = n;
448
+ return t;
449
+ };
450
+ return te(e, t);
451
+ }
452
+ function ne(e) {
453
+ var t = ie();
454
+ return function n() {
455
+ var o = ae(e), r;
456
+ if (t) {
457
+ var i = ae(this).constructor;
458
+ r = Reflect.construct(o, arguments, i);
459
+ } else {
460
+ r = o.apply(this, arguments);
461
+ }
462
+ return oe(this, r);
463
+ };
464
+ }
465
+ function oe(e, t) {
466
+ if (t && (X(t) === "object" || typeof t === "function")) {
467
+ return t;
615
468
  }
616
-
617
- return true; // Keep all headers and non-interactive options
618
- })).map(function (option, index) {
619
- if (!has_default()(option.props, 'active')) {
620
- // ignore Headings and Dividers
621
- return option;
469
+ return re(e);
470
+ }
471
+ function re(e) {
472
+ if (e === void 0) {
473
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
622
474
  }
623
-
624
- var active = _this.availableOptionCount === activeIndex;
625
- _this.availableOptionCount += 1;
626
- var matchRangePhrase = option.props.label !== undefined ? option.props.label : option.props.value;
627
- var matchRangesProp = option.props.matchRanges;
628
- var matchRanges = !controlledFilter && value && (hasExactMatch || index > 0) ? (0,filter_namespaceObject.keywordLocations)(matchRangePhrase, keywords) || undefined // keywordLocations can return false, matchRanges must be an array or undefined
629
- : undefined;
630
-
631
- if (active) {
632
- _this.activeValue = option.props.value;
633
- return /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(option, {
634
- ref: _this.handleActiveOptionMount,
635
- id: _this.activeItemId,
636
- onClick: _this.handleSelectOption,
637
- matchRanges: matchRangesProp || matchRanges,
638
- active: true
639
- });
475
+ return e;
476
+ }
477
+ function ie() {
478
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
479
+ if (Reflect.construct.sham) return false;
480
+ if (typeof Proxy === "function") return true;
481
+ try {
482
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
483
+ return true;
484
+ } catch (e) {
485
+ return false;
640
486
  }
641
-
642
- return /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(option, {
643
- onClick: _this.handleSelectOption,
644
- matchRanges: matchRangesProp || matchRanges
645
- });
646
- });
647
- return /*#__PURE__*/external_react_default().createElement((ResultsMenu_default()), ComboBox_extends({
648
- style: extend_default()({
649
- overflow: 'auto',
650
- width: Math.max(anchorWidth !== null && anchorWidth !== void 0 ? anchorWidth : 0, 200)
651
- }, menuStyle),
652
- controlledExternally: true,
653
- maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : undefined,
654
- onScrollBottom: onScrollBottom ? _this.handleScrollBottom : undefined,
655
- isLoading: isLoadingOptions
656
- }, pick_default()(_this.props, 'className', 'noOptionsMessage', 'footerMessage', 'animateLoading', 'loadingMessage', 'onScroll')), _this.options);
657
- });
658
-
659
- _this.state = {
660
- activeIndex: 0,
661
- anchor: null,
662
- typedValue: undefined,
663
- open: false,
664
- value: props.defaultValue || ''
665
- };
666
- _this.controlledExternally = has_default()(props, 'value');
667
- _this.popoverId = (0,id_namespaceObject.createDOMID)('popover');
668
- _this.activeItemId = (0,id_namespaceObject.createDOMID)('active-item');
669
-
670
- if (false) {}
671
-
672
- if (false) {}
673
-
674
- return _this;
675
- }
676
-
677
- ComboBox_createClass(ComboBox, [{
678
- key: "componentDidUpdate",
679
- value: function componentDidUpdate(prevProps, prevState) {
680
- if (false) {}
681
-
682
- this.previousActiveIndex = prevState.activeIndex;
683
- }
684
- }, {
685
- key: "getValue",
686
- value: function getValue() {
687
- return this.isControlled() ? this.props.value : this.state.value;
688
- }
689
- }, {
690
- key: "getDisplayValue",
691
- value: function getDisplayValue() {
692
- var value = this.getValue();
693
- var typedValue = this.state.typedValue;
694
- var initialOptions = external_react_namespaceObject.Children.toArray(this.props.children).filter(external_react_namespaceObject.isValidElement);
695
- var optionForValue = !typedValue && initialOptions.find(function (option) {
696
- return option.props.label !== undefined && option.props.value === value;
697
- });
698
-
699
- if (optionForValue) {
700
- return optionForValue === null || optionForValue === void 0 ? void 0 : optionForValue.props.label;
701
- }
702
-
703
- return value;
704
487
  }
705
- }, {
706
- key: "open",
707
- value: function open() {
708
- var _this2 = this;
709
-
710
- this.setState({
711
- open: true,
712
- activeIndex: 0
713
- }, function () {
714
- var _this2$props$onOpen, _this2$props;
715
-
716
- (_this2$props$onOpen = (_this2$props = _this2.props).onOpen) === null || _this2$props$onOpen === void 0 ? void 0 : _this2$props$onOpen.call(_this2$props);
717
- });
488
+ function ae(e) {
489
+ ae = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
490
+ return t.__proto__ || Object.getPrototypeOf(t);
491
+ };
492
+ return ae(e);
718
493
  }
719
- }, {
720
- key: "close",
721
- value: function close() {
722
- var _this3 = this;
723
-
724
- this.setState({
725
- open: false
726
- }, function () {
727
- var _this3$props$onClose, _this3$props;
728
-
729
- _this3.previousActiveIndex = null;
730
- (_this3$props$onClose = (_this3$props = _this3.props).onClose) === null || _this3$props$onClose === void 0 ? void 0 : _this3$props$onClose.call(_this3$props);
731
- });
494
+ function le(e, t, n) {
495
+ if (t in e) {
496
+ Object.defineProperty(e, t, {
497
+ value: n,
498
+ enumerable: true,
499
+ configurable: true,
500
+ writable: true
501
+ });
502
+ } else {
503
+ e[t] = n;
504
+ }
505
+ return e;
506
+ }
507
+ var ue = {
508
+ animateLoading: i().bool,
509
+ append: i().bool,
510
+ children: i().node,
511
+ controlledFilter: i().bool,
512
+ defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
513
+ defaultValue: i().string,
514
+ describedBy: i().string,
515
+ disabled: i().bool,
516
+ elementRef: i().oneOfType([ i().func, i().object ]),
517
+ error: i().bool,
518
+ footerMessage: i().node,
519
+ inline: i().bool,
520
+ inputRef: i().oneOfType([ i().func, i().object ]),
521
+ isLoadingOptions: i().bool,
522
+ labelledBy: i().string,
523
+ loadingMessage: i().node,
524
+ menuStyle: i().object,
525
+ name: i().string,
526
+ noOptionsMessage: i().node,
527
+ onChange: i().func,
528
+ onClose: i().func,
529
+ onFocus: i().func,
530
+ onKeyDown: i().func,
531
+ onOpen: i().func,
532
+ onScroll: i().func,
533
+ onScrollBottom: i().func,
534
+ placeholder: i().string,
535
+ prepend: i().bool,
536
+ size: i().oneOf([ "small", "medium", "large" ]),
537
+ value: i().string
538
+ };
539
+ var ce = {
540
+ animateLoading: false,
541
+ controlledFilter: false,
542
+ defaultPlacement: "vertical",
543
+ disabled: false,
544
+ error: false,
545
+ inline: false,
546
+ isLoadingOptions: false,
547
+ menuStyle: {},
548
+ placeholder: (0, m._)("Select..."),
549
+ size: "medium"
550
+ };
551
+ function se(e, t) {
552
+ var n = t.clientX, o = t.clientY;
553
+ var r = e.getBoundingClientRect(), i = r.top, a = r.left, l = r.bottom, u = r.right;
554
+ return n > a && n < u && o > i && o < l;
732
555
  }
733
556
  /**
557
+ * `ComboBox` allows the user to select a predefined string or enter a new value. Unlike `Select`
558
+ * and `Multiselect`, `Option` value must always be a string and `Option` does not have a label
559
+ * property.
560
+ */ var fe = function(e) {
561
+ ee(r, e);
562
+ var t = ne(r);
563
+ // @docs-props-type ComboBoxPropsBase
564
+ function r(e) {
565
+ var i;
566
+ Q(this, r);
567
+ i = t.call(this, e);
568
+ le(re(i), "activeItemId", void 0);
569
+ le(re(i), "activeValue", void 0);
570
+ le(re(i), "availableOptionCount", 0);
571
+ le(re(i), "controlledExternally", void 0);
572
+ le(re(i), "focusCalledInternally", false);
573
+ le(re(i), "options", void 0);
574
+ le(re(i), "popoverId", void 0);
575
+ le(re(i), "previousActiveIndex", null);
576
+ le(re(i), "textInput", null);
577
+ le(re(i), "handleInputMount", (function(e) {
578
+ i.textInput = e;
579
+ U(i.props.inputRef, e);
580
+ }));
581
+ le(re(i), "handleAnchorMount", (function(e) {
582
+ i.setState({
583
+ anchor: e
584
+ });
585
+ U(i.props.elementRef, e);
586
+ }));
587
+ le(re(i), "handleActiveOptionMount", (function(e) {
588
+ if (i.previousActiveIndex !== i.state.activeIndex) {
589
+ e === null || e === void 0 ? void 0 : e.scrollIntoViewIfNeeded();
590
+ }
591
+ }));
592
+ le(re(i), "handleInputFocus", (function(e) {
593
+ var t, n;
594
+ /* SUI-930 On IE 11 this handler is essentially deferred after calling
595
+ * this.textInput.focus(). this.focusCalledInternally enables the focus event to be ignored
596
+ * when the menu closes. */ if (i.focusCalledInternally) {
597
+ i.focusCalledInternally = false;
598
+ } else {
599
+ i.open();
600
+ }
601
+ (t = (n = i.props).onFocus) === null || t === void 0 ? void 0 : t.call(n, e);
602
+ }));
603
+ le(re(i), "handleChange", (function(e, t) {
604
+ var n, o;
605
+ var r = t.value, a = t.selectedOption;
606
+ var l = i.props.name;
607
+ var u = a ? undefined : r;
608
+ if (i.isControlled()) {
609
+ i.setState({
610
+ activeIndex: 0,
611
+ typedValue: u
612
+ });
613
+ } else {
614
+ i.setState({
615
+ value: r,
616
+ activeIndex: 0,
617
+ typedValue: u
618
+ });
619
+ }
620
+ (n = (o = i.props).onChange) === null || n === void 0 ? void 0 : n.call(o, e, {
621
+ value: r,
622
+ name: l
623
+ });
624
+ }));
625
+ le(re(i), "handleSelectOption", (function(e, t) {
626
+ i.handleChange(e, J(J({}, t), {}, {
627
+ selectedOption: true
628
+ }));
629
+ i.focusCalledInternally = true;
630
+ i.focus();
631
+ i.close();
632
+ }));
633
+ le(re(i), "handleInputKeyDown", (function(e) {
634
+ var t = i.props, o = t.children, r = t.onKeyDown, a = t.onScrollBottom;
635
+ var l = i.availableOptionCount;
636
+ var u = i.activeValue;
637
+ var c = (0, g.keycode)(e.nativeEvent);
638
+ if (i.state.open) {
639
+ switch (c) {
640
+ case "enter":
641
+ {
642
+ if (u) {
643
+ i.handleSelectOption(e, {
644
+ value: u
645
+ });
646
+ }
647
+ break;
648
+ }
649
+
650
+ case "tab":
651
+ i.close();
652
+ break;
653
+
654
+ case "down":
655
+ i.setState((function(e) {
656
+ return {
657
+ activeIndex: Math.min(e.activeIndex + 1, l - 1)
658
+ };
659
+ }));
660
+ if (o && a) {
661
+ var s = n.Children.count(o) - 2;
662
+ if (i.state.activeIndex === s) {
663
+ i.handleScrollBottom(e);
664
+ }
665
+ }
666
+ break;
667
+
668
+ case "up":
669
+ i.setState((function(e) {
670
+ return {
671
+ activeIndex: Math.max(e.activeIndex - 1, 0)
672
+ };
673
+ }));
674
+ break;
675
+
676
+ default:
677
+ // do nothing
678
+ }
679
+ } else if ((0, g.addsCharacter)(e.nativeEvent) !== false || // Safari 9.0 returns undefined
680
+ c === "enter" || c === "backspace" || c === "down" || c === "up") {
681
+ i.open();
682
+ }
683
+ r === null || r === void 0 ? void 0 : r(e);
684
+ }));
685
+ le(re(i), "handleInputClick", (function() {
686
+ if (!i.state.open && !i.props.disabled) {
687
+ i.open();
688
+ }
689
+ }));
690
+ le(re(i), "handleRequestClose", (function(e) {
691
+ var t = e.event, n = e.reason;
692
+ var o = n === "offScreen" || n === "escapeKey" || n === "clickAway" && i.state.anchor && !se(i.state.anchor, t);
693
+ if (o) {
694
+ i.close();
695
+ }
696
+ }));
697
+ le(re(i), "handleScrollBottom", (function(e) {
698
+ if (i.state.open && !i.props.isLoadingOptions) {
699
+ var t, n;
700
+ (t = (n = i.props).onScrollBottom) === null || t === void 0 ? void 0 : t.call(n, e);
701
+ }
702
+ }));
703
+ le(re(i), "renderMenu", (function(e) {
704
+ var t = e.anchorWidth, r = e.maxHeight;
705
+ var a = i.props, u = a.children, s = a.controlledFilter, f = a.isLoadingOptions, p = a.menuStyle, v = a.onScrollBottom;
706
+ var b = i.state, g = b.activeIndex, I = b.typedValue;
707
+ var S = i.getValue();
708
+ var C = n.Children.toArray(u).filter(n.isValidElement);
709
+ var k = h()(C, (function(e) {
710
+ if (e.type === O.Heading) {
711
+ return false;
712
+ }
713
+ if (e.props.label === undefined) {
714
+ return e.props.value === S;
715
+ }
716
+ if (e.props.label !== undefined && I !== undefined) {
717
+ return e.props.label === S;
718
+ }
719
+ return e.props.value === S;
720
+ }));
721
+ if (!k && S) {
722
+ C.unshift( o().createElement(W, {
723
+ description: (0, m._)("(New value)"),
724
+ descriptionPosition: "right",
725
+ key: "currentValueOption",
726
+ value: S,
727
+ "data-test-current-value-option": S
728
+ }));
729
+ }
730
+ // Highlight Active
731
+ i.availableOptionCount = 0;
732
+ i.activeValue = undefined;
733
+ var P = (0, y.stringToKeywords)(I ? S : i.getDisplayValue());
734
+ i.options = (s ? C : C.filter((function(e) {
735
+ if (e.props.label !== undefined) {
736
+ return (0, y.testPhrase)(e.props.label, P);
737
+ }
738
+ if (e.props.value !== undefined) {
739
+ return (0, y.testPhrase)(e.props.value, P);
740
+ }
741
+ return true;
742
+ // Keep all headers and non-interactive options
743
+ }))).map((function(e, t) {
744
+ if (!c()(e.props, "active")) {
745
+ // ignore Headings and Dividers
746
+ return e;
747
+ }
748
+ var o = i.availableOptionCount === g;
749
+ i.availableOptionCount += 1;
750
+ var r = e.props.label !== undefined ? e.props.label : e.props.value;
751
+ var a = e.props.matchRanges;
752
+ var l = !s && S && (k || t > 0) ? (0, y.keywordLocations)(r, P) || undefined : undefined;
753
+ if (o) {
754
+ i.activeValue = e.props.value;
755
+
756
+ return (0, n.cloneElement)(e, {
757
+ ref: i.handleActiveOptionMount,
758
+ id: i.activeItemId,
759
+ onClick: i.handleSelectOption,
760
+ matchRanges: a || l,
761
+ active: true
762
+ });
763
+ }
764
+
765
+ return (0, n.cloneElement)(e, {
766
+ onClick: i.handleSelectOption,
767
+ matchRanges: a || l
768
+ });
769
+ }));
770
+
771
+ return o().createElement(w(), Y({
772
+ style: l()({
773
+ overflow: "auto",
774
+ width: Math.max(t !== null && t !== void 0 ? t : 0, 200)
775
+ }, p),
776
+ controlledExternally: true,
777
+ maxHeight: r !== null && r !== void 0 ? r : undefined,
778
+ onScrollBottom: v ? i.handleScrollBottom : undefined,
779
+ isLoading: f
780
+ }, d()(i.props, "className", "noOptionsMessage", "footerMessage", "animateLoading", "loadingMessage", "onScroll")), i.options);
781
+ }));
782
+ i.state = {
783
+ activeIndex: 0,
784
+ anchor: null,
785
+ typedValue: undefined,
786
+ open: false,
787
+ value: e.defaultValue || ""
788
+ };
789
+ i.controlledExternally = c()(e, "value");
790
+ i.popoverId = (0, b.createDOMID)("popover");
791
+ i.activeItemId = (0, b.createDOMID)("active-item");
792
+ if (false) {}
793
+ if (false) {}
794
+ return i;
795
+ }
796
+ $(r, [ {
797
+ key: "componentDidUpdate",
798
+ value: function e(t, n) {
799
+ if (false) {}
800
+ this.previousActiveIndex = n.activeIndex;
801
+ }
802
+ }, {
803
+ key: "getValue",
804
+ value: function e() {
805
+ return this.isControlled() ? this.props.value : this.state.value;
806
+ }
807
+ }, {
808
+ key: "getDisplayValue",
809
+ value: function e() {
810
+ var t = this.getValue();
811
+ var o = this.state.typedValue;
812
+ var r = n.Children.toArray(this.props.children).filter(n.isValidElement);
813
+ var i = !o && r.find((function(e) {
814
+ return e.props.label !== undefined && e.props.value === t;
815
+ }));
816
+ if (i) {
817
+ return i === null || i === void 0 ? void 0 : i.props.label;
818
+ }
819
+ return t;
820
+ }
821
+ }, {
822
+ key: "open",
823
+ value: function e() {
824
+ var t = this;
825
+ this.setState({
826
+ open: true,
827
+ activeIndex: 0
828
+ }, (function() {
829
+ var e, n;
830
+ (e = (n = t.props).onOpen) === null || e === void 0 ? void 0 : e.call(n);
831
+ }));
832
+ }
833
+ }, {
834
+ key: "close",
835
+ value: function e() {
836
+ var t = this;
837
+ this.setState({
838
+ open: false
839
+ }, (function() {
840
+ var e, n;
841
+ t.previousActiveIndex = null;
842
+ (e = (n = t.props).onClose) === null || e === void 0 ? void 0 : e.call(n);
843
+ }));
844
+ }
845
+ /**
734
846
  * Focus the `ComboBox`.
735
- */
736
-
737
- }, {
738
- key: "focus",
739
- value: function focus() {
740
- var _this$textInput;
741
-
742
- (_this$textInput = this.textInput) === null || _this$textInput === void 0 ? void 0 : _this$textInput.focus();
743
- }
744
- }, {
745
- key: "isControlled",
746
- value: function isControlled() {
747
- return this.controlledExternally;
748
- }
749
- }, {
750
- key: "render",
751
- value: function render() {
752
- var defaultPlacement = this.props.defaultPlacement;
753
- var _this$state2 = this.state,
754
- anchor = _this$state2.anchor,
755
- open = _this$state2.open;
756
- var currentValue = this.getValue();
757
- var currentDisplayValue = this.getDisplayValue();
758
- return /*#__PURE__*/external_react_default().createElement((Text_default()), ComboBox_extends({
759
- autoCapitalize: "off",
760
- autoComplete: "off",
761
- autoCorrect: "off",
762
- spellCheck: false,
763
- canClear: true,
764
- "data-test": "combo-box"
765
- }, omit_default()(this.props, 'animateLoading', 'className', 'controlledFilter', 'defaultValue', 'footerMessage', 'isLoadingOptions', 'loadingMessage', 'menuStyle', 'noOptionsMessage', 'onClose', 'onOpen', 'onScroll', 'onScrollBottom', 'spellCheck'), {
766
- "data-test-popover-id": this.popoverId,
767
- "data-test-label": currentDisplayValue,
768
- "data-test-value": currentValue,
769
- "data-test-open": open && !!anchor,
770
- onFocus: this.handleInputFocus,
771
- onClick: this.handleInputClick,
772
- onChange: this.handleChange,
773
- onKeyDown: this.handleInputKeyDown,
774
- inputRef: this.handleInputMount,
775
- elementRef: this.handleAnchorMount,
776
- role: "combobox",
777
- value: currentDisplayValue,
778
- "aria-activedescendant": this.activeItemId,
779
- "aria-expanded": open,
780
- "aria-haspopup": true,
781
- "aria-label": (0,i18n_namespaceObject._)('Value input'),
782
- "aria-controls": open ? this.popoverId : undefined
783
- }), /*#__PURE__*/external_react_default().createElement((Popover_default()), {
784
- anchor: anchor,
785
- autoCloseWhenOffScreen: true,
786
- canCoverAnchor: false,
787
- defaultPlacement: defaultPlacement,
788
- id: this.popoverId,
789
- onRequestClose: this.handleRequestClose,
790
- open: open && !!anchor,
791
- repositionMode: "flip"
792
- }, this.renderMenu));
793
- }
794
- }]);
795
-
796
- return ComboBox;
797
- }(external_react_namespaceObject.Component);
798
-
799
- ComboBox_defineProperty(ComboBox, "propTypes", ComboBox_propTypes);
800
-
801
- ComboBox_defineProperty(ComboBox, "defaultProps", ComboBox_defaultProps);
802
-
803
- ComboBox_defineProperty(ComboBox, "Option", ComboBox_Option);
804
-
805
- ComboBox_defineProperty(ComboBox, "Divider", Menu_namespaceObject.Divider);
806
-
807
- ComboBox_defineProperty(ComboBox, "Heading", Menu_namespaceObject.Heading);
808
-
809
- /* harmony default export */ const ComboBox_ComboBox = (ComboBox);
810
-
811
- ;// CONCATENATED MODULE: ./src/ComboBox/index.ts
812
-
813
-
814
- module.exports = __webpack_exports__;
815
- /******/ })()
816
- ;
847
+ */ }, {
848
+ key: "focus",
849
+ value: function e() {
850
+ var t;
851
+ (t = this.textInput) === null || t === void 0 ? void 0 : t.focus();
852
+ }
853
+ }, {
854
+ key: "isControlled",
855
+ value: function e() {
856
+ return this.controlledExternally;
857
+ }
858
+ }, {
859
+ key: "render",
860
+ value: function e() {
861
+ var t = this.props.defaultPlacement;
862
+ var n = this.state, r = n.anchor, i = n.open;
863
+ var a = this.getValue();
864
+ var l = this.getDisplayValue();
865
+
866
+ return o().createElement(P(), Y({
867
+ autoCapitalize: "off",
868
+ autoComplete: "off",
869
+ autoCorrect: "off",
870
+ spellCheck: false,
871
+ canClear: true,
872
+ "data-test": "combo-box"
873
+ }, f()(this.props, "animateLoading", "className", "controlledFilter", "defaultValue", "footerMessage", "isLoadingOptions", "loadingMessage", "menuStyle", "noOptionsMessage", "onClose", "onOpen", "onScroll", "onScrollBottom", "spellCheck"), {
874
+ "data-test-popover-id": this.popoverId,
875
+ "data-test-label": l,
876
+ "data-test-value": a,
877
+ "data-test-open": i && !!r,
878
+ onFocus: this.handleInputFocus,
879
+ onClick: this.handleInputClick,
880
+ onChange: this.handleChange,
881
+ onKeyDown: this.handleInputKeyDown,
882
+ inputRef: this.handleInputMount,
883
+ elementRef: this.handleAnchorMount,
884
+ role: "combobox",
885
+ value: l,
886
+ "aria-activedescendant": this.activeItemId,
887
+ "aria-expanded": i,
888
+ "aria-haspopup": true,
889
+ "aria-label": (0, m._)("Value input"),
890
+ "aria-controls": i ? this.popoverId : undefined
891
+ }), o().createElement(S(), {
892
+ anchor: r,
893
+ autoCloseWhenOffScreen: true,
894
+ canCoverAnchor: false,
895
+ defaultPlacement: t,
896
+ id: this.popoverId,
897
+ onRequestClose: this.handleRequestClose,
898
+ open: i && !!r,
899
+ repositionMode: "flip"
900
+ }, this.renderMenu));
901
+ }
902
+ } ]);
903
+ return r;
904
+ }(n.Component);
905
+ le(fe, "propTypes", ue);
906
+ le(fe, "defaultProps", ce);
907
+ le(fe, "Option", W);
908
+ le(fe, "Divider", O.Divider);
909
+ le(fe, "Heading", O.Heading);
910
+ /* harmony default export */ const pe = fe;
911
+ // CONCATENATED MODULE: ./src/ComboBox/index.ts
912
+ module.exports = t;
913
+ /******/})();