@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/Concertina.js CHANGED
@@ -1,815 +1,1010 @@
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
- Panel: () => (/* reexport */ Concertina_Panel),
55
- "default": () => (/* reexport */ Concertina_Concertina)
56
- });
57
-
58
- ;// CONCATENATED MODULE: external "react"
59
- const external_react_namespaceObject = require("react");
60
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
61
- ;// CONCATENATED MODULE: external "prop-types"
62
- const external_prop_types_namespaceObject = require("prop-types");
63
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
64
- ;// CONCATENATED MODULE: external "lodash/debounce"
65
- const debounce_namespaceObject = require("lodash/debounce");
66
- var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_namespaceObject);
67
- ;// CONCATENATED MODULE: external "lodash/take"
68
- const take_namespaceObject = require("lodash/take");
69
- var take_default = /*#__PURE__*/__webpack_require__.n(take_namespaceObject);
70
- ;// CONCATENATED MODULE: external "lodash/takeRight"
71
- const takeRight_namespaceObject = require("lodash/takeRight");
72
- var takeRight_default = /*#__PURE__*/__webpack_require__.n(takeRight_namespaceObject);
73
- ;// CONCATENATED MODULE: external "@splunk/react-ui/EventListener"
74
- const EventListener_namespaceObject = require("@splunk/react-ui/EventListener");
75
- var EventListener_default = /*#__PURE__*/__webpack_require__.n(EventListener_namespaceObject);
76
- ;// CONCATENATED MODULE: external "lodash/keys"
77
- const keys_namespaceObject = require("lodash/keys");
78
- var keys_default = /*#__PURE__*/__webpack_require__.n(keys_namespaceObject);
79
- ;// CONCATENATED MODULE: external "lodash/omit"
80
- const omit_namespaceObject = require("lodash/omit");
81
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_namespaceObject);
82
- ;// CONCATENATED MODULE: external "styled-components"
83
- const external_styled_components_namespaceObject = require("styled-components");
84
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
85
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
86
- const Clickable_namespaceObject = require("@splunk/react-ui/Clickable");
87
- var Clickable_default = /*#__PURE__*/__webpack_require__.n(Clickable_namespaceObject);
88
- ;// CONCATENATED MODULE: external "@splunk/themes"
89
- const themes_namespaceObject = require("@splunk/themes");
90
- ;// CONCATENATED MODULE: ./src/Concertina/HeadingStyles.ts
91
-
92
-
93
-
94
- var StyledClickable = external_styled_components_default()((Clickable_default())).withConfig({
95
- displayName: "HeadingStyles__StyledClickable",
96
- componentId: "sc-1h92oaj-0"
97
- })(["display:block;width:100%;cursor:pointer;position:relative;padding:6px ", ";line-height:", ";border-radius:0;color:", ";", " &:focus:not([disabled]){box-shadow:", ";}", ""], themes_namespaceObject.variables.spacing, themes_namespaceObject.variables.lineHeight, themes_namespaceObject.variables.textColor, (0,themes_namespaceObject.pickVariant)('$inner', {
98
- "true": (0,external_styled_components_namespaceObject.css)(["*:not(:first-child) > &&{border-top:2px solid ", ";}*:not(:last-child) > &&{border-bottom:2px solid ", ";}"], themes_namespaceObject.variables.backgroundColor, themes_namespaceObject.variables.backgroundColor),
99
- "false": (0,external_styled_components_namespaceObject.css)(["& + &&{border-top:2px solid ", ";}"], themes_namespaceObject.variables.backgroundColor)
100
- }), themes_namespaceObject.variables.focusShadowInset, (0,themes_namespaceObject.pickVariant)('$status', {
101
- normal: (0,external_styled_components_namespaceObject.css)(["background-color:", ";&:hover:not([disabled]){background-color:", ";}"], (0,themes_namespaceObject.pick)({
102
- dark: themes_namespaceObject.variables.gray45,
103
- light: themes_namespaceObject.variables.gray96
104
- }), (0,themes_namespaceObject.pick)({
105
- dark: themes_namespaceObject.variables.gray30,
106
- light: themes_namespaceObject.variables.gray92
107
- })),
108
- disabled: (0,external_styled_components_namespaceObject.css)(["background-color:", ";"], (0,themes_namespaceObject.pick)({
109
- dark: themes_namespaceObject.variables.gray80,
110
- light: themes_namespaceObject.variables.gray96
111
- })),
112
- error: (0,external_styled_components_namespaceObject.css)(["background-color:", ";color:", ";&:hover:not([disabled]){background-color:", ";}"], themes_namespaceObject.variables.errorColor, themes_namespaceObject.variables.white, themes_namespaceObject.variables.errorColorD10),
113
- warning: (0,external_styled_components_namespaceObject.css)(["background-color:", ";color:", ";&:hover:not([disabled]){background-color:", ";box-shadow:none;}"], themes_namespaceObject.variables.warningColor, themes_namespaceObject.variables.white, themes_namespaceObject.variables.warningColorD10)
114
- }));
115
- var StyledHeadingContent = external_styled_components_default().span.withConfig({
116
- displayName: "HeadingStyles__StyledHeadingContent",
117
- componentId: "sc-1h92oaj-1"
118
- })(["display:flex;justify-content:space-between;"]);
119
- var StyledDescription = external_styled_components_default().span.withConfig({
120
- displayName: "HeadingStyles__StyledDescription",
121
- componentId: "sc-1h92oaj-2"
122
- })(["font-size:", ";"], themes_namespaceObject.variables.fontSizeSmall);
123
-
124
- ;// CONCATENATED MODULE: ./src/Concertina/Heading.tsx
125
- 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); }
126
-
127
- 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); }
128
-
129
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
130
-
131
- 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); } }
132
-
133
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
134
-
135
- 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); }
136
-
137
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
138
-
139
- 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); }; }
140
-
141
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
142
-
143
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
144
-
145
- 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; } }
146
-
147
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
148
-
149
- 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; }
150
-
151
-
152
-
153
-
154
-
155
-
156
- var propTypes = {
157
- children: (external_prop_types_default()).node.isRequired,
158
- description: (external_prop_types_default()).node,
159
-
160
- /** @private */
161
- index: (external_prop_types_default()).number.isRequired,
162
-
163
- /** @private */
164
- onClick: (external_prop_types_default()).func,
165
-
166
- /** @private */
167
- panelId: (external_prop_types_default()).string,
168
-
169
- /** @private */
170
- position: external_prop_types_default().oneOf(['top', 'inner', 'bottom']),
171
- status: external_prop_types_default().oneOf(['normal', 'warning', 'error', 'disabled'])
172
- };
173
- var defaultProps = {
174
- position: 'inner'
175
- };
176
-
177
- var Heading = /*#__PURE__*/function (_Component) {
178
- _inherits(Heading, _Component);
179
-
180
- var _super = _createSuper(Heading);
181
-
182
- function Heading() {
183
- var _this;
184
-
185
- _classCallCheck(this, Heading);
186
-
187
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
188
- args[_key] = arguments[_key];
189
- }
190
-
191
- _this = _super.call.apply(_super, [this].concat(args));
192
-
193
- _defineProperty(_assertThisInitialized(_this), "container", null);
194
-
195
- _defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
196
- var _this$props$onClick, _this$props;
197
-
198
- (_this$props$onClick = (_this$props = _this.props).onClick) === null || _this$props$onClick === void 0 ? void 0 : _this$props$onClick.call(_this$props, e, {
199
- index: _this.props.index,
200
- panelId: _this.props.panelId,
201
- position: _this.props.position
202
- });
1
+ /******/ (() => {
2
+ // webpackBootstrap
3
+ /******/ "use strict";
4
+ /******/ // The require scope
5
+ /******/ var e = {};
6
+ /******/
7
+ /************************************************************************/
8
+ /******/ /* webpack/runtime/compat get default export */
9
+ /******/ (() => {
10
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
11
+ /******/ e.n = t => {
12
+ /******/ var n = t && t.__esModule ?
13
+ /******/ () => t["default"]
14
+ /******/ : () => t
15
+ /******/;
16
+ e.d(n, {
17
+ a: n
18
+ });
19
+ /******/ return n;
20
+ /******/ };
21
+ /******/ })();
22
+ /******/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ (() => {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ e.d = (t, n) => {
27
+ /******/ for (var r in n) {
28
+ /******/ if (e.o(n, r) && !e.o(t, r)) {
29
+ /******/ Object.defineProperty(t, r, {
30
+ enumerable: true,
31
+ get: n[r]
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
+ Panel: () => /* reexport */ Pe,
65
+ default: () => /* reexport */ Ve
203
66
  });
204
-
205
- _defineProperty(_assertThisInitialized(_this), "handleMount", function (container) {
206
- _this.container = container;
207
- });
208
-
209
- return _this;
210
- }
211
-
212
- _createClass(Heading, [{
213
- key: "focus",
214
- value: function focus() {
215
- var _this$container;
216
-
217
- (_this$container = this.container) === null || _this$container === void 0 ? void 0 : _this$container.focus();
218
- }
219
- }, {
220
- key: "render",
221
- value: function render() {
222
- var _this$props2 = this.props,
223
- children = _this$props2.children,
224
- description = _this$props2.description,
225
- panelId = _this$props2.panelId,
226
- position = _this$props2.position,
227
- status = _this$props2.status;
228
- return /*#__PURE__*/external_react_default().createElement(StyledClickable, _extends({
229
- disabled: status === 'disabled',
230
- $inner: position === 'inner',
231
- $status: status,
232
- onClick: this.handleClick,
233
- ref: this.handleMount,
234
- "data-test": "heading",
235
- "data-test-panel-id": panelId
236
- }, omit_default()(this.props, keys_default()(Heading.propTypes))), /*#__PURE__*/external_react_default().createElement(StyledHeadingContent, null, /*#__PURE__*/external_react_default().createElement("span", {
237
- "data-concertina-role": "title"
238
- }, children), description && /*#__PURE__*/external_react_default().createElement(StyledDescription, {
239
- "data-concertina-role": "description"
240
- }, description)));
241
- }
242
- }]);
243
-
244
- return Heading;
245
- }(external_react_namespaceObject.Component);
246
-
247
- _defineProperty(Heading, "propTypes", propTypes);
248
-
249
- _defineProperty(Heading, "defaultProps", defaultProps);
250
-
251
- /* harmony default export */ const Concertina_Heading = (Heading);
252
- ;// CONCATENATED MODULE: external "lodash/throttle"
253
- const throttle_namespaceObject = require("lodash/throttle");
254
- var throttle_default = /*#__PURE__*/__webpack_require__.n(throttle_namespaceObject);
255
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Box"
256
- const Box_namespaceObject = require("@splunk/react-ui/Box");
257
- var Box_default = /*#__PURE__*/__webpack_require__.n(Box_namespaceObject);
258
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Scroll"
259
- const Scroll_namespaceObject = require("@splunk/react-ui/Scroll");
260
- var Scroll_default = /*#__PURE__*/__webpack_require__.n(Scroll_namespaceObject);
261
- ;// CONCATENATED MODULE: ./src/Concertina/ConcertinaStyles.ts
262
-
263
-
264
-
265
-
266
- var StyledScroll = external_styled_components_default()((Scroll_default())).withConfig({
267
- displayName: "ConcertinaStyles__StyledScroll",
268
- componentId: "sc-1fzuh39-0"
269
- })(["position:absolute;left:0;top:0;right:0;bottom:0;"]);
270
- var StyledBox = external_styled_components_default()(StyledScroll.withComponent((Box_default()))).withConfig({
271
- displayName: "ConcertinaStyles__StyledBox",
272
- componentId: "sc-1fzuh39-1"
273
- })(["overflow:hidden;"]);
274
- var StyledTop = external_styled_components_default().div.withConfig({
275
- displayName: "ConcertinaStyles__StyledTop",
276
- componentId: "sc-1fzuh39-2"
277
- })(["position:absolute;left:0;top:0;right:0;z-index:1;background-color:", ";&::after{content:'';position:absolute;bottom:-10px;height:10px;left:0;right:0;background-image:linear-gradient(180deg,rgba(0,0,0,0.15),rgba(0,0,0,0));}"], themes_namespaceObject.variables.backgroundColor);
278
- var StyledBottom = external_styled_components_default().div.withConfig({
279
- displayName: "ConcertinaStyles__StyledBottom",
280
- componentId: "sc-1fzuh39-3"
281
- })(["position:absolute;left:0;bottom:0;right:0;background-color:", ";&::before{content:'';position:absolute;top:-5px;height:5px;left:0;right:0;background-image:linear-gradient(0deg,rgba(0,0,0,0.15),rgba(0,0,0,0));}"], themes_namespaceObject.variables.backgroundColor);
282
- var StyledPanelBody = external_styled_components_default().div.withConfig({
283
- displayName: "ConcertinaStyles__StyledPanelBody",
284
- componentId: "sc-1fzuh39-4"
285
- })(["", ""], (0,themes_namespaceObject.pickVariant)('$status', {
286
- error: {
287
- dark: (0,external_styled_components_namespaceObject.css)(["background-color:", ";"], themes_namespaceObject.mixins.colorWithAlpha(themes_namespaceObject.variables.errorColor, 0.5)),
288
- light: (0,external_styled_components_namespaceObject.css)(["background-color:", ";"], themes_namespaceObject.variables.errorColorL50)
289
- },
290
- warning: {
291
- dark: (0,external_styled_components_namespaceObject.css)(["background-color:", ";"], themes_namespaceObject.mixins.colorWithAlpha(themes_namespaceObject.variables.warningColor, 0.5)),
292
- light: (0,external_styled_components_namespaceObject.css)(["background-color:", ";"], themes_namespaceObject.variables.warningColorL50)
293
- },
294
- disabled: (0,external_styled_components_namespaceObject.css)(["display:none;"])
295
- }));
296
-
297
- ;// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
298
- /**
67
+ // CONCATENATED MODULE: external "react"
68
+ const n = require("react");
69
+ var r = e.n(n);
70
+ // CONCATENATED MODULE: external "prop-types"
71
+ const o = require("prop-types");
72
+ var i = e.n(o);
73
+ // CONCATENATED MODULE: external "lodash/debounce"
74
+ const a = require("lodash/debounce");
75
+ var l = e.n(a);
76
+ // CONCATENATED MODULE: external "lodash/take"
77
+ const s = require("lodash/take");
78
+ var c = e.n(s);
79
+ // CONCATENATED MODULE: external "lodash/takeRight"
80
+ const u = require("lodash/takeRight");
81
+ var f = e.n(u);
82
+ // CONCATENATED MODULE: external "@splunk/react-ui/EventListener"
83
+ const p = require("@splunk/react-ui/EventListener");
84
+ var d = e.n(p);
85
+ // CONCATENATED MODULE: external "lodash/keys"
86
+ const h = require("lodash/keys");
87
+ var y = e.n(h);
88
+ // CONCATENATED MODULE: external "lodash/omit"
89
+ const b = require("lodash/omit");
90
+ var v = e.n(b);
91
+ // CONCATENATED MODULE: external "styled-components"
92
+ const g = require("styled-components");
93
+ var m = e.n(g);
94
+ // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
95
+ const k = require("@splunk/react-ui/Clickable");
96
+ var S = e.n(k);
97
+ // CONCATENATED MODULE: external "@splunk/themes"
98
+ const w = require("@splunk/themes");
99
+ // CONCATENATED MODULE: ./src/Concertina/HeadingStyles.ts
100
+ var C = m()(S()).withConfig({
101
+ displayName: "HeadingStyles__StyledClickable",
102
+ componentId: "sc-1h92oaj-0"
103
+ })([ "display:block;width:100%;cursor:pointer;position:relative;padding:6px ", ";line-height:", ";border-radius:0;color:", ";", " &:focus:not([disabled]){box-shadow:", ";}", "" ], w.variables.spacing, w.variables.lineHeight, w.variables.textColor, (0,
104
+ w.pickVariant)("$inner", {
105
+ true: (0, g.css)([ "*:not(:first-child) > &&{border-top:2px solid ", ";}*:not(:last-child) > &&{border-bottom:2px solid ", ";}" ], w.variables.backgroundColor, w.variables.backgroundColor),
106
+ false: (0, g.css)([ "& + &&{border-top:2px solid ", ";}" ], w.variables.backgroundColor)
107
+ }), w.variables.focusShadowInset, (0, w.pickVariant)("$status", {
108
+ normal: (0, g.css)([ "background-color:", ";&:hover:not([disabled]){background-color:", ";}" ], (0,
109
+ w.pick)({
110
+ dark: w.variables.gray45,
111
+ light: w.variables.gray96
112
+ }), (0, w.pick)({
113
+ dark: w.variables.gray30,
114
+ light: w.variables.gray92
115
+ })),
116
+ disabled: (0, g.css)([ "background-color:", ";" ], (0, w.pick)({
117
+ dark: w.variables.gray80,
118
+ light: w.variables.gray96
119
+ })),
120
+ error: (0, g.css)([ "background-color:", ";color:", ";&:hover:not([disabled]){background-color:", ";}" ], w.variables.errorColor, w.variables.white, w.variables.errorColorD10),
121
+ warning: (0, g.css)([ "background-color:", ";color:", ";&:hover:not([disabled]){background-color:", ";box-shadow:none;}" ], w.variables.warningColor, w.variables.white, w.variables.warningColorD10)
122
+ }));
123
+ var O = m().span.withConfig({
124
+ displayName: "HeadingStyles__StyledHeadingContent",
125
+ componentId: "sc-1h92oaj-1"
126
+ })([ "display:flex;justify-content:space-between;" ]);
127
+ var P = m().span.withConfig({
128
+ displayName: "HeadingStyles__StyledDescription",
129
+ componentId: "sc-1h92oaj-2"
130
+ })([ "font-size:", ";" ], w.variables.fontSizeSmall);
131
+ // CONCATENATED MODULE: ./src/Concertina/Heading.tsx
132
+ function j(e) {
133
+ "@babel/helpers - typeof";
134
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
135
+ j = function e(t) {
136
+ return typeof t;
137
+ };
138
+ } else {
139
+ j = function e(t) {
140
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
141
+ };
142
+ }
143
+ return j(e);
144
+ }
145
+ function E() {
146
+ E = Object.assign || function(e) {
147
+ for (var t = 1; t < arguments.length; t++) {
148
+ var n = arguments[t];
149
+ for (var r in n) {
150
+ if (Object.prototype.hasOwnProperty.call(n, r)) {
151
+ e[r] = n[r];
152
+ }
153
+ }
154
+ }
155
+ return e;
156
+ };
157
+ return E.apply(this, arguments);
158
+ }
159
+ function x(e, t) {
160
+ if (!(e instanceof t)) {
161
+ throw new TypeError("Cannot call a class as a function");
162
+ }
163
+ }
164
+ function _(e, t) {
165
+ for (var n = 0; n < t.length; n++) {
166
+ var r = t[n];
167
+ r.enumerable = r.enumerable || false;
168
+ r.configurable = true;
169
+ if ("value" in r) r.writable = true;
170
+ Object.defineProperty(e, r.key, r);
171
+ }
172
+ }
173
+ function H(e, t, n) {
174
+ if (t) _(e.prototype, t);
175
+ if (n) _(e, n);
176
+ return e;
177
+ }
178
+ function T(e, t) {
179
+ if (typeof t !== "function" && t !== null) {
180
+ throw new TypeError("Super expression must either be null or a function");
181
+ }
182
+ e.prototype = Object.create(t && t.prototype, {
183
+ constructor: {
184
+ value: e,
185
+ writable: true,
186
+ configurable: true
187
+ }
188
+ });
189
+ if (t) R(e, t);
190
+ }
191
+ function R(e, t) {
192
+ R = Object.setPrototypeOf || function e(t, n) {
193
+ t.__proto__ = n;
194
+ return t;
195
+ };
196
+ return R(e, t);
197
+ }
198
+ function I(e) {
199
+ var t = M();
200
+ return function n() {
201
+ var r = A(e), o;
202
+ if (t) {
203
+ var i = A(this).constructor;
204
+ o = Reflect.construct(r, arguments, i);
205
+ } else {
206
+ o = r.apply(this, arguments);
207
+ }
208
+ return q(this, o);
209
+ };
210
+ }
211
+ function q(e, t) {
212
+ if (t && (j(t) === "object" || typeof t === "function")) {
213
+ return t;
214
+ }
215
+ return z(e);
216
+ }
217
+ function z(e) {
218
+ if (e === void 0) {
219
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
220
+ }
221
+ return e;
222
+ }
223
+ function M() {
224
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
225
+ if (Reflect.construct.sham) return false;
226
+ if (typeof Proxy === "function") return true;
227
+ try {
228
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
229
+ return true;
230
+ } catch (e) {
231
+ return false;
232
+ }
233
+ }
234
+ function A(e) {
235
+ A = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
236
+ return t.__proto__ || Object.getPrototypeOf(t);
237
+ };
238
+ return A(e);
239
+ }
240
+ function W(e, t, n) {
241
+ if (t in e) {
242
+ Object.defineProperty(e, t, {
243
+ value: n,
244
+ enumerable: true,
245
+ configurable: true,
246
+ writable: true
247
+ });
248
+ } else {
249
+ e[t] = n;
250
+ }
251
+ return e;
252
+ }
253
+ var B = {
254
+ children: i().node.isRequired,
255
+ description: i().node,
256
+ /** @private */
257
+ index: i().number.isRequired,
258
+ /** @private */
259
+ onClick: i().func,
260
+ /** @private */
261
+ panelId: i().string,
262
+ /** @private */
263
+ position: i().oneOf([ "top", "inner", "bottom" ]),
264
+ status: i().oneOf([ "normal", "warning", "error", "disabled" ])
265
+ };
266
+ var D = {
267
+ position: "inner"
268
+ };
269
+ var N = function(e) {
270
+ T(n, e);
271
+ var t = I(n);
272
+ function n() {
273
+ var e;
274
+ x(this, n);
275
+ for (var r = arguments.length, o = new Array(r), i = 0; i < r; i++) {
276
+ o[i] = arguments[i];
277
+ }
278
+ e = t.call.apply(t, [ this ].concat(o));
279
+ W(z(e), "container", null);
280
+ W(z(e), "handleClick", (function(t) {
281
+ var n, r;
282
+ (n = (r = e.props).onClick) === null || n === void 0 ? void 0 : n.call(r, t, {
283
+ index: e.props.index,
284
+ panelId: e.props.panelId,
285
+ position: e.props.position
286
+ });
287
+ }));
288
+ W(z(e), "handleMount", (function(t) {
289
+ e.container = t;
290
+ }));
291
+ return e;
292
+ }
293
+ H(n, [ {
294
+ key: "focus",
295
+ value: function e() {
296
+ var t;
297
+ (t = this.container) === null || t === void 0 ? void 0 : t.focus();
298
+ }
299
+ }, {
300
+ key: "render",
301
+ value: function e() {
302
+ var t = this.props, o = t.children, i = t.description, a = t.panelId, l = t.position, s = t.status;
303
+
304
+ return r().createElement(C, E({
305
+ disabled: s === "disabled",
306
+ $inner: l === "inner",
307
+ $status: s,
308
+ onClick: this.handleClick,
309
+ ref: this.handleMount,
310
+ "data-test": "heading",
311
+ "data-test-panel-id": a
312
+ }, v()(this.props, y()(n.propTypes))), r().createElement(O, null, r().createElement("span", {
313
+ "data-concertina-role": "title"
314
+ }, o), i && r().createElement(P, {
315
+ "data-concertina-role": "description"
316
+ }, i)));
317
+ }
318
+ } ]);
319
+ return n;
320
+ }(n.Component);
321
+ W(N, "propTypes", B);
322
+ W(N, "defaultProps", D);
323
+ /* harmony default export */ const $ = N;
324
+ // CONCATENATED MODULE: external "lodash/throttle"
325
+ const U = require("lodash/throttle");
326
+ var V = e.n(U);
327
+ // CONCATENATED MODULE: external "@splunk/react-ui/Box"
328
+ const L = require("@splunk/react-ui/Box");
329
+ var F = e.n(L);
330
+ // CONCATENATED MODULE: external "@splunk/react-ui/Scroll"
331
+ const G = require("@splunk/react-ui/Scroll");
332
+ var J = e.n(G);
333
+ // CONCATENATED MODULE: ./src/Concertina/ConcertinaStyles.ts
334
+ var K = m()(J()).withConfig({
335
+ displayName: "ConcertinaStyles__StyledScroll",
336
+ componentId: "sc-1fzuh39-0"
337
+ })([ "position:absolute;left:0;top:0;right:0;bottom:0;" ]);
338
+ var Q = m()(K.withComponent(F())).withConfig({
339
+ displayName: "ConcertinaStyles__StyledBox",
340
+ componentId: "sc-1fzuh39-1"
341
+ })([ "overflow:hidden;" ]);
342
+ var X = m().div.withConfig({
343
+ displayName: "ConcertinaStyles__StyledTop",
344
+ componentId: "sc-1fzuh39-2"
345
+ })([ "position:absolute;left:0;top:0;right:0;z-index:1;background-color:", ";&::after{content:'';position:absolute;bottom:-10px;height:10px;left:0;right:0;background-image:linear-gradient(180deg,rgba(0,0,0,0.15),rgba(0,0,0,0));}" ], w.variables.backgroundColor);
346
+ var Y = m().div.withConfig({
347
+ displayName: "ConcertinaStyles__StyledBottom",
348
+ componentId: "sc-1fzuh39-3"
349
+ })([ "position:absolute;left:0;bottom:0;right:0;background-color:", ";&::before{content:'';position:absolute;top:-5px;height:5px;left:0;right:0;background-image:linear-gradient(0deg,rgba(0,0,0,0.15),rgba(0,0,0,0));}" ], w.variables.backgroundColor);
350
+ var Z = m().div.withConfig({
351
+ displayName: "ConcertinaStyles__StyledPanelBody",
352
+ componentId: "sc-1fzuh39-4"
353
+ })([ "", "" ], (0, w.pickVariant)("$status", {
354
+ error: {
355
+ dark: (0, g.css)([ "background-color:", ";" ], w.mixins.colorWithAlpha(w.variables.errorColor, .5)),
356
+ light: (0, g.css)([ "background-color:", ";" ], w.variables.errorColorL50)
357
+ },
358
+ warning: {
359
+ dark: (0, g.css)([ "background-color:", ";" ], w.mixins.colorWithAlpha(w.variables.warningColor, .5)),
360
+ light: (0, g.css)([ "background-color:", ";" ], w.variables.warningColorL50)
361
+ },
362
+ disabled: (0, g.css)([ "display:none;" ])
363
+ }));
364
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
365
+ /**
299
366
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
300
367
  *
301
368
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
302
369
  * @param current - The new value of the ref.
303
370
  */
304
- function updateReactRef(ref, current) {
305
- if (ref) {
306
- if (typeof ref === 'function') {
307
- ref(current);
308
- } else {
309
- // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
310
- // the intention here is to signal "we will take care of setting 'current', not you".
311
- ref.current = current; // eslint-disable-line no-param-reassign
312
- }
313
- }
314
- }
315
-
316
-
317
- ;// CONCATENATED MODULE: ./src/Concertina/ConcertinaContext.tsx
318
-
319
- var ConcertinaContext = /*#__PURE__*/(0,external_react_namespaceObject.createContext)({});
320
- ConcertinaContext.displayName = 'Concertina';
321
- /* harmony default export */ const Concertina_ConcertinaContext = (ConcertinaContext);
322
- ;// CONCATENATED MODULE: ./src/Concertina/Panel.tsx
323
- function Panel_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Panel_typeof = function _typeof(obj) { return typeof obj; }; } else { Panel_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Panel_typeof(obj); }
324
-
325
- function Panel_extends() { Panel_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 Panel_extends.apply(this, arguments); }
326
-
327
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
328
-
329
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
330
-
331
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
332
-
333
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
334
-
335
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
336
-
337
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
338
-
339
- function Panel_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
340
-
341
- function Panel_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); } }
342
-
343
- function Panel_createClass(Constructor, protoProps, staticProps) { if (protoProps) Panel_defineProperties(Constructor.prototype, protoProps); if (staticProps) Panel_defineProperties(Constructor, staticProps); return Constructor; }
344
-
345
- function Panel_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) Panel_setPrototypeOf(subClass, superClass); }
346
-
347
- function Panel_setPrototypeOf(o, p) { Panel_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Panel_setPrototypeOf(o, p); }
348
-
349
- function Panel_createSuper(Derived) { var hasNativeReflectConstruct = Panel_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Panel_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Panel_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Panel_possibleConstructorReturn(this, result); }; }
350
-
351
- function Panel_possibleConstructorReturn(self, call) { if (call && (Panel_typeof(call) === "object" || typeof call === "function")) { return call; } return Panel_assertThisInitialized(self); }
352
-
353
- function Panel_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
354
-
355
- function Panel_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; } }
356
-
357
- function Panel_getPrototypeOf(o) { Panel_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Panel_getPrototypeOf(o); }
358
-
359
- function Panel_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; }
360
-
361
-
362
-
363
-
364
-
365
-
366
-
367
-
368
-
369
-
370
-
371
- var Panel_propTypes = {
372
- children: (external_prop_types_default()).node,
373
- description: (external_prop_types_default()).node,
374
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
375
-
376
- /** @private */
377
- index: (external_prop_types_default()).number,
378
- panelId: (external_prop_types_default()).string,
379
- status: external_prop_types_default().oneOf(['normal', 'warning', 'error', 'disabled']),
380
- title: (external_prop_types_default()).node.isRequired
381
- };
382
- var Panel_defaultProps = {
383
- status: 'normal'
384
- };
385
-
386
- var Panel = /*#__PURE__*/function (_Component) {
387
- Panel_inherits(Panel, _Component);
388
-
389
- var _super = Panel_createSuper(Panel);
390
-
391
- // @docs-props-type PanelPropsBase
392
- function Panel(props) {
393
- var _this;
394
-
395
- Panel_classCallCheck(this, Panel);
396
-
397
- _this = _super.call(this, props);
398
-
399
- Panel_defineProperty(Panel_assertThisInitialized(_this), "lastHeight", void 0);
400
-
401
- Panel_defineProperty(Panel_assertThisInitialized(_this), "measureHeight", function (e) {
402
- var _this$props$index, _this$context$onChang, _this$context;
403
-
404
- if (!_this.state.containerEl || !_this.state.bodyEl) {
405
- return;
406
- }
407
-
408
- var newHeight = _this.state.containerEl.clientHeight;
409
-
410
- if (newHeight === _this.lastHeight) {
411
- return;
412
- }
413
-
414
- var data = {
415
- headingHeight: _this.state.containerEl.offsetHeight - _this.state.bodyEl.offsetHeight,
416
- height: _this.state.containerEl.offsetHeight,
417
- index: (_this$props$index = _this.props.index) !== null && _this$props$index !== void 0 ? _this$props$index : 0,
418
- panelId: _this.props.panelId
419
- };
420
- _this.lastHeight = newHeight;
421
- (_this$context$onChang = (_this$context = _this.context).onChange) === null || _this$context$onChang === void 0 ? void 0 : _this$context$onChang.call(_this$context, e, data);
422
- });
423
-
424
- Panel_defineProperty(Panel_assertThisInitialized(_this), "handleResize", throttle_default()(_this.measureHeight, 300));
425
-
426
- Panel_defineProperty(Panel_assertThisInitialized(_this), "handleMount", function (el) {
427
- _this.setState({
428
- containerEl: el
429
- });
430
-
431
- updateReactRef(_this.props.elementRef, el);
432
- });
433
-
434
- Panel_defineProperty(Panel_assertThisInitialized(_this), "handleHeadingMount", function (heading) {
435
- _this.setState({
436
- heading: heading
437
- });
438
- });
439
-
440
- Panel_defineProperty(Panel_assertThisInitialized(_this), "handleBodyMount", function (bodyEl) {
441
- _this.setState({
442
- bodyEl: bodyEl
443
- });
444
- });
445
-
446
- _this.state = {
447
- bodyEl: null,
448
- containerEl: null,
449
- heading: null
450
- };
451
- return _this;
452
- }
453
-
454
- Panel_createClass(Panel, [{
455
- key: "componentDidUpdate",
456
- value: function componentDidUpdate(prevProps, prevState) {
457
- if (this.props.children !== prevProps.children || !prevState.containerEl) {
458
- this.measureHeight();
459
- }
460
- }
461
- }, {
462
- key: "componentWillUnmount",
463
- value: function componentWillUnmount() {
464
- this.handleResize.cancel();
465
- }
466
- }, {
467
- key: "focus",
468
- value: function focus() {
469
- var _this$state$heading;
470
-
471
- (_this$state$heading = this.state.heading) === null || _this$state$heading === void 0 ? void 0 : _this$state$heading.focus();
472
- }
473
- }, {
474
- key: "render",
475
- value: function render() {
476
- var _this$props = this.props,
477
- children = _this$props.children,
478
- description = _this$props.description,
479
- index = _this$props.index,
480
- panelId = _this$props.panelId,
481
- status = _this$props.status,
482
- style = _this$props.style,
483
- title = _this$props.title;
484
- var onHeadingClickContext = this.context.onHeadingClick;
485
- return /*#__PURE__*/external_react_default().createElement("div", Panel_extends({
486
- ref: this.handleMount,
487
- "data-test": "panel",
488
- "data-test-panel-id": panelId || "".concat(index)
489
- }, omit_default()(this.props, [].concat(_toConsumableArray(keys_default()(Panel.propTypes)), ['style']))), /*#__PURE__*/external_react_default().createElement(Concertina_Heading, {
490
- onClick: onHeadingClickContext,
491
- ref: this.handleHeadingMount,
492
- description: description,
493
- index: index !== null && index !== void 0 ? index : 0,
494
- panelId: panelId || "".concat(index),
495
- position: "inner",
496
- status: status
497
- }, title), /*#__PURE__*/external_react_default().createElement((EventListener_default()), {
498
- target: window,
499
- eventType: "resize",
500
- listener: this.handleResize
501
- }), /*#__PURE__*/external_react_default().createElement(StyledPanelBody, {
502
- $status: status,
503
- "data-test": "body",
504
- style: style,
505
- ref: this.handleBodyMount
506
- }, children));
507
- }
508
- }]);
509
-
510
- return Panel;
511
- }(external_react_namespaceObject.Component);
512
-
513
- Panel_defineProperty(Panel, "propTypes", Panel_propTypes);
514
-
515
- Panel_defineProperty(Panel, "defaultProps", Panel_defaultProps);
516
-
517
- Panel_defineProperty(Panel, "contextType", Concertina_ConcertinaContext);
518
-
519
- /* harmony default export */ const Concertina_Panel = (Panel);
520
- ;// CONCATENATED MODULE: ./src/Concertina/Concertina.tsx
521
- function Concertina_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Concertina_typeof = function _typeof(obj) { return typeof obj; }; } else { Concertina_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Concertina_typeof(obj); }
522
-
523
- function Concertina_extends() { Concertina_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 Concertina_extends.apply(this, arguments); }
524
-
525
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
526
-
527
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
528
-
529
- function Concertina_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
530
-
531
- function Concertina_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); } }
532
-
533
- function Concertina_createClass(Constructor, protoProps, staticProps) { if (protoProps) Concertina_defineProperties(Constructor.prototype, protoProps); if (staticProps) Concertina_defineProperties(Constructor, staticProps); return Constructor; }
534
-
535
- function Concertina_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) Concertina_setPrototypeOf(subClass, superClass); }
536
-
537
- function Concertina_setPrototypeOf(o, p) { Concertina_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Concertina_setPrototypeOf(o, p); }
538
-
539
- function Concertina_createSuper(Derived) { var hasNativeReflectConstruct = Concertina_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Concertina_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Concertina_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Concertina_possibleConstructorReturn(this, result); }; }
540
-
541
- function Concertina_possibleConstructorReturn(self, call) { if (call && (Concertina_typeof(call) === "object" || typeof call === "function")) { return call; } return Concertina_assertThisInitialized(self); }
542
-
543
- function Concertina_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
544
-
545
- function Concertina_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; } }
546
-
547
- function Concertina_getPrototypeOf(o) { Concertina_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Concertina_getPrototypeOf(o); }
548
-
549
- function Concertina_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; }
550
-
551
-
552
-
553
-
554
-
555
-
556
-
557
-
558
-
559
-
560
-
561
- var Concertina_propTypes = {
562
- children: (external_prop_types_default()).node,
563
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object])
564
- };
565
- var Concertina_defaultProps = {};
566
-
567
- /**
568
- * @deprecated
569
- * Concertina has been deprecated and will be removed in a future major version.
570
- */
571
- var Concertina = /*#__PURE__*/function (_Component) {
572
- Concertina_inherits(Concertina, _Component);
573
-
574
- var _super = Concertina_createSuper(Concertina);
575
-
576
- // @docs-props-type ConcertinaPropsBase
577
- function Concertina(props) {
578
- var _this;
579
-
580
- Concertina_classCallCheck(this, Concertina);
581
-
582
- _this = _super.call(this, props);
583
-
584
- Concertina_defineProperty(Concertina_assertThisInitialized(_this), "panelPositions", void 0);
585
-
586
- Concertina_defineProperty(Concertina_assertThisInitialized(_this), "handleUpdate", function (e, data) {
587
- _this.panelPositions[data.index] = data;
588
- var total = 0;
589
-
590
- _this.panelPositions.forEach(function (panel) {
591
- // eslint-disable-next-line no-param-reassign
592
- panel.offsetTop = total;
593
- total += panel.height || 0;
594
- });
595
-
596
- _this.updateHeadings();
597
- });
598
-
599
- Concertina_defineProperty(Concertina_assertThisInitialized(_this), "handleElementMount", function (scrollEl) {
600
- _this.setState({
601
- scrollEl: scrollEl
602
- }); // The scrollEl gets unmounted during the animation, it's necessary to cache the
603
- // recorded height until it is remounted.
604
-
605
-
606
- if (scrollEl) {
607
- _this.setState({
608
- innerWidth: scrollEl.clientWidth
371
+ function ee(e, t) {
372
+ if (e) {
373
+ if (typeof e === "function") {
374
+ e(t);
375
+ } else {
376
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
377
+ // the intention here is to signal "we will take care of setting 'current', not you".
378
+ e.current = t;
379
+ // eslint-disable-line no-param-reassign
380
+ }
381
+ }
382
+ }
383
+ // CONCATENATED MODULE: ./src/Concertina/ConcertinaContext.tsx
384
+ var te = (0, n.createContext)({});
385
+ te.displayName = "Concertina";
386
+ /* harmony default export */ const ne = te;
387
+ // CONCATENATED MODULE: ./src/Concertina/Panel.tsx
388
+ function re(e) {
389
+ "@babel/helpers - typeof";
390
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
391
+ re = function e(t) {
392
+ return typeof t;
393
+ };
394
+ } else {
395
+ re = function e(t) {
396
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
397
+ };
398
+ }
399
+ return re(e);
400
+ }
401
+ function oe() {
402
+ oe = Object.assign || function(e) {
403
+ for (var t = 1; t < arguments.length; t++) {
404
+ var n = arguments[t];
405
+ for (var r in n) {
406
+ if (Object.prototype.hasOwnProperty.call(n, r)) {
407
+ e[r] = n[r];
408
+ }
409
+ }
410
+ }
411
+ return e;
412
+ };
413
+ return oe.apply(this, arguments);
414
+ }
415
+ function ie(e) {
416
+ return ce(e) || se(e) || le(e) || ae();
417
+ }
418
+ function ae() {
419
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
420
+ }
421
+ function le(e, t) {
422
+ if (!e) return;
423
+ if (typeof e === "string") return ue(e, t);
424
+ var n = Object.prototype.toString.call(e).slice(8, -1);
425
+ if (n === "Object" && e.constructor) n = e.constructor.name;
426
+ if (n === "Map" || n === "Set") return Array.from(e);
427
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ue(e, t);
428
+ }
429
+ function se(e) {
430
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(e)) return Array.from(e);
431
+ }
432
+ function ce(e) {
433
+ if (Array.isArray(e)) return ue(e);
434
+ }
435
+ function ue(e, t) {
436
+ if (t == null || t > e.length) t = e.length;
437
+ for (var n = 0, r = new Array(t); n < t; n++) {
438
+ r[n] = e[n];
439
+ }
440
+ return r;
441
+ }
442
+ function fe(e, t) {
443
+ if (!(e instanceof t)) {
444
+ throw new TypeError("Cannot call a class as a function");
445
+ }
446
+ }
447
+ function pe(e, t) {
448
+ for (var n = 0; n < t.length; n++) {
449
+ var r = t[n];
450
+ r.enumerable = r.enumerable || false;
451
+ r.configurable = true;
452
+ if ("value" in r) r.writable = true;
453
+ Object.defineProperty(e, r.key, r);
454
+ }
455
+ }
456
+ function de(e, t, n) {
457
+ if (t) pe(e.prototype, t);
458
+ if (n) pe(e, n);
459
+ return e;
460
+ }
461
+ function he(e, t) {
462
+ if (typeof t !== "function" && t !== null) {
463
+ throw new TypeError("Super expression must either be null or a function");
464
+ }
465
+ e.prototype = Object.create(t && t.prototype, {
466
+ constructor: {
467
+ value: e,
468
+ writable: true,
469
+ configurable: true
470
+ }
609
471
  });
610
- }
611
- });
612
-
613
- Concertina_defineProperty(Concertina_assertThisInitialized(_this), "handleResize", function () {
614
- _this.setState(function (state) {
615
- var _state$scrollEl;
616
-
617
- return {
618
- innerWidth: (_state$scrollEl = state.scrollEl) === null || _state$scrollEl === void 0 ? void 0 : _state$scrollEl.clientWidth
472
+ if (t) ye(e, t);
473
+ }
474
+ function ye(e, t) {
475
+ ye = Object.setPrototypeOf || function e(t, n) {
476
+ t.__proto__ = n;
477
+ return t;
619
478
  };
620
- });
621
- });
622
-
623
- Concertina_defineProperty(Concertina_assertThisInitialized(_this), "handleScroll", function () {
624
- _this.updateHeadings();
625
- });
626
-
627
- Concertina_defineProperty(Concertina_assertThisInitialized(_this), "handleScrollComplete", function () {
628
- _this.setState({
629
- targetTop: undefined
630
- });
631
- });
632
-
633
- Concertina_defineProperty(Concertina_assertThisInitialized(_this), "handleClick", function (e, _ref) {
634
- var _this$panelPositions$;
635
-
636
- var index = _ref.index,
637
- position = _ref.position;
638
- var scrollEl = _this.state.scrollEl;
639
-
640
- if (!scrollEl) {
641
- return;
642
- }
643
-
644
- var headingsBeforeHeight = take_default()(_this.panelPositions, index).map(function (item) {
645
- return item.headingHeight;
646
- }).reduce(function (a, b) {
647
- return a + b;
648
- }, 0); // sum the heights
649
-
650
- var headingsAfterHeight = takeRight_default()(_this.panelPositions, _this.panelPositions.length - index - 1).map(function (item) {
651
- return item.headingHeight;
652
- }).reduce(function (a, b) {
653
- return a + b;
654
- }, 0); // sum the heights
655
-
656
- var availableHeight = scrollEl.clientHeight - headingsBeforeHeight - headingsAfterHeight;
657
- var panelHeight = _this.panelPositions[index].height;
658
- var topPosition = ((_this$panelPositions$ = _this.panelPositions[index].offsetTop) !== null && _this$panelPositions$ !== void 0 ? _this$panelPositions$ : 0) - headingsBeforeHeight;
659
- var bottomPosition = topPosition - (availableHeight - panelHeight);
660
- var shouldPartlyPopUp = availableHeight > panelHeight && (position === 'bottom' || position === 'inner'); // if the entire panel is in view, do nothing
661
-
662
- if (shouldPartlyPopUp && bottomPosition < scrollEl.scrollTop) {
663
- return;
664
- }
665
-
666
- var targetTop = shouldPartlyPopUp ? bottomPosition : topPosition; // handleRest will shift focus;
667
-
668
- if (position !== 'inner') {
669
- e.currentTarget.blur();
670
- }
671
-
672
- _this.setState({
673
- targetTop: targetTop
674
- });
675
- });
676
-
677
- Concertina_defineProperty(Concertina_assertThisInitialized(_this), "updateHeadingsImpl", function () {
678
- var scrollEl = _this.state.scrollEl;
679
-
680
- if (!scrollEl) {
681
- return;
682
- }
683
-
684
- var top = scrollEl.scrollTop;
685
-
686
- function reduceTop(show, panel) {
687
- if (panel.offsetTop !== undefined && panel.offsetTop < top) {
688
- top += panel.headingHeight;
689
- return show + 1;
479
+ return ye(e, t);
480
+ }
481
+ function be(e) {
482
+ var t = me();
483
+ return function n() {
484
+ var r = ke(e), o;
485
+ if (t) {
486
+ var i = ke(this).constructor;
487
+ o = Reflect.construct(r, arguments, i);
488
+ } else {
489
+ o = r.apply(this, arguments);
490
+ }
491
+ return ve(this, o);
492
+ };
493
+ }
494
+ function ve(e, t) {
495
+ if (t && (re(t) === "object" || typeof t === "function")) {
496
+ return t;
690
497
  }
691
-
692
- return show;
693
- }
694
-
695
- var bottom = top + scrollEl.clientHeight;
696
-
697
- function reduceBottom(show, panel) {
698
- if (panel.offsetTop !== undefined && panel.offsetTop + panel.headingHeight > bottom) {
699
- bottom -= panel.headingHeight;
700
- return show + 1;
498
+ return ge(e);
499
+ }
500
+ function ge(e) {
501
+ if (e === void 0) {
502
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
701
503
  }
702
-
703
- return show;
704
- }
705
-
706
- _this.setState({
707
- panelsTopCount: _this.panelPositions.reduce(reduceTop, 0),
708
- panelsBottomCount: _this.panelPositions.reduceRight(reduceBottom, 0)
709
- });
710
- });
711
-
712
- Concertina_defineProperty(Concertina_assertThisInitialized(_this), "updateHeadings", debounce_default()(_this.updateHeadingsImpl, 0));
713
-
714
- _this.state = {
715
- innerWidth: '100%',
716
- panelsBottomCount: 0,
717
- panelsTopCount: 0,
718
- scrollEl: null
504
+ return e;
505
+ }
506
+ function me() {
507
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
508
+ if (Reflect.construct.sham) return false;
509
+ if (typeof Proxy === "function") return true;
510
+ try {
511
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
512
+ return true;
513
+ } catch (e) {
514
+ return false;
515
+ }
516
+ }
517
+ function ke(e) {
518
+ ke = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
519
+ return t.__proto__ || Object.getPrototypeOf(t);
520
+ };
521
+ return ke(e);
522
+ }
523
+ function Se(e, t, n) {
524
+ if (t in e) {
525
+ Object.defineProperty(e, t, {
526
+ value: n,
527
+ enumerable: true,
528
+ configurable: true,
529
+ writable: true
530
+ });
531
+ } else {
532
+ e[t] = n;
533
+ }
534
+ return e;
535
+ }
536
+ var we = {
537
+ children: i().node,
538
+ description: i().node,
539
+ elementRef: i().oneOfType([ i().func, i().object ]),
540
+ /** @private */
541
+ index: i().number,
542
+ panelId: i().string,
543
+ status: i().oneOf([ "normal", "warning", "error", "disabled" ]),
544
+ title: i().node.isRequired
545
+ };
546
+ var Ce = {
547
+ status: "normal"
719
548
  };
720
- _this.panelPositions = [];
721
- return _this;
722
- }
723
-
724
- Concertina_createClass(Concertina, [{
725
- key: "componentWillUnmount",
726
- value: function componentWillUnmount() {
727
- this.updateHeadings.cancel();
728
- }
729
- }, {
730
- key: "renderHeadings",
731
- value: function renderHeadings(items, position) {
732
- var _this2 = this;
733
-
734
- var headings = items.map(function (item) {
735
- var _item$props$index;
736
-
737
- return /*#__PURE__*/external_react_default().createElement(Concertina_Heading, {
738
- onClick: _this2.handleClick,
739
- description: item.props.description,
740
- panelId: item.props.panelId,
741
- index: (_item$props$index = item.props.index) !== null && _item$props$index !== void 0 ? _item$props$index : 0,
742
- position: position,
743
- status: item.props.status,
744
- key: item.props.panelId,
745
- tabIndex: -1
746
- }, item.props.title);
747
- });
748
- return headings;
749
- }
750
- }, {
751
- key: "render",
752
- value: function render() {
753
- if (false) {}
754
-
755
- var _this$props = this.props,
756
- children = _this$props.children,
757
- otherProps = _objectWithoutProperties(_this$props, ["children"]);
758
-
759
- var childrenCleaned = external_react_namespaceObject.Children.toArray(children).filter(external_react_namespaceObject.isValidElement).map(function (item, index) {
760
- return /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(item, {
761
- index: index
549
+ var Oe = function(e) {
550
+ he(n, e);
551
+ var t = be(n);
552
+ // @docs-props-type PanelPropsBase
553
+ function n(e) {
554
+ var r;
555
+ fe(this, n);
556
+ r = t.call(this, e);
557
+ Se(ge(r), "lastHeight", void 0);
558
+ Se(ge(r), "measureHeight", (function(e) {
559
+ var t, n, o;
560
+ if (!r.state.containerEl || !r.state.bodyEl) {
561
+ return;
562
+ }
563
+ var i = r.state.containerEl.clientHeight;
564
+ if (i === r.lastHeight) {
565
+ return;
566
+ }
567
+ var a = {
568
+ headingHeight: r.state.containerEl.offsetHeight - r.state.bodyEl.offsetHeight,
569
+ height: r.state.containerEl.offsetHeight,
570
+ index: (t = r.props.index) !== null && t !== void 0 ? t : 0,
571
+ panelId: r.props.panelId
572
+ };
573
+ r.lastHeight = i;
574
+ (n = (o = r.context).onChange) === null || n === void 0 ? void 0 : n.call(o, e, a);
575
+ }));
576
+ Se(ge(r), "handleResize", V()(r.measureHeight, 300));
577
+ Se(ge(r), "handleMount", (function(e) {
578
+ r.setState({
579
+ containerEl: e
580
+ });
581
+ ee(r.props.elementRef, e);
582
+ }));
583
+ Se(ge(r), "handleHeadingMount", (function(e) {
584
+ r.setState({
585
+ heading: e
586
+ });
587
+ }));
588
+ Se(ge(r), "handleBodyMount", (function(e) {
589
+ r.setState({
590
+ bodyEl: e
591
+ });
592
+ }));
593
+ r.state = {
594
+ bodyEl: null,
595
+ containerEl: null,
596
+ heading: null
597
+ };
598
+ return r;
599
+ }
600
+ de(n, [ {
601
+ key: "componentDidUpdate",
602
+ value: function e(t, n) {
603
+ if (this.props.children !== t.children || !n.containerEl) {
604
+ this.measureHeight();
605
+ }
606
+ }
607
+ }, {
608
+ key: "componentWillUnmount",
609
+ value: function e() {
610
+ this.handleResize.cancel();
611
+ }
612
+ }, {
613
+ key: "focus",
614
+ value: function e() {
615
+ var t;
616
+ (t = this.state.heading) === null || t === void 0 ? void 0 : t.focus();
617
+ }
618
+ }, {
619
+ key: "render",
620
+ value: function e() {
621
+ var t = this.props, o = t.children, i = t.description, a = t.index, l = t.panelId, s = t.status, c = t.style, u = t.title;
622
+ var f = this.context.onHeadingClick;
623
+
624
+ return r().createElement("div", oe({
625
+ ref: this.handleMount,
626
+ "data-test": "panel",
627
+ "data-test-panel-id": l || "".concat(a)
628
+ }, v()(this.props, [].concat(ie(y()(n.propTypes)), [ "style" ]))), r().createElement($, {
629
+ onClick: f,
630
+ ref: this.handleHeadingMount,
631
+ description: i,
632
+ index: a !== null && a !== void 0 ? a : 0,
633
+ panelId: l || "".concat(a),
634
+ position: "inner",
635
+ status: s
636
+ }, u), r().createElement(d(), {
637
+ target: window,
638
+ eventType: "resize",
639
+ listener: this.handleResize
640
+ }), r().createElement(Z, {
641
+ $status: s,
642
+ "data-test": "body",
643
+ style: c,
644
+ ref: this.handleBodyMount
645
+ }, o));
646
+ }
647
+ } ]);
648
+ return n;
649
+ }(n.Component);
650
+ Se(Oe, "propTypes", we);
651
+ Se(Oe, "defaultProps", Ce);
652
+ Se(Oe, "contextType", ne);
653
+ /* harmony default export */ const Pe = Oe;
654
+ // CONCATENATED MODULE: ./src/Concertina/Concertina.tsx
655
+ function je(e) {
656
+ "@babel/helpers - typeof";
657
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
658
+ je = function e(t) {
659
+ return typeof t;
660
+ };
661
+ } else {
662
+ je = function e(t) {
663
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
664
+ };
665
+ }
666
+ return je(e);
667
+ }
668
+ function Ee() {
669
+ Ee = Object.assign || function(e) {
670
+ for (var t = 1; t < arguments.length; t++) {
671
+ var n = arguments[t];
672
+ for (var r in n) {
673
+ if (Object.prototype.hasOwnProperty.call(n, r)) {
674
+ e[r] = n[r];
675
+ }
676
+ }
677
+ }
678
+ return e;
679
+ };
680
+ return Ee.apply(this, arguments);
681
+ }
682
+ function xe(e, t) {
683
+ if (e == null) return {};
684
+ var n = _e(e, t);
685
+ var r, o;
686
+ if (Object.getOwnPropertySymbols) {
687
+ var i = Object.getOwnPropertySymbols(e);
688
+ for (o = 0; o < i.length; o++) {
689
+ r = i[o];
690
+ if (t.indexOf(r) >= 0) continue;
691
+ if (!Object.prototype.propertyIsEnumerable.call(e, r)) continue;
692
+ n[r] = e[r];
693
+ }
694
+ }
695
+ return n;
696
+ }
697
+ function _e(e, t) {
698
+ if (e == null) return {};
699
+ var n = {};
700
+ var r = Object.keys(e);
701
+ var o, i;
702
+ for (i = 0; i < r.length; i++) {
703
+ o = r[i];
704
+ if (t.indexOf(o) >= 0) continue;
705
+ n[o] = e[o];
706
+ }
707
+ return n;
708
+ }
709
+ function He(e, t) {
710
+ if (!(e instanceof t)) {
711
+ throw new TypeError("Cannot call a class as a function");
712
+ }
713
+ }
714
+ function Te(e, t) {
715
+ for (var n = 0; n < t.length; n++) {
716
+ var r = t[n];
717
+ r.enumerable = r.enumerable || false;
718
+ r.configurable = true;
719
+ if ("value" in r) r.writable = true;
720
+ Object.defineProperty(e, r.key, r);
721
+ }
722
+ }
723
+ function Re(e, t, n) {
724
+ if (t) Te(e.prototype, t);
725
+ if (n) Te(e, n);
726
+ return e;
727
+ }
728
+ function Ie(e, t) {
729
+ if (typeof t !== "function" && t !== null) {
730
+ throw new TypeError("Super expression must either be null or a function");
731
+ }
732
+ e.prototype = Object.create(t && t.prototype, {
733
+ constructor: {
734
+ value: e,
735
+ writable: true,
736
+ configurable: true
737
+ }
762
738
  });
763
- });
764
- var topPanels = take_default()(childrenCleaned, this.state.panelsTopCount);
765
- var bottomPanels = takeRight_default()(childrenCleaned, this.state.panelsBottomCount);
766
- return /*#__PURE__*/external_react_default().createElement(StyledBox, Concertina_extends({
767
- "data-test": "concertina"
768
- }, otherProps), /*#__PURE__*/external_react_default().createElement((EventListener_default()), {
769
- target: window,
770
- eventType: "resize",
771
- listener: this.handleResize
772
- }), this.state.panelsTopCount > 0 && /*#__PURE__*/external_react_default().createElement(StyledTop, {
773
- style: {
774
- width: this.state.innerWidth
775
- },
776
- "data-test": "dock-top"
777
- }, this.renderHeadings(topPanels, 'top')), /*#__PURE__*/external_react_default().createElement(StyledScroll, {
778
- onScroll: this.handleScroll,
779
- stopScrollPropagation: true,
780
- key: "scroll-container",
781
- elementRef: this.handleElementMount,
782
- "data-test": "scroll",
783
- top: this.state.targetTop,
784
- onScrollComplete: this.handleScrollComplete
785
- }, /*#__PURE__*/external_react_default().createElement(Concertina_ConcertinaContext.Provider, {
786
- value: {
787
- onHeadingClick: this.handleClick,
788
- onChange: this.handleUpdate
739
+ if (t) qe(e, t);
740
+ }
741
+ function qe(e, t) {
742
+ qe = Object.setPrototypeOf || function e(t, n) {
743
+ t.__proto__ = n;
744
+ return t;
745
+ };
746
+ return qe(e, t);
747
+ }
748
+ function ze(e) {
749
+ var t = We();
750
+ return function n() {
751
+ var r = Be(e), o;
752
+ if (t) {
753
+ var i = Be(this).constructor;
754
+ o = Reflect.construct(r, arguments, i);
755
+ } else {
756
+ o = r.apply(this, arguments);
757
+ }
758
+ return Me(this, o);
759
+ };
760
+ }
761
+ function Me(e, t) {
762
+ if (t && (je(t) === "object" || typeof t === "function")) {
763
+ return t;
789
764
  }
790
- }, childrenCleaned)), this.state.panelsBottomCount > 0 && /*#__PURE__*/external_react_default().createElement(StyledBottom, {
791
- style: {
792
- width: this.state.innerWidth
793
- },
794
- "data-test": "dock-bottom"
795
- }, this.renderHeadings(bottomPanels, 'bottom')));
796
- }
797
- }]);
798
-
799
- return Concertina;
800
- }(external_react_namespaceObject.Component);
801
-
802
- Concertina_defineProperty(Concertina, "propTypes", Concertina_propTypes);
803
-
804
- Concertina_defineProperty(Concertina, "defaultProps", Concertina_defaultProps);
805
-
806
- Concertina_defineProperty(Concertina, "Panel", Concertina_Panel);
807
-
808
- /* harmony default export */ const Concertina_Concertina = (Concertina);
809
-
810
- ;// CONCATENATED MODULE: ./src/Concertina/index.ts
811
-
812
-
813
- module.exports = __webpack_exports__;
814
- /******/ })()
815
- ;
765
+ return Ae(e);
766
+ }
767
+ function Ae(e) {
768
+ if (e === void 0) {
769
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
770
+ }
771
+ return e;
772
+ }
773
+ function We() {
774
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
775
+ if (Reflect.construct.sham) return false;
776
+ if (typeof Proxy === "function") return true;
777
+ try {
778
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
779
+ return true;
780
+ } catch (e) {
781
+ return false;
782
+ }
783
+ }
784
+ function Be(e) {
785
+ Be = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
786
+ return t.__proto__ || Object.getPrototypeOf(t);
787
+ };
788
+ return Be(e);
789
+ }
790
+ function De(e, t, n) {
791
+ if (t in e) {
792
+ Object.defineProperty(e, t, {
793
+ value: n,
794
+ enumerable: true,
795
+ configurable: true,
796
+ writable: true
797
+ });
798
+ } else {
799
+ e[t] = n;
800
+ }
801
+ return e;
802
+ }
803
+ var Ne = {
804
+ children: i().node,
805
+ elementRef: i().oneOfType([ i().func, i().object ])
806
+ };
807
+ var $e = {};
808
+ /**
809
+ * @deprecated
810
+ * Concertina has been deprecated and will be removed in a future major version.
811
+ */ var Ue = function(e) {
812
+ Ie(o, e);
813
+ var t = ze(o);
814
+ // @docs-props-type ConcertinaPropsBase
815
+ function o(e) {
816
+ var n;
817
+ He(this, o);
818
+ n = t.call(this, e);
819
+ De(Ae(n), "panelPositions", void 0);
820
+ De(Ae(n), "handleUpdate", (function(e, t) {
821
+ n.panelPositions[t.index] = t;
822
+ var r = 0;
823
+ n.panelPositions.forEach((function(e) {
824
+ // eslint-disable-next-line no-param-reassign
825
+ e.offsetTop = r;
826
+ r += e.height || 0;
827
+ }));
828
+ n.updateHeadings();
829
+ }));
830
+ De(Ae(n), "handleElementMount", (function(e) {
831
+ n.setState({
832
+ scrollEl: e
833
+ });
834
+ // The scrollEl gets unmounted during the animation, it's necessary to cache the
835
+ // recorded height until it is remounted.
836
+ if (e) {
837
+ n.setState({
838
+ innerWidth: e.clientWidth
839
+ });
840
+ }
841
+ }));
842
+ De(Ae(n), "handleResize", (function() {
843
+ n.setState((function(e) {
844
+ var t;
845
+ return {
846
+ innerWidth: (t = e.scrollEl) === null || t === void 0 ? void 0 : t.clientWidth
847
+ };
848
+ }));
849
+ }));
850
+ De(Ae(n), "handleScroll", (function() {
851
+ n.updateHeadings();
852
+ }));
853
+ De(Ae(n), "handleScrollComplete", (function() {
854
+ n.setState({
855
+ targetTop: undefined
856
+ });
857
+ }));
858
+ De(Ae(n), "handleClick", (function(e, t) {
859
+ var r;
860
+ var o = t.index, i = t.position;
861
+ var a = n.state.scrollEl;
862
+ if (!a) {
863
+ return;
864
+ }
865
+ var l = c()(n.panelPositions, o).map((function(e) {
866
+ return e.headingHeight;
867
+ })).reduce((function(e, t) {
868
+ return e + t;
869
+ }), 0);
870
+ // sum the heights
871
+ var s = f()(n.panelPositions, n.panelPositions.length - o - 1).map((function(e) {
872
+ return e.headingHeight;
873
+ })).reduce((function(e, t) {
874
+ return e + t;
875
+ }), 0);
876
+ // sum the heights
877
+ var u = a.clientHeight - l - s;
878
+ var p = n.panelPositions[o].height;
879
+ var d = ((r = n.panelPositions[o].offsetTop) !== null && r !== void 0 ? r : 0) - l;
880
+ var h = d - (u - p);
881
+ var y = u > p && (i === "bottom" || i === "inner");
882
+ // if the entire panel is in view, do nothing
883
+ if (y && h < a.scrollTop) {
884
+ return;
885
+ }
886
+ var b = y ? h : d;
887
+ // handleRest will shift focus;
888
+ if (i !== "inner") {
889
+ e.currentTarget.blur();
890
+ }
891
+ n.setState({
892
+ targetTop: b
893
+ });
894
+ }));
895
+ De(Ae(n), "updateHeadingsImpl", (function() {
896
+ var e = n.state.scrollEl;
897
+ if (!e) {
898
+ return;
899
+ }
900
+ var t = e.scrollTop;
901
+ function r(e, n) {
902
+ if (n.offsetTop !== undefined && n.offsetTop < t) {
903
+ t += n.headingHeight;
904
+ return e + 1;
905
+ }
906
+ return e;
907
+ }
908
+ var o = t + e.clientHeight;
909
+ function i(e, t) {
910
+ if (t.offsetTop !== undefined && t.offsetTop + t.headingHeight > o) {
911
+ o -= t.headingHeight;
912
+ return e + 1;
913
+ }
914
+ return e;
915
+ }
916
+ n.setState({
917
+ panelsTopCount: n.panelPositions.reduce(r, 0),
918
+ panelsBottomCount: n.panelPositions.reduceRight(i, 0)
919
+ });
920
+ }));
921
+ De(Ae(n), "updateHeadings", l()(n.updateHeadingsImpl, 0));
922
+ n.state = {
923
+ innerWidth: "100%",
924
+ panelsBottomCount: 0,
925
+ panelsTopCount: 0,
926
+ scrollEl: null
927
+ };
928
+ n.panelPositions = [];
929
+ return n;
930
+ }
931
+ Re(o, [ {
932
+ key: "componentWillUnmount",
933
+ value: function e() {
934
+ this.updateHeadings.cancel();
935
+ }
936
+ }, {
937
+ key: "renderHeadings",
938
+ value: function e(t, n) {
939
+ var o = this;
940
+ var i = t.map((function(e) {
941
+ var t;
942
+
943
+ return r().createElement($, {
944
+ onClick: o.handleClick,
945
+ description: e.props.description,
946
+ panelId: e.props.panelId,
947
+ index: (t = e.props.index) !== null && t !== void 0 ? t : 0,
948
+ position: n,
949
+ status: e.props.status,
950
+ key: e.props.panelId,
951
+ tabIndex: -1
952
+ }, e.props.title);
953
+ }));
954
+ return i;
955
+ }
956
+ }, {
957
+ key: "render",
958
+ value: function e() {
959
+ if (false) {}
960
+ var t = this.props, o = t.children, i = xe(t, [ "children" ]);
961
+ var a = n.Children.toArray(o).filter(n.isValidElement).map((function(e, t) {
962
+
963
+ return (0, n.cloneElement)(e, {
964
+ index: t
965
+ });
966
+ }));
967
+ var l = c()(a, this.state.panelsTopCount);
968
+ var s = f()(a, this.state.panelsBottomCount);
969
+
970
+ return r().createElement(Q, Ee({
971
+ "data-test": "concertina"
972
+ }, i), r().createElement(d(), {
973
+ target: window,
974
+ eventType: "resize",
975
+ listener: this.handleResize
976
+ }), this.state.panelsTopCount > 0 && r().createElement(X, {
977
+ style: {
978
+ width: this.state.innerWidth
979
+ },
980
+ "data-test": "dock-top"
981
+ }, this.renderHeadings(l, "top")), r().createElement(K, {
982
+ onScroll: this.handleScroll,
983
+ stopScrollPropagation: true,
984
+ key: "scroll-container",
985
+ elementRef: this.handleElementMount,
986
+ "data-test": "scroll",
987
+ top: this.state.targetTop,
988
+ onScrollComplete: this.handleScrollComplete
989
+ }, r().createElement(ne.Provider, {
990
+ value: {
991
+ onHeadingClick: this.handleClick,
992
+ onChange: this.handleUpdate
993
+ }
994
+ }, a)), this.state.panelsBottomCount > 0 && r().createElement(Y, {
995
+ style: {
996
+ width: this.state.innerWidth
997
+ },
998
+ "data-test": "dock-bottom"
999
+ }, this.renderHeadings(s, "bottom")));
1000
+ }
1001
+ } ]);
1002
+ return o;
1003
+ }(n.Component);
1004
+ De(Ue, "propTypes", Ne);
1005
+ De(Ue, "defaultProps", $e);
1006
+ De(Ue, "Panel", Pe);
1007
+ /* harmony default export */ const Ve = Ue;
1008
+ // CONCATENATED MODULE: ./src/Concertina/index.ts
1009
+ module.exports = t;
1010
+ /******/})();