funda-ui 4.7.545 → 4.7.555

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.
@@ -11,569 +11,6 @@
11
11
  return /******/ (() => { // webpackBootstrap
12
12
  /******/ var __webpack_modules__ = ({
13
13
 
14
- /***/ 993:
15
- /***/ (function(module, exports, __webpack_require__) {
16
-
17
- /* module decorator */ module = __webpack_require__.nmd(module);
18
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
19
- (function webpackUniversalModuleDefinition(root, factory) {
20
- if (( false ? 0 : _typeof2(exports)) === 'object' && ( false ? 0 : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
21
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
22
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
23
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
24
- })(this, function () {
25
- return (/******/function () {
26
- // webpackBootstrap
27
- /******/
28
- "use strict";
29
-
30
- /******/
31
- var __webpack_modules__ = {
32
- /***/357: /***/function _(__unused_webpack_module, __webpack_exports__, __nested_webpack_require_1061__) {
33
- /* harmony export */__nested_webpack_require_1061__.d(__webpack_exports__, {
34
- /* harmony export */"easeInOutQuad": function easeInOutQuad() {
35
- return (/* binding */_easeInOutQuad
36
- );
37
- },
38
- /* harmony export */"easeInQuad": function easeInQuad() {
39
- return (/* binding */_easeInQuad
40
- );
41
- },
42
- /* harmony export */"easeLinear": function easeLinear() {
43
- return (/* binding */_easeLinear
44
- );
45
- },
46
- /* harmony export */"easeOutQuad": function easeOutQuad() {
47
- return (/* binding */_easeOutQuad
48
- );
49
- }
50
- /* harmony export */
51
- });
52
- /* unused harmony exports easeInSine, easeOutSine, easeInOutSine, easeInExpo, easeOutExpo, easeInOutExpo, easeInCirc, easeOutCirc, easeInOutCirc, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint, easeInElastic, easeOutElastic, easeInOutElastic, easeInBack, easeOutBack, easeInOutBack */
53
- /*
54
- * All easing functions
55
- * @link: https://easings.net
56
- * @param {Number} t - time (Amount of time that has passed since the beginning of the animation. Usually starts at 0 and is slowly increased using a game loop or other update function.)
57
- * @param {Number} b - beginning value (The starting point of the animation. Usually it's a static value, you can start at 0 for example.)
58
- * @param {Number} c - change in value (The amount of change needed to go from starting point to end point. It's also usually a static value.)
59
- * @param {Number} d - duration (Amount of time the animation will take. Usually a static value aswell.)
60
- * @return {number}
61
- */
62
- function _easeLinear(t, b, c, d) {
63
- return c * t / d + b;
64
- }
65
- function _easeInQuad(t, b, c, d) {
66
- return c * (t /= d) * t + b;
67
- }
68
- function _easeOutQuad(t, b, c, d) {
69
- return -c * (t /= d) * (t - 2) + b;
70
- }
71
- function _easeInOutQuad(t, b, c, d) {
72
- if ((t /= d / 2) < 1) return c / 2 * t * t + b;
73
- return -c / 2 * (--t * (t - 2) - 1) + b;
74
- }
75
- function easeInSine(t, b, c, d) {
76
- return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
77
- }
78
- function easeOutSine(t, b, c, d) {
79
- return c * Math.sin(t / d * (Math.PI / 2)) + b;
80
- }
81
- function easeInOutSine(t, b, c, d) {
82
- return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
83
- }
84
- function easeInExpo(t, b, c, d) {
85
- return t == 0 ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
86
- }
87
- function easeOutExpo(t, b, c, d) {
88
- return t == d ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
89
- }
90
- function easeInOutExpo(t, b, c, d) {
91
- if (t == 0) return b;
92
- if (t == d) return b + c;
93
- if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
94
- return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
95
- }
96
- function easeInCirc(t, b, c, d) {
97
- return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
98
- }
99
- function easeOutCirc(t, b, c, d) {
100
- return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
101
- }
102
- function easeInOutCirc(t, b, c, d) {
103
- if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
104
- return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
105
- }
106
- function easeInCubic(t, b, c, d) {
107
- return c * (t /= d) * t * t + b;
108
- }
109
- function easeOutCubic(t, b, c, d) {
110
- return c * ((t = t / d - 1) * t * t + 1) + b;
111
- }
112
- function easeInOutCubic(t, b, c, d) {
113
- if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
114
- return c / 2 * ((t -= 2) * t * t + 2) + b;
115
- }
116
- function easeInQuart(t, b, c, d) {
117
- return c * (t /= d) * t * t * t + b;
118
- }
119
- function easeOutQuart(t, b, c, d) {
120
- return -c * ((t = t / d - 1) * t * t * t - 1) + b;
121
- }
122
- function easeInOutQuart(t, b, c, d) {
123
- if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
124
- return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
125
- }
126
- function easeInQuint(t, b, c, d) {
127
- return c * (t /= d) * t * t * t * t + b;
128
- }
129
- function easeOutQuint(t, b, c, d) {
130
- return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
131
- }
132
- function easeInOutQuint(t, b, c, d) {
133
- if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
134
- return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
135
- }
136
- function easeInElastic(t, b, c, d) {
137
- var s = 1.70158;
138
- var p = 0;
139
- var a = c;
140
- if (t == 0) return b;
141
- if ((t /= d) == 1) return b + c;
142
- if (!p) p = d * .3;
143
- if (a < Math.abs(c)) {
144
- a = c;
145
- var s = p / 4;
146
- } else var s = p / (2 * Math.PI) * Math.asin(c / a);
147
- return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
148
- }
149
- function easeOutElastic(t, b, c, d) {
150
- var s = 1.70158;
151
- var p = 0;
152
- var a = c;
153
- if (t == 0) return b;
154
- if ((t /= d) == 1) return b + c;
155
- if (!p) p = d * .3;
156
- if (a < Math.abs(c)) {
157
- a = c;
158
- var s = p / 4;
159
- } else var s = p / (2 * Math.PI) * Math.asin(c / a);
160
- return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
161
- }
162
- function easeInOutElastic(t, b, c, d) {
163
- var s = 1.70158;
164
- var p = 0;
165
- var a = c;
166
- if (t == 0) return b;
167
- if ((t /= d / 2) == 2) return b + c;
168
- if (!p) p = d * (.3 * 1.5);
169
- if (a < Math.abs(c)) {
170
- a = c;
171
- var s = p / 4;
172
- } else var s = p / (2 * Math.PI) * Math.asin(c / a);
173
- if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
174
- return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
175
- }
176
- function easeInBack(t, b, c, d) {
177
- var s = 1.70158;
178
- if (s == undefined) s = 1.70158;
179
- return c * (t /= d) * t * ((s + 1) * t - s) + b;
180
- }
181
- function easeOutBack(t, b, c, d) {
182
- var s = 1.70158;
183
- if (s == undefined) s = 1.70158;
184
- return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
185
- }
186
- function easeInOutBack(t, b, c, d) {
187
- var s = 1.70158;
188
- if (s == undefined) s = 1.70158;
189
- if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
190
- return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;
191
- }
192
-
193
- /***/
194
- },
195
-
196
- /***/65: /***/function _(__unused_webpack_module, __webpack_exports__, __nested_webpack_require_8432__) {
197
- /* harmony export */__nested_webpack_require_8432__.d(__webpack_exports__, {
198
- /* harmony export */"setDefaultOptions": function setDefaultOptions() {
199
- return (/* binding */_setDefaultOptions
200
- );
201
- }
202
- /* harmony export */
203
- });
204
- /* harmony import */
205
- var _validate__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_8432__(258);
206
- function _typeof(obj) {
207
- "@babel/helpers - typeof";
208
-
209
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
210
- return typeof obj;
211
- } : function (obj) {
212
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
213
- }, _typeof(obj);
214
- }
215
-
216
- /**
217
- * Set a default JSON format configuration
218
- *
219
- * @param {*} props - Set some default keys and values.
220
- * @param {*} options - A JSON variable passed in from outside, including key and value.
221
- * @return {JSON} - Merge the new and old values.
222
- */
223
- function _setDefaultOptions(props, options) {
224
- if (_typeof(options) === ( true ? "undefined" : 0) || options === null || options === false) options = {};
225
- //Set a default configuration
226
- if ((0, _validate__WEBPACK_IMPORTED_MODULE_0__.isJSON)(props)) {
227
- var defaultConfigValues = Object.values(props);
228
- Object.keys(props).forEach(function (prop, index) {
229
- // Well-formed string type
230
- Object.keys(options).forEach(function (prop2, index2) {
231
- if (prop2 === prop) {
232
- var _v = options[prop2];
233
- if (_v == 'true') _v = true;
234
- if (_v == 'false') _v = false;
235
- if ((0, _validate__WEBPACK_IMPORTED_MODULE_0__.isValidNumeric)(_v)) _v = parseFloat(_v);
236
- if ((0, _validate__WEBPACK_IMPORTED_MODULE_0__.isJSON)(_v)) _v = Object.prototype.toString.call(_v) === '[object Object]' ? _v : JSON.parse(_v);
237
- options[prop2] = _v;
238
- }
239
- });
240
-
241
- //
242
- if (_typeof(options[prop]) === ( true ? "undefined" : 0) || options[prop] === null) options[prop] = defaultConfigValues[index];
243
- });
244
- }
245
- return options;
246
- }
247
-
248
- /***/
249
- },
250
-
251
- /***/258: /***/function _(__unused_webpack_module, __webpack_exports__, __nested_webpack_require_11060__) {
252
- /* harmony export */__nested_webpack_require_11060__.d(__webpack_exports__, {
253
- /* harmony export */"isJSON": function isJSON() {
254
- return (/* binding */_isJSON
255
- );
256
- },
257
- /* harmony export */"isValidNumeric": function isValidNumeric() {
258
- return (/* binding */_isValidNumeric
259
- );
260
- }
261
- /* harmony export */
262
- });
263
- /* unused harmony exports isEmpty, isNumber, isInt, isEmail, isTel, isMobile */
264
- function _typeof(obj) {
265
- "@babel/helpers - typeof";
266
-
267
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
268
- return typeof obj;
269
- } : function (obj) {
270
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
271
- }, _typeof(obj);
272
- }
273
- /**
274
- * Check if a string is a valid number
275
- * @param str - The string to check
276
- * @returns boolean indicating if the string is a valid number
277
- */
278
- function _isValidNumeric(str) {
279
- if (typeof str !== "string") return false; // we only process strings!
280
- if (!isNaN(Number(str)) &&
281
- // use type coercion to parse the _entirety_ of the string
282
- !isNaN(parseFloat(str)) // ensure strings of whitespace fail
283
- ) {
284
- return true;
285
- }
286
- return false;
287
- }
288
-
289
- /**
290
- * Determine whether it is in JSON format
291
- * @param str - The value to check
292
- * @returns boolean indicating if the value is valid JSON
293
- */
294
- function _isJSON(str) {
295
- if (typeof str === 'string' && str.length > 0) {
296
- if (str.replace(/\"\"/g, '').replace(/\,/g, '') === '[{}]') {
297
- return false;
298
- }
299
- if (/^[\],:{}\s]*$/.test(str.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
300
- return true;
301
- }
302
- return false;
303
- }
304
- if (_typeof(str) === 'object' && Object.prototype.toString.call(str) === '[object Object]' && !str.length) {
305
- return true;
306
- }
307
- return false;
308
- }
309
-
310
- /**
311
- * Check if input is empty
312
- * @param input - The input to check (string or array of strings)
313
- * @returns boolean indicating if the input is empty
314
- */
315
- function isEmpty(input) {
316
- if (Array.isArray(input)) {
317
- return input.some(function (str) {
318
- return !str.replace(/\s/g, '').length === true;
319
- });
320
- }
321
- return !input.replace(/\s/g, '').length === true;
322
- }
323
-
324
- /**
325
- * Check if input is a valid number
326
- * @param input - The input to check
327
- * @returns boolean indicating if the input is a valid number
328
- */
329
- function isNumber(input) {
330
- var reg = /^[\d|\.|,]+$/;
331
- return reg.test(input);
332
- }
333
-
334
- /**
335
- * Check if input is a valid integer
336
- * @param input - The input to check
337
- * @returns boolean indicating if the input is a valid integer
338
- */
339
- function isInt(input) {
340
- if (input === "") {
341
- return false;
342
- }
343
- var reg = /\D+/;
344
- return !reg.test(input);
345
- }
346
-
347
- /**
348
- * Check if input is a valid email address
349
- * @param input - The input to check
350
- * @returns boolean indicating if the input is a valid email
351
- */
352
- function isEmail(input) {
353
- var reg = /^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
354
- return reg.test(input);
355
- }
356
-
357
- /**
358
- * Check if input is a valid telephone number
359
- * @param input - The input to check
360
- * @returns boolean indicating if the input is a valid telephone number
361
- */
362
- function isTel(input) {
363
- var reg = /^[0-9- ]{7,20}$/;
364
- return reg.test(input);
365
- }
366
-
367
- /**
368
- * Check if input is a valid mobile number
369
- * @param input - The input to check
370
- * @returns boolean indicating if the input is a valid mobile number
371
- */
372
- function isMobile(input) {
373
- var reg = /^1[0-9]{10}$/;
374
- return reg.test(input);
375
- }
376
-
377
- /***/
378
- }
379
-
380
- /******/
381
- };
382
- /************************************************************************/
383
- /******/ // The module cache
384
- /******/
385
- var __webpack_module_cache__ = {};
386
- /******/
387
- /******/ // The require function
388
- /******/
389
- function __nested_webpack_require_16046__(moduleId) {
390
- /******/ // Check if module is in cache
391
- /******/var cachedModule = __webpack_module_cache__[moduleId];
392
- /******/
393
- if (cachedModule !== undefined) {
394
- /******/return cachedModule.exports;
395
- /******/
396
- }
397
- /******/ // Create a new module (and put it into the cache)
398
- /******/
399
- var module = __webpack_module_cache__[moduleId] = {
400
- /******/ // no module.id needed
401
- /******/ // no module.loaded needed
402
- /******/exports: {}
403
- /******/
404
- };
405
- /******/
406
- /******/ // Execute the module function
407
- /******/
408
- __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_16046__);
409
- /******/
410
- /******/ // Return the exports of the module
411
- /******/
412
- return module.exports;
413
- /******/
414
- }
415
- /******/
416
- /************************************************************************/
417
- /******/ /* webpack/runtime/define property getters */
418
- /******/
419
- (function () {
420
- /******/ // define getter functions for harmony exports
421
- /******/__nested_webpack_require_16046__.d = function (exports, definition) {
422
- /******/for (var key in definition) {
423
- /******/if (__nested_webpack_require_16046__.o(definition, key) && !__nested_webpack_require_16046__.o(exports, key)) {
424
- /******/Object.defineProperty(exports, key, {
425
- enumerable: true,
426
- get: definition[key]
427
- });
428
- /******/
429
- }
430
- /******/
431
- }
432
- /******/
433
- };
434
- /******/
435
- })();
436
- /******/
437
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
438
- /******/
439
- (function () {
440
- /******/__nested_webpack_require_16046__.o = function (obj, prop) {
441
- return Object.prototype.hasOwnProperty.call(obj, prop);
442
- };
443
- /******/
444
- })();
445
- /******/
446
- /******/ /* webpack/runtime/make namespace object */
447
- /******/
448
- (function () {
449
- /******/ // define __esModule on exports
450
- /******/__nested_webpack_require_16046__.r = function (exports) {
451
- /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
452
- /******/Object.defineProperty(exports, Symbol.toStringTag, {
453
- value: 'Module'
454
- });
455
- /******/
456
- }
457
- /******/
458
- Object.defineProperty(exports, '__esModule', {
459
- value: true
460
- });
461
- /******/
462
- };
463
- /******/
464
- })();
465
- /******/
466
- /************************************************************************/
467
- var __webpack_exports__ = {};
468
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
469
- (function () {
470
- __nested_webpack_require_16046__.r(__webpack_exports__);
471
- /* harmony export */
472
- __nested_webpack_require_16046__.d(__webpack_exports__, {
473
- /* harmony export */"default": function _default() {
474
- return __WEBPACK_DEFAULT_EXPORT__;
475
- }
476
- /* harmony export */
477
- });
478
- /* harmony import */
479
- var _easing__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_16046__(357);
480
- /* harmony import */
481
- var _initDefaultOptions__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_16046__(65);
482
- function _typeof(obj) {
483
- "@babel/helpers - typeof";
484
-
485
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
486
- return typeof obj;
487
- } : function (obj) {
488
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
489
- }, _typeof(obj);
490
- }
491
-
492
- /**
493
- * Element Animate
494
- * @public
495
- *
496
- * @param {HTMLElement} curElement - Element of animation.
497
- * @param {?JSON} config - Configuration of animation
498
- * @param {?string} easeType - Types of easing animation.
499
- * @param {?Function} callback - Callback after animation ends
500
- */
501
- function animateStyles(curElement, config) {
502
- var easeType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'linear';
503
- var callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {};
504
- if (_typeof(curElement) === ( true ? "undefined" : 0)) return;
505
-
506
- // Set a default configuration
507
- config = (0, _initDefaultOptions__WEBPACK_IMPORTED_MODULE_0__.setDefaultOptions)({
508
- "startHeight": 0,
509
- // node.scrollHeight
510
- "endHeight": 0,
511
- "speed": 200 //ms
512
- }, config);
513
- var _endHeight = config.endHeight;
514
- var _speed = config.speed;
515
- var _startHeight = config.startHeight;
516
- var duration = _speed;
517
- var start = new Date().getTime();
518
- var from = 0;
519
- var to = 100;
520
- var requestId;
521
- var loop = function loop() {
522
- //easing
523
- var time = new Date().getTime() - start; //Work out the elapsed time
524
- var val;
525
- switch (easeType) {
526
- case "linear":
527
- val = (0, _easing__WEBPACK_IMPORTED_MODULE_1__.easeLinear)(time, from, to - from, duration);
528
- break;
529
- case "ease-in":
530
- val = (0, _easing__WEBPACK_IMPORTED_MODULE_1__.easeInQuad)(time, from, to - from, duration);
531
- break;
532
- case "ease-out":
533
- val = (0, _easing__WEBPACK_IMPORTED_MODULE_1__.easeOutQuad)(time, from, to - from, duration);
534
- break;
535
- case "ease-in-out":
536
- val = (0, _easing__WEBPACK_IMPORTED_MODULE_1__.easeInOutQuad)(time, from, to - from, duration);
537
- break;
538
- default:
539
- val = (0, _easing__WEBPACK_IMPORTED_MODULE_1__.easeLinear)(time, from, to - from, duration);
540
- }
541
-
542
- // Elapsed time in miliseconds
543
- var percent = val / 100;
544
-
545
- // change height
546
- if (curElement.clientHeight < _endHeight) {
547
- curElement.style.height = _endHeight * percent + 'px';
548
- } else {
549
- if (_startHeight > 0) curElement.style.height = _startHeight - _startHeight * percent + 'px';
550
- }
551
-
552
- //If the elapsed time is less than the speed (ms)
553
- if (time < duration) {
554
- requestId = window.requestAnimationFrame(loop);
555
- } else {
556
- // change height
557
- curElement.style.height = _endHeight + 'px';
558
- if (typeof callback === 'function') callback();
559
- window.cancelAnimationFrame(requestId);
560
- }
561
- };
562
- requestId = window.requestAnimationFrame(loop);
563
- }
564
- /* harmony default export */
565
- var __WEBPACK_DEFAULT_EXPORT__ = animateStyles;
566
- })();
567
-
568
- /******/
569
- return __webpack_exports__;
570
- /******/
571
- }()
572
- );
573
- });
574
-
575
- /***/ }),
576
-
577
14
  /***/ 188:
578
15
  /***/ (function(module, exports, __webpack_require__) {
579
16
 
@@ -895,7 +332,7 @@ var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__
895
332
  // EXTERNAL MODULE: ../Utils/dist/cjs/cls.js
896
333
  var cls = __webpack_require__(188);
897
334
  ;// CONCATENATED MODULE: ./src/AccordionItem.tsx
898
- var _excluded = ["heightObserver", "index", "animSpeed", "easeType", "arrowOnly", "itemClassName", "itemContentWrapperClassName", "itemContentClassName", "itemTriggerClassName", "itemHeaderClassName", "itemTriggerIcon", "itemStyle", "activeItem", "title", "onToggleEv", "onTransitionEnd", "onItemCollapse", "isExpanded", "children"];
335
+ var _excluded = ["heightObserver", "index", "animSpeed", "easing", "arrowOnly", "itemClassName", "itemContentWrapperClassName", "itemContentClassName", "itemTriggerClassName", "itemHeaderClassName", "itemTriggerIcon", "itemStyle", "activeItem", "title", "onToggleEv", "onTransitionEnd", "onItemCollapse", "isExpanded", "children"];
899
336
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
900
337
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
901
338
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -911,7 +348,7 @@ var AccordionItem = function AccordionItem(props) {
911
348
  var heightObserver = props.heightObserver,
912
349
  index = props.index,
913
350
  animSpeed = props.animSpeed,
914
- easeType = props.easeType,
351
+ easing = props.easing,
915
352
  arrowOnly = props.arrowOnly,
916
353
  itemClassName = props.itemClassName,
917
354
  itemContentWrapperClassName = props.itemContentWrapperClassName,
@@ -952,6 +389,16 @@ var AccordionItem = function AccordionItem(props) {
952
389
  }
953
390
  onToggleEv === null || onToggleEv === void 0 ? void 0 : onToggleEv(e);
954
391
  };
392
+
393
+ // Generate CSS transition style
394
+ var getTransitionStyle = function getTransitionStyle() {
395
+ var transitionDuration = "".concat(animSpeed, "ms");
396
+ var transitionTiming = easing;
397
+ return {
398
+ transition: "max-height ".concat(transitionDuration, " ").concat(transitionTiming),
399
+ overflow: 'hidden'
400
+ };
401
+ };
955
402
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
956
403
  if (triggerRef.current && typeof onItemCollapse === 'function') {
957
404
  if (isFirstRender.current) {
@@ -960,7 +407,7 @@ var AccordionItem = function AccordionItem(props) {
960
407
  }
961
408
  onItemCollapse(triggerRef.current, iconRef.current, isExpanded);
962
409
  }
963
- }, [isExpanded, onItemCollapse]);
410
+ }, [isExpanded]);
964
411
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
965
412
  if (contentWrapperRef.current && !initialHeightSet.current) {
966
413
  initialHeightSet.current = true;
@@ -969,17 +416,17 @@ var AccordionItem = function AccordionItem(props) {
969
416
  setInternalExpanded(shouldBeExpanded);
970
417
  }
971
418
 
972
- // Set initial height when activeItem is true
419
+ // Set initial maxHeight when activeItem is true
973
420
  if (shouldBeExpanded && contentRef.current) {
974
421
  var contentHeight = contentRef.current.offsetHeight;
975
- contentWrapperRef.current.style.height = "".concat(contentHeight, "px");
422
+ contentWrapperRef.current.style.maxHeight = "".concat(contentHeight, "px");
976
423
  }
977
424
  }
978
425
  }, [activeItem, controlledExpanded]);
