@entur/expand 3.6.13-beta.0 → 3.6.13-beta.3
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/dist/expand.cjs.js +3 -636
- package/dist/expand.cjs.js.map +1 -1
- package/dist/expand.esm.js +3 -636
- package/dist/expand.esm.js.map +1 -1
- package/package.json +6 -14
package/dist/expand.cjs.js
CHANGED
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const utils = require("@entur/utils");
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const React = require("react");
|
|
6
|
+
const classNames = require("classnames");
|
|
6
7
|
const typography = require("@entur/typography");
|
|
8
|
+
const reactCollapse = require("react-collapse");
|
|
7
9
|
const icons = require("@entur/icons");
|
|
8
10
|
const AccordionContext = React.createContext(null);
|
|
9
11
|
const Accordion = ({ ...rest }) => {
|
|
@@ -27,643 +29,8 @@ const useAccordion = ({ id, defaultOpen }) => {
|
|
|
27
29
|
toggle: () => setOpenId(isOpen ? null : id)
|
|
28
30
|
};
|
|
29
31
|
};
|
|
30
|
-
function getDefaultExportFromCjs(x) {
|
|
31
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
32
|
-
}
|
|
33
|
-
var classnames = { exports: {} };
|
|
34
|
-
/*!
|
|
35
|
-
Copyright (c) 2018 Jed Watson.
|
|
36
|
-
Licensed under the MIT License (MIT), see
|
|
37
|
-
http://jedwatson.github.io/classnames
|
|
38
|
-
*/
|
|
39
|
-
var hasRequiredClassnames;
|
|
40
|
-
function requireClassnames() {
|
|
41
|
-
if (hasRequiredClassnames) return classnames.exports;
|
|
42
|
-
hasRequiredClassnames = 1;
|
|
43
|
-
(function(module2) {
|
|
44
|
-
(function() {
|
|
45
|
-
var hasOwn = {}.hasOwnProperty;
|
|
46
|
-
function classNames2() {
|
|
47
|
-
var classes = "";
|
|
48
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
49
|
-
var arg = arguments[i];
|
|
50
|
-
if (arg) {
|
|
51
|
-
classes = appendClass(classes, parseValue(arg));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return classes;
|
|
55
|
-
}
|
|
56
|
-
function parseValue(arg) {
|
|
57
|
-
if (typeof arg === "string" || typeof arg === "number") {
|
|
58
|
-
return arg;
|
|
59
|
-
}
|
|
60
|
-
if (typeof arg !== "object") {
|
|
61
|
-
return "";
|
|
62
|
-
}
|
|
63
|
-
if (Array.isArray(arg)) {
|
|
64
|
-
return classNames2.apply(null, arg);
|
|
65
|
-
}
|
|
66
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
67
|
-
return arg.toString();
|
|
68
|
-
}
|
|
69
|
-
var classes = "";
|
|
70
|
-
for (var key in arg) {
|
|
71
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
72
|
-
classes = appendClass(classes, key);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return classes;
|
|
76
|
-
}
|
|
77
|
-
function appendClass(value, newClass) {
|
|
78
|
-
if (!newClass) {
|
|
79
|
-
return value;
|
|
80
|
-
}
|
|
81
|
-
if (value) {
|
|
82
|
-
return value + " " + newClass;
|
|
83
|
-
}
|
|
84
|
-
return value + newClass;
|
|
85
|
-
}
|
|
86
|
-
if (module2.exports) {
|
|
87
|
-
classNames2.default = classNames2;
|
|
88
|
-
module2.exports = classNames2;
|
|
89
|
-
} else {
|
|
90
|
-
window.classNames = classNames2;
|
|
91
|
-
}
|
|
92
|
-
})();
|
|
93
|
-
})(classnames);
|
|
94
|
-
return classnames.exports;
|
|
95
|
-
}
|
|
96
|
-
var classnamesExports = requireClassnames();
|
|
97
|
-
const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
|
|
98
|
-
var Collapse = {};
|
|
99
|
-
var hasRequiredCollapse;
|
|
100
|
-
function requireCollapse() {
|
|
101
|
-
if (hasRequiredCollapse) return Collapse;
|
|
102
|
-
hasRequiredCollapse = 1;
|
|
103
|
-
function _typeof(obj) {
|
|
104
|
-
"@babel/helpers - typeof";
|
|
105
|
-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
106
|
-
_typeof = function _typeof2(obj2) {
|
|
107
|
-
return typeof obj2;
|
|
108
|
-
};
|
|
109
|
-
} else {
|
|
110
|
-
_typeof = function _typeof2(obj2) {
|
|
111
|
-
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
return _typeof(obj);
|
|
115
|
-
}
|
|
116
|
-
Object.defineProperty(Collapse, "__esModule", {
|
|
117
|
-
value: true
|
|
118
|
-
});
|
|
119
|
-
Collapse.Collapse = void 0;
|
|
120
|
-
var _react = _interopRequireDefault(React);
|
|
121
|
-
function _interopRequireDefault(obj) {
|
|
122
|
-
return obj && obj.__esModule ? obj : { "default": obj };
|
|
123
|
-
}
|
|
124
|
-
function _classCallCheck(instance, Constructor) {
|
|
125
|
-
if (!(instance instanceof Constructor)) {
|
|
126
|
-
throw new TypeError("Cannot call a class as a function");
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
function _defineProperties(target, props) {
|
|
130
|
-
for (var i = 0; i < props.length; i++) {
|
|
131
|
-
var descriptor = props[i];
|
|
132
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
133
|
-
descriptor.configurable = true;
|
|
134
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
135
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
139
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
140
|
-
return Constructor;
|
|
141
|
-
}
|
|
142
|
-
function _inherits(subClass, superClass) {
|
|
143
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
144
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
145
|
-
}
|
|
146
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
|
147
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
148
|
-
}
|
|
149
|
-
function _setPrototypeOf(o, p) {
|
|
150
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
|
|
151
|
-
o2.__proto__ = p2;
|
|
152
|
-
return o2;
|
|
153
|
-
};
|
|
154
|
-
return _setPrototypeOf(o, p);
|
|
155
|
-
}
|
|
156
|
-
function _createSuper(Derived) {
|
|
157
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
158
|
-
return function _createSuperInternal() {
|
|
159
|
-
var Super = _getPrototypeOf(Derived), result;
|
|
160
|
-
if (hasNativeReflectConstruct) {
|
|
161
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
162
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
163
|
-
} else {
|
|
164
|
-
result = Super.apply(this, arguments);
|
|
165
|
-
}
|
|
166
|
-
return _possibleConstructorReturn(this, result);
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
function _possibleConstructorReturn(self, call) {
|
|
170
|
-
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
171
|
-
return call;
|
|
172
|
-
} else if (call !== void 0) {
|
|
173
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
174
|
-
}
|
|
175
|
-
return _assertThisInitialized(self);
|
|
176
|
-
}
|
|
177
|
-
function _assertThisInitialized(self) {
|
|
178
|
-
if (self === void 0) {
|
|
179
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
180
|
-
}
|
|
181
|
-
return self;
|
|
182
|
-
}
|
|
183
|
-
function _isNativeReflectConstruct() {
|
|
184
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
185
|
-
if (Reflect.construct.sham) return false;
|
|
186
|
-
if (typeof Proxy === "function") return true;
|
|
187
|
-
try {
|
|
188
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
189
|
-
}));
|
|
190
|
-
return true;
|
|
191
|
-
} catch (e) {
|
|
192
|
-
return false;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
function _getPrototypeOf(o) {
|
|
196
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
|
|
197
|
-
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
198
|
-
};
|
|
199
|
-
return _getPrototypeOf(o);
|
|
200
|
-
}
|
|
201
|
-
function _defineProperty(obj, key, value) {
|
|
202
|
-
if (key in obj) {
|
|
203
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
204
|
-
} else {
|
|
205
|
-
obj[key] = value;
|
|
206
|
-
}
|
|
207
|
-
return obj;
|
|
208
|
-
}
|
|
209
|
-
var Collapse$1 = /* @__PURE__ */ function(_React$Component) {
|
|
210
|
-
_inherits(Collapse2, _React$Component);
|
|
211
|
-
var _super = _createSuper(Collapse2);
|
|
212
|
-
function Collapse2(props) {
|
|
213
|
-
var _this;
|
|
214
|
-
_classCallCheck(this, Collapse2);
|
|
215
|
-
_this = _super.call(this, props);
|
|
216
|
-
_defineProperty(_assertThisInitialized(_this), "timeout", void 0);
|
|
217
|
-
_defineProperty(_assertThisInitialized(_this), "container", void 0);
|
|
218
|
-
_defineProperty(_assertThisInitialized(_this), "content", void 0);
|
|
219
|
-
_defineProperty(_assertThisInitialized(_this), "onResize", function() {
|
|
220
|
-
clearTimeout(_this.timeout);
|
|
221
|
-
if (!_this.container || !_this.content) {
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
var _this$props = _this.props, isOpened = _this$props.isOpened, checkTimeout = _this$props.checkTimeout;
|
|
225
|
-
var containerHeight = Math.floor(_this.container.clientHeight);
|
|
226
|
-
var contentHeight = Math.floor(_this.content.clientHeight);
|
|
227
|
-
var isFullyOpened = isOpened && Math.abs(contentHeight - containerHeight) <= 1;
|
|
228
|
-
var isFullyClosed = !isOpened && Math.abs(containerHeight) <= 1;
|
|
229
|
-
if (isFullyOpened || isFullyClosed) {
|
|
230
|
-
_this.onRest({
|
|
231
|
-
isFullyOpened,
|
|
232
|
-
isFullyClosed,
|
|
233
|
-
isOpened,
|
|
234
|
-
containerHeight,
|
|
235
|
-
contentHeight
|
|
236
|
-
});
|
|
237
|
-
} else {
|
|
238
|
-
_this.onWork({
|
|
239
|
-
isFullyOpened,
|
|
240
|
-
isFullyClosed,
|
|
241
|
-
isOpened,
|
|
242
|
-
containerHeight,
|
|
243
|
-
contentHeight
|
|
244
|
-
});
|
|
245
|
-
_this.timeout = setTimeout(function() {
|
|
246
|
-
return _this.onResize();
|
|
247
|
-
}, checkTimeout);
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
_defineProperty(_assertThisInitialized(_this), "onRest", function(_ref) {
|
|
251
|
-
var isFullyOpened = _ref.isFullyOpened, isFullyClosed = _ref.isFullyClosed, isOpened = _ref.isOpened, containerHeight = _ref.containerHeight, contentHeight = _ref.contentHeight;
|
|
252
|
-
if (!_this.container || !_this.content) {
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
var hasOpened = isOpened && _this.container.style.height === "".concat(contentHeight, "px");
|
|
256
|
-
var hasClosed = !isOpened && _this.container.style.height === "0px";
|
|
257
|
-
if (hasOpened || hasClosed) {
|
|
258
|
-
_this.container.style.overflow = isOpened ? "initial" : "hidden";
|
|
259
|
-
_this.container.style.height = isOpened ? "auto" : "0px";
|
|
260
|
-
var onRest = _this.props.onRest;
|
|
261
|
-
if (onRest) {
|
|
262
|
-
onRest({
|
|
263
|
-
isFullyOpened,
|
|
264
|
-
isFullyClosed,
|
|
265
|
-
isOpened,
|
|
266
|
-
containerHeight,
|
|
267
|
-
contentHeight
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
_defineProperty(_assertThisInitialized(_this), "onWork", function(_ref2) {
|
|
273
|
-
var isFullyOpened = _ref2.isFullyOpened, isFullyClosed = _ref2.isFullyClosed, isOpened = _ref2.isOpened, containerHeight = _ref2.containerHeight, contentHeight = _ref2.contentHeight;
|
|
274
|
-
if (!_this.container || !_this.content) {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
var isOpenining = isOpened && _this.container.style.height === "".concat(contentHeight, "px");
|
|
278
|
-
var isClosing = !isOpened && _this.container.style.height === "0px";
|
|
279
|
-
if (isOpenining || isClosing) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
_this.container.style.overflow = "hidden";
|
|
283
|
-
_this.container.style.height = isOpened ? "".concat(contentHeight, "px") : "0px";
|
|
284
|
-
var onWork = _this.props.onWork;
|
|
285
|
-
if (onWork) {
|
|
286
|
-
onWork({
|
|
287
|
-
isFullyOpened,
|
|
288
|
-
isFullyClosed,
|
|
289
|
-
isOpened,
|
|
290
|
-
containerHeight,
|
|
291
|
-
contentHeight
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
_defineProperty(_assertThisInitialized(_this), "onRefContainer", function(container) {
|
|
296
|
-
_this.container = container;
|
|
297
|
-
});
|
|
298
|
-
_defineProperty(_assertThisInitialized(_this), "onRefContent", function(content) {
|
|
299
|
-
_this.content = content;
|
|
300
|
-
});
|
|
301
|
-
if (props.initialStyle) {
|
|
302
|
-
_this.initialStyle = props.initialStyle;
|
|
303
|
-
} else {
|
|
304
|
-
_this.initialStyle = props.isOpened ? {
|
|
305
|
-
height: "auto",
|
|
306
|
-
overflow: "initial"
|
|
307
|
-
} : {
|
|
308
|
-
height: "0px",
|
|
309
|
-
overflow: "hidden"
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
return _this;
|
|
313
|
-
}
|
|
314
|
-
_createClass(Collapse2, [{
|
|
315
|
-
key: "componentDidMount",
|
|
316
|
-
value: function componentDidMount() {
|
|
317
|
-
this.onResize();
|
|
318
|
-
}
|
|
319
|
-
}, {
|
|
320
|
-
key: "shouldComponentUpdate",
|
|
321
|
-
value: function shouldComponentUpdate(nextProps) {
|
|
322
|
-
var _this$props2 = this.props, theme = _this$props2.theme, isOpened = _this$props2.isOpened, children = _this$props2.children;
|
|
323
|
-
return children !== nextProps.children || isOpened !== nextProps.isOpened || Object.keys(theme).some(function(c) {
|
|
324
|
-
return theme[c] !== nextProps.theme[c];
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
}, {
|
|
328
|
-
key: "getSnapshotBeforeUpdate",
|
|
329
|
-
value: function getSnapshotBeforeUpdate() {
|
|
330
|
-
if (!this.container || !this.content) {
|
|
331
|
-
return null;
|
|
332
|
-
}
|
|
333
|
-
if (this.container.style.height === "auto") {
|
|
334
|
-
var contentHeight = this.content.clientHeight;
|
|
335
|
-
this.container.style.height = "".concat(contentHeight, "px");
|
|
336
|
-
}
|
|
337
|
-
return null;
|
|
338
|
-
}
|
|
339
|
-
}, {
|
|
340
|
-
key: "componentDidUpdate",
|
|
341
|
-
value: function componentDidUpdate() {
|
|
342
|
-
this.onResize();
|
|
343
|
-
}
|
|
344
|
-
}, {
|
|
345
|
-
key: "componentWillUnmount",
|
|
346
|
-
value: function componentWillUnmount() {
|
|
347
|
-
clearTimeout(this.timeout);
|
|
348
|
-
}
|
|
349
|
-
}, {
|
|
350
|
-
key: "render",
|
|
351
|
-
value: function render() {
|
|
352
|
-
var _this$props3 = this.props, theme = _this$props3.theme, children = _this$props3.children, isOpened = _this$props3.isOpened;
|
|
353
|
-
return /* @__PURE__ */ _react["default"].createElement("div", {
|
|
354
|
-
ref: this.onRefContainer,
|
|
355
|
-
className: theme.collapse,
|
|
356
|
-
style: this.initialStyle,
|
|
357
|
-
"aria-hidden": !isOpened
|
|
358
|
-
}, /* @__PURE__ */ _react["default"].createElement("div", {
|
|
359
|
-
ref: this.onRefContent,
|
|
360
|
-
className: theme.content
|
|
361
|
-
}, children));
|
|
362
|
-
}
|
|
363
|
-
}]);
|
|
364
|
-
return Collapse2;
|
|
365
|
-
}(_react["default"].Component);
|
|
366
|
-
Collapse.Collapse = Collapse$1;
|
|
367
|
-
_defineProperty(Collapse$1, "defaultProps", {
|
|
368
|
-
theme: {
|
|
369
|
-
collapse: "ReactCollapse--collapse",
|
|
370
|
-
content: "ReactCollapse--content"
|
|
371
|
-
},
|
|
372
|
-
initialStyle: void 0,
|
|
373
|
-
onRest: void 0,
|
|
374
|
-
onWork: void 0,
|
|
375
|
-
checkTimeout: 50
|
|
376
|
-
});
|
|
377
|
-
return Collapse;
|
|
378
|
-
}
|
|
379
|
-
var UnmountClosed = {};
|
|
380
|
-
var hasRequiredUnmountClosed;
|
|
381
|
-
function requireUnmountClosed() {
|
|
382
|
-
if (hasRequiredUnmountClosed) return UnmountClosed;
|
|
383
|
-
hasRequiredUnmountClosed = 1;
|
|
384
|
-
function _typeof(obj) {
|
|
385
|
-
"@babel/helpers - typeof";
|
|
386
|
-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
387
|
-
_typeof = function _typeof2(obj2) {
|
|
388
|
-
return typeof obj2;
|
|
389
|
-
};
|
|
390
|
-
} else {
|
|
391
|
-
_typeof = function _typeof2(obj2) {
|
|
392
|
-
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
return _typeof(obj);
|
|
396
|
-
}
|
|
397
|
-
Object.defineProperty(UnmountClosed, "__esModule", {
|
|
398
|
-
value: true
|
|
399
|
-
});
|
|
400
|
-
UnmountClosed.UnmountClosed = void 0;
|
|
401
|
-
var _react = _interopRequireDefault(React);
|
|
402
|
-
var _Collapse = requireCollapse();
|
|
403
|
-
var _excluded = ["isOpened"], _excluded2 = ["isOpened"];
|
|
404
|
-
function _interopRequireDefault(obj) {
|
|
405
|
-
return obj && obj.__esModule ? obj : { "default": obj };
|
|
406
|
-
}
|
|
407
|
-
function _extends() {
|
|
408
|
-
_extends = Object.assign || function(target) {
|
|
409
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
410
|
-
var source = arguments[i];
|
|
411
|
-
for (var key in source) {
|
|
412
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
413
|
-
target[key] = source[key];
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
return target;
|
|
418
|
-
};
|
|
419
|
-
return _extends.apply(this, arguments);
|
|
420
|
-
}
|
|
421
|
-
function ownKeys(object, enumerableOnly) {
|
|
422
|
-
var keys = Object.keys(object);
|
|
423
|
-
if (Object.getOwnPropertySymbols) {
|
|
424
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
425
|
-
if (enumerableOnly) {
|
|
426
|
-
symbols = symbols.filter(function(sym) {
|
|
427
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
keys.push.apply(keys, symbols);
|
|
431
|
-
}
|
|
432
|
-
return keys;
|
|
433
|
-
}
|
|
434
|
-
function _objectSpread(target) {
|
|
435
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
436
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
437
|
-
if (i % 2) {
|
|
438
|
-
ownKeys(Object(source), true).forEach(function(key) {
|
|
439
|
-
_defineProperty(target, key, source[key]);
|
|
440
|
-
});
|
|
441
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
442
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
443
|
-
} else {
|
|
444
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
445
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
return target;
|
|
450
|
-
}
|
|
451
|
-
function _objectWithoutProperties(source, excluded) {
|
|
452
|
-
if (source == null) return {};
|
|
453
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
454
|
-
var key, i;
|
|
455
|
-
if (Object.getOwnPropertySymbols) {
|
|
456
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
457
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
458
|
-
key = sourceSymbolKeys[i];
|
|
459
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
460
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
461
|
-
target[key] = source[key];
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
return target;
|
|
465
|
-
}
|
|
466
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
467
|
-
if (source == null) return {};
|
|
468
|
-
var target = {};
|
|
469
|
-
var sourceKeys = Object.keys(source);
|
|
470
|
-
var key, i;
|
|
471
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
472
|
-
key = sourceKeys[i];
|
|
473
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
474
|
-
target[key] = source[key];
|
|
475
|
-
}
|
|
476
|
-
return target;
|
|
477
|
-
}
|
|
478
|
-
function _classCallCheck(instance, Constructor) {
|
|
479
|
-
if (!(instance instanceof Constructor)) {
|
|
480
|
-
throw new TypeError("Cannot call a class as a function");
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
function _defineProperties(target, props) {
|
|
484
|
-
for (var i = 0; i < props.length; i++) {
|
|
485
|
-
var descriptor = props[i];
|
|
486
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
487
|
-
descriptor.configurable = true;
|
|
488
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
489
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
493
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
494
|
-
return Constructor;
|
|
495
|
-
}
|
|
496
|
-
function _inherits(subClass, superClass) {
|
|
497
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
498
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
499
|
-
}
|
|
500
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
|
501
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
502
|
-
}
|
|
503
|
-
function _setPrototypeOf(o, p) {
|
|
504
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
|
|
505
|
-
o2.__proto__ = p2;
|
|
506
|
-
return o2;
|
|
507
|
-
};
|
|
508
|
-
return _setPrototypeOf(o, p);
|
|
509
|
-
}
|
|
510
|
-
function _createSuper(Derived) {
|
|
511
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
512
|
-
return function _createSuperInternal() {
|
|
513
|
-
var Super = _getPrototypeOf(Derived), result;
|
|
514
|
-
if (hasNativeReflectConstruct) {
|
|
515
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
516
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
517
|
-
} else {
|
|
518
|
-
result = Super.apply(this, arguments);
|
|
519
|
-
}
|
|
520
|
-
return _possibleConstructorReturn(this, result);
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
function _possibleConstructorReturn(self, call) {
|
|
524
|
-
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
525
|
-
return call;
|
|
526
|
-
} else if (call !== void 0) {
|
|
527
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
528
|
-
}
|
|
529
|
-
return _assertThisInitialized(self);
|
|
530
|
-
}
|
|
531
|
-
function _assertThisInitialized(self) {
|
|
532
|
-
if (self === void 0) {
|
|
533
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
534
|
-
}
|
|
535
|
-
return self;
|
|
536
|
-
}
|
|
537
|
-
function _isNativeReflectConstruct() {
|
|
538
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
539
|
-
if (Reflect.construct.sham) return false;
|
|
540
|
-
if (typeof Proxy === "function") return true;
|
|
541
|
-
try {
|
|
542
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
543
|
-
}));
|
|
544
|
-
return true;
|
|
545
|
-
} catch (e) {
|
|
546
|
-
return false;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
function _getPrototypeOf(o) {
|
|
550
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
|
|
551
|
-
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
552
|
-
};
|
|
553
|
-
return _getPrototypeOf(o);
|
|
554
|
-
}
|
|
555
|
-
function _defineProperty(obj, key, value) {
|
|
556
|
-
if (key in obj) {
|
|
557
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
558
|
-
} else {
|
|
559
|
-
obj[key] = value;
|
|
560
|
-
}
|
|
561
|
-
return obj;
|
|
562
|
-
}
|
|
563
|
-
var UnmountClosed$1 = /* @__PURE__ */ function(_React$PureComponent) {
|
|
564
|
-
_inherits(UnmountClosed2, _React$PureComponent);
|
|
565
|
-
var _super = _createSuper(UnmountClosed2);
|
|
566
|
-
function UnmountClosed2(props) {
|
|
567
|
-
var _this;
|
|
568
|
-
_classCallCheck(this, UnmountClosed2);
|
|
569
|
-
_this = _super.call(this, props);
|
|
570
|
-
_defineProperty(_assertThisInitialized(_this), "onWork", function(_ref) {
|
|
571
|
-
var isOpened = _ref.isOpened, rest = _objectWithoutProperties(_ref, _excluded);
|
|
572
|
-
_this.setState({
|
|
573
|
-
isResting: false,
|
|
574
|
-
isOpened
|
|
575
|
-
});
|
|
576
|
-
var onWork = _this.props.onWork;
|
|
577
|
-
if (onWork) {
|
|
578
|
-
onWork(_objectSpread({
|
|
579
|
-
isOpened
|
|
580
|
-
}, rest));
|
|
581
|
-
}
|
|
582
|
-
});
|
|
583
|
-
_defineProperty(_assertThisInitialized(_this), "onRest", function(_ref2) {
|
|
584
|
-
var isOpened = _ref2.isOpened, rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
585
|
-
_this.setState({
|
|
586
|
-
isResting: true,
|
|
587
|
-
isOpened,
|
|
588
|
-
isInitialRender: false
|
|
589
|
-
});
|
|
590
|
-
var onRest = _this.props.onRest;
|
|
591
|
-
if (onRest) {
|
|
592
|
-
onRest(_objectSpread({
|
|
593
|
-
isOpened
|
|
594
|
-
}, rest));
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
_defineProperty(_assertThisInitialized(_this), "getInitialStyle", function() {
|
|
598
|
-
var _this$state = _this.state, isOpened = _this$state.isOpened, isInitialRender = _this$state.isInitialRender;
|
|
599
|
-
if (isInitialRender) {
|
|
600
|
-
return isOpened ? {
|
|
601
|
-
height: "auto",
|
|
602
|
-
overflow: "initial"
|
|
603
|
-
} : {
|
|
604
|
-
height: "0px",
|
|
605
|
-
overflow: "hidden"
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
|
-
return {
|
|
609
|
-
height: "0px",
|
|
610
|
-
overflow: "hidden"
|
|
611
|
-
};
|
|
612
|
-
});
|
|
613
|
-
_this.state = {
|
|
614
|
-
isResting: true,
|
|
615
|
-
isOpened: props.isOpened,
|
|
616
|
-
isInitialRender: true
|
|
617
|
-
};
|
|
618
|
-
return _this;
|
|
619
|
-
}
|
|
620
|
-
_createClass(UnmountClosed2, [{
|
|
621
|
-
key: "componentDidUpdate",
|
|
622
|
-
value: function componentDidUpdate(prevProps) {
|
|
623
|
-
var isOpened = this.props.isOpened;
|
|
624
|
-
if (prevProps.isOpened !== isOpened) {
|
|
625
|
-
this.setState({
|
|
626
|
-
isResting: false,
|
|
627
|
-
isOpened,
|
|
628
|
-
isInitialRender: false
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
}, {
|
|
633
|
-
key: "render",
|
|
634
|
-
value: function render() {
|
|
635
|
-
var _this$state2 = this.state, isResting = _this$state2.isResting, isOpened = _this$state2.isOpened;
|
|
636
|
-
return isResting && !isOpened ? null : /* @__PURE__ */ _react["default"].createElement(_Collapse.Collapse, _extends({}, this.props, {
|
|
637
|
-
initialStyle: this.getInitialStyle(),
|
|
638
|
-
onWork: this.onWork,
|
|
639
|
-
onRest: this.onRest
|
|
640
|
-
}));
|
|
641
|
-
}
|
|
642
|
-
}]);
|
|
643
|
-
return UnmountClosed2;
|
|
644
|
-
}(_react["default"].PureComponent);
|
|
645
|
-
UnmountClosed.UnmountClosed = UnmountClosed$1;
|
|
646
|
-
_defineProperty(UnmountClosed$1, "defaultProps", {
|
|
647
|
-
onWork: void 0,
|
|
648
|
-
onRest: void 0
|
|
649
|
-
});
|
|
650
|
-
return UnmountClosed;
|
|
651
|
-
}
|
|
652
|
-
var lib;
|
|
653
|
-
var hasRequiredLib;
|
|
654
|
-
function requireLib() {
|
|
655
|
-
if (hasRequiredLib) return lib;
|
|
656
|
-
hasRequiredLib = 1;
|
|
657
|
-
var _require = requireCollapse(), Collapse2 = _require.Collapse;
|
|
658
|
-
var _require2 = requireUnmountClosed(), UnmountClosed2 = _require2.UnmountClosed;
|
|
659
|
-
lib = UnmountClosed2;
|
|
660
|
-
UnmountClosed2.Collapse = Collapse2;
|
|
661
|
-
UnmountClosed2.UnmountClosed = UnmountClosed2;
|
|
662
|
-
return lib;
|
|
663
|
-
}
|
|
664
|
-
var libExports = requireLib();
|
|
665
32
|
const BaseExpand = ({ open, ...rest }) => {
|
|
666
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
33
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactCollapse.UnmountClosed, { isOpened: open, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest }) });
|
|
667
34
|
};
|
|
668
35
|
const ExpandArrow = ({
|
|
669
36
|
open = false,
|