@splunk/react-ui 4.20.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 -441
- package/Anchor.js +147 -193
- package/Animation.js +142 -166
- package/AnimationToggle.js +197 -253
- package/Box.js +145 -194
- package/Breadcrumbs.js +288 -298
- package/Button.js +488 -613
- package/ButtonGroup.js +160 -212
- package/ButtonSimple.js +543 -562
- package/CHANGELOG.md +26 -0
- package/Calendar.js +1107 -1195
- package/Card.js +771 -746
- package/CardLayout.js +205 -223
- package/Chip.js +509 -612
- package/Clickable.js +416 -472
- package/CloseButton.js +165 -250
- package/Code.js +1808 -2172
- package/Code.js.LICENSE.txt +8 -0
- package/CollapsiblePanel.js +586 -675
- package/Color.js +1066 -1297
- package/ColumnLayout.js +402 -465
- package/ComboBox.js +892 -969
- package/Concertina.js +998 -963
- package/ControlGroup.js +687 -718
- package/Date.js +567 -697
- package/DefinitionList.js +308 -310
- package/Divider.js +149 -194
- package/Dropdown.js +459 -558
- package/DualListbox.js +1480 -1735
- package/EventListener.js +94 -165
- package/File.js +1051 -1173
- package/FormRows.js +885 -880
- package/Heading.js +216 -263
- package/Image.js +446 -558
- package/JSONTree.js +690 -699
- package/Layer.js +442 -582
- package/Link.js +336 -361
- package/List.js +213 -237
- package/Markdown.js +510 -612
- package/Menu.js +1109 -1331
- package/Message.js +474 -629
- package/MessageBar.js +387 -561
- package/Modal.js +810 -798
- package/ModalLayer.js +326 -343
- package/Monogram.js +308 -368
- package/Multiselect.js +3558 -3998
- package/Number.js +729 -843
- package/Paginator.js +510 -615
- package/Paragraph.js +145 -188
- package/Popover.js +1470 -1693
- package/Progress.js +301 -362
- package/RadioBar.js +610 -651
- package/RadioList.js +483 -544
- package/Resize.js +530 -623
- package/ResultsMenu.js +494 -597
- package/ScreenReaderContent.js +142 -187
- package/Scroll.js +595 -598
- package/ScrollContainerContext.js +197 -278
- package/Search.js +745 -817
- package/Select.js +2441 -2746
- package/SidePanel.js +390 -392
- package/Slider.js +668 -825
- package/SlidingPanels.js +639 -645
- package/SplitButton.js +464 -499
- package/StaticContent.js +161 -217
- package/StepBar.js +386 -466
- package/Switch.js +710 -764
- package/TabBar.js +724 -815
- package/TabLayout.js +406 -438
- package/Table.js +4842 -5121
- package/Text.js +1169 -1351
- package/TextArea.js +1097 -1307
- package/Tooltip.js +624 -721
- package/TransitionOpen.js +489 -546
- package/Typography.js +176 -229
- package/WaitSpinner.js +230 -298
- package/package.json +14 -15
- package/stubs-splunkui.d.ts +4 -1
- package/types/src/ComboBox/Option.d.ts +1 -1
- package/types/src/Concertina/Concertina.d.ts +4 -0
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/types/src/Link/Link.d.ts +7 -3
- package/types/src/Link/docs/examples/NewWindow.d.ts +2 -0
- package/types/src/Markdown/Markdown.d.ts +1 -1
- package/types/src/Markdown/renderers/MarkdownHeading.d.ts +1 -1
- package/types/src/Menu/Item.d.ts +1 -1
- package/types/src/Menu/Menu.d.ts +1 -0
- package/types/src/MessageBar/docs/examples/WithActions.d.ts +2 -0
- package/types/src/Multiselect/Option.d.ts +1 -1
- package/types/src/Search/Option.d.ts +1 -1
- package/types/src/Select/Option.d.ts +1 -1
- package/types/src/Select/OptionBase.d.ts +1 -1
- package/types/src/fixtures/FetchOptions.d.ts +2 -8
- package/useForceUpdate.js +112 -146
- package/useKeyPress.js +74 -128
- package/usePrevious.js +65 -129
- package/useRovingFocus.js +122 -218
- package/types/src/Link/docs/examples/NewTab.d.ts +0 -2
- /package/types/src/Table/docs/examples/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
- /package/types/src/Table/docs/examples/prisma/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
package/Dropdown.js
CHANGED
|
@@ -1,575 +1,476 @@
|
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
"use strict";
|
|
101
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return updateReactRef; });
|
|
102
|
-
/**
|
|
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 o = t && t.__esModule ?
|
|
13
|
+
/******/ () => t["default"]
|
|
14
|
+
/******/ : () => t
|
|
15
|
+
/******/;
|
|
16
|
+
e.d(o, {
|
|
17
|
+
a: o
|
|
18
|
+
});
|
|
19
|
+
/******/ return o;
|
|
20
|
+
/******/ };
|
|
21
|
+
/******/ })();
|
|
22
|
+
/******/
|
|
23
|
+
/******/ /* webpack/runtime/define property getters */
|
|
24
|
+
/******/ (() => {
|
|
25
|
+
/******/ // define getter functions for harmony exports
|
|
26
|
+
/******/ e.d = (t, o) => {
|
|
27
|
+
/******/ for (var n in o) {
|
|
28
|
+
/******/ if (e.o(o, n) && !e.o(t, n)) {
|
|
29
|
+
/******/ Object.defineProperty(t, n, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: o[n]
|
|
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
|
+
default: () => /* reexport */ N,
|
|
65
|
+
legacyRefMode: () => /* reexport */ W
|
|
66
|
+
});
|
|
67
|
+
// CONCATENATED MODULE: external "react"
|
|
68
|
+
const o = require("react");
|
|
69
|
+
var n = e.n(o);
|
|
70
|
+
// CONCATENATED MODULE: external "prop-types"
|
|
71
|
+
const r = require("prop-types");
|
|
72
|
+
var l = e.n(r);
|
|
73
|
+
// CONCATENATED MODULE: external "lodash/has"
|
|
74
|
+
const i = require("lodash/has");
|
|
75
|
+
var s = e.n(i);
|
|
76
|
+
// CONCATENATED MODULE: external "lodash/includes"
|
|
77
|
+
const a = require("lodash/includes");
|
|
78
|
+
var c = e.n(a);
|
|
79
|
+
// CONCATENATED MODULE: external "lodash/isEmpty"
|
|
80
|
+
const u = require("lodash/isEmpty");
|
|
81
|
+
// CONCATENATED MODULE: external "lodash/isFunction"
|
|
82
|
+
const p = require("lodash/isFunction");
|
|
83
|
+
var f = e.n(p);
|
|
84
|
+
// CONCATENATED MODULE: external "lodash/keys"
|
|
85
|
+
const d = require("lodash/keys");
|
|
86
|
+
var g = e.n(d);
|
|
87
|
+
// CONCATENATED MODULE: external "lodash/omit"
|
|
88
|
+
const y = require("lodash/omit");
|
|
89
|
+
var v = e.n(y);
|
|
90
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/id"
|
|
91
|
+
const h = require("@splunk/ui-utils/id");
|
|
92
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
|
|
93
|
+
const b = require("@splunk/ui-utils/keyboard");
|
|
94
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Popover"
|
|
95
|
+
const O = require("@splunk/react-ui/Popover");
|
|
96
|
+
var m = e.n(O);
|
|
97
|
+
// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
|
|
98
|
+
/**
|
|
103
99
|
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
104
100
|
*
|
|
105
101
|
* @param ref - The React callback or object ref. Can be `null` or `undefined`.
|
|
106
102
|
* @param current - The new value of the ref.
|
|
107
103
|
*/
|
|
108
|
-
function
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
104
|
+
function C(e, t) {
|
|
105
|
+
if (e) {
|
|
106
|
+
if (typeof e === "function") {
|
|
107
|
+
e(t);
|
|
108
|
+
} else {
|
|
109
|
+
// the public signature of this util uses React.Ref<T> to mirror the way React types refs.
|
|
110
|
+
// the intention here is to signal "we will take care of setting 'current', not you".
|
|
111
|
+
e.current = t;
|
|
112
|
+
// eslint-disable-line no-param-reassign
|
|
113
|
+
}
|
|
114
|
+
}
|
|
116
115
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
/***/ }),
|
|
130
|
-
|
|
131
|
-
/***/ 15:
|
|
132
|
-
/***/ (function(module, exports) {
|
|
133
|
-
|
|
134
|
-
module.exports = require("lodash/includes");
|
|
135
|
-
|
|
136
|
-
/***/ }),
|
|
137
|
-
|
|
138
|
-
/***/ 2:
|
|
139
|
-
/***/ (function(module, exports) {
|
|
140
|
-
|
|
141
|
-
module.exports = require("react");
|
|
142
|
-
|
|
143
|
-
/***/ }),
|
|
144
|
-
|
|
145
|
-
/***/ 21:
|
|
146
|
-
/***/ (function(module, exports) {
|
|
147
|
-
|
|
148
|
-
module.exports = require("@splunk/react-ui/Popover");
|
|
149
|
-
|
|
150
|
-
/***/ }),
|
|
151
|
-
|
|
152
|
-
/***/ 240:
|
|
153
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
154
|
-
|
|
155
|
-
"use strict";
|
|
156
|
-
// ESM COMPAT FLAG
|
|
157
|
-
__webpack_require__.r(__webpack_exports__);
|
|
158
|
-
|
|
159
|
-
// EXPORTS
|
|
160
|
-
__webpack_require__.d(__webpack_exports__, "default", function() { return /* reexport */ src_Dropdown_Dropdown; });
|
|
161
|
-
__webpack_require__.d(__webpack_exports__, "legacyRefMode", function() { return /* reexport */ legacyRefMode; });
|
|
162
|
-
|
|
163
|
-
// EXTERNAL MODULE: external "react"
|
|
164
|
-
var external_react_ = __webpack_require__(2);
|
|
165
|
-
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
166
|
-
|
|
167
|
-
// EXTERNAL MODULE: external "prop-types"
|
|
168
|
-
var external_prop_types_ = __webpack_require__(1);
|
|
169
|
-
var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
|
|
170
|
-
|
|
171
|
-
// EXTERNAL MODULE: external "lodash/has"
|
|
172
|
-
var has_ = __webpack_require__(11);
|
|
173
|
-
var has_default = /*#__PURE__*/__webpack_require__.n(has_);
|
|
174
|
-
|
|
175
|
-
// EXTERNAL MODULE: external "lodash/includes"
|
|
176
|
-
var includes_ = __webpack_require__(15);
|
|
177
|
-
var includes_default = /*#__PURE__*/__webpack_require__.n(includes_);
|
|
178
|
-
|
|
179
|
-
// EXTERNAL MODULE: external "lodash/isEmpty"
|
|
180
|
-
var isEmpty_ = __webpack_require__(90);
|
|
181
|
-
|
|
182
|
-
// EXTERNAL MODULE: external "lodash/isFunction"
|
|
183
|
-
var isFunction_ = __webpack_require__(71);
|
|
184
|
-
var isFunction_default = /*#__PURE__*/__webpack_require__.n(isFunction_);
|
|
185
|
-
|
|
186
|
-
// EXTERNAL MODULE: external "lodash/keys"
|
|
187
|
-
var keys_ = __webpack_require__(9);
|
|
188
|
-
var keys_default = /*#__PURE__*/__webpack_require__.n(keys_);
|
|
189
|
-
|
|
190
|
-
// EXTERNAL MODULE: external "lodash/omit"
|
|
191
|
-
var omit_ = __webpack_require__(5);
|
|
192
|
-
var omit_default = /*#__PURE__*/__webpack_require__.n(omit_);
|
|
193
|
-
|
|
194
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/id"
|
|
195
|
-
var id_ = __webpack_require__(8);
|
|
196
|
-
|
|
197
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/keyboard"
|
|
198
|
-
var keyboard_ = __webpack_require__(7);
|
|
199
|
-
|
|
200
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/Popover"
|
|
201
|
-
var Popover_ = __webpack_require__(21);
|
|
202
|
-
var Popover_default = /*#__PURE__*/__webpack_require__.n(Popover_);
|
|
203
|
-
|
|
204
|
-
// EXTERNAL MODULE: ./src/utils/updateReactRef.ts
|
|
205
|
-
var updateReactRef = __webpack_require__(10);
|
|
206
|
-
|
|
207
|
-
// CONCATENATED MODULE: ./src/Dropdown/Dropdown.tsx
|
|
208
|
-
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); }
|
|
209
|
-
|
|
210
|
-
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; }
|
|
211
|
-
|
|
212
|
-
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) { _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; }
|
|
213
|
-
|
|
214
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
215
|
-
|
|
216
|
-
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); } }
|
|
217
|
-
|
|
218
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
219
|
-
|
|
220
|
-
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); }
|
|
221
|
-
|
|
222
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
223
|
-
|
|
224
|
-
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); }; }
|
|
225
|
-
|
|
226
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
227
|
-
|
|
228
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
229
|
-
|
|
230
|
-
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; } }
|
|
231
|
-
|
|
232
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
233
|
-
|
|
234
|
-
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; }
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
/** @public */
|
|
249
|
-
|
|
250
|
-
var possibleCloseReasons = ['clickAway', 'contentClick', 'escapeKey', 'offScreen', 'tabKey', 'toggleClick'];
|
|
251
|
-
var propTypes = {
|
|
252
|
-
align: external_prop_types_default.a.oneOf(['center', 'edge', 'theme', 'end']),
|
|
253
|
-
canCoverAnchor: external_prop_types_default.a.bool,
|
|
254
|
-
children: external_prop_types_default.a.oneOfType([external_prop_types_default.a.node, external_prop_types_default.a.func]),
|
|
255
|
-
closeReasons: external_prop_types_default.a.arrayOf(external_prop_types_default.a.oneOf(possibleCloseReasons)),
|
|
256
|
-
defaultPlacement: external_prop_types_default.a.oneOf(['above', 'below', 'left', 'right', 'vertical', 'horizontal']),
|
|
257
|
-
elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
258
|
-
focusToggleReasons: external_prop_types_default.a.arrayOf(external_prop_types_default.a.oneOf(possibleCloseReasons)),
|
|
259
|
-
inputId: external_prop_types_default.a.string,
|
|
260
|
-
onRequestClose: external_prop_types_default.a.func,
|
|
261
|
-
onRequestOpen: external_prop_types_default.a.func,
|
|
262
|
-
open: external_prop_types_default.a.bool,
|
|
263
|
-
openWithArrowKeys: external_prop_types_default.a.bool,
|
|
264
|
-
repositionMode: external_prop_types_default.a.oneOf(['none', 'flip', 'any']),
|
|
265
|
-
retainFocus: external_prop_types_default.a.bool,
|
|
266
|
-
takeFocus: external_prop_types_default.a.bool,
|
|
267
|
-
toggle: external_prop_types_default.a.element.isRequired
|
|
268
|
-
};
|
|
269
|
-
var defaultProps = {
|
|
270
|
-
align: 'theme',
|
|
271
|
-
canCoverAnchor: true,
|
|
272
|
-
closeReasons: possibleCloseReasons,
|
|
273
|
-
defaultPlacement: 'below',
|
|
274
|
-
focusToggleReasons: ['contentClick', 'escapeKey', 'tabKey', 'toggleClick'],
|
|
275
|
-
repositionMode: 'flip',
|
|
276
|
-
retainFocus: false,
|
|
277
|
-
openWithArrowKeys: false,
|
|
278
|
-
takeFocus: true
|
|
279
|
-
};
|
|
280
|
-
var legacyRefMode = Symbol('Dropdown legacy ref mode marker');
|
|
281
|
-
|
|
282
|
-
var Dropdown_Dropdown = /*#__PURE__*/function (_Component) {
|
|
283
|
-
_inherits(Dropdown, _Component);
|
|
284
|
-
|
|
285
|
-
var _super = _createSuper(Dropdown);
|
|
286
|
-
|
|
287
|
-
// @docs-props-type DropdownPropsBase
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Enumeration of the possible reasons for closing the Select.
|
|
291
|
-
* 'clickAway', 'escapeKey', and 'offScreen' are inherited from Popover, but repeated here for
|
|
292
|
-
* docs extraction.
|
|
293
|
-
*/
|
|
294
|
-
function Dropdown(props) {
|
|
295
|
-
var _this;
|
|
296
|
-
|
|
297
|
-
_classCallCheck(this, Dropdown);
|
|
298
|
-
|
|
299
|
-
_this = _super.call(this, props);
|
|
300
|
-
|
|
301
|
-
_defineProperty(_assertThisInitialized(_this), "controlledExternally", void 0);
|
|
302
|
-
|
|
303
|
-
_defineProperty(_assertThisInitialized(_this), "popoverId", void 0);
|
|
304
|
-
|
|
305
|
-
_defineProperty(_assertThisInitialized(_this), "toggleRef", null);
|
|
306
|
-
|
|
307
|
-
_defineProperty(_assertThisInitialized(_this), "toggleId", void 0);
|
|
308
|
-
|
|
309
|
-
_defineProperty(_assertThisInitialized(_this), "handleToggleMount", function (el) {
|
|
310
|
-
_this.toggleRef = el;
|
|
311
|
-
|
|
312
|
-
_this.setState({
|
|
313
|
-
anchor: el
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
if (_this.props.toggle.type[legacyRefMode]) {
|
|
317
|
-
// TS: assume that legacy ref mode toggles support elementRef
|
|
318
|
-
Object(updateReactRef["a" /* updateReactRef */])(_this.props.toggle.props.elementRef, el);
|
|
319
|
-
} else {
|
|
320
|
-
// TS: ref does not exist on React.ReactElement - technically, this is undocumented API
|
|
321
|
-
Object(updateReactRef["a" /* updateReactRef */])(_this.props.toggle.ref, el);
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
_defineProperty(_assertThisInitialized(_this), "handleToggleClick", function (event) {
|
|
326
|
-
var _this$props$toggle$pr, _this$props$toggle$pr2;
|
|
327
|
-
|
|
328
|
-
(_this$props$toggle$pr = (_this$props$toggle$pr2 = _this.props.toggle.props).onClick) === null || _this$props$toggle$pr === void 0 ? void 0 : _this$props$toggle$pr.call(_this$props$toggle$pr2, event);
|
|
329
|
-
|
|
330
|
-
if (_this.isOpen()) {
|
|
331
|
-
_this.handleRequestClose({
|
|
332
|
-
reason: 'toggleClick',
|
|
333
|
-
event: event
|
|
334
|
-
});
|
|
335
|
-
} else {
|
|
336
|
-
var _this$props$onRequest, _this$props;
|
|
337
|
-
|
|
338
|
-
(_this$props$onRequest = (_this$props = _this.props).onRequestOpen) === null || _this$props$onRequest === void 0 ? void 0 : _this$props$onRequest.call(_this$props, event, {
|
|
339
|
-
reason: 'toggleClick'
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
if (!_this.isControlled()) {
|
|
343
|
-
_this.setState({
|
|
344
|
-
open: true
|
|
345
|
-
});
|
|
116
|
+
// CONCATENATED MODULE: ./src/Dropdown/Dropdown.tsx
|
|
117
|
+
function k(e) {
|
|
118
|
+
"@babel/helpers - typeof";
|
|
119
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
120
|
+
k = function e(t) {
|
|
121
|
+
return typeof t;
|
|
122
|
+
};
|
|
123
|
+
} else {
|
|
124
|
+
k = function e(t) {
|
|
125
|
+
return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
126
|
+
};
|
|
346
127
|
}
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
var eventKeyCode = Object(keyboard_["keycode"])(e.nativeEvent);
|
|
360
|
-
|
|
361
|
-
if (eventKeyCode === 'up' || eventKeyCode === 'down') {
|
|
362
|
-
var _this$props$onRequest2, _this$props2;
|
|
363
|
-
|
|
364
|
-
e.preventDefault();
|
|
365
|
-
(_this$props$onRequest2 = (_this$props2 = _this.props).onRequestOpen) === null || _this$props$onRequest2 === void 0 ? void 0 : _this$props$onRequest2.call(_this$props2, e, {
|
|
366
|
-
reason: 'toggleKeydown'
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
if (!_this.isControlled()) {
|
|
370
|
-
_this.setState({
|
|
371
|
-
open: true
|
|
372
|
-
});
|
|
128
|
+
return k(e);
|
|
129
|
+
}
|
|
130
|
+
function R(e, t) {
|
|
131
|
+
var o = Object.keys(e);
|
|
132
|
+
if (Object.getOwnPropertySymbols) {
|
|
133
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
134
|
+
if (t) n = n.filter((function(t) {
|
|
135
|
+
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
136
|
+
}));
|
|
137
|
+
o.push.apply(o, n);
|
|
373
138
|
}
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
// Ignore clicks on toggle.
|
|
391
|
-
if (el.id === toggleId) {
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
el = el.parentNode;
|
|
139
|
+
return o;
|
|
140
|
+
}
|
|
141
|
+
function w(e) {
|
|
142
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
143
|
+
var o = arguments[t] != null ? arguments[t] : {};
|
|
144
|
+
if (t % 2) {
|
|
145
|
+
R(Object(o), true).forEach((function(t) {
|
|
146
|
+
_(e, t, o[t]);
|
|
147
|
+
}));
|
|
148
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
149
|
+
Object.defineProperties(e, Object.getOwnPropertyDescriptors(o));
|
|
150
|
+
} else {
|
|
151
|
+
R(Object(o)).forEach((function(t) {
|
|
152
|
+
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(o, t));
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
396
155
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
if (
|
|
401
|
-
|
|
156
|
+
return e;
|
|
157
|
+
}
|
|
158
|
+
function P(e, t) {
|
|
159
|
+
if (!(e instanceof t)) {
|
|
160
|
+
throw new TypeError("Cannot call a class as a function");
|
|
402
161
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
162
|
+
}
|
|
163
|
+
function j(e, t) {
|
|
164
|
+
for (var o = 0; o < t.length; o++) {
|
|
165
|
+
var n = t[o];
|
|
166
|
+
n.enumerable = n.enumerable || false;
|
|
167
|
+
n.configurable = true;
|
|
168
|
+
if ("value" in n) n.writable = true;
|
|
169
|
+
Object.defineProperty(e, n.key, n);
|
|
408
170
|
}
|
|
409
|
-
|
|
410
|
-
onRequestClose === null || onRequestClose === void 0 ? void 0 : onRequestClose(info);
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
|
|
414
|
-
_defineProperty(_assertThisInitialized(_this), "handleContentClick", function (event) {
|
|
415
|
-
_this.handleRequestClose({
|
|
416
|
-
reason: 'contentClick',
|
|
417
|
-
event: event
|
|
418
|
-
});
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
_this.state = {
|
|
422
|
-
anchor: null,
|
|
423
|
-
open: false
|
|
424
|
-
};
|
|
425
|
-
_this.controlledExternally = has_default()(props, 'open');
|
|
426
|
-
_this.popoverId = Object(id_["createDOMID"])('popover');
|
|
427
|
-
_this.toggleId = Object(id_["createDOMID"])('toggle');
|
|
428
|
-
return _this;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
_createClass(Dropdown, [{
|
|
432
|
-
key: "componentDidUpdate",
|
|
433
|
-
value: function componentDidUpdate() {
|
|
434
|
-
if (false) {}
|
|
435
|
-
|
|
436
|
-
var otherProps = _objectSpread({}, omit_default()(this.props, keys_default()(Dropdown.propTypes), 'value', 'id'));
|
|
437
|
-
|
|
438
|
-
if (false) {}
|
|
439
171
|
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
172
|
+
function q(e, t, o) {
|
|
173
|
+
if (t) j(e.prototype, t);
|
|
174
|
+
if (o) j(e, o);
|
|
175
|
+
return e;
|
|
444
176
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
177
|
+
function S(e, t) {
|
|
178
|
+
if (typeof t !== "function" && t !== null) {
|
|
179
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
180
|
+
}
|
|
181
|
+
e.prototype = Object.create(t && t.prototype, {
|
|
182
|
+
constructor: {
|
|
183
|
+
value: e,
|
|
184
|
+
writable: true,
|
|
185
|
+
configurable: true
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
if (t) T(e, t);
|
|
189
|
+
}
|
|
190
|
+
function T(e, t) {
|
|
191
|
+
T = Object.setPrototypeOf || function e(t, o) {
|
|
192
|
+
t.__proto__ = o;
|
|
193
|
+
return t;
|
|
194
|
+
};
|
|
195
|
+
return T(e, t);
|
|
455
196
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
197
|
+
function D(e) {
|
|
198
|
+
var t = K();
|
|
199
|
+
return function o() {
|
|
200
|
+
var n = M(e), r;
|
|
201
|
+
if (t) {
|
|
202
|
+
var l = M(this).constructor;
|
|
203
|
+
r = Reflect.construct(n, arguments, l);
|
|
204
|
+
} else {
|
|
205
|
+
r = n.apply(this, arguments);
|
|
206
|
+
}
|
|
207
|
+
return I(this, r);
|
|
208
|
+
};
|
|
460
209
|
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
210
|
+
function I(e, t) {
|
|
211
|
+
if (t && (k(t) === "object" || typeof t === "function")) {
|
|
212
|
+
return t;
|
|
213
|
+
}
|
|
214
|
+
return E(e);
|
|
215
|
+
}
|
|
216
|
+
function E(e) {
|
|
217
|
+
if (e === void 0) {
|
|
218
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
219
|
+
}
|
|
220
|
+
return e;
|
|
221
|
+
}
|
|
222
|
+
function K() {
|
|
223
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
224
|
+
if (Reflect.construct.sham) return false;
|
|
225
|
+
if (typeof Proxy === "function") return true;
|
|
226
|
+
try {
|
|
227
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
|
|
228
|
+
return true;
|
|
229
|
+
} catch (e) {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
470
232
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
canCoverAnchor = _this$props4.canCoverAnchor,
|
|
477
|
-
children = _this$props4.children,
|
|
478
|
-
closeReasons = _this$props4.closeReasons,
|
|
479
|
-
defaultPlacement = _this$props4.defaultPlacement,
|
|
480
|
-
elementRef = _this$props4.elementRef,
|
|
481
|
-
repositionMode = _this$props4.repositionMode,
|
|
482
|
-
retainFocus = _this$props4.retainFocus,
|
|
483
|
-
takeFocus = _this$props4.takeFocus;
|
|
484
|
-
var anchor = this.state.anchor;
|
|
485
|
-
var handleRequestClose = this.handleRequestClose,
|
|
486
|
-
handleContentClick = this.handleContentClick;
|
|
487
|
-
var toggle = this.renderToggle();
|
|
488
|
-
return /*#__PURE__*/external_react_default.a.createElement(external_react_default.a.Fragment, null, toggle, /*#__PURE__*/external_react_default.a.createElement(Popover_default.a, {
|
|
489
|
-
align: align,
|
|
490
|
-
open: !!anchor && this.isOpen(),
|
|
491
|
-
autoCloseWhenOffScreen: includes_default()(closeReasons, 'offScreen'),
|
|
492
|
-
anchor: anchor,
|
|
493
|
-
canCoverAnchor: canCoverAnchor,
|
|
494
|
-
elementRef: elementRef,
|
|
495
|
-
retainFocus: retainFocus,
|
|
496
|
-
defaultPlacement: defaultPlacement,
|
|
497
|
-
onRequestClose: handleRequestClose,
|
|
498
|
-
repositionMode: repositionMode,
|
|
499
|
-
id: this.popoverId,
|
|
500
|
-
"aria-labelledby": this.props.inputId || this.props.toggle.props.id || this.toggleId,
|
|
501
|
-
takeFocus: takeFocus
|
|
502
|
-
}, isFunction_default()(children) ? // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
503
|
-
function () {
|
|
504
|
-
return /*#__PURE__*/external_react_default.a.createElement("div", {
|
|
505
|
-
onClick: handleContentClick
|
|
506
|
-
}, children.apply(void 0, arguments));
|
|
507
|
-
} :
|
|
508
|
-
/*#__PURE__*/
|
|
509
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
510
|
-
external_react_default.a.createElement("div", {
|
|
511
|
-
onClick: handleContentClick
|
|
512
|
-
}, children)));
|
|
233
|
+
function M(e) {
|
|
234
|
+
M = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
|
|
235
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
236
|
+
};
|
|
237
|
+
return M(e);
|
|
513
238
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
239
|
+
function _(e, t, o) {
|
|
240
|
+
if (t in e) {
|
|
241
|
+
Object.defineProperty(e, t, {
|
|
242
|
+
value: o,
|
|
243
|
+
enumerable: true,
|
|
244
|
+
configurable: true,
|
|
245
|
+
writable: true
|
|
246
|
+
});
|
|
247
|
+
} else {
|
|
248
|
+
e[t] = o;
|
|
249
|
+
}
|
|
250
|
+
return e;
|
|
251
|
+
}
|
|
252
|
+
/** @public */ var F = [ "clickAway", "contentClick", "escapeKey", "offScreen", "tabKey", "toggleClick" ];
|
|
253
|
+
var A = {
|
|
254
|
+
align: l().oneOf([ "center", "edge", "theme", "end" ]),
|
|
255
|
+
canCoverAnchor: l().bool,
|
|
256
|
+
children: l().oneOfType([ l().node, l().func ]),
|
|
257
|
+
closeReasons: l().arrayOf(l().oneOf(F)),
|
|
258
|
+
defaultPlacement: l().oneOf([ "above", "below", "left", "right", "vertical", "horizontal" ]),
|
|
259
|
+
elementRef: l().oneOfType([ l().func, l().object ]),
|
|
260
|
+
focusToggleReasons: l().arrayOf(l().oneOf(F)),
|
|
261
|
+
inputId: l().string,
|
|
262
|
+
onRequestClose: l().func,
|
|
263
|
+
onRequestOpen: l().func,
|
|
264
|
+
open: l().bool,
|
|
265
|
+
openWithArrowKeys: l().bool,
|
|
266
|
+
repositionMode: l().oneOf([ "none", "flip", "any" ]),
|
|
267
|
+
retainFocus: l().bool,
|
|
268
|
+
takeFocus: l().bool,
|
|
269
|
+
toggle: l().element.isRequired
|
|
270
|
+
};
|
|
271
|
+
var x = {
|
|
272
|
+
align: "theme",
|
|
273
|
+
canCoverAnchor: true,
|
|
274
|
+
closeReasons: F,
|
|
275
|
+
defaultPlacement: "below",
|
|
276
|
+
focusToggleReasons: [ "contentClick", "escapeKey", "tabKey", "toggleClick" ],
|
|
277
|
+
repositionMode: "flip",
|
|
278
|
+
retainFocus: false,
|
|
279
|
+
openWithArrowKeys: false,
|
|
280
|
+
takeFocus: true
|
|
281
|
+
};
|
|
282
|
+
var W = Symbol("Dropdown legacy ref mode marker");
|
|
283
|
+
var z = function(e) {
|
|
284
|
+
S(r, e);
|
|
285
|
+
var t = D(r);
|
|
286
|
+
// @docs-props-type DropdownPropsBase
|
|
287
|
+
/**
|
|
288
|
+
* Enumeration of the possible reasons for closing the Select.
|
|
289
|
+
* 'clickAway', 'escapeKey', and 'offScreen' are inherited from Popover, but repeated here for
|
|
290
|
+
* docs extraction.
|
|
291
|
+
*/ function r(e) {
|
|
292
|
+
var o;
|
|
293
|
+
P(this, r);
|
|
294
|
+
o = t.call(this, e);
|
|
295
|
+
_(E(o), "controlledExternally", void 0);
|
|
296
|
+
_(E(o), "popoverId", void 0);
|
|
297
|
+
_(E(o), "toggleRef", null);
|
|
298
|
+
_(E(o), "toggleId", void 0);
|
|
299
|
+
_(E(o), "handleToggleMount", (function(e) {
|
|
300
|
+
o.toggleRef = e;
|
|
301
|
+
o.setState({
|
|
302
|
+
anchor: e
|
|
303
|
+
});
|
|
304
|
+
if (o.props.toggle.type[W]) {
|
|
305
|
+
// TS: assume that legacy ref mode toggles support elementRef
|
|
306
|
+
C(o.props.toggle.props.elementRef, e);
|
|
307
|
+
} else {
|
|
308
|
+
// TS: ref does not exist on React.ReactElement - technically, this is undocumented API
|
|
309
|
+
C(o.props.toggle.ref, e);
|
|
310
|
+
}
|
|
311
|
+
}));
|
|
312
|
+
_(E(o), "handleToggleClick", (function(e) {
|
|
313
|
+
var t, n;
|
|
314
|
+
(t = (n = o.props.toggle.props).onClick) === null || t === void 0 ? void 0 : t.call(n, e);
|
|
315
|
+
if (o.isOpen()) {
|
|
316
|
+
o.handleRequestClose({
|
|
317
|
+
reason: "toggleClick",
|
|
318
|
+
event: e
|
|
319
|
+
});
|
|
320
|
+
} else {
|
|
321
|
+
var r, l;
|
|
322
|
+
(r = (l = o.props).onRequestOpen) === null || r === void 0 ? void 0 : r.call(l, e, {
|
|
323
|
+
reason: "toggleClick"
|
|
324
|
+
});
|
|
325
|
+
if (!o.isControlled()) {
|
|
326
|
+
o.setState({
|
|
327
|
+
open: true
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}));
|
|
332
|
+
_(E(o), "handleToggleKeyDownOpen", (function(e) {
|
|
333
|
+
var t, n;
|
|
334
|
+
(t = (n = o.props.toggle.props).onKeyDown) === null || t === void 0 ? void 0 : t.call(n, e);
|
|
335
|
+
if (!o.props.openWithArrowKeys) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
var r = (0, b.keycode)(e.nativeEvent);
|
|
339
|
+
if (r === "up" || r === "down") {
|
|
340
|
+
var l, i;
|
|
341
|
+
e.preventDefault();
|
|
342
|
+
(l = (i = o.props).onRequestOpen) === null || l === void 0 ? void 0 : l.call(i, e, {
|
|
343
|
+
reason: "toggleKeydown"
|
|
344
|
+
});
|
|
345
|
+
if (!o.isControlled()) {
|
|
346
|
+
o.setState({
|
|
347
|
+
open: true
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}));
|
|
352
|
+
_(E(o), "handleRequestClose", (function(e) {
|
|
353
|
+
var t = e.event, n = e.reason;
|
|
354
|
+
var r = o.props, l = r.closeReasons, i = r.focusToggleReasons, s = r.onRequestClose;
|
|
355
|
+
if (t && n === "clickAway") {
|
|
356
|
+
var a = t.target;
|
|
357
|
+
var u = o.props.inputId || o.props.toggle.props.id || o.toggleId;
|
|
358
|
+
while (a) {
|
|
359
|
+
// Ignore clicks on toggle.
|
|
360
|
+
if (a.id === u) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
a = a.parentNode;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (o.isOpen() && c()(l, n)) {
|
|
367
|
+
if (c()(i, n)) {
|
|
368
|
+
o.focus();
|
|
369
|
+
}
|
|
370
|
+
if (!o.isControlled()) {
|
|
371
|
+
o.setState({
|
|
372
|
+
open: false
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
s === null || s === void 0 ? void 0 : s(e);
|
|
376
|
+
}
|
|
377
|
+
}));
|
|
378
|
+
_(E(o), "handleContentClick", (function(e) {
|
|
379
|
+
o.handleRequestClose({
|
|
380
|
+
reason: "contentClick",
|
|
381
|
+
event: e
|
|
382
|
+
});
|
|
383
|
+
}));
|
|
384
|
+
o.state = {
|
|
385
|
+
anchor: null,
|
|
386
|
+
open: false
|
|
387
|
+
};
|
|
388
|
+
o.controlledExternally = s()(e, "open");
|
|
389
|
+
o.popoverId = (0, h.createDOMID)("popover");
|
|
390
|
+
o.toggleId = (0, h.createDOMID)("toggle");
|
|
391
|
+
return o;
|
|
392
|
+
}
|
|
393
|
+
q(r, [ {
|
|
394
|
+
key: "componentDidUpdate",
|
|
395
|
+
value: function e() {
|
|
396
|
+
if (false) {}
|
|
397
|
+
var t = w({}, v()(this.props, g()(r.propTypes), "value", "id"));
|
|
398
|
+
if (false) {}
|
|
399
|
+
}
|
|
400
|
+
}, {
|
|
401
|
+
key: "isOpen",
|
|
402
|
+
value: function e() {
|
|
403
|
+
return this.isControlled() ? this.props.open : this.state.open;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Places focus on the toggle.
|
|
407
|
+
*/ }, {
|
|
408
|
+
key: "focus",
|
|
409
|
+
value: function e() {
|
|
410
|
+
var t;
|
|
411
|
+
(t = this.toggleRef) === null || t === void 0 ? void 0 : t.focus();
|
|
412
|
+
}
|
|
413
|
+
}, {
|
|
414
|
+
key: "isControlled",
|
|
415
|
+
value: function e() {
|
|
416
|
+
return this.controlledExternally;
|
|
417
|
+
}
|
|
418
|
+
}, {
|
|
419
|
+
key: "renderToggle",
|
|
420
|
+
value: function e() {
|
|
421
|
+
var t;
|
|
422
|
+
|
|
423
|
+
return (0, o.cloneElement)(this.props.toggle, (t = {
|
|
424
|
+
onClick: this.handleToggleClick,
|
|
425
|
+
onKeyDown: this.handleToggleKeyDownOpen
|
|
426
|
+
}, _(t, this.props.toggle.type[W] ? "elementRef" : "ref", this.handleToggleMount),
|
|
427
|
+
_(t, "aria-controls", this.isOpen() ? this.popoverId : undefined), _(t, "aria-haspopup", this.props.toggle.props["aria-haspopup"] || true),
|
|
428
|
+
_(t, "aria-expanded", this.isOpen()), _(t, "data-test", this.props.toggle.props["data-test"] || "dropdown"),
|
|
429
|
+
_(t, "data-test-popover-id", this.popoverId), _(t, "id", this.props.inputId || this.props.toggle.props.id || this.toggleId),
|
|
430
|
+
t));
|
|
431
|
+
}
|
|
432
|
+
}, {
|
|
433
|
+
key: "render",
|
|
434
|
+
value: function e() {
|
|
435
|
+
var t = this.props, o = t.align, r = t.canCoverAnchor, l = t.children, i = t.closeReasons, s = t.defaultPlacement, a = t.elementRef, u = t.repositionMode, p = t.retainFocus, d = t.takeFocus;
|
|
436
|
+
var g = this.state.anchor;
|
|
437
|
+
var y = this.handleRequestClose, v = this.handleContentClick;
|
|
438
|
+
var h = this.renderToggle();
|
|
439
|
+
|
|
440
|
+
return n().createElement(n().Fragment, null, h, n().createElement(m(), {
|
|
441
|
+
align: o,
|
|
442
|
+
open: !!g && this.isOpen(),
|
|
443
|
+
autoCloseWhenOffScreen: c()(i, "offScreen"),
|
|
444
|
+
anchor: g,
|
|
445
|
+
canCoverAnchor: r,
|
|
446
|
+
elementRef: a,
|
|
447
|
+
retainFocus: p,
|
|
448
|
+
defaultPlacement: s,
|
|
449
|
+
onRequestClose: y,
|
|
450
|
+
repositionMode: u,
|
|
451
|
+
id: this.popoverId,
|
|
452
|
+
"aria-labelledby": this.props.inputId || this.props.toggle.props.id || this.toggleId,
|
|
453
|
+
takeFocus: d
|
|
454
|
+
}, f()(l) ? // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
455
|
+
function() {
|
|
456
|
+
|
|
457
|
+
return n().createElement("div", {
|
|
458
|
+
onClick: v
|
|
459
|
+
}, l.apply(void 0, arguments));
|
|
460
|
+
} :
|
|
461
|
+
|
|
462
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
463
|
+
n().createElement("div", {
|
|
464
|
+
onClick: v
|
|
465
|
+
}, l)));
|
|
466
|
+
}
|
|
467
|
+
} ]);
|
|
468
|
+
return r;
|
|
469
|
+
}(o.Component);
|
|
470
|
+
_(z, "possibleCloseReasons", F);
|
|
471
|
+
_(z, "propTypes", A);
|
|
472
|
+
_(z, "defaultProps", x);
|
|
473
|
+
/* harmony default export */ const N = z;
|
|
474
|
+
// CONCATENATED MODULE: ./src/Dropdown/index.ts
|
|
475
|
+
module.exports = t;
|
|
476
|
+
/******/})();
|