@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.
- package/Accordion.js +425 -325
- package/Anchor.js +147 -117
- package/Animation.js +142 -94
- package/AnimationToggle.js +197 -193
- package/Box.js +145 -118
- package/Breadcrumbs.js +288 -206
- package/Button.js +488 -465
- package/ButtonGroup.js +160 -128
- package/ButtonSimple.js +543 -462
- package/CHANGELOG.md +24 -3
- package/Calendar.js +1111 -1001
- package/Card.js +771 -598
- package/CardLayout.js +205 -147
- package/Chip.js +509 -488
- package/Clickable.js +414 -352
- package/CloseButton.js +165 -142
- package/Code.js +1807 -2084
- package/CollapsiblePanel.js +586 -519
- package/Color.js +1068 -1068
- package/ColumnLayout.js +402 -363
- package/ComboBox.js +903 -794
- package/Concertina.js +997 -802
- package/ControlGroup.js +687 -594
- package/Date.js +567 -547
- package/DefinitionList.js +308 -234
- package/Divider.js +149 -118
- package/Dropdown.js +459 -416
- package/DualListbox.js +1479 -1541
- package/EventListener.js +94 -97
- package/File.js +1051 -969
- package/FormRows.js +883 -696
- package/Heading.js +216 -193
- package/Image.js +446 -402
- package/JSONTree.js +690 -551
- package/Layer.js +437 -410
- package/Link.js +336 -255
- package/List.js +213 -161
- package/Markdown.js +509 -487
- package/Menu.js +1104 -1056
- package/Message.js +475 -441
- package/MessageBar.js +387 -373
- package/Modal.js +810 -634
- package/ModalLayer.js +326 -243
- package/Monogram.js +308 -276
- package/Multiselect.js +3564 -3364
- package/Number.js +729 -687
- package/Paginator.js +510 -449
- package/Paragraph.js +145 -112
- package/Popover.js +1459 -1432
- package/Progress.js +301 -246
- package/RadioBar.js +634 -527
- package/RadioList.js +483 -444
- package/Resize.js +530 -489
- package/ResultsMenu.js +479 -455
- package/ScreenReaderContent.js +142 -111
- package/Scroll.js +595 -456
- package/ScrollContainerContext.js +197 -206
- package/Search.js +756 -650
- package/Select.js +2446 -2345
- package/SidePanel.js +390 -284
- package/Slider.js +680 -676
- package/SlidingPanels.js +639 -503
- package/SplitButton.js +464 -367
- package/StaticContent.js +161 -133
- package/StepBar.js +386 -358
- package/Switch.js +710 -640
- package/TabBar.js +741 -680
- package/TabLayout.js +406 -322
- package/Table.js +4974 -4616
- package/Text.js +1170 -1138
- package/TextArea.js +1102 -1090
- package/Tooltip.js +624 -581
- package/TransitionOpen.js +489 -422
- package/Typography.js +176 -153
- package/WaitSpinner.js +230 -206
- package/package.json +7 -7
- package/types/src/Color/Color.d.ts +0 -1
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/types/src/RadioBar/RadioBar.d.ts +1 -0
- package/types/src/ResultsMenu/ResultsMenu.d.ts +0 -2
- package/types/src/Select/docs/examples/Icons.d.ts +1 -9
- package/types/src/Slider/Slider.d.ts +1 -0
- package/types/src/TabBar/Tab.d.ts +10 -1
- package/types/src/TabBar/TabBar.d.ts +4 -2
- package/types/src/Table/Head.d.ts +7 -3
- package/types/src/Table/Table.d.ts +3 -2
- package/types/src/Table/TableContext.d.ts +2 -0
- package/useForceUpdate.js +112 -82
- package/useKeyPress.js +74 -71
- package/usePrevious.js +65 -65
- package/useRovingFocus.js +122 -138
package/TransitionOpen.js
CHANGED
|
@@ -1,431 +1,498 @@
|
|
|
1
|
-
/******/ (() => {
|
|
2
|
-
|
|
3
|
-
/******/
|
|
4
|
-
/******/
|
|
5
|
-
/******/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/******/
|
|
9
|
-
/******/
|
|
10
|
-
/******/
|
|
11
|
-
/******/
|
|
12
|
-
/******/
|
|
13
|
-
/******/
|
|
14
|
-
/******/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/******/
|
|
20
|
-
/******/
|
|
21
|
-
/******/
|
|
22
|
-
/******/
|
|
23
|
-
/******/
|
|
24
|
-
/******/
|
|
25
|
-
/******/
|
|
26
|
-
/******/
|
|
27
|
-
/******/
|
|
28
|
-
/******/
|
|
29
|
-
/******/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/******/
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/
|
|
37
|
-
/******/
|
|
38
|
-
/******/
|
|
39
|
-
/******/
|
|
40
|
-
/******/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/******/
|
|
44
|
-
/******/
|
|
45
|
-
/******/
|
|
46
|
-
/******/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
function
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
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
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
return
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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
|
-
|
|
392
|
-
|
|
393
|
-
|
|
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
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
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
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
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
|
-
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
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
|
+
/******/})();
|