@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/TransitionOpen.js CHANGED
@@ -1,431 +1,498 @@
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 */ TransitionOpen_TransitionOpen)
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/omit"
67
- const omit_namespaceObject = require("lodash/omit");
68
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_namespaceObject);
69
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Animation"
70
- const Animation_namespaceObject = require("@splunk/react-ui/Animation");
71
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/focus"
72
- const focus_namespaceObject = require("@splunk/ui-utils/focus");
73
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/style"
74
- const style_namespaceObject = require("@splunk/ui-utils/style");
75
- ;// CONCATENATED MODULE: external "react-spring"
76
- const external_react_spring_namespaceObject = require("react-spring");
77
- ;// CONCATENATED MODULE: external "styled-components"
78
- const external_styled_components_namespaceObject = require("styled-components");
79
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
80
- ;// CONCATENATED MODULE: external "@splunk/themes"
81
- const themes_namespaceObject = require("@splunk/themes");
82
- ;// CONCATENATED MODULE: ./src/TransitionOpen/TransitionOpenStyles.ts
83
-
84
-
85
-
86
- var Styled = external_styled_components_default()(external_react_spring_namespaceObject.animated.div).withConfig({
87
- displayName: "TransitionOpenStyles__Styled",
88
- componentId: "sc-1x58s0g-0"
89
- })(["", ";", ";"], themes_namespaceObject.mixins.reset('block'), function (_ref) {
90
- var $hideOverflow = _ref.$hideOverflow;
91
- return $hideOverflow && (0,external_styled_components_namespaceObject.css)(["overflow:hidden;"]);
92
- });
93
- var StyledInner = external_styled_components_default()(external_react_spring_namespaceObject.animated.div).withConfig({
94
- displayName: "TransitionOpenStyles__StyledInner",
95
- componentId: "sc-1x58s0g-1"
96
- })(["", ";", ";width:100%;"], themes_namespaceObject.mixins.reset('table'), themes_namespaceObject.mixins.clearfix());
97
-
98
- ;// CONCATENATED MODULE: ./src/TransitionOpen/TransitionOpen.tsx
99
- 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); }
100
-
101
- 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); }
102
-
103
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
104
-
105
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
106
-
107
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
108
-
109
- 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); } }
110
-
111
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
112
-
113
- 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); }
114
-
115
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
116
-
117
- 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); }; }
118
-
119
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
120
-
121
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
122
-
123
- 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; } }
124
-
125
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
126
-
127
- 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; }
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
- var propTypes = {
138
- animation: external_prop_types_default().oneOf(['slideFromTop', 'slideFromRight', 'slideFromBottom', 'slideFromLeft', 'expandHeight', 'expandWidth', 'none']),
139
- animateOnMount: (external_prop_types_default()).bool,
140
- children: (external_prop_types_default()).node,
141
- className: (external_prop_types_default()).string,
142
- id: (external_prop_types_default()).string,
143
- innerClassName: (external_prop_types_default()).string,
144
- innerStyle: (external_prop_types_default()).object,
145
- onAnimationEnd: (external_prop_types_default()).func,
146
- open: (external_prop_types_default()).bool,
147
- outerClassName: (external_prop_types_default()).string,
148
- outerId: (external_prop_types_default()).string,
149
- outerStyle: (external_prop_types_default()).object,
150
- renderChildrenWhenCollapsed: (external_prop_types_default()).bool,
151
- retainFocus: (external_prop_types_default()).bool,
152
- takeFocus: (external_prop_types_default()).bool
153
- };
154
- var defaultProps = {
155
- animation: 'expandHeight',
156
- animateOnMount: false,
157
- innerStyle: {},
158
- open: false,
159
- outerStyle: {},
160
- renderChildrenWhenCollapsed: false,
161
- retainFocus: false,
162
- takeFocus: false
163
- };
164
-
165
- var TransitionOpen = /*#__PURE__*/function (_Component) {
166
- _inherits(TransitionOpen, _Component);
167
-
168
- var _super = _createSuper(TransitionOpen);
169
-
170
- // @docs-props-type TransitionOpenPropsBase
171
- function TransitionOpen(props) {
172
- var _this;
173
-
174
- _classCallCheck(this, TransitionOpen);
175
-
176
- _this = _super.call(this, props);
177
-
178
- _defineProperty(_assertThisInitialized(_this), "allowAnimationUpdates", true);
179
-
180
- _defineProperty(_assertThisInitialized(_this), "getValue", function (el) {
181
- var animation = _this.props.animation;
182
- var value = 0;
183
-
184
- if (el) {
185
- if (_this.props.takeFocus) {
186
- (0,focus_namespaceObject.takeFocus)(el, 'container');
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
+ default: () => /* reexport */ W
65
+ });
66
+ // CONCATENATED MODULE: external "react"
67
+ const n = require("react");
68
+ var r = e.n(n);
69
+ // CONCATENATED MODULE: external "prop-types"
70
+ const o = require("prop-types");
71
+ var a = e.n(o);
72
+ // CONCATENATED MODULE: external "lodash/keys"
73
+ const i = require("lodash/keys");
74
+ var s = e.n(i);
75
+ // CONCATENATED MODULE: external "lodash/omit"
76
+ const l = require("lodash/omit");
77
+ var u = e.n(l);
78
+ // CONCATENATED MODULE: external "@splunk/react-ui/Animation"
79
+ const c = require("@splunk/react-ui/Animation");
80
+ // CONCATENATED MODULE: external "@splunk/ui-utils/focus"
81
+ const f = require("@splunk/ui-utils/focus");
82
+ // CONCATENATED MODULE: external "@splunk/ui-utils/style"
83
+ const p = require("@splunk/ui-utils/style");
84
+ // CONCATENATED MODULE: external "react-spring"
85
+ const d = require("react-spring");
86
+ // CONCATENATED MODULE: external "styled-components"
87
+ const m = require("styled-components");
88
+ var y = e.n(m);
89
+ // CONCATENATED MODULE: external "@splunk/themes"
90
+ const h = require("@splunk/themes");
91
+ // CONCATENATED MODULE: ./src/TransitionOpen/TransitionOpenStyles.ts
92
+ var v = y()(d.animated.div).withConfig({
93
+ displayName: "TransitionOpenStyles__Styled",
94
+ componentId: "sc-1x58s0g-0"
95
+ })([ "", ";", ";" ], h.mixins.reset("block"), (function(e) {
96
+ var t = e.$hideOverflow;
97
+ return t && (0, m.css)([ "overflow:hidden;" ]);
98
+ }));
99
+ var b = y()(d.animated.div).withConfig({
100
+ displayName: "TransitionOpenStyles__StyledInner",
101
+ componentId: "sc-1x58s0g-1"
102
+ })([ "", ";", ";width:100%;" ], h.mixins.reset("table"), h.mixins.clearfix());
103
+ // CONCATENATED MODULE: ./src/TransitionOpen/TransitionOpen.tsx
104
+ function g(e) {
105
+ "@babel/helpers - typeof";
106
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
107
+ g = function e(t) {
108
+ return typeof t;
109
+ };
110
+ } else {
111
+ g = function e(t) {
112
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
113
+ };
187
114
  }
188
-
189
- switch (animation) {
190
- case 'slideFromTop':
191
- case 'slideFromBottom':
192
- case 'expandHeight':
193
- case 'none':
194
- value = el.offsetHeight;
195
- break;
196
-
197
- case 'slideFromLeft':
198
- case 'slideFromRight':
199
- case 'expandWidth':
200
- value = el.offsetWidth;
201
- break;
202
-
203
- default: // Intentionally left empty.
204
-
115
+ return g(e);
116
+ }
117
+ function O() {
118
+ O = Object.assign || function(e) {
119
+ for (var t = 1; t < arguments.length; t++) {
120
+ var n = arguments[t];
121
+ for (var r in n) {
122
+ if (Object.prototype.hasOwnProperty.call(n, r)) {
123
+ e[r] = n[r];
124
+ }
125
+ }
126
+ }
127
+ return e;
128
+ };
129
+ return O.apply(this, arguments);
130
+ }
131
+ function w(e, t) {
132
+ var n = Object.keys(e);
133
+ if (Object.getOwnPropertySymbols) {
134
+ var r = Object.getOwnPropertySymbols(e);
135
+ if (t) r = r.filter((function(t) {
136
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
137
+ }));
138
+ n.push.apply(n, r);
205
139
  }
206
- }
207
-
208
- return value;
209
- });
210
-
211
- _defineProperty(_assertThisInitialized(_this), "handleMount", function (el) {
212
- var value = _this.getValue(el);
213
-
214
- _this.setState({
215
- value: value,
216
- innerEl: el
217
- });
218
- });
219
-
220
- _defineProperty(_assertThisInitialized(_this), "handleRest", function () {
221
- var _this$props$onAnimati, _this$props;
222
-
223
- if (_this.allowAnimationUpdates) {
224
- _this.setState({
225
- animating: false
226
- });
227
- }
228
-
229
- (_this$props$onAnimati = (_this$props = _this.props).onAnimationEnd) === null || _this$props$onAnimati === void 0 ? void 0 : _this$props$onAnimati.call(_this$props);
230
- });
231
-
232
- _defineProperty(_assertThisInitialized(_this), "handleTab", function (e) {
233
- if (_this.state.innerEl) {
234
- (0,focus_namespaceObject.handleTab)(_this.state.innerEl, e);
235
- }
236
- });
237
-
238
- _defineProperty(_assertThisInitialized(_this), "internalRender", function (_ref) {
239
- var value = _ref.value,
240
- transform = _ref.transform;
241
- var _this$props2 = _this.props,
242
- animation = _this$props2.animation,
243
- className = _this$props2.className,
244
- children = _this$props2.children,
245
- id = _this$props2.id,
246
- innerClassName = _this$props2.innerClassName,
247
- innerStyle = _this$props2.innerStyle,
248
- open = _this$props2.open,
249
- outerClassName = _this$props2.outerClassName,
250
- outerId = _this$props2.outerId,
251
- outerStyle = _this$props2.outerStyle,
252
- renderChildrenWhenCollapsed = _this$props2.renderChildrenWhenCollapsed;
253
- var animating = _this.state.animating;
254
- var dimension;
255
-
256
- if (animating) {
257
- switch (animation) {
258
- case 'slideFromTop':
259
- case 'slideFromBottom':
260
- case 'expandHeight':
261
- case 'none':
262
- dimension = 'height';
263
- break;
264
-
265
- case 'slideFromLeft':
266
- case 'slideFromRight':
267
- case 'expandWidth':
268
- dimension = 'width';
269
- break;
270
-
271
- default: // Intentionally left empty.
272
-
140
+ return n;
141
+ }
142
+ function S(e) {
143
+ for (var t = 1; t < arguments.length; t++) {
144
+ var n = arguments[t] != null ? arguments[t] : {};
145
+ if (t % 2) {
146
+ w(Object(n), true).forEach((function(t) {
147
+ R(e, t, n[t]);
148
+ }));
149
+ } else if (Object.getOwnPropertyDescriptors) {
150
+ Object.defineProperties(e, Object.getOwnPropertyDescriptors(n));
151
+ } else {
152
+ w(Object(n)).forEach((function(t) {
153
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
154
+ }));
155
+ }
273
156
  }
274
- }
275
-
276
- if (!open && !animating && renderChildrenWhenCollapsed) {
277
- return /*#__PURE__*/external_react_default().createElement(Styled, {
278
- $hideOverflow: false,
279
- className: (0,style_namespaceObject.toClassName)(className, outerClassName),
280
- style: _objectSpread(_objectSpread({}, outerStyle), dimension && _defineProperty({}, dimension, value)),
281
- id: outerId
282
- }, /*#__PURE__*/external_react_default().createElement(StyledInner, _extends({
283
- "data-test": "transition-open"
284
- }, omit_default()(_this.props, keys_default()(TransitionOpen.propTypes)), {
285
- ref: _this.handleMount,
286
- tabIndex: -1,
287
- className: innerClassName,
288
- id: id,
289
- onKeyDown: _this.props.retainFocus ? _this.handleTab : undefined,
290
- style: _objectSpread(_objectSpread({}, innerStyle), {}, {
291
- transform: transform,
292
- display: 'none'
293
- })
294
- }), children));
295
- }
296
- /* eslint-disable jsx-a11y/no-static-element-interactions */
297
-
298
-
299
- return /*#__PURE__*/external_react_default().createElement(Styled, {
300
- $hideOverflow: !open || animating,
301
- className: (0,style_namespaceObject.toClassName)(className, outerClassName),
302
- style: _objectSpread(_objectSpread({}, outerStyle), dimension && _defineProperty({}, dimension, value)),
303
- id: outerId
304
- }, (open || animating) && /*#__PURE__*/external_react_default().createElement(StyledInner, _extends({
305
- "data-test": "transition-open"
306
- }, omit_default()(_this.props, keys_default()(TransitionOpen.propTypes)), {
307
- ref: _this.handleMount,
308
- tabIndex: -1,
309
- className: innerClassName,
310
- id: id,
311
- onKeyDown: _this.props.retainFocus ? _this.handleTab : undefined,
312
- style: _objectSpread(_objectSpread({}, innerStyle), {}, {
313
- transform: transform
314
- })
315
- }), children));
316
- });
317
-
318
- _defineProperty(_assertThisInitialized(_this), "getSpringTransition", function () {
319
- var _this$props3 = _this.props,
320
- open = _this$props3.open,
321
- animation = _this$props3.animation;
322
- var value = _this.state.value;
323
- var toValue = {
324
- value: open ? value : 0
325
- };
326
- var fromValue = {
327
- value: open ? 0 : value
328
- };
329
- var config = {
330
- precision: 1
331
- }; // Only use precision when not using transform, otherwise transform animation will break
332
- // Expansion doesn't require a valid value; the subsequent render animates it.
333
-
334
- if (animation === 'expandWidth' || animation === 'expandHeight' || animation === 'none') {
335
- return {
336
- to: toValue,
337
- config: config
157
+ return e;
158
+ }
159
+ function j(e, t) {
160
+ if (!(e instanceof t)) {
161
+ throw new TypeError("Cannot call a class as a function");
162
+ }
163
+ }
164
+ function F(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 x(e, t, n) {
174
+ if (t) F(e.prototype, t);
175
+ if (n) F(e, n);
176
+ return e;
177
+ }
178
+ function P(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) T(e, t);
190
+ }
191
+ function T(e, t) {
192
+ T = Object.setPrototypeOf || function e(t, n) {
193
+ t.__proto__ = n;
194
+ return t;
338
195
  };
339
- } // Slide transitions require a valid value, render without transition first.
340
-
341
-
342
- if (!value) {
343
- return null;
344
- }
345
-
346
- if (animation !== 'slideFromTop' && animation !== 'slideFromLeft') {
347
- // Return the standard transition if not using a transform.
348
- return {
349
- to: toValue,
350
- from: fromValue,
351
- config: config
196
+ return T(e, t);
197
+ }
198
+ function k(e) {
199
+ var t = _();
200
+ return function n() {
201
+ var r = N(e), o;
202
+ if (t) {
203
+ var a = N(this).constructor;
204
+ o = Reflect.construct(r, arguments, a);
205
+ } else {
206
+ o = r.apply(this, arguments);
207
+ }
208
+ return E(this, o);
352
209
  };
353
- } // The top and left directions require an additional transform of their inner content to match the outer dimension animation.
354
- // This is needed to achieve a clipping effect from the outer div, rather than the consumer providing their own.
355
-
356
-
357
- var orientation = animation === 'slideFromTop' ? 'Y' : 'X';
358
- var toTransform = "translate".concat(orientation, "(").concat(open ? 0 : -value, "px)");
359
- var fromTransform = "translate".concat(orientation, "(").concat(open ? -value : 0, "px)");
360
- return {
361
- to: _objectSpread({
362
- transform: toTransform
363
- }, toValue),
364
- from: _objectSpread({
365
- transform: fromTransform
366
- }, fromValue)
367
- };
368
- });
369
-
370
- _this.state = {
371
- animating: props.animateOnMount ? props.open : false,
372
- innerEl: null,
373
- prevOpen: props.open // eslint-disable-line react/no-unused-state
374
-
375
- };
376
- return _this;
377
- }
378
-
379
- _createClass(TransitionOpen, [{
380
- key: "componentDidUpdate",
381
- value: function componentDidUpdate() {
382
- var value = this.getValue(this.state.innerEl);
383
-
384
- if (this.state.value !== value && !this.state.animating) {
385
- this.setState({
386
- value: value
387
- }); // eslint-disable-line react/no-did-update-set-state
388
- }
389
210
  }
390
- }, {
391
- key: "componentWillUnmount",
392
- value: function componentWillUnmount() {
393
- this.allowAnimationUpdates = false;
211
+ function E(e, t) {
212
+ if (t && (g(t) === "object" || typeof t === "function")) {
213
+ return t;
214
+ }
215
+ return C(e);
394
216
  }
395
- }, {
396
- key: "render",
397
- value: function render() {
398
- var animation = this.props.animation;
399
- return /*#__PURE__*/external_react_default().createElement(Animation_namespaceObject.Spring, _extends({}, this.getSpringTransition(), {
400
- immediate: animation === 'none',
401
- onRest: this.handleRest
402
- }), // eslint-disable-next-line @typescript-eslint/no-explicit-any
403
- this.internalRender);
217
+ function C(e) {
218
+ if (e === void 0) {
219
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
220
+ }
221
+ return e;
404
222
  }
405
- }]);
406
-
407
- return TransitionOpen;
408
- }(external_react_namespaceObject.Component);
409
-
410
- _defineProperty(TransitionOpen, "propTypes", propTypes);
411
-
412
- _defineProperty(TransitionOpen, "defaultProps", defaultProps);
413
-
414
- _defineProperty(TransitionOpen, "getDerivedStateFromProps", function (props, state) {
415
- if (props.open !== state.prevOpen) {
416
- return {
417
- animating: true,
418
- prevOpen: props.open
223
+ function _() {
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 N(e) {
235
+ N = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
236
+ return t.__proto__ || Object.getPrototypeOf(t);
237
+ };
238
+ return N(e);
239
+ }
240
+ function R(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 q = {
254
+ animation: a().oneOf([ "slideFromTop", "slideFromRight", "slideFromBottom", "slideFromLeft", "expandHeight", "expandWidth", "none" ]),
255
+ animateOnMount: a().bool,
256
+ children: a().node,
257
+ className: a().string,
258
+ id: a().string,
259
+ innerClassName: a().string,
260
+ innerStyle: a().object,
261
+ onAnimationEnd: a().func,
262
+ open: a().bool,
263
+ outerClassName: a().string,
264
+ outerId: a().string,
265
+ outerStyle: a().object,
266
+ renderChildrenWhenCollapsed: a().bool,
267
+ retainFocus: a().bool,
268
+ takeFocus: a().bool
419
269
  };
420
- }
421
-
422
- return null;
423
- });
424
-
425
- /* harmony default export */ const TransitionOpen_TransitionOpen = (TransitionOpen);
426
- ;// CONCATENATED MODULE: ./src/TransitionOpen/index.ts
427
-
428
-
429
- module.exports = __webpack_exports__;
430
- /******/ })()
431
- ;
270
+ var D = {
271
+ animation: "expandHeight",
272
+ animateOnMount: false,
273
+ innerStyle: {},
274
+ open: false,
275
+ outerStyle: {},
276
+ renderChildrenWhenCollapsed: false,
277
+ retainFocus: false,
278
+ takeFocus: false
279
+ };
280
+ var M = function(e) {
281
+ P(n, e);
282
+ var t = k(n);
283
+ // @docs-props-type TransitionOpenPropsBase
284
+ function n(e) {
285
+ var o;
286
+ j(this, n);
287
+ o = t.call(this, e);
288
+ R(C(o), "allowAnimationUpdates", true);
289
+ R(C(o), "getValue", (function(e) {
290
+ var t = o.props.animation;
291
+ var n = 0;
292
+ if (e) {
293
+ if (o.props.takeFocus) {
294
+ (0, f.takeFocus)(e, "container");
295
+ }
296
+ switch (t) {
297
+ case "slideFromTop":
298
+ case "slideFromBottom":
299
+ case "expandHeight":
300
+ case "none":
301
+ n = e.offsetHeight;
302
+ break;
303
+
304
+ case "slideFromLeft":
305
+ case "slideFromRight":
306
+ case "expandWidth":
307
+ n = e.offsetWidth;
308
+ break;
309
+
310
+ default:
311
+ // Intentionally left empty.
312
+ }
313
+ }
314
+ return n;
315
+ }));
316
+ R(C(o), "handleMount", (function(e) {
317
+ var t = o.getValue(e);
318
+ o.setState({
319
+ value: t,
320
+ innerEl: e
321
+ });
322
+ }));
323
+ R(C(o), "handleRest", (function() {
324
+ var e, t;
325
+ if (o.allowAnimationUpdates) {
326
+ o.setState({
327
+ animating: false
328
+ });
329
+ }
330
+ (e = (t = o.props).onAnimationEnd) === null || e === void 0 ? void 0 : e.call(t);
331
+ }));
332
+ R(C(o), "handleTab", (function(e) {
333
+ if (o.state.innerEl) {
334
+ (0, f.handleTab)(o.state.innerEl, e);
335
+ }
336
+ }));
337
+ R(C(o), "internalRender", (function(e) {
338
+ var t = e.value, a = e.transform;
339
+ var i = o.props, l = i.animation, c = i.className, f = i.children, d = i.id, m = i.innerClassName, y = i.innerStyle, h = i.open, g = i.outerClassName, w = i.outerId, j = i.outerStyle, F = i.renderChildrenWhenCollapsed;
340
+ var x = o.state.animating;
341
+ var P;
342
+ if (x) {
343
+ switch (l) {
344
+ case "slideFromTop":
345
+ case "slideFromBottom":
346
+ case "expandHeight":
347
+ case "none":
348
+ P = "height";
349
+ break;
350
+
351
+ case "slideFromLeft":
352
+ case "slideFromRight":
353
+ case "expandWidth":
354
+ P = "width";
355
+ break;
356
+
357
+ default:
358
+ // Intentionally left empty.
359
+ }
360
+ }
361
+ if (!h && !x && F) {
362
+
363
+ return r().createElement(v, {
364
+ $hideOverflow: false,
365
+ className: (0, p.toClassName)(c, g),
366
+ style: S(S({}, j), P && R({}, P, t)),
367
+ id: w
368
+ }, r().createElement(b, O({
369
+ "data-test": "transition-open"
370
+ }, u()(o.props, s()(n.propTypes)), {
371
+ ref: o.handleMount,
372
+ tabIndex: -1,
373
+ className: m,
374
+ id: d,
375
+ onKeyDown: o.props.retainFocus ? o.handleTab : undefined,
376
+ style: S(S({}, y), {}, {
377
+ transform: a,
378
+ display: "none"
379
+ })
380
+ }), f));
381
+ }
382
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
383
+ return r().createElement(v, {
384
+ $hideOverflow: !h || x,
385
+ className: (0, p.toClassName)(c, g),
386
+ style: S(S({}, j), P && R({}, P, t)),
387
+ id: w
388
+ }, (h || x) && r().createElement(b, O({
389
+ "data-test": "transition-open"
390
+ }, u()(o.props, s()(n.propTypes)), {
391
+ ref: o.handleMount,
392
+ tabIndex: -1,
393
+ className: m,
394
+ id: d,
395
+ onKeyDown: o.props.retainFocus ? o.handleTab : undefined,
396
+ style: S(S({}, y), {}, {
397
+ transform: a
398
+ })
399
+ }), f));
400
+ }));
401
+ R(C(o), "getSpringTransition", (function() {
402
+ var e = o.props, t = e.open, n = e.animation;
403
+ var r = o.state.value;
404
+ var a = {
405
+ value: t ? r : 0
406
+ };
407
+ var i = {
408
+ value: t ? 0 : r
409
+ };
410
+ var s = {
411
+ precision: 1
412
+ };
413
+ // Only use precision when not using transform, otherwise transform animation will break
414
+ // Expansion doesn't require a valid value; the subsequent render animates it.
415
+ if (n === "expandWidth" || n === "expandHeight" || n === "none") {
416
+ return {
417
+ to: a,
418
+ config: s
419
+ };
420
+ }
421
+ // Slide transitions require a valid value, render without transition first.
422
+ if (!r) {
423
+ return null;
424
+ }
425
+ if (n !== "slideFromTop" && n !== "slideFromLeft") {
426
+ // Return the standard transition if not using a transform.
427
+ return {
428
+ to: a,
429
+ from: i,
430
+ config: s
431
+ };
432
+ }
433
+ // The top and left directions require an additional transform of their inner content to match the outer dimension animation.
434
+ // This is needed to achieve a clipping effect from the outer div, rather than the consumer providing their own.
435
+ var l = n === "slideFromTop" ? "Y" : "X";
436
+ var u = "translate".concat(l, "(").concat(t ? 0 : -r, "px)");
437
+ var c = "translate".concat(l, "(").concat(t ? -r : 0, "px)");
438
+ return {
439
+ to: S({
440
+ transform: u
441
+ }, a),
442
+ from: S({
443
+ transform: c
444
+ }, i)
445
+ };
446
+ }));
447
+ o.state = {
448
+ animating: e.animateOnMount ? e.open : false,
449
+ innerEl: null,
450
+ prevOpen: e.open
451
+ };
452
+ return o;
453
+ }
454
+ x(n, [ {
455
+ key: "componentDidUpdate",
456
+ value: function e() {
457
+ var t = this.getValue(this.state.innerEl);
458
+ if (this.state.value !== t && !this.state.animating) {
459
+ this.setState({
460
+ value: t
461
+ });
462
+ // eslint-disable-line react/no-did-update-set-state
463
+ }
464
+ }
465
+ }, {
466
+ key: "componentWillUnmount",
467
+ value: function e() {
468
+ this.allowAnimationUpdates = false;
469
+ }
470
+ }, {
471
+ key: "render",
472
+ value: function e() {
473
+ var t = this.props.animation;
474
+
475
+ return r().createElement(c.Spring, O({}, this.getSpringTransition(), {
476
+ immediate: t === "none",
477
+ onRest: this.handleRest
478
+ }), // eslint-disable-next-line @typescript-eslint/no-explicit-any
479
+ this.internalRender);
480
+ }
481
+ } ]);
482
+ return n;
483
+ }(n.Component);
484
+ R(M, "propTypes", q);
485
+ R(M, "defaultProps", D);
486
+ R(M, "getDerivedStateFromProps", (function(e, t) {
487
+ if (e.open !== t.prevOpen) {
488
+ return {
489
+ animating: true,
490
+ prevOpen: e.open
491
+ };
492
+ }
493
+ return null;
494
+ }));
495
+ /* harmony default export */ const W = M;
496
+ // CONCATENATED MODULE: ./src/TransitionOpen/index.ts
497
+ module.exports = t;
498
+ /******/})();