@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/Dropdown.js
CHANGED
|
@@ -1,433 +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
|
-
const
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
+
/**
|
|
90
99
|
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
91
100
|
*
|
|
92
101
|
* @param ref - The React callback or object ref. Can be `null` or `undefined`.
|
|
93
102
|
* @param current - The new value of the ref.
|
|
94
103
|
*/
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
+
}
|
|
103
115
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
116
|
-
|
|
117
|
-
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); } }
|
|
118
|
-
|
|
119
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
120
|
-
|
|
121
|
-
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); }
|
|
122
|
-
|
|
123
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
124
|
-
|
|
125
|
-
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); }; }
|
|
126
|
-
|
|
127
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
128
|
-
|
|
129
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
130
|
-
|
|
131
|
-
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; } }
|
|
132
|
-
|
|
133
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
134
|
-
|
|
135
|
-
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; }
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
/** @public */
|
|
150
|
-
|
|
151
|
-
var possibleCloseReasons = ['clickAway', 'contentClick', 'escapeKey', 'offScreen', 'tabKey', 'toggleClick'];
|
|
152
|
-
var propTypes = {
|
|
153
|
-
align: external_prop_types_default().oneOf(['center', 'edge', 'theme', 'end']),
|
|
154
|
-
canCoverAnchor: (external_prop_types_default()).bool,
|
|
155
|
-
children: external_prop_types_default().oneOfType([(external_prop_types_default()).node, (external_prop_types_default()).func]),
|
|
156
|
-
closeReasons: external_prop_types_default().arrayOf(external_prop_types_default().oneOf(possibleCloseReasons)),
|
|
157
|
-
defaultPlacement: external_prop_types_default().oneOf(['above', 'below', 'left', 'right', 'vertical', 'horizontal']),
|
|
158
|
-
elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
|
|
159
|
-
focusToggleReasons: external_prop_types_default().arrayOf(external_prop_types_default().oneOf(possibleCloseReasons)),
|
|
160
|
-
inputId: (external_prop_types_default()).string,
|
|
161
|
-
onRequestClose: (external_prop_types_default()).func,
|
|
162
|
-
onRequestOpen: (external_prop_types_default()).func,
|
|
163
|
-
open: (external_prop_types_default()).bool,
|
|
164
|
-
openWithArrowKeys: (external_prop_types_default()).bool,
|
|
165
|
-
repositionMode: external_prop_types_default().oneOf(['none', 'flip', 'any']),
|
|
166
|
-
retainFocus: (external_prop_types_default()).bool,
|
|
167
|
-
takeFocus: (external_prop_types_default()).bool,
|
|
168
|
-
toggle: (external_prop_types_default()).element.isRequired
|
|
169
|
-
};
|
|
170
|
-
var defaultProps = {
|
|
171
|
-
align: 'theme',
|
|
172
|
-
canCoverAnchor: true,
|
|
173
|
-
closeReasons: possibleCloseReasons,
|
|
174
|
-
defaultPlacement: 'below',
|
|
175
|
-
focusToggleReasons: ['contentClick', 'escapeKey', 'tabKey', 'toggleClick'],
|
|
176
|
-
repositionMode: 'flip',
|
|
177
|
-
retainFocus: false,
|
|
178
|
-
openWithArrowKeys: false,
|
|
179
|
-
takeFocus: true
|
|
180
|
-
};
|
|
181
|
-
var legacyRefMode = Symbol('Dropdown legacy ref mode marker');
|
|
182
|
-
|
|
183
|
-
var Dropdown = /*#__PURE__*/function (_Component) {
|
|
184
|
-
_inherits(Dropdown, _Component);
|
|
185
|
-
|
|
186
|
-
var _super = _createSuper(Dropdown);
|
|
187
|
-
|
|
188
|
-
// @docs-props-type DropdownPropsBase
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Enumeration of the possible reasons for closing the Select.
|
|
192
|
-
* 'clickAway', 'escapeKey', and 'offScreen' are inherited from Popover, but repeated here for
|
|
193
|
-
* docs extraction.
|
|
194
|
-
*/
|
|
195
|
-
function Dropdown(props) {
|
|
196
|
-
var _this;
|
|
197
|
-
|
|
198
|
-
_classCallCheck(this, Dropdown);
|
|
199
|
-
|
|
200
|
-
_this = _super.call(this, props);
|
|
201
|
-
|
|
202
|
-
_defineProperty(_assertThisInitialized(_this), "controlledExternally", void 0);
|
|
203
|
-
|
|
204
|
-
_defineProperty(_assertThisInitialized(_this), "popoverId", void 0);
|
|
205
|
-
|
|
206
|
-
_defineProperty(_assertThisInitialized(_this), "toggleRef", null);
|
|
207
|
-
|
|
208
|
-
_defineProperty(_assertThisInitialized(_this), "toggleId", void 0);
|
|
209
|
-
|
|
210
|
-
_defineProperty(_assertThisInitialized(_this), "handleToggleMount", function (el) {
|
|
211
|
-
_this.toggleRef = el;
|
|
212
|
-
|
|
213
|
-
_this.setState({
|
|
214
|
-
anchor: el
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
if (_this.props.toggle.type[legacyRefMode]) {
|
|
218
|
-
// TS: assume that legacy ref mode toggles support elementRef
|
|
219
|
-
updateReactRef(_this.props.toggle.props.elementRef, el);
|
|
220
|
-
} else {
|
|
221
|
-
// TS: ref does not exist on React.ReactElement - technically, this is undocumented API
|
|
222
|
-
updateReactRef(_this.props.toggle.ref, el);
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
_defineProperty(_assertThisInitialized(_this), "handleToggleClick", function (event) {
|
|
227
|
-
var _this$props$toggle$pr, _this$props$toggle$pr2;
|
|
228
|
-
|
|
229
|
-
(_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);
|
|
230
|
-
|
|
231
|
-
if (_this.isOpen()) {
|
|
232
|
-
_this.handleRequestClose({
|
|
233
|
-
reason: 'toggleClick',
|
|
234
|
-
event: event
|
|
235
|
-
});
|
|
236
|
-
} else {
|
|
237
|
-
var _this$props$onRequest, _this$props;
|
|
238
|
-
|
|
239
|
-
(_this$props$onRequest = (_this$props = _this.props).onRequestOpen) === null || _this$props$onRequest === void 0 ? void 0 : _this$props$onRequest.call(_this$props, event, {
|
|
240
|
-
reason: 'toggleClick'
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
if (!_this.isControlled()) {
|
|
244
|
-
_this.setState({
|
|
245
|
-
open: true
|
|
246
|
-
});
|
|
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
|
+
};
|
|
247
127
|
}
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
var eventKeyCode = (0,keyboard_namespaceObject.keycode)(e.nativeEvent);
|
|
261
|
-
|
|
262
|
-
if (eventKeyCode === 'up' || eventKeyCode === 'down') {
|
|
263
|
-
var _this$props$onRequest2, _this$props2;
|
|
264
|
-
|
|
265
|
-
e.preventDefault();
|
|
266
|
-
(_this$props$onRequest2 = (_this$props2 = _this.props).onRequestOpen) === null || _this$props$onRequest2 === void 0 ? void 0 : _this$props$onRequest2.call(_this$props2, e, {
|
|
267
|
-
reason: 'toggleKeydown'
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
if (!_this.isControlled()) {
|
|
271
|
-
_this.setState({
|
|
272
|
-
open: true
|
|
273
|
-
});
|
|
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);
|
|
274
138
|
}
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
// Ignore clicks on toggle.
|
|
292
|
-
if (el.id === toggleId) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
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
|
+
}
|
|
297
155
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (
|
|
302
|
-
|
|
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");
|
|
303
161
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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);
|
|
309
170
|
}
|
|
310
|
-
|
|
311
|
-
onRequestClose === null || onRequestClose === void 0 ? void 0 : onRequestClose(info);
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
_defineProperty(_assertThisInitialized(_this), "handleContentClick", function (event) {
|
|
316
|
-
_this.handleRequestClose({
|
|
317
|
-
reason: 'contentClick',
|
|
318
|
-
event: event
|
|
319
|
-
});
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
_this.state = {
|
|
323
|
-
anchor: null,
|
|
324
|
-
open: false
|
|
325
|
-
};
|
|
326
|
-
_this.controlledExternally = has_default()(props, 'open');
|
|
327
|
-
_this.popoverId = (0,id_namespaceObject.createDOMID)('popover');
|
|
328
|
-
_this.toggleId = (0,id_namespaceObject.createDOMID)('toggle');
|
|
329
|
-
return _this;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
_createClass(Dropdown, [{
|
|
333
|
-
key: "componentDidUpdate",
|
|
334
|
-
value: function componentDidUpdate() {
|
|
335
|
-
if (false) {}
|
|
336
|
-
|
|
337
|
-
var otherProps = _objectSpread({}, omit_default()(this.props, keys_default()(Dropdown.propTypes), 'value', 'id'));
|
|
338
|
-
|
|
339
|
-
if (false) {}
|
|
340
171
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
172
|
+
function q(e, t, o) {
|
|
173
|
+
if (t) j(e.prototype, t);
|
|
174
|
+
if (o) j(e, o);
|
|
175
|
+
return e;
|
|
345
176
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
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);
|
|
356
196
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
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
|
+
};
|
|
361
209
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
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
|
+
}
|
|
371
232
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
canCoverAnchor = _this$props4.canCoverAnchor,
|
|
378
|
-
children = _this$props4.children,
|
|
379
|
-
closeReasons = _this$props4.closeReasons,
|
|
380
|
-
defaultPlacement = _this$props4.defaultPlacement,
|
|
381
|
-
elementRef = _this$props4.elementRef,
|
|
382
|
-
repositionMode = _this$props4.repositionMode,
|
|
383
|
-
retainFocus = _this$props4.retainFocus,
|
|
384
|
-
takeFocus = _this$props4.takeFocus;
|
|
385
|
-
var anchor = this.state.anchor;
|
|
386
|
-
var handleRequestClose = this.handleRequestClose,
|
|
387
|
-
handleContentClick = this.handleContentClick;
|
|
388
|
-
var toggle = this.renderToggle();
|
|
389
|
-
return /*#__PURE__*/external_react_default().createElement((external_react_default()).Fragment, null, toggle, /*#__PURE__*/external_react_default().createElement((Popover_default()), {
|
|
390
|
-
align: align,
|
|
391
|
-
open: !!anchor && this.isOpen(),
|
|
392
|
-
autoCloseWhenOffScreen: includes_default()(closeReasons, 'offScreen'),
|
|
393
|
-
anchor: anchor,
|
|
394
|
-
canCoverAnchor: canCoverAnchor,
|
|
395
|
-
elementRef: elementRef,
|
|
396
|
-
retainFocus: retainFocus,
|
|
397
|
-
defaultPlacement: defaultPlacement,
|
|
398
|
-
onRequestClose: handleRequestClose,
|
|
399
|
-
repositionMode: repositionMode,
|
|
400
|
-
id: this.popoverId,
|
|
401
|
-
"aria-labelledby": this.props.inputId || this.props.toggle.props.id || this.toggleId,
|
|
402
|
-
takeFocus: takeFocus
|
|
403
|
-
}, isFunction_default()(children) ? // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
404
|
-
function () {
|
|
405
|
-
return /*#__PURE__*/external_react_default().createElement("div", {
|
|
406
|
-
onClick: handleContentClick
|
|
407
|
-
}, children.apply(void 0, arguments));
|
|
408
|
-
} :
|
|
409
|
-
/*#__PURE__*/
|
|
410
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
411
|
-
external_react_default().createElement("div", {
|
|
412
|
-
onClick: handleContentClick
|
|
413
|
-
}, 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);
|
|
414
238
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
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
|
+
/******/})();
|