979
426
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
980
- if (parseFloat(heightObserver) !== index) return;
427
+ if (!heightObserver || !Array.isArray(heightObserver) || !heightObserver.includes(index)) return;
981
428
 
982
- // When the content height changes dynamically, change the height of the wrapper
429
+ // When the content height changes dynamically, change the maxHeight of the wrapper
983
430
  if (contentRef.current && contentWrapperRef.current) {
984
431
  var _contentPadding = window.getComputedStyle(contentRef.current).getPropertyValue('padding-bottom');
985
432
  observer.current = new ResizeObserver(function (entries) {
@@ -987,7 +434,9 @@ var AccordionItem = function AccordionItem(props) {
987
434
  return;
988
435
  }
989
436
  entries.forEach(function (entry) {
990
- if (contentWrapperRef.current !== null) contentWrapperRef.current.style.height = entry.contentRect.bottom + parseFloat(_contentPadding) + 'px';
437
+ if (contentWrapperRef.current !== null && isExpanded) {
438
+ contentWrapperRef.current.style.maxHeight = entry.contentRect.bottom + parseFloat(_contentPadding) + 'px';
439
+ }
991
440
  });
992
441
  });
993
442
  observer.current.observe(contentRef.current);
@@ -996,7 +445,19 @@ var AccordionItem = function AccordionItem(props) {
996
445
  var _observer$current;
997
446
  if (contentRef.current) (_observer$current = observer.current) === null || _observer$current === void 0 ? void 0 : _observer$current.unobserve(contentRef.current);
998
447
  };
999
- }, [heightObserver]);
448
+ }, [heightObserver, isExpanded]);
449
+
450
+ // Update maxHeight when expanded state changes
451
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
452
+ if (contentWrapperRef.current && contentRef.current) {
453
+ if (isExpanded) {
454
+ var contentHeight = contentRef.current.scrollHeight;
455
+ contentWrapperRef.current.style.maxHeight = "".concat(contentHeight, "px");
456
+ } else {
457
+ contentWrapperRef.current.style.maxHeight = '0px';
458
+ }
459
+ }
460
+ }, [isExpanded]);
1000
461
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", _extends({}, attributes, {
1001
462
  "data-index": index,
