@splunk/react-ui 4.21.0 → 4.22.0

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