@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.
- package/Accordion.js +425 -325
- package/Anchor.js +147 -117
- package/Animation.js +142 -94
- package/AnimationToggle.js +197 -193
- package/Box.js +145 -118
- package/Breadcrumbs.js +288 -206
- package/Button.js +488 -465
- package/ButtonGroup.js +160 -128
- package/ButtonSimple.js +543 -462
- package/CHANGELOG.md +7 -2
- package/Calendar.js +1111 -1001
- package/Card.js +771 -598
- package/CardLayout.js +205 -147
- package/Chip.js +509 -488
- package/Clickable.js +414 -352
- package/CloseButton.js +165 -142
- package/Code.js +1808 -2084
- package/Code.js.LICENSE.txt +8 -0
- package/CollapsiblePanel.js +586 -519
- package/Color.js +1066 -1069
- package/ColumnLayout.js +402 -363
- package/ComboBox.js +891 -794
- package/Concertina.js +997 -802
- package/ControlGroup.js +687 -594
- package/Date.js +567 -547
- package/DefinitionList.js +308 -234
- package/Divider.js +149 -118
- package/Dropdown.js +459 -416
- package/DualListbox.js +1479 -1541
- package/EventListener.js +94 -97
- package/File.js +1051 -969
- package/FormRows.js +883 -696
- package/Heading.js +216 -193
- package/Image.js +446 -402
- package/JSONTree.js +690 -551
- package/Layer.js +437 -410
- package/Link.js +336 -255
- package/List.js +213 -161
- package/Markdown.js +509 -487
- package/Menu.js +1105 -1056
- package/Message.js +475 -441
- package/MessageBar.js +387 -373
- package/Modal.js +810 -634
- package/ModalLayer.js +326 -243
- package/Monogram.js +308 -276
- package/Multiselect.js +3550 -3364
- package/Number.js +729 -687
- package/Paginator.js +510 -449
- package/Paragraph.js +145 -112
- package/Popover.js +1459 -1432
- package/Progress.js +301 -246
- package/RadioBar.js +610 -527
- package/RadioList.js +483 -444
- package/Resize.js +530 -489
- package/ResultsMenu.js +494 -455
- package/ScreenReaderContent.js +142 -111
- package/Scroll.js +595 -456
- package/ScrollContainerContext.js +197 -206
- package/Search.js +744 -650
- package/Select.js +2442 -2345
- package/SidePanel.js +390 -284
- package/Slider.js +669 -676
- package/SlidingPanels.js +639 -503
- package/SplitButton.js +464 -367
- package/StaticContent.js +161 -133
- package/StepBar.js +386 -358
- package/Switch.js +710 -640
- package/TabBar.js +726 -680
- package/TabLayout.js +406 -322
- package/Table.js +4842 -4616
- package/Text.js +1170 -1138
- package/TextArea.js +1102 -1090
- package/Tooltip.js +624 -581
- package/TransitionOpen.js +489 -422
- package/Typography.js +176 -153
- package/WaitSpinner.js +230 -206
- package/package.json +5 -5
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/useForceUpdate.js +112 -82
- package/useKeyPress.js +74 -71
- package/usePrevious.js +65 -65
- package/useRovingFocus.js +122 -138
package/ComboBox.js
CHANGED
|
@@ -1,816 +1,913 @@
|
|
|
1
|
-
/******/ (() => {
|
|
2
|
-
|
|
3
|
-
/******/
|
|
4
|
-
/******/
|
|
5
|
-
/******/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/******/
|
|
9
|
-
/******/
|
|
10
|
-
/******/
|
|
11
|
-
/******/
|
|
12
|
-
/******/
|
|
13
|
-
/******/
|
|
14
|
-
/******/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/******/
|
|
20
|
-
/******/
|
|
21
|
-
/******/
|
|
22
|
-
/******/
|
|
23
|
-
/******/
|
|
24
|
-
/******/
|
|
25
|
-
/******/
|
|
26
|
-
/******/
|
|
27
|
-
/******/
|
|
28
|
-
/******/
|
|
29
|
-
/******/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/******/
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/
|
|
37
|
-
/******/
|
|
38
|
-
/******/
|
|
39
|
-
/******/
|
|
40
|
-
/******/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/******/
|
|
44
|
-
/******/
|
|
45
|
-
/******/
|
|
46
|
-
/******/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
function
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
"
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
function
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
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
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
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
|
-
|
|
584
|
-
|
|
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
|
-
|
|
588
|
-
|
|
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
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
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
|
-
|
|
614
|
-
|
|
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
|
-
|
|
618
|
-
|
|
619
|
-
if (
|
|
620
|
-
|
|
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
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
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
|
-
|
|
707
|
-
|
|
708
|
-
|
|
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
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
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
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
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
|
+
/******/})();
|