1002
463
  className: (0,cls.combinedCls)('custom-accordion-item', (0,cls.clsWrite)(itemClassName, 'accordion-item'), isExpanded ? ' active' : ''),
@@ -1029,19 +490,13 @@ var AccordionItem = function AccordionItem(props) {
1029
490
  ref: contentWrapperRef,
1030
491
  className: (0,cls.combinedCls)('custom-accordion-content__wrapper w-100', (0,cls.clsWrite)(itemContentWrapperClassName, 'accordion-collapse')),
1031
492
  role: "tabpanel",
1032
- style: {
1033
- height: '0',
1034
- overflow: 'hidden' // "overflow" affects the width, so add `w-100` to `custom-accordion-content__wrapper`
1035
- }
493
+ style: getTransitionStyle()
1036
494
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
1037
495
  className: (0,cls.combinedCls)('custom-accordion-content', (0,cls.clsWrite)(itemContentClassName, 'accordion-body')),
1038
496
  ref: contentRef
1039
497
  }, children))));
1040
498
  };
1041
499
  /* harmony default export */ const src_AccordionItem = (AccordionItem);
1042
- // EXTERNAL MODULE: ../Utils/dist/cjs/anim.js
1043
- var anim = __webpack_require__(993);
1044
- var anim_default = /*#__PURE__*/__webpack_require__.n(anim);
1045
500
  ;// CONCATENATED MODULE: ./src/Accordion.tsx
