@splunk/react-ui 4.21.0 → 4.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/Accordion.js +425 -325
  2. package/Anchor.js +147 -117
  3. package/Animation.js +142 -94
  4. package/AnimationToggle.js +197 -193
  5. package/Box.js +145 -118
  6. package/Breadcrumbs.js +288 -206
  7. package/Button.js +488 -465
  8. package/ButtonGroup.js +160 -128
  9. package/ButtonSimple.js +543 -462
  10. package/CHANGELOG.md +7 -2
  11. package/Calendar.js +1111 -1001
  12. package/Card.js +771 -598
  13. package/CardLayout.js +205 -147
  14. package/Chip.js +509 -488
  15. package/Clickable.js +414 -352
  16. package/CloseButton.js +165 -142
  17. package/Code.js +1808 -2084
  18. package/Code.js.LICENSE.txt +8 -0
  19. package/CollapsiblePanel.js +586 -519
  20. package/Color.js +1066 -1069
  21. package/ColumnLayout.js +402 -363
  22. package/ComboBox.js +891 -794
  23. package/Concertina.js +997 -802
  24. package/ControlGroup.js +687 -594
  25. package/Date.js +567 -547
  26. package/DefinitionList.js +308 -234
  27. package/Divider.js +149 -118
  28. package/Dropdown.js +459 -416
  29. package/DualListbox.js +1479 -1541
  30. package/EventListener.js +94 -97
  31. package/File.js +1051 -969
  32. package/FormRows.js +883 -696
  33. package/Heading.js +216 -193
  34. package/Image.js +446 -402
  35. package/JSONTree.js +690 -551
  36. package/Layer.js +437 -410
  37. package/Link.js +336 -255
  38. package/List.js +213 -161
  39. package/Markdown.js +509 -487
  40. package/Menu.js +1105 -1056
  41. package/Message.js +475 -441
  42. package/MessageBar.js +387 -373
  43. package/Modal.js +810 -634
  44. package/ModalLayer.js +326 -243
  45. package/Monogram.js +308 -276
  46. package/Multiselect.js +3550 -3364
  47. package/Number.js +729 -687
  48. package/Paginator.js +510 -449
  49. package/Paragraph.js +145 -112
  50. package/Popover.js +1459 -1432
  51. package/Progress.js +301 -246
  52. package/RadioBar.js +610 -527
  53. package/RadioList.js +483 -444
  54. package/Resize.js +530 -489
  55. package/ResultsMenu.js +494 -455
  56. package/ScreenReaderContent.js +142 -111
  57. package/Scroll.js +595 -456
  58. package/ScrollContainerContext.js +197 -206
  59. package/Search.js +744 -650
  60. package/Select.js +2442 -2345
  61. package/SidePanel.js +390 -284
  62. package/Slider.js +669 -676
  63. package/SlidingPanels.js +639 -503
  64. package/SplitButton.js +464 -367
  65. package/StaticContent.js +161 -133
  66. package/StepBar.js +386 -358
  67. package/Switch.js +710 -640
  68. package/TabBar.js +726 -680
  69. package/TabLayout.js +406 -322
  70. package/Table.js +4842 -4616
  71. package/Text.js +1170 -1138
  72. package/TextArea.js +1102 -1090
  73. package/Tooltip.js +624 -581
  74. package/TransitionOpen.js +489 -422
  75. package/Typography.js +176 -153
  76. package/WaitSpinner.js +230 -206
  77. package/package.json +5 -5
  78. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  79. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  80. package/useForceUpdate.js +112 -82
  81. package/useKeyPress.js +74 -71
  82. package/usePrevious.js +65 -65
  83. package/useRovingFocus.js +122 -138