1046
501
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1047
502
  function Accordion_extends() { Accordion_extends = Object.assign ? Object.assign.bind() : 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 Accordion_extends.apply(this, arguments); }
@@ -1064,10 +519,10 @@ function Accordion_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1064
519
 
1065
520
 
1066
521
 
1067
-
1068
522
  // Adapt the easing parameters of TweenMax
1069
523
  var EasingList = /*#__PURE__*/function (EasingList) {
1070
524
  EasingList["linear"] = "linear";
525
+ EasingList["ease"] = "ease";
1071
526
  EasingList["easeIn"] = "ease-in";
1072
527
  EasingList["easeOut"] = "ease-out";
1073
528
  EasingList["easeInOut"] = "ease-in-out";
@@ -1079,7 +534,8 @@ var Accordion = function Accordion(props) {
1079
534
  _props$defaultActiveA = props.defaultActiveAll,
1080
535
  defaultActiveAll = _props$defaultActiveA === void 0 ? false : _props$defaultActiveA,
1081
536
  duration = props.duration,
1082
- easing = props.easing,
537
+ _props$easing = props.easing,
538
+ easing = _props$easing === void 0 ? 'ease' : _props$easing,
1083
539
  _props$alternateColla = props.alternateCollapse,
1084
540
  alternateCollapse = _props$alternateColla === void 0 ? true : _props$alternateColla,
1085
541
  _props$arrowOnly = props.arrowOnly,
@@ -1089,55 +545,26 @@ var Accordion = function Accordion(props) {
1089
545
  var animSpeed = duration || 200;
1090
546
  var easeType = typeof alternateCollapse === 'undefined' ? EasingList['linear'] : EasingList[easing];
1091
547
  var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
1092
- var animPlaceholderRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
1093
- var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
548
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
1094
549
  _useState2 = Accordion_slicedToArray(_useState, 2),
1095
- animOK = _useState2[0],
1096
- setAnimOK = _useState2[1];
1097
- var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(-1),
550
+ heightObserver = _useState2[0],
551
+ setHeightObserver = _useState2[1];
552
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(new Set()),
1098
553
  _useState4 = Accordion_slicedToArray(_useState3, 2),
1099
- heightObserver = _useState4[0],
1100
- setHeightObserver = _useState4[1];
1101
- var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(new Set()),
1102
- _useState6 = Accordion_slicedToArray(_useState5, 2),
1103
- expandedItems = _useState6[0],
1104
- setExpandedItems = _useState6[1]; // Keep track of all expanded items
554
+ expandedItems = _useState4[0],
555
+ setExpandedItems = _useState4[1]; // Keep track of all expanded items
1105
556
  var animationInProgress = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
557
+ var initExpanded = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
1106
558
  function handleClickItem(e) {
1107
559
  if (animationInProgress.current) return;
1108
560
  if (e.target.closest('.custom-accordion-header') === null) return;
1109
- if (animOK) return;
1110
561
  animationInProgress.current = true;
1111
562
  var reactDomEl = arrowOnly ? e.currentTarget.closest('.custom-accordion-item') : e.currentTarget;
1112
563
  var curIndex = parseInt(reactDomEl.dataset.index);
1113
564
  var reactDomWrapperEl = rootRef.current;
1114
565
  var $li = reactDomWrapperEl.querySelectorAll('.custom-accordion-item');
1115
- var $allContent = reactDomWrapperEl.querySelectorAll('.custom-accordion-content__wrapper');
1116
- var $curContent = reactDomEl.querySelector('.custom-accordion-content__wrapper');
1117
566
  if (reactDomEl.getAttribute('aria-expanded') === 'false' || reactDomEl.getAttribute('aria-expanded') === null) {
1118
- setAnimOK(true);
1119
- setTimeout(function () {
1120
- setAnimOK(false);
1121
- }, animSpeed);
1122
567
  if (alternateCollapse) {
1123
- // Hide other all sibling content
1124
- Array.prototype.forEach.call($allContent, function (node) {
1125
- if (node.clientHeight > 0) {
1126
- anim_default()(node, {
1127
- startHeight: node.scrollHeight,
1128
- endHeight: 0,
1129
- speed: animSpeed
1130
- }, easeType, function () {
1131
- animationInProgress.current = false;
1132
- });
1133
- }
1134
- });
1135
-
1136
- // Update all items to collapsed state
1137
- Array.prototype.forEach.call($li, function (node) {
1138
- node.setAttribute('aria-expanded', 'false');
1139
- });
1140
-
1141
568
  // Update expanded items state
1142
569
  setExpandedItems(new Set([curIndex]));
1143
570
  } else {
@@ -1146,80 +573,63 @@ var Accordion = function Accordion(props) {
1146
573
  return new Set([].concat(_toConsumableArray(prev), [curIndex]));
1147
574
  });
1148
575
  }
1149
- reactDomEl.setAttribute('aria-expanded', 'true');
1150
- anim_default()($curContent, {
1151
- startHeight: 0,
1152
- endHeight: $curContent.scrollHeight,
1153
- speed: animSpeed
1154
- }, easeType, function () {
1155
- setHeightObserver(curIndex);
1156
- animationInProgress.current = false;
1157
- });
1158
576
  } else {
1159
- reactDomEl.setAttribute('aria-expanded', 'false');
1160
-
1161
577
  // Remove current item from expanded items
1162
578
  setExpandedItems(function (prev) {
1163
579
  var newSet = new Set(prev);
1164
580
  newSet["delete"](curIndex);
1165
581
  return newSet;
1166
582
  });
1167
- anim_default()($curContent, {
1168
- startHeight: $curContent.scrollHeight,
1169
- endHeight: 0,
1170
- speed: animSpeed
1171
- }, easeType, function () {
1172
- animationInProgress.current = false;
1173
- });
1174
583
  }
584
+
585
+ // Reset animation flag after transition duration
586
+ setTimeout(function () {
587
+ animationInProgress.current = false;
588
+ }, animSpeed);
1175
589
  onChange === null || onChange === void 0 ? void 0 : onChange(reactDomEl, curIndex);
1176
590
  }
1177
591
 
1178
- // Initialize expanded items based on defaultActiveIndex or defaultActiveAll
592
+ //Initialize expanded items based on defaultActiveIndex or defaultActiveAll
1179
593
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
1180
- if (defaultActiveAll && children && rootRef.current && animPlaceholderRef.current) {
594
+ // Skip the default height initialization to prevent re-initialization.
595
+ // This method is useful when you want to manually control when the accordion should
596
+ // skip the automatic height initialization process, especially useful when `children` change frequently.
597
+ if (initExpanded.current === true) return;
598
+ if (defaultActiveAll && children && rootRef.current) {
1181
599
  var allIndices = Array.from({
1182
600
  length: children.length
1183
601
  }, function (_, i) {
1184
602
  return i;
1185
603
  });
1186
604
  setExpandedItems(new Set(allIndices));
605
+ // Set heightObserver for all items to enable height monitoring
606
+ setHeightObserver(allIndices);
1187
607
 
1188
- // Actually expand all items without animation
1189
- var $allItems = rootRef.current.querySelectorAll('.custom-accordion-item');
1190
- Array.prototype.forEach.call($allItems, function (node, index) {
1191
- var $curContent = node.querySelector('.custom-accordion-content__wrapper');
1192
- if ($curContent) {
1193
- // !!! Don't use the .custom-accordion-contentwrapper height directly, it may be more than a dozen pixels
1194
- $curContent.style.height = "".concat(node.querySelector('.custom-accordion-content__wrapper > .custom-accordion-content').scrollHeight, "px");
1195
- }
1196
- });
1197
- anim_default()(animPlaceholderRef.current, {
1198
- startHeight: 0,
1199
- endHeight: 10,
1200
- speed: animSpeed
1201
- }, easeType, function () {
1202
- setTimeout(function () {}, animSpeed);
1203
- });
608
+ //
609
+ initExpanded.current = true;
1204
610
  } else if (defaultActiveIndex !== undefined) {
1205
611
  var initialExpanded = new Set();
612
+ var observerIndices = [];
1206
613
  if (Array.isArray(defaultActiveIndex)) {
1207
614
  defaultActiveIndex.forEach(function (index) {
1208
- return initialExpanded.add(index);
615
+ initialExpanded.add(index);
616
+ observerIndices.push(index);
1209
617
  });
1210
618
  } else if (typeof defaultActiveIndex === 'number') {
1211
619
  initialExpanded.add(defaultActiveIndex);
620
+ observerIndices.push(defaultActiveIndex);
1212
621
  }
1213
622
  setExpandedItems(initialExpanded);
623
+ // Set heightObserver for default active items to enable height monitoring
624
+ if (observerIndices.length > 0) {
625
+ setHeightObserver(observerIndices);
626
+ }
627
+
628
+ //
629
+ initExpanded.current = true;
1214
630
  }
1215
631
  }, [defaultActiveIndex, defaultActiveAll, children]);
1216
632
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
1217
- className: "custom-accordion-anim-placeholder",
1218
- style: {
1219
- display: 'none'
1220
- },
1221
- ref: animPlaceholderRef
1222
- }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
1223
633
  className: (0,cls.combinedCls)('custom-accordion-item', (0,cls.clsWrite)(wrapperClassName, 'accordion')),
1224
634
  role: "tablist",
1225
635
  ref: rootRef
@@ -1236,6 +646,7 @@ var Accordion = function Accordion(props) {
1236
646
  index: i,
1237
647
  defaultActiveAll: defaultActiveAll,
1238
648
  animSpeed: animSpeed,
649
+ easing: easeType,
1239
650
  arrowOnly: arrowOnly,
1240
651
  heightObserver: heightObserver,
1241
652
  activeItem: _defaultActive,