package/ResultsMenu.js CHANGED
@@ -1,469 +1,508 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ // The require scope
4
- /******/ var __webpack_require__ = {};
5
- /******/
6
- /************************************************************************/
7
- /******/ /* webpack/runtime/compat get default export */
8
- /******/ (() => {
9
- /******/ // getDefaultExport function for compatibility with non-harmony modules
10
- /******/ __webpack_require__.n = (module) => {
11
- /******/ var getter = module && module.__esModule ?
12
- /******/ () => (module['default']) :
13
- /******/ () => (module);
14
- /******/ __webpack_require__.d(getter, { a: getter });
15
- /******/ return getter;
16
- /******/ };
17
- /******/ })();
18
- /******/
19
- /******/ /* webpack/runtime/define property getters */
20
- /******/ (() => {
21
- /******/ // define getter functions for harmony exports
22
- /******/ __webpack_require__.d = (exports, definition) => {
23
- /******/ for(var key in definition) {
24
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26
- /******/ }
27
- /******/ }
28
- /******/ };
29
- /******/ })();
30
- /******/
31
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
32
- /******/ (() => {
33
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
34
- /******/ })();
35
- /******/
36
- /******/ /* webpack/runtime/make namespace object */
37
- /******/ (() => {
38
- /******/ // define __esModule on exports
39
- /******/ __webpack_require__.r = (exports) => {
40
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
41
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
42
- /******/ }
43
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
44
- /******/ };
45
- /******/ })();
46
- /******/
47
- /************************************************************************/
48
- var __webpack_exports__ = {};
49
- // ESM COMPAT FLAG
50
- __webpack_require__.r(__webpack_exports__);
51
-
52
- // EXPORTS
53
- __webpack_require__.d(__webpack_exports__, {
54
- "default": () => (/* reexport */ ResultsMenu_ResultsMenu)
55
- });
56
-
57
- ;// CONCATENATED MODULE: external "react"
58
- const external_react_namespaceObject = require("react");
59
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
60
- ;// CONCATENATED MODULE: external "prop-types"
61
- const external_prop_types_namespaceObject = require("prop-types");
62
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
63
- ;// CONCATENATED MODULE: external "lodash/keys"
64
- const keys_namespaceObject = require("lodash/keys");
65
- var keys_default = /*#__PURE__*/__webpack_require__.n(keys_namespaceObject);
66
- ;// CONCATENATED MODULE: external "lodash/memoize"
67
- const memoize_namespaceObject = require("lodash/memoize");
68
- var memoize_default = /*#__PURE__*/__webpack_require__.n(memoize_namespaceObject);
69
- ;// CONCATENATED MODULE: external "lodash/omit"
70
- const omit_namespaceObject = require("lodash/omit");
71
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_namespaceObject);
72
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
73
- const i18n_namespaceObject = require("@splunk/ui-utils/i18n");
74
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/userAgent"
75
- const userAgent_namespaceObject = require("@splunk/ui-utils/userAgent");
76
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Menu"
77
- const Menu_namespaceObject = require("@splunk/react-ui/Menu");
78
- var Menu_default = /*#__PURE__*/__webpack_require__.n(Menu_namespaceObject);
79
- ;// CONCATENATED MODULE: external "styled-components"
80
- const external_styled_components_namespaceObject = require("styled-components");
81
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
82
- ;// CONCATENATED MODULE: external "@splunk/react-ui/WaitSpinner"
83
- const WaitSpinner_namespaceObject = require("@splunk/react-ui/WaitSpinner");
84
- var WaitSpinner_default = /*#__PURE__*/__webpack_require__.n(WaitSpinner_namespaceObject);
85
- ;// CONCATENATED MODULE: external "@splunk/themes"
86
- const themes_namespaceObject = require("@splunk/themes");
87
- ;// CONCATENATED MODULE: ./src/ResultsMenu/ResultsMenuStyles.ts
88
-
89
-
90
-
91
- var Styled = external_styled_components_default().div.withConfig({
92
- displayName: "ResultsMenuStyles__Styled",
93
- componentId: "avbhl8-0"
94
- })(["", ";flex-direction:column;max-height:calc(100vh - 20px);", ""], themes_namespaceObject.mixins.reset('flex'), (0,themes_namespaceObject.pick)({
95
- prisma: (0,external_styled_components_namespaceObject.css)(["border-radius:", ";background-color:", ";"], themes_namespaceObject.variables.borderRadius, themes_namespaceObject.variables.backgroundColorPopup)
96
- }));
97
- var StyledFooter = external_styled_components_default().div.withConfig({
98
- displayName: "ResultsMenuStyles__StyledFooter",
99
- componentId: "avbhl8-1"
100
- })(["padding:", ";color:", ";", ""], (0,themes_namespaceObject.pick)({
101
- prisma: {
102
- comfortable: '10px 16px',
103
- compact: '6px 16px'
104
- },
105
- enterprise: '6px 10px'
106
- }), (0,themes_namespaceObject.pick)({
107
- prisma: themes_namespaceObject.variables.contentColorMuted,
108
- enterprise: themes_namespaceObject.variables.textGray
109
- }), function (_ref) {
110
- var $placement = _ref.$placement;
111
- return $placement === 'above' ? (0,themes_namespaceObject.pick)({
112
- prisma: (0,external_styled_components_namespaceObject.css)(["border-bottom:1px solid ", ";"], themes_namespaceObject.variables.neutral200),
113
- enterprise: (0,external_styled_components_namespaceObject.css)(["border-bottom:", ";"], themes_namespaceObject.variables.border)
114
- }) : (0,themes_namespaceObject.pick)({
115
- prisma: (0,external_styled_components_namespaceObject.css)(["border-top:1px solid ", ";"], themes_namespaceObject.variables.neutral200),
116
- enterprise: (0,external_styled_components_namespaceObject.css)(["border-top:", ";"], themes_namespaceObject.variables.border)
117
- });
118
- });
119
- var StyledLoading = external_styled_components_default().li.withConfig({
120
- displayName: "ResultsMenuStyles__StyledLoading",
121
- componentId: "avbhl8-2"
122
- })(["", ";padding:", ";gap:", ";"], themes_namespaceObject.mixins.reset('flex'), (0,themes_namespaceObject.pick)({
123
- prisma: {
124
- comfortable: '10px 16px',
125
- compact: '6px 16px'
126
- },
127
- enterprise: '6px 10px'
128
- }), themes_namespaceObject.variables.spacingXSmall);
129
- var StyledWait = external_styled_components_default()((WaitSpinner_default())).withConfig({
130
- displayName: "ResultsMenuStyles__StyledWait",
131
- componentId: "avbhl8-3"
132
- })(["flex:0 0 auto;"]);
133
- var StyledLoadingMessage = external_styled_components_default().div.withConfig({
134
- displayName: "ResultsMenuStyles__StyledLoadingMessage",
135
- componentId: "avbhl8-4"
136
- })(["flex:1 0 0;color:", ";"], (0,themes_namespaceObject.pick)({
137
- prisma: themes_namespaceObject.variables.contentColorMuted,
138
- enterprise: themes_namespaceObject.variables.textGray
139
- }));
140
-
141
- ;// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
142
- /**
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 */ U
65
+ });
66
+ // CONCATENATED MODULE: external "react"
67
+ const o = require("react");
68
+ var n = e.n(o);
69
+ // CONCATENATED MODULE: external "prop-types"
70
+ const r = require("prop-types");
71
+ var l = e.n(r);
72
+ // CONCATENATED MODULE: external "lodash/keys"
73
+ const i = require("lodash/keys");
74
+ var a = e.n(i);
75
+ // CONCATENATED MODULE: external "lodash/memoize"
76
+ const s = require("lodash/memoize");
77
+ var u = e.n(s);
78
+ // CONCATENATED MODULE: external "lodash/omit"
79
+ const c = require("lodash/omit");
80
+ var p = e.n(c);
81
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
82
+ const f = require("@splunk/ui-utils/i18n");
83
+ // CONCATENATED MODULE: external "@splunk/ui-utils/userAgent"
84
+ const d = require("@splunk/ui-utils/userAgent");
85
+ // CONCATENATED MODULE: external "@splunk/react-ui/Menu"
86
+ const m = require("@splunk/react-ui/Menu");
87
+ var h = e.n(m);
88
+ // CONCATENATED MODULE: external "styled-components"
89
+ const v = require("styled-components");
90
+ var g = e.n(v);
91
+ // CONCATENATED MODULE: external "@splunk/react-ui/WaitSpinner"
92
+ const b = require("@splunk/react-ui/WaitSpinner");
93
+ var y = e.n(b);
94
+ // CONCATENATED MODULE: external "@splunk/themes"
95
+ const M = require("@splunk/themes");
96
+ // CONCATENATED MODULE: ./src/ResultsMenu/ResultsMenuStyles.ts
97
+ var S = g().div.withConfig({
98
+ displayName: "ResultsMenuStyles__Styled",
99
+ componentId: "avbhl8-0"
100
+ })([ "", ";flex-direction:column;max-height:calc(100vh - 20px);", "" ], M.mixins.reset("flex"), (0,
101
+ M.pick)({
102
+ prisma: (0, v.css)([ "border-radius:", ";background-color:", ";" ], M.variables.borderRadius, M.variables.backgroundColorPopup)
103
+ }));
104
+ var x = g().div.withConfig({
105
+ displayName: "ResultsMenuStyles__StyledFooter",
106
+ componentId: "avbhl8-1"
107
+ })([ "padding:", ";color:", ";", "" ], (0, M.pick)({
108
+ prisma: {
109
+ comfortable: "10px 16px",
110
+ compact: "6px 16px"
111
+ },
112
+ enterprise: "6px 10px"
113
+ }), (0, M.pick)({
114
+ prisma: M.variables.contentColorMuted,
115
+ enterprise: M.variables.textGray
116
+ }), (function(e) {
117
+ var t = e.$placement;
118
+ return t === "above" ? (0, M.pick)({
119
+ prisma: (0, v.css)([ "border-bottom:1px solid ", ";" ], M.variables.neutral200),
120
+ enterprise: (0, v.css)([ "border-bottom:", ";" ], M.variables.border)
121
+ }) : (0, M.pick)({
122
+ prisma: (0, v.css)([ "border-top:1px solid ", ";" ], M.variables.neutral200),
123
+ enterprise: (0, v.css)([ "border-top:", ";" ], M.variables.border)
124
+ });
125
+ }));
126
+ var E = g().li.withConfig({
127
+ displayName: "ResultsMenuStyles__StyledLoading",
128
+ componentId: "avbhl8-2"
129
+ })([ "", ";padding:", ";gap:", ";" ], M.mixins.reset("flex"), (0, M.pick)({
130
+ prisma: {
131
+ comfortable: "10px 16px",
132
+ compact: "6px 16px"
133
+ },
134
+ enterprise: "6px 10px"
135
+ }), M.variables.spacingXSmall);
136
+ var O = g()(y()).withConfig({
137
+ displayName: "ResultsMenuStyles__StyledWait",
138
+ componentId: "avbhl8-3"
139
+ })([ "flex:0 0 auto;" ]);
140
+ var k = g().div.withConfig({
141
+ displayName: "ResultsMenuStyles__StyledLoadingMessage",
142
+ componentId: "avbhl8-4"
143
+ })([ "flex:1 0 0;color:", ";" ], (0, M.pick)({
144
+ prisma: M.variables.contentColorMuted,
145
+ enterprise: M.variables.textGray
146
+ }));
147
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
148
+ /**
143
149
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
144
150
  *
145
151
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
146
152
  * @param current - The new value of the ref.
147
153
  */
148
- function updateReactRef(ref, current) {
149
- if (ref) {
150
- if (typeof ref === 'function') {
151
- ref(current);
152
- } else {
153
- // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
154
- // the intention here is to signal "we will take care of setting 'current', not you".
155
- ref.current = current; // eslint-disable-line no-param-reassign
154
+ function w(e, t) {
155
+ if (e) {
156
+ if (typeof e === "function") {
157
+ e(t);
158
+ } else {
159
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
160
+ // the intention here is to signal "we will take care of setting 'current', not you".
161
+ e.current = t;
162
+ // eslint-disable-line no-param-reassign
163
+ }
164
+ }
156
165
  }
157
- }
158
- }
159
-
160
-
161
- ;// CONCATENATED MODULE: ./src/ResultsMenu/ResultsMenu.tsx
162
- 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); }
163
-
164
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
165
-
166
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
167
-
168
- 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); } }
169
-
170
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
171
-
172
- 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); }
173
-
174
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
175
-
176
- 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); }; }
177
-
178
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
179
-
180
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
181
-
182
- 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; } }
183
-
184
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
185
-
186
- 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; }
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
- var propTypes = {
199
- animateLoading: (external_prop_types_default()).bool,
200
- children: (external_prop_types_default()).node,
201
-
202
- /** @private */
203
- controlledExternally: (external_prop_types_default()).bool,
204
- childrenStart: (external_prop_types_default()).node,
205
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
206
- footerMessage: (external_prop_types_default()).node,
207
- isLoading: (external_prop_types_default()).bool,
208
- loadingMessage: (external_prop_types_default()).node,
209
- maxHeight: (external_prop_types_default()).number,
210
- noOptionsMessage: (external_prop_types_default()).node,
211
- onScroll: (external_prop_types_default()).func,
212
- onScrollBottom: (external_prop_types_default()).func,
213
- placement: (external_prop_types_default()).string
214
- };
215
- var defaultProps = {
216
- animateLoading: false,
217
- isLoading: false,
218
- loadingMessage: (0,i18n_namespaceObject._)('Loading...'),
219
- noOptionsMessage: (0,i18n_namespaceObject._)('No matches')
220
- };
221
- var menuContextRole = {
222
- role: 'listbox'
223
- };
224
- var getMenuInlineStyle = memoize_default()(function (menuMaxHeight) {
225
- return {
226
- overflow: 'auto',
227
- maxHeight: menuMaxHeight || 'calc(100vh - 20px)',
228
- flexDirection: 'column'
229
- };
230
- });
231
- var getMenuBottomInlineStyle = memoize_default()(function (height) {
232
- return {
233
- height: height
234
- };
235
- });
236
-
237
- // @docs-props-type ResultsMenuPropsBase
238
- var ResultsMenu = /*#__PURE__*/function (_Component) {
239
- _inherits(ResultsMenu, _Component);
240
-
241
- var _super = _createSuper(ResultsMenu);
242
-
243
- function ResultsMenu(props) {
244
- var _this;
245
-
246
- _classCallCheck(this, ResultsMenu);
247
-
248
- _this = _super.call(this, props);
249
-
250
- _defineProperty(_assertThisInitialized(_this), "scrollBottomOffset", void 0);
251
-
252
- _defineProperty(_assertThisInitialized(_this), "itemMinHeight", void 0);
253
-
254
- _defineProperty(_assertThisInitialized(_this), "handleMenuMount", function (menuEl) {
255
- _this.setState({
256
- menuEl: menuEl
257
- });
258
- });
259
-
260
- _defineProperty(_assertThisInitialized(_this), "handleMount", function (el) {
261
- _this.setState({
262
- containerEl: el
263
- });
264
-
265
- updateReactRef(_this.props.elementRef, el);
266
- });
267
-
268
- _defineProperty(_assertThisInitialized(_this), "handleMouseEnter", function () {
269
- _this.setState({
270
- windowTop: document.documentElement.scrollTop
271
- });
272
- });
273
-
274
- _defineProperty(_assertThisInitialized(_this), "handleMouseLeave", function () {
275
- _this.setState({
276
- windowTop: document.documentElement.scrollTop
277
- });
278
- });
279
-
280
- _defineProperty(_assertThisInitialized(_this), "handleScroll", function (e) {
281
- var _this$props$onScroll, _this$props;
282
-
283
- if (_this.props.onScrollBottom != null) {
284
- if (e.target && _this.state.menuEl) {
285
- var bottomScrollMenu = _this.state.menuEl.scrollHeight - _this.state.menuEl.offsetHeight - _this.scrollBottomOffset; // Adding 1 due to border of menu item.
286
-
287
- if (_this.state.menuEl.scrollTop + 1 >= bottomScrollMenu) {
288
- _this.handleScrollBottom(e);
289
- }
166
+ // CONCATENATED MODULE: ./src/ResultsMenu/ResultsMenu.tsx
167
+ function _(e) {
168
+ "@babel/helpers - typeof";
169
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
170
+ _ = function e(t) {
171
+ return typeof t;
172
+ };
173
+ } else {
174
+ _ = function e(t) {
175
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
176
+ };
290
177
  }
291
- }
292
-
293
- (_this$props$onScroll = (_this$props = _this.props).onScroll) === null || _this$props$onScroll === void 0 ? void 0 : _this$props$onScroll.call(_this$props, e);
294
- });
295
-
296
- _defineProperty(_assertThisInitialized(_this), "handleWheelMenu", function (e) {
297
- // Safety net to ensure window doesn't scroll if menu is scrolled pass the numberOfItemsLoaded at high velocity.
298
- e.stopPropagation();
299
- document.documentElement.scrollTop = _this.state.windowTop;
300
- });
301
-
302
- _defineProperty(_assertThisInitialized(_this), "handleScrollBottomOnFullMenu", function () {
303
- var currentChildrenCount = external_react_namespaceObject.Children.count(_this.props.children);
304
- var _this$state = _this.state,
305
- childrenCount = _this$state.childrenCount,
306
- menuMaxHeight = _this$state.menuMaxHeight; // If menu is full length, load more items.
307
-
308
- if (_this.checkFullHeight()) {
309
- _this.handleScrollBottom(null);
310
- } // avoid triggering this logic if this.state.childrenCount is null
311
- // because that's not a real change in the number of children
312
- // and thus we want to avoid resetting the value of scrollBottomTriggered
313
-
314
-
315
- if (menuMaxHeight && currentChildrenCount != null && currentChildrenCount !== childrenCount) {
316
- _this.setState({
317
- numberOfItemsLoaded: currentChildrenCount - (childrenCount !== null && childrenCount !== void 0 ? childrenCount : 0),
318
- scrollBottomTriggered: false
319
- });
320
- }
321
-
322
- if (currentChildrenCount !== childrenCount) {
323
- _this.setState({
324
- childrenCount: currentChildrenCount
325
- });
326
- }
327
- });
328
-
329
- _this.state = {
330
- containerEl: null,
331
- menuEl: null,
332
- menuMaxHeight: undefined,
333
- numberOfItemsLoaded: 0,
334
- scrollBottomTriggered: false,
335
- windowTop: 0
336
- }; // The remaining amount of pixels when scrolled from bottom of menu to trigger onScrollBottom().
337
-
338
- _this.scrollBottomOffset = 400;
339
- _this.itemMinHeight = 28;
340
- return _this;
341
- }
342
-
343
- _createClass(ResultsMenu, [{
344
- key: "componentDidUpdate",
345
- value: function componentDidUpdate() {
346
- var _this$state2 = this.state,
347
- containerEl = _this$state2.containerEl,
348
- menuEl = _this$state2.menuEl,
349
- menuMaxHeight = _this$state2.menuMaxHeight;
350
-
351
- if (!userAgent_namespaceObject.isIE11 || !containerEl || !menuEl) {
352
- return;
353
- }
354
-
355
- if (this.props.maxHeight) {
356
- var otherElementsHeight = containerEl.scrollHeight - menuEl.clientHeight;
357
- var newMenuMaxHeight = this.props.maxHeight - otherElementsHeight;
358
-
359
- if (menuMaxHeight === undefined || Math.abs(menuMaxHeight - newMenuMaxHeight) > 1) {
360
- // eslint-disable-next-line react/no-did-update-set-state
361
- this.setState({
362
- menuMaxHeight: newMenuMaxHeight
363
- });
178
+ return _(e);
179
+ }
180
+ function H() {
181
+ H = Object.assign || function(e) {
182
+ for (var t = 1; t < arguments.length; t++) {
183
+ var o = arguments[t];
184
+ for (var n in o) {
185
+ if (Object.prototype.hasOwnProperty.call(o, n)) {
186
+ e[n] = o[n];
187
+ }
188
+ }
189
+ }
190
+ return e;
191
+ };
192
+ return H.apply(this, arguments);
193
+ }
194
+ function T(e, t) {
195
+ if (!(e instanceof t)) {
196
+ throw new TypeError("Cannot call a class as a function");
364
197
  }
365
- } // If onScrollBottom is defined, determine if it should be triggered.
366
-
367
-
368
- if (this.props && this.props.onScrollBottom && this.props.children) {
369
- this.handleScrollBottomOnFullMenu();
370
- }
371
198
  }
372
- }, {
373
- key: "handleScrollBottom",
374
- value: function handleScrollBottom(e) {
375
- // Prevent multiple calls to onScrollBottom.
376
- if (!this.state.scrollBottomTriggered) {
377
- var _this$props$onScrollB, _this$props2;
378
-
379
- this.setState({
380
- scrollBottomTriggered: true
199
+ function B(e, t) {
200
+ for (var o = 0; o < t.length; o++) {
201
+ var n = t[o];
202
+ n.enumerable = n.enumerable || false;
203
+ n.configurable = true;
204
+ if ("value" in n) n.writable = true;
205
+ Object.defineProperty(e, n.key, n);
206
+ }
207
+ }
208
+ function C(e, t, o) {
209
+ if (t) B(e.prototype, t);
210
+ if (o) B(e, o);
211
+ return e;
212
+ }
213
+ function P(e, t) {
214
+ if (typeof t !== "function" && t !== null) {
215
+ throw new TypeError("Super expression must either be null or a function");
216
+ }
217
+ e.prototype = Object.create(t && t.prototype, {
218
+ constructor: {
219
+ value: e,
220
+ writable: true,
221
+ configurable: true
222
+ }
381
223
  });
382
- (_this$props$onScrollB = (_this$props2 = this.props).onScrollBottom) === null || _this$props$onScrollB === void 0 ? void 0 : _this$props$onScrollB.call(_this$props2, e);
383
- }
224
+ if (t) L(e, t);
384
225
  }
385
- }, {
386
- key: "checkFullHeight",
387
- value: function checkFullHeight() {
388
- var menuEl = this.state.menuEl;
389
- return menuEl && menuEl.scrollHeight === menuEl.offsetHeight;
226
+ function L(e, t) {
227
+ L = Object.setPrototypeOf || function e(t, o) {
228
+ t.__proto__ = o;
229
+ return t;
230
+ };
231
+ return L(e, t);
390
232
  }
391
- }, {
392
- key: "renderFooterMessage",
393
- value: function renderFooterMessage() {
394
- return this.props.footerMessage && !!external_react_namespaceObject.Children.toArray(this.props.children).length && /*#__PURE__*/external_react_default().createElement(StyledFooter, {
395
- $placement: this.props.placement,
396
- "data-test": "footer-message",
397
- key: "footer"
398
- }, this.props.footerMessage);
233
+ function j(e) {
234
+ var t = q();
235
+ return function o() {
236
+ var n = F(e), r;
237
+ if (t) {
238
+ var l = F(this).constructor;
239
+ r = Reflect.construct(n, arguments, l);
240
+ } else {
241
+ r = n.apply(this, arguments);
242
+ }
243
+ return R(this, r);
244
+ };
399
245
  }
400
- }, {
401
- key: "render",
402
- value: function render() {
403
- var _this$props3 = this.props,
404
- animateLoading = _this$props3.animateLoading,
405
- children = _this$props3.children,
406
- controlledExternally = _this$props3.controlledExternally,
407
- childrenStart = _this$props3.childrenStart,
408
- isLoading = _this$props3.isLoading,
409
- loadingMessage = _this$props3.loadingMessage,
410
- noOptionsMessage = _this$props3.noOptionsMessage,
411
- onScrollBottom = _this$props3.onScrollBottom,
412
- placement = _this$props3.placement,
413
- style = _this$props3.style,
414
- tabIndex = _this$props3.tabIndex;
415
- var otherProps = omit_default()(this.props, keys_default()(ResultsMenu.propTypes));
416
- // Assumption: that you cannot be filtered if you are a result
417
- var hasResults = external_react_namespaceObject.Children.toArray(children).filter(external_react_namespaceObject.isValidElement).some(function (_ref) {
418
- var type = _ref.type;
419
- return !(type === Menu_namespaceObject.Divider && type.filterFirst || (type === Menu_namespaceObject.Divider || type === Menu_namespaceObject.Heading) && (type.filterLast || type.filterConsecutive));
420
- });
421
- var fullHeight = this.checkFullHeight();
422
- var menuInlineStyle = getMenuInlineStyle(this.state.menuMaxHeight);
423
- var menuBottomInlineStyle = getMenuBottomInlineStyle(this.state.scrollBottomTriggered ? this.state.numberOfItemsLoaded * this.itemMinHeight || 0 : 0);
424
- /* eslint-disable jsx-a11y/aria-role */
425
-
426
- return /*#__PURE__*/external_react_default().createElement(Styled, _extends({
427
- key: "wrapper",
428
- style: style,
429
- ref: this.handleMount,
430
- onWheel: onScrollBottom ? this.handleWheelMenu : undefined,
431
- onMouseEnter: onScrollBottom ? this.handleMouseEnter : undefined,
432
- onMouseLeave: onScrollBottom ? this.handleMouseLeave : undefined
433
- }, omit_default()(otherProps, 'tabIndex')), placement !== 'above' && childrenStart, placement === 'above' && this.renderFooterMessage(), /*#__PURE__*/external_react_default().createElement(Menu_namespaceObject.MenuContext.Provider, {
434
- value: menuContextRole
435
- }, /*#__PURE__*/external_react_default().createElement((Menu_default()), {
436
- key: "menu",
437
- style: menuInlineStyle,
438
- controlledExternally: controlledExternally,
439
- elementRef: this.handleMenuMount,
440
- onScroll: this.handleScroll,
441
- stopScrollPropagation: true,
442
- tabIndex: tabIndex
443
- }, !hasResults && noOptionsMessage && !isLoading && /*#__PURE__*/external_react_default().createElement((Menu_default()).Item, {
444
- "data-test": "no-results-message",
445
- disabled: true
446
- }, noOptionsMessage), children, onScrollBottom && !fullHeight &&
447
- /*#__PURE__*/
448
- // Bottom spacer fills in the space of new items being loaded by using the minimum possible height x menuItems.
449
- external_react_default().createElement("div", {
450
- "data-test": "results-menu-bottom-spacer",
451
- style: menuBottomInlineStyle
452
- }), isLoading && /*#__PURE__*/external_react_default().createElement(StyledLoading, null, animateLoading && /*#__PURE__*/external_react_default().createElement(StyledWait, null), /*#__PURE__*/external_react_default().createElement(StyledLoadingMessage, null, loadingMessage)))), placement !== 'above' && this.renderFooterMessage(), placement === 'above' && childrenStart);
246
+ function R(e, t) {
247
+ if (t && (_(t) === "object" || typeof t === "function")) {
248
+ return t;
249
+ }
250
+ return I(e);
251
+ }
252
+ function I(e) {
253
+ if (e === void 0) {
254
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
255
+ }
256
+ return e;
453
257
  }
454
- }]);
455
-
456
- return ResultsMenu;
457
- }(external_react_namespaceObject.Component);
458
-
459
- _defineProperty(ResultsMenu, "propTypes", propTypes);
460
-
461
- _defineProperty(ResultsMenu, "defaultProps", defaultProps);
462
-
463
- /* harmony default export */ const ResultsMenu_ResultsMenu = (ResultsMenu);
464
- ;// CONCATENATED MODULE: ./src/ResultsMenu/index.ts
465
-
466
-
467
- module.exports = __webpack_exports__;
468
- /******/ })()
469
- ;
258
+ function q() {
259
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
260
+ if (Reflect.construct.sham) return false;
261
+ if (typeof Proxy === "function") return true;
262
+ try {
263
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
264
+ return true;
265
+ } catch (e) {
266
+ return false;
267
+ }
268
+ }
269
+ function F(e) {
270
+ F = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
271
+ return t.__proto__ || Object.getPrototypeOf(t);
272
+ };
273
+ return F(e);
274
+ }
275
+ function D(e, t, o) {
276
+ if (t in e) {
277
+ Object.defineProperty(e, t, {
278
+ value: o,
279
+ enumerable: true,
280
+ configurable: true,
281
+ writable: true
282
+ });
283
+ } else {
284
+ e[t] = o;
285
+ }
286
+ return e;
287
+ }
288
+ var N = {
289
+ animateLoading: l().bool,
290
+ children: l().node,
291
+ /** @private */
292
+ controlledExternally: l().bool,
293
+ childrenStart: l().node,
294
+ elementRef: l().oneOfType([ l().func, l().object ]),
295
+ footerMessage: l().node,
296
+ isLoading: l().bool,
297
+ loadingMessage: l().node,
298
+ maxHeight: l().number,
299
+ noOptionsMessage: l().node,
300
+ onScroll: l().func,
301
+ onScrollBottom: l().func,
302
+ placement: l().string
303
+ };
304
+ var W = {
305
+ animateLoading: false,
306
+ isLoading: false,
307
+ loadingMessage: (0, f._)("Loading..."),
308
+ noOptionsMessage: (0, f._)("No matches")
309
+ };
310
+ var A = {
311
+ role: "listbox"
312
+ };
313
+ var G = u()((function(e) {
314
+ return {
315
+ overflow: "auto",
316
+ maxHeight: e || "calc(100vh - 20px)",
317
+ flexDirection: "column"
318
+ };
319
+ }));
320
+ var $ = u()((function(e) {
321
+ return {
322
+ height: e
323
+ };
324
+ }));
325
+ // @docs-props-type ResultsMenuPropsBase
326
+ var z = function(e) {
327
+ P(r, e);
328
+ var t = j(r);
329
+ function r(e) {
330
+ var n;
331
+ T(this, r);
332
+ n = t.call(this, e);
333
+ D(I(n), "scrollBottomOffset", void 0);
334
+ D(I(n), "itemMinHeight", void 0);
335
+ D(I(n), "handleMenuMount", (function(e) {
336
+ n.setState({
337
+ menuEl: e
338
+ });
339
+ }));
340
+ D(I(n), "handleMount", (function(e) {
341
+ n.setState({
342
+ containerEl: e
343
+ });
344
+ w(n.props.elementRef, e);
345
+ }));
346
+ D(I(n), "handleMouseEnter", (function() {
347
+ n.setState({
348
+ windowTop: document.documentElement.scrollTop
349
+ });
350
+ }));
351
+ D(I(n), "handleMouseLeave", (function() {
352
+ n.setState({
353
+ windowTop: document.documentElement.scrollTop
354
+ });
355
+ }));
356
+ D(I(n), "handleScroll", (function(e) {
357
+ var t, o;
358
+ if (n.props.onScrollBottom != null) {
359
+ if (e.target && n.state.menuEl) {
360
+ var r = n.state.menuEl.scrollHeight - n.state.menuEl.offsetHeight - n.scrollBottomOffset;
361
+ // Adding 1 due to border of menu item.
362
+ if (n.state.menuEl.scrollTop + 1 >= r) {
363
+ n.handleScrollBottom(e);
364
+ }
365
+ }
366
+ }
367
+ (t = (o = n.props).onScroll) === null || t === void 0 ? void 0 : t.call(o, e);
368
+ }));
369
+ D(I(n), "handleWheelMenu", (function(e) {
370
+ // Safety net to ensure window doesn't scroll if menu is scrolled pass the numberOfItemsLoaded at high velocity.
371
+ e.stopPropagation();
372
+ document.documentElement.scrollTop = n.state.windowTop;
373
+ }));
374
+ D(I(n), "handleScrollBottomOnFullMenu", (function() {
375
+ var e = o.Children.count(n.props.children);
376
+ var t = n.state, r = t.childrenCount, l = t.menuMaxHeight;
377
+ // If menu is full length, load more items.
378
+ if (n.checkFullHeight()) {
379
+ n.handleScrollBottom(null);
380
+ }
381
+ // avoid triggering this logic if this.state.childrenCount is null
382
+ // because that's not a real change in the number of children
383
+ // and thus we want to avoid resetting the value of scrollBottomTriggered
384
+ if (l && e != null && e !== r) {
385
+ n.setState({
386
+ numberOfItemsLoaded: e - (r !== null && r !== void 0 ? r : 0),
387
+ scrollBottomTriggered: false
388
+ });
389
+ }
390
+ if (e !== r) {
391
+ n.setState({
392
+ childrenCount: e
393
+ });
394
+ }
395
+ }));
396
+ n.state = {
397
+ containerEl: null,
398
+ menuEl: null,
399
+ menuMaxHeight: undefined,
400
+ numberOfItemsLoaded: 0,
401
+ scrollBottomTriggered: false,
402
+ windowTop: 0
403
+ };
404
+ // The remaining amount of pixels when scrolled from bottom of menu to trigger onScrollBottom().
405
+ n.scrollBottomOffset = 400;
406
+ n.itemMinHeight = 28;
407
+ return n;
408
+ }
409
+ C(r, [ {
410
+ key: "componentDidUpdate",
411
+ value: function e() {
412
+ var t = this.state, o = t.containerEl, n = t.menuEl, r = t.menuMaxHeight;
413
+ if (!d.isIE11 || !o || !n) {
414
+ return;
415
+ }
416
+ if (this.props.maxHeight) {
417
+ var l = o.scrollHeight - n.clientHeight;
418
+ var i = this.props.maxHeight - l;
419
+ if (r === undefined || Math.abs(r - i) > 1) {
420
+ // eslint-disable-next-line react/no-did-update-set-state
421
+ this.setState({
422
+ menuMaxHeight: i
423
+ });
424
+ }
425
+ }
426
+ // If onScrollBottom is defined, determine if it should be triggered.
427
+ if (this.props && this.props.onScrollBottom && this.props.children) {
428
+ this.handleScrollBottomOnFullMenu();
429
+ }
430
+ }
431
+ }, {
432
+ key: "handleScrollBottom",
433
+ value: function e(t) {
434
+ // Prevent multiple calls to onScrollBottom.
435
+ if (!this.state.scrollBottomTriggered) {
436
+ var o, n;
437
+ this.setState({
438
+ scrollBottomTriggered: true
439
+ });
440
+ (o = (n = this.props).onScrollBottom) === null || o === void 0 ? void 0 : o.call(n, t);
441
+ }
442
+ }
443
+ }, {
444
+ key: "checkFullHeight",
445
+ value: function e() {
446
+ var t = this.state.menuEl;
447
+ return t && t.scrollHeight === t.offsetHeight;
448
+ }
449
+ }, {
450
+ key: "renderFooterMessage",
451
+ value: function e() {
452
+ return this.props.footerMessage && !!o.Children.toArray(this.props.children).length && n().createElement(x, {
453
+ $placement: this.props.placement,
454
+ "data-test": "footer-message",
455
+ key: "footer"
456
+ }, this.props.footerMessage);
457
+ }
458
+ }, {
459
+ key: "render",
460
+ value: function e() {
461
+ var t = this.props, l = t.animateLoading, i = t.children, s = t.controlledExternally, u = t.childrenStart, c = t.isLoading, f = t.loadingMessage, d = t.noOptionsMessage, v = t.onScrollBottom, g = t.placement, b = t.style, y = t.tabIndex;
462
+ var M = p()(this.props, a()(r.propTypes));
463
+ // Assumption: that you cannot be filtered if you are a result
464
+ var x = o.Children.toArray(i).filter(o.isValidElement).some((function(e) {
465
+ var t = e.type;
466
+ return !(t === m.Divider && t.filterFirst || (t === m.Divider || t === m.Heading) && (t.filterLast || t.filterConsecutive));
467
+ }));
468
+ var w = this.checkFullHeight();
469
+ var _ = G(this.state.menuMaxHeight);
470
+ var T = $(this.state.scrollBottomTriggered ? this.state.numberOfItemsLoaded * this.itemMinHeight || 0 : 0);
471
+ /* eslint-disable jsx-a11y/aria-role */
472
+ return n().createElement(S, H({
473
+ key: "wrapper",
474
+ style: b,
475
+ ref: this.handleMount,
476
+ onWheel: v ? this.handleWheelMenu : undefined,
477
+ onMouseEnter: v ? this.handleMouseEnter : undefined,
478
+ onMouseLeave: v ? this.handleMouseLeave : undefined
479
+ }, p()(M, "tabIndex")), g !== "above" && u, g === "above" && this.renderFooterMessage(), n().createElement(m.MenuContext.Provider, {
480
+ value: A
481
+ }, n().createElement(h(), {
482
+ key: "menu",
483
+ style: _,
484
+ controlledExternally: s,
485
+ elementRef: this.handleMenuMount,
486
+ onScroll: this.handleScroll,
487
+ stopScrollPropagation: true,
488
+ tabIndex: y
489
+ }, !x && d && !c && n().createElement(h().Item, {
490
+ "data-test": "no-results-message",
491
+ disabled: true
492
+ }, d), i, v && !w &&
493
+
494
+ // Bottom spacer fills in the space of new items being loaded by using the minimum possible height x menuItems.
495
+ n().createElement("div", {
496
+ "data-test": "results-menu-bottom-spacer",
497
+ style: T
498
+ }), c && n().createElement(E, null, l && n().createElement(O, null), n().createElement(k, null, f)))), g !== "above" && this.renderFooterMessage(), g === "above" && u);
499
+ }
500
+ } ]);
501
+ return r;
502
+ }(o.Component);
503
+ D(z, "propTypes", N);
504
+ D(z, "defaultProps", W);
505
+ /* harmony default export */ const U = z;
506
+ // CONCATENATED MODULE: ./src/ResultsMenu/index.ts
507
+ module.exports = t;
508
+ /******/})();