@pdg/react-admin-layout 1.0.12 → 1.0.14

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/index.esm.js CHANGED
@@ -1,9 +1,9 @@
1
- import {Grid,useTheme,alpha,ListItemButton,ListItemIcon,Icon,ListItemText,Badge,Collapse,styled,List,Box,Toolbar,Typography,AppBar,Drawer,IconButton}from'@mui/material';import*as React from'react';import React__default,{useState,useEffect,useCallback,useMemo}from'react';import {useLocation}from'react-router-dom';import {ExpandMore,Menu}from'@mui/icons-material';var CardLayoutDefaultProps = {
1
+ import {Grid,useTheme,alpha,ListItemButton,ListItemIcon,Icon,ListItemText,Badge,Collapse,styled,List,Box,Toolbar,Typography,AppBar,Drawer,IconButton}from'@mui/material';import React,{useState,useEffect,useCallback,useMemo}from'react';import {useLocation}from'react-router-dom';import {ExpandMore,Menu}from'@mui/icons-material';import SimpleBar from'simplebar-react';import'simplebar-react/dist/simplebar.min.css';var CardLayoutDefaultProps = {
2
2
  backgroundColor: '#eff3f8',
3
3
  };var CardLayout = function (_a) {
4
4
  var children = _a.children, backgroundColor = _a.backgroundColor;
5
- return (React__default.createElement(Grid, { container: true, direction: 'column', alignItems: 'center', justifyContent: 'center', style: { minHeight: '100vh', backgroundColor: backgroundColor } },
6
- React__default.createElement(Grid, { item: true, xs: 12 }, children)));
5
+ return (React.createElement(Grid, { container: true, direction: 'column', alignItems: 'center', justifyContent: 'center', style: { minHeight: '100vh', backgroundColor: backgroundColor } },
6
+ React.createElement(Grid, { item: true, xs: 12 }, children)));
7
7
  };
8
8
  CardLayout.defaultProps = CardLayoutDefaultProps;/******************************************************************************
9
9
  Copyright (c) Microsoft Corporation.
@@ -133,1583 +133,27 @@ var notEmpty = function (v) {
133
133
  }); }, [isExpand, theme]);
134
134
  var primaryTypographyProps = useMemo(function () { return ({ sx: { fontWeight: info.depth === 1 ? 600 : null } }); }, [info]);
135
135
  // -------------------------------------------------------------------------------------------------------------------
136
- return (React__default.createElement(React__default.Fragment, null,
137
- React__default.createElement(ListItemButton, { onClick: isExpandable
136
+ return (React.createElement(React.Fragment, null,
137
+ React.createElement(ListItemButton, { onClick: isExpandable
138
138
  ? toggleIsExpand
139
139
  : function () {
140
140
  if (onClick)
141
141
  onClick(info);
142
142
  }, selected: isExpandable ? false : info.uri === location.pathname, style: containerStyle },
143
- React__default.createElement(ListItemIcon, { sx: { minWidth: 30 } }, icon && React__default.createElement(Icon, { fontSize: 'small' }, icon)),
144
- React__default.createElement(ListItemText, { primaryTypographyProps: primaryTypographyProps }, info.badge ? (React__default.createElement(Badge, { badgeContent: info.badge, color: 'error', variant: badgeVariant !== undefined ? badgeVariant : info.badgeVariant, anchorOrigin: { horizontal: 'left', vertical: 'top' }, slotProps: { badge: { style: { left: '100%', top: '50%', transform: 'translate(10px, -50%)' } } } },
145
- React__default.createElement("div", null, info.name))) : (info.name)),
146
- isExpandable && React__default.createElement(ExpandMore, { sx: expandIconSx })),
147
- React__default.createElement(Collapse, { in: isExpand, style: collapseStyle }, isExpandable &&
143
+ React.createElement(ListItemIcon, { sx: { minWidth: 30 } }, icon && React.createElement(Icon, { fontSize: 'small' }, icon)),
144
+ React.createElement(ListItemText, { primaryTypographyProps: primaryTypographyProps }, info.badge ? (React.createElement(Badge, { badgeContent: info.badge, color: 'error', variant: badgeVariant !== undefined ? badgeVariant : info.badgeVariant, anchorOrigin: { horizontal: 'left', vertical: 'top' }, slotProps: {
145
+ badge: { style: { left: '100%', top: '50%', transform: 'scale(.8) translate(10px, -50%)' } },
146
+ } },
147
+ React.createElement("div", null, info.name))) : (info.name)),
148
+ isExpandable && React.createElement(ExpandMore, { sx: expandIconSx })),
149
+ React.createElement(Collapse, { in: isExpand, style: collapseStyle }, isExpandable &&
148
150
  info.items &&
149
- info.items.map(function (subInfo, idx) { return (React__default.createElement(SideMenuListItem, { key: idx, badgeVariant: badgeVariant, info: subInfo, onClick: onClick })); }))));
151
+ info.items.map(function (subInfo, idx) { return (React.createElement(SideMenuListItem, { key: idx, badgeVariant: badgeVariant, info: subInfo, onClick: onClick })); }))));
150
152
  };var StyledList = styled(List)(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n padding: 0;\n"], ["\n padding: 0;\n"])));
151
153
  var templateObject_1$3;var SideMenuList = function (_a) {
152
154
  var list = _a.list, badgeVariant = _a.badgeVariant, onClick = _a.onClick;
153
- return (React__default.createElement(StyledList, null, list.map(function (info, idx) { return (React__default.createElement(SideMenuListItem, { key: idx, info: info, badgeVariant: badgeVariant, onClick: onClick })); })));
154
- };/** Detect free variable `global` from Node.js. */
155
- var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
156
-
157
- var freeGlobal$1 = freeGlobal;/** Detect free variable `self`. */
158
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
159
-
160
- /** Used as a reference to the global object. */
161
- var root = freeGlobal$1 || freeSelf || Function('return this')();
162
-
163
- var root$1 = root;/** Built-in value references. */
164
- var Symbol = root$1.Symbol;
165
-
166
- var Symbol$1 = Symbol;/** Used for built-in method references. */
167
- var objectProto$1 = Object.prototype;
168
-
169
- /** Used to check objects for own properties. */
170
- var hasOwnProperty = objectProto$1.hasOwnProperty;
171
-
172
- /**
173
- * Used to resolve the
174
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
175
- * of values.
176
- */
177
- var nativeObjectToString$1 = objectProto$1.toString;
178
-
179
- /** Built-in value references. */
180
- var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
181
-
182
- /**
183
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
184
- *
185
- * @private
186
- * @param {*} value The value to query.
187
- * @returns {string} Returns the raw `toStringTag`.
188
- */
189
- function getRawTag(value) {
190
- var isOwn = hasOwnProperty.call(value, symToStringTag$1),
191
- tag = value[symToStringTag$1];
192
-
193
- try {
194
- value[symToStringTag$1] = undefined;
195
- var unmasked = true;
196
- } catch (e) {}
197
-
198
- var result = nativeObjectToString$1.call(value);
199
- if (unmasked) {
200
- if (isOwn) {
201
- value[symToStringTag$1] = tag;
202
- } else {
203
- delete value[symToStringTag$1];
204
- }
205
- }
206
- return result;
207
- }/** Used for built-in method references. */
208
- var objectProto = Object.prototype;
209
-
210
- /**
211
- * Used to resolve the
212
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
213
- * of values.
214
- */
215
- var nativeObjectToString = objectProto.toString;
216
-
217
- /**
218
- * Converts `value` to a string using `Object.prototype.toString`.
219
- *
220
- * @private
221
- * @param {*} value The value to convert.
222
- * @returns {string} Returns the converted string.
223
- */
224
- function objectToString(value) {
225
- return nativeObjectToString.call(value);
226
- }/** `Object#toString` result references. */
227
- var nullTag = '[object Null]',
228
- undefinedTag = '[object Undefined]';
229
-
230
- /** Built-in value references. */
231
- var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
232
-
233
- /**
234
- * The base implementation of `getTag` without fallbacks for buggy environments.
235
- *
236
- * @private
237
- * @param {*} value The value to query.
238
- * @returns {string} Returns the `toStringTag`.
239
- */
240
- function baseGetTag(value) {
241
- if (value == null) {
242
- return value === undefined ? undefinedTag : nullTag;
243
- }
244
- return (symToStringTag && symToStringTag in Object(value))
245
- ? getRawTag(value)
246
- : objectToString(value);
247
- }/**
248
- * Checks if `value` is object-like. A value is object-like if it's not `null`
249
- * and has a `typeof` result of "object".
250
- *
251
- * @static
252
- * @memberOf _
253
- * @since 4.0.0
254
- * @category Lang
255
- * @param {*} value The value to check.
256
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
257
- * @example
258
- *
259
- * _.isObjectLike({});
260
- * // => true
261
- *
262
- * _.isObjectLike([1, 2, 3]);
263
- * // => true
264
- *
265
- * _.isObjectLike(_.noop);
266
- * // => false
267
- *
268
- * _.isObjectLike(null);
269
- * // => false
270
- */
271
- function isObjectLike(value) {
272
- return value != null && typeof value == 'object';
273
- }/** `Object#toString` result references. */
274
- var symbolTag = '[object Symbol]';
275
-
276
- /**
277
- * Checks if `value` is classified as a `Symbol` primitive or object.
278
- *
279
- * @static
280
- * @memberOf _
281
- * @since 4.0.0
282
- * @category Lang
283
- * @param {*} value The value to check.
284
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
285
- * @example
286
- *
287
- * _.isSymbol(Symbol.iterator);
288
- * // => true
289
- *
290
- * _.isSymbol('abc');
291
- * // => false
292
- */
293
- function isSymbol(value) {
294
- return typeof value == 'symbol' ||
295
- (isObjectLike(value) && baseGetTag(value) == symbolTag);
296
- }/** Used to match a single whitespace character. */
297
- var reWhitespace = /\s/;
298
-
299
- /**
300
- * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
301
- * character of `string`.
302
- *
303
- * @private
304
- * @param {string} string The string to inspect.
305
- * @returns {number} Returns the index of the last non-whitespace character.
306
- */
307
- function trimmedEndIndex(string) {
308
- var index = string.length;
309
-
310
- while (index-- && reWhitespace.test(string.charAt(index))) {}
311
- return index;
312
- }/** Used to match leading whitespace. */
313
- var reTrimStart = /^\s+/;
314
-
315
- /**
316
- * The base implementation of `_.trim`.
317
- *
318
- * @private
319
- * @param {string} string The string to trim.
320
- * @returns {string} Returns the trimmed string.
321
- */
322
- function baseTrim(string) {
323
- return string
324
- ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
325
- : string;
326
- }/**
327
- * Checks if `value` is the
328
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
329
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
330
- *
331
- * @static
332
- * @memberOf _
333
- * @since 0.1.0
334
- * @category Lang
335
- * @param {*} value The value to check.
336
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
337
- * @example
338
- *
339
- * _.isObject({});
340
- * // => true
341
- *
342
- * _.isObject([1, 2, 3]);
343
- * // => true
344
- *
345
- * _.isObject(_.noop);
346
- * // => true
347
- *
348
- * _.isObject(null);
349
- * // => false
350
- */
351
- function isObject(value) {
352
- var type = typeof value;
353
- return value != null && (type == 'object' || type == 'function');
354
- }/** Used as references for various `Number` constants. */
355
- var NAN = 0 / 0;
356
-
357
- /** Used to detect bad signed hexadecimal string values. */
358
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
359
-
360
- /** Used to detect binary string values. */
361
- var reIsBinary = /^0b[01]+$/i;
362
-
363
- /** Used to detect octal string values. */
364
- var reIsOctal = /^0o[0-7]+$/i;
365
-
366
- /** Built-in method references without a dependency on `root`. */
367
- var freeParseInt = parseInt;
368
-
369
- /**
370
- * Converts `value` to a number.
371
- *
372
- * @static
373
- * @memberOf _
374
- * @since 4.0.0
375
- * @category Lang
376
- * @param {*} value The value to process.
377
- * @returns {number} Returns the number.
378
- * @example
379
- *
380
- * _.toNumber(3.2);
381
- * // => 3.2
382
- *
383
- * _.toNumber(Number.MIN_VALUE);
384
- * // => 5e-324
385
- *
386
- * _.toNumber(Infinity);
387
- * // => Infinity
388
- *
389
- * _.toNumber('3.2');
390
- * // => 3.2
391
- */
392
- function toNumber(value) {
393
- if (typeof value == 'number') {
394
- return value;
395
- }
396
- if (isSymbol(value)) {
397
- return NAN;
398
- }
399
- if (isObject(value)) {
400
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
401
- value = isObject(other) ? (other + '') : other;
402
- }
403
- if (typeof value != 'string') {
404
- return value === 0 ? value : +value;
405
- }
406
- value = baseTrim(value);
407
- var isBinary = reIsBinary.test(value);
408
- return (isBinary || reIsOctal.test(value))
409
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
410
- : (reIsBadHex.test(value) ? NAN : +value);
411
- }/**
412
- * Gets the timestamp of the number of milliseconds that have elapsed since
413
- * the Unix epoch (1 January 1970 00:00:00 UTC).
414
- *
415
- * @static
416
- * @memberOf _
417
- * @since 2.4.0
418
- * @category Date
419
- * @returns {number} Returns the timestamp.
420
- * @example
421
- *
422
- * _.defer(function(stamp) {
423
- * console.log(_.now() - stamp);
424
- * }, _.now());
425
- * // => Logs the number of milliseconds it took for the deferred invocation.
426
- */
427
- var now = function() {
428
- return root$1.Date.now();
429
- };
430
-
431
- var now$1 = now;/** Error message constants. */
432
- var FUNC_ERROR_TEXT$1 = 'Expected a function';
433
-
434
- /* Built-in method references for those with the same name as other `lodash` methods. */
435
- var nativeMax = Math.max,
436
- nativeMin = Math.min;
437
-
438
- /**
439
- * Creates a debounced function that delays invoking `func` until after `wait`
440
- * milliseconds have elapsed since the last time the debounced function was
441
- * invoked. The debounced function comes with a `cancel` method to cancel
442
- * delayed `func` invocations and a `flush` method to immediately invoke them.
443
- * Provide `options` to indicate whether `func` should be invoked on the
444
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
445
- * with the last arguments provided to the debounced function. Subsequent
446
- * calls to the debounced function return the result of the last `func`
447
- * invocation.
448
- *
449
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
450
- * invoked on the trailing edge of the timeout only if the debounced function
451
- * is invoked more than once during the `wait` timeout.
452
- *
453
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
454
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
455
- *
456
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
457
- * for details over the differences between `_.debounce` and `_.throttle`.
458
- *
459
- * @static
460
- * @memberOf _
461
- * @since 0.1.0
462
- * @category Function
463
- * @param {Function} func The function to debounce.
464
- * @param {number} [wait=0] The number of milliseconds to delay.
465
- * @param {Object} [options={}] The options object.
466
- * @param {boolean} [options.leading=false]
467
- * Specify invoking on the leading edge of the timeout.
468
- * @param {number} [options.maxWait]
469
- * The maximum time `func` is allowed to be delayed before it's invoked.
470
- * @param {boolean} [options.trailing=true]
471
- * Specify invoking on the trailing edge of the timeout.
472
- * @returns {Function} Returns the new debounced function.
473
- * @example
474
- *
475
- * // Avoid costly calculations while the window size is in flux.
476
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
477
- *
478
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
479
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
480
- * 'leading': true,
481
- * 'trailing': false
482
- * }));
483
- *
484
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
485
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
486
- * var source = new EventSource('/stream');
487
- * jQuery(source).on('message', debounced);
488
- *
489
- * // Cancel the trailing debounced invocation.
490
- * jQuery(window).on('popstate', debounced.cancel);
491
- */
492
- function debounce(func, wait, options) {
493
- var lastArgs,
494
- lastThis,
495
- maxWait,
496
- result,
497
- timerId,
498
- lastCallTime,
499
- lastInvokeTime = 0,
500
- leading = false,
501
- maxing = false,
502
- trailing = true;
503
-
504
- if (typeof func != 'function') {
505
- throw new TypeError(FUNC_ERROR_TEXT$1);
506
- }
507
- wait = toNumber(wait) || 0;
508
- if (isObject(options)) {
509
- leading = !!options.leading;
510
- maxing = 'maxWait' in options;
511
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
512
- trailing = 'trailing' in options ? !!options.trailing : trailing;
513
- }
514
-
515
- function invokeFunc(time) {
516
- var args = lastArgs,
517
- thisArg = lastThis;
518
-
519
- lastArgs = lastThis = undefined;
520
- lastInvokeTime = time;
521
- result = func.apply(thisArg, args);
522
- return result;
523
- }
524
-
525
- function leadingEdge(time) {
526
- // Reset any `maxWait` timer.
527
- lastInvokeTime = time;
528
- // Start the timer for the trailing edge.
529
- timerId = setTimeout(timerExpired, wait);
530
- // Invoke the leading edge.
531
- return leading ? invokeFunc(time) : result;
532
- }
533
-
534
- function remainingWait(time) {
535
- var timeSinceLastCall = time - lastCallTime,
536
- timeSinceLastInvoke = time - lastInvokeTime,
537
- timeWaiting = wait - timeSinceLastCall;
538
-
539
- return maxing
540
- ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
541
- : timeWaiting;
542
- }
543
-
544
- function shouldInvoke(time) {
545
- var timeSinceLastCall = time - lastCallTime,
546
- timeSinceLastInvoke = time - lastInvokeTime;
547
-
548
- // Either this is the first call, activity has stopped and we're at the
549
- // trailing edge, the system time has gone backwards and we're treating
550
- // it as the trailing edge, or we've hit the `maxWait` limit.
551
- return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
552
- (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
553
- }
554
-
555
- function timerExpired() {
556
- var time = now$1();
557
- if (shouldInvoke(time)) {
558
- return trailingEdge(time);
559
- }
560
- // Restart the timer.
561
- timerId = setTimeout(timerExpired, remainingWait(time));
562
- }
563
-
564
- function trailingEdge(time) {
565
- timerId = undefined;
566
-
567
- // Only invoke if we have `lastArgs` which means `func` has been
568
- // debounced at least once.
569
- if (trailing && lastArgs) {
570
- return invokeFunc(time);
571
- }
572
- lastArgs = lastThis = undefined;
573
- return result;
574
- }
575
-
576
- function cancel() {
577
- if (timerId !== undefined) {
578
- clearTimeout(timerId);
579
- }
580
- lastInvokeTime = 0;
581
- lastArgs = lastCallTime = lastThis = timerId = undefined;
582
- }
583
-
584
- function flush() {
585
- return timerId === undefined ? result : trailingEdge(now$1());
586
- }
587
-
588
- function debounced() {
589
- var time = now$1(),
590
- isInvoking = shouldInvoke(time);
591
-
592
- lastArgs = arguments;
593
- lastThis = this;
594
- lastCallTime = time;
595
-
596
- if (isInvoking) {
597
- if (timerId === undefined) {
598
- return leadingEdge(lastCallTime);
599
- }
600
- if (maxing) {
601
- // Handle invocations in a tight loop.
602
- clearTimeout(timerId);
603
- timerId = setTimeout(timerExpired, wait);
604
- return invokeFunc(lastCallTime);
605
- }
606
- }
607
- if (timerId === undefined) {
608
- timerId = setTimeout(timerExpired, wait);
609
- }
610
- return result;
611
- }
612
- debounced.cancel = cancel;
613
- debounced.flush = flush;
614
- return debounced;
615
- }/** Error message constants. */
616
- var FUNC_ERROR_TEXT = 'Expected a function';
617
-
618
- /**
619
- * Creates a throttled function that only invokes `func` at most once per
620
- * every `wait` milliseconds. The throttled function comes with a `cancel`
621
- * method to cancel delayed `func` invocations and a `flush` method to
622
- * immediately invoke them. Provide `options` to indicate whether `func`
623
- * should be invoked on the leading and/or trailing edge of the `wait`
624
- * timeout. The `func` is invoked with the last arguments provided to the
625
- * throttled function. Subsequent calls to the throttled function return the
626
- * result of the last `func` invocation.
627
- *
628
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
629
- * invoked on the trailing edge of the timeout only if the throttled function
630
- * is invoked more than once during the `wait` timeout.
631
- *
632
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
633
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
634
- *
635
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
636
- * for details over the differences between `_.throttle` and `_.debounce`.
637
- *
638
- * @static
639
- * @memberOf _
640
- * @since 0.1.0
641
- * @category Function
642
- * @param {Function} func The function to throttle.
643
- * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
644
- * @param {Object} [options={}] The options object.
645
- * @param {boolean} [options.leading=true]
646
- * Specify invoking on the leading edge of the timeout.
647
- * @param {boolean} [options.trailing=true]
648
- * Specify invoking on the trailing edge of the timeout.
649
- * @returns {Function} Returns the new throttled function.
650
- * @example
651
- *
652
- * // Avoid excessively updating the position while scrolling.
653
- * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
654
- *
655
- * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
656
- * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
657
- * jQuery(element).on('click', throttled);
658
- *
659
- * // Cancel the trailing throttled invocation.
660
- * jQuery(window).on('popstate', throttled.cancel);
661
- */
662
- function throttle(func, wait, options) {
663
- var leading = true,
664
- trailing = true;
665
-
666
- if (typeof func != 'function') {
667
- throw new TypeError(FUNC_ERROR_TEXT);
668
- }
669
- if (isObject(options)) {
670
- leading = 'leading' in options ? !!options.leading : leading;
671
- trailing = 'trailing' in options ? !!options.trailing : trailing;
672
- }
673
- return debounce(func, wait, {
674
- 'leading': leading,
675
- 'maxWait': wait,
676
- 'trailing': trailing
677
- });
678
- }function getDefaultExportFromCjs (x) {
679
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
680
- }var canUseDOM = !!(
681
- typeof window !== 'undefined' &&
682
- window.document &&
683
- window.document.createElement
684
- );
685
-
686
- var canUseDom = canUseDOM;
687
-
688
- var canUseDOM$1 = /*@__PURE__*/getDefaultExportFromCjs(canUseDom);/**
689
- * simplebar-core - v1.2.4
690
- * Scrollbars, simpler.
691
- * https://grsmto.github.io/simplebar/
692
- *
693
- * Made by Adrien Denat from a fork by Jonathan Nicol
694
- * Under MIT License
695
- */
696
-
697
-
698
- /******************************************************************************
699
- Copyright (c) Microsoft Corporation.
700
-
701
- Permission to use, copy, modify, and/or distribute this software for any
702
- purpose with or without fee is hereby granted.
703
-
704
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
705
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
706
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
707
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
708
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
709
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
710
- PERFORMANCE OF THIS SOFTWARE.
711
- ***************************************************************************** */
712
-
713
- var __assign$1 = function() {
714
- __assign$1 = Object.assign || function __assign(t) {
715
- for (var s, i = 1, n = arguments.length; i < n; i++) {
716
- s = arguments[i];
717
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
718
- }
719
- return t;
720
- };
721
- return __assign$1.apply(this, arguments);
722
- };
723
-
724
- var cachedScrollbarWidth = null;
725
- var cachedDevicePixelRatio = null;
726
- if (canUseDOM$1) {
727
- window.addEventListener('resize', function () {
728
- if (cachedDevicePixelRatio !== window.devicePixelRatio) {
729
- cachedDevicePixelRatio = window.devicePixelRatio;
730
- cachedScrollbarWidth = null;
731
- }
732
- });
733
- }
734
- function scrollbarWidth() {
735
- if (cachedScrollbarWidth === null) {
736
- if (typeof document === 'undefined') {
737
- cachedScrollbarWidth = 0;
738
- return cachedScrollbarWidth;
739
- }
740
- var body = document.body;
741
- var box = document.createElement('div');
742
- box.classList.add('simplebar-hide-scrollbar');
743
- body.appendChild(box);
744
- var width = box.getBoundingClientRect().right;
745
- body.removeChild(box);
746
- cachedScrollbarWidth = width;
747
- }
748
- return cachedScrollbarWidth;
749
- }
750
-
751
- function getElementWindow$1(element) {
752
- if (!element ||
753
- !element.ownerDocument ||
754
- !element.ownerDocument.defaultView) {
755
- return window;
756
- }
757
- return element.ownerDocument.defaultView;
758
- }
759
- function getElementDocument$1(element) {
760
- if (!element || !element.ownerDocument) {
761
- return document;
762
- }
763
- return element.ownerDocument;
764
- }
765
- // Helper function to retrieve options from element attributes
766
- var getOptions$1 = function (obj) {
767
- var initialObj = {};
768
- var options = Array.prototype.reduce.call(obj, function (acc, attribute) {
769
- var option = attribute.name.match(/data-simplebar-(.+)/);
770
- if (option) {
771
- var key = option[1].replace(/\W+(.)/g, function (_, chr) { return chr.toUpperCase(); });
772
- switch (attribute.value) {
773
- case 'true':
774
- acc[key] = true;
775
- break;
776
- case 'false':
777
- acc[key] = false;
778
- break;
779
- case undefined:
780
- acc[key] = true;
781
- break;
782
- default:
783
- acc[key] = attribute.value;
784
- }
785
- }
786
- return acc;
787
- }, initialObj);
788
- return options;
789
- };
790
- function addClasses$1(el, classes) {
791
- var _a;
792
- if (!el)
793
- return;
794
- (_a = el.classList).add.apply(_a, classes.split(' '));
795
- }
796
- function removeClasses$1(el, classes) {
797
- if (!el)
798
- return;
799
- classes.split(' ').forEach(function (className) {
800
- el.classList.remove(className);
801
- });
802
- }
803
- function classNamesToQuery$1(classNames) {
804
- return ".".concat(classNames.split(' ').join('.'));
805
- }
806
-
807
- var helpers = /*#__PURE__*/Object.freeze({
808
- __proto__: null,
809
- getElementWindow: getElementWindow$1,
810
- getElementDocument: getElementDocument$1,
811
- getOptions: getOptions$1,
812
- addClasses: addClasses$1,
813
- removeClasses: removeClasses$1,
814
- classNamesToQuery: classNamesToQuery$1
815
- });
816
-
817
- var getElementWindow = getElementWindow$1, getElementDocument = getElementDocument$1, getOptions = getOptions$1, addClasses = addClasses$1, removeClasses = removeClasses$1, classNamesToQuery = classNamesToQuery$1;
818
- var SimpleBarCore = /** @class */ (function () {
819
- function SimpleBarCore(element, options) {
820
- if (options === void 0) { options = {}; }
821
- var _this = this;
822
- this.removePreventClickId = null;
823
- this.minScrollbarWidth = 20;
824
- this.stopScrollDelay = 175;
825
- this.isScrolling = false;
826
- this.isMouseEntering = false;
827
- this.scrollXTicking = false;
828
- this.scrollYTicking = false;
829
- this.wrapperEl = null;
830
- this.contentWrapperEl = null;
831
- this.contentEl = null;
832
- this.offsetEl = null;
833
- this.maskEl = null;
834
- this.placeholderEl = null;
835
- this.heightAutoObserverWrapperEl = null;
836
- this.heightAutoObserverEl = null;
837
- this.rtlHelpers = null;
838
- this.scrollbarWidth = 0;
839
- this.resizeObserver = null;
840
- this.mutationObserver = null;
841
- this.elStyles = null;
842
- this.isRtl = null;
843
- this.mouseX = 0;
844
- this.mouseY = 0;
845
- this.onMouseMove = function () { };
846
- this.onWindowResize = function () { };
847
- this.onStopScrolling = function () { };
848
- this.onMouseEntered = function () { };
849
- /**
850
- * On scroll event handling
851
- */
852
- this.onScroll = function () {
853
- var elWindow = getElementWindow(_this.el);
854
- if (!_this.scrollXTicking) {
855
- elWindow.requestAnimationFrame(_this.scrollX);
856
- _this.scrollXTicking = true;
857
- }
858
- if (!_this.scrollYTicking) {
859
- elWindow.requestAnimationFrame(_this.scrollY);
860
- _this.scrollYTicking = true;
861
- }
862
- if (!_this.isScrolling) {
863
- _this.isScrolling = true;
864
- addClasses(_this.el, _this.classNames.scrolling);
865
- }
866
- _this.showScrollbar('x');
867
- _this.showScrollbar('y');
868
- _this.onStopScrolling();
869
- };
870
- this.scrollX = function () {
871
- if (_this.axis.x.isOverflowing) {
872
- _this.positionScrollbar('x');
873
- }
874
- _this.scrollXTicking = false;
875
- };
876
- this.scrollY = function () {
877
- if (_this.axis.y.isOverflowing) {
878
- _this.positionScrollbar('y');
879
- }
880
- _this.scrollYTicking = false;
881
- };
882
- this._onStopScrolling = function () {
883
- removeClasses(_this.el, _this.classNames.scrolling);
884
- if (_this.options.autoHide) {
885
- _this.hideScrollbar('x');
886
- _this.hideScrollbar('y');
887
- }
888
- _this.isScrolling = false;
889
- };
890
- this.onMouseEnter = function () {
891
- if (!_this.isMouseEntering) {
892
- addClasses(_this.el, _this.classNames.mouseEntered);
893
- _this.showScrollbar('x');
894
- _this.showScrollbar('y');
895
- _this.isMouseEntering = true;
896
- }
897
- _this.onMouseEntered();
898
- };
899
- this._onMouseEntered = function () {
900
- removeClasses(_this.el, _this.classNames.mouseEntered);
901
- if (_this.options.autoHide) {
902
- _this.hideScrollbar('x');
903
- _this.hideScrollbar('y');
904
- }
905
- _this.isMouseEntering = false;
906
- };
907
- this._onMouseMove = function (e) {
908
- _this.mouseX = e.clientX;
909
- _this.mouseY = e.clientY;
910
- if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) {
911
- _this.onMouseMoveForAxis('x');
912
- }
913
- if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) {
914
- _this.onMouseMoveForAxis('y');
915
- }
916
- };
917
- this.onMouseLeave = function () {
918
- _this.onMouseMove.cancel();
919
- if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) {
920
- _this.onMouseLeaveForAxis('x');
921
- }
922
- if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) {
923
- _this.onMouseLeaveForAxis('y');
924
- }
925
- _this.mouseX = -1;
926
- _this.mouseY = -1;
927
- };
928
- this._onWindowResize = function () {
929
- // Recalculate scrollbarWidth in case it's a zoom
930
- _this.scrollbarWidth = _this.getScrollbarWidth();
931
- _this.hideNativeScrollbar();
932
- };
933
- this.onPointerEvent = function (e) {
934
- if (!_this.axis.x.track.el ||
935
- !_this.axis.y.track.el ||
936
- !_this.axis.x.scrollbar.el ||
937
- !_this.axis.y.scrollbar.el)
938
- return;
939
- var isWithinTrackXBounds, isWithinTrackYBounds;
940
- _this.axis.x.track.rect = _this.axis.x.track.el.getBoundingClientRect();
941
- _this.axis.y.track.rect = _this.axis.y.track.el.getBoundingClientRect();
942
- if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) {
943
- isWithinTrackXBounds = _this.isWithinBounds(_this.axis.x.track.rect);
944
- }
945
- if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) {
946
- isWithinTrackYBounds = _this.isWithinBounds(_this.axis.y.track.rect);
947
- }
948
- // If any pointer event is called on the scrollbar
949
- if (isWithinTrackXBounds || isWithinTrackYBounds) {
950
- // Prevent event leaking
951
- e.stopPropagation();
952
- if (e.type === 'pointerdown' && e.pointerType !== 'touch') {
953
- if (isWithinTrackXBounds) {
954
- _this.axis.x.scrollbar.rect =
955
- _this.axis.x.scrollbar.el.getBoundingClientRect();
956
- if (_this.isWithinBounds(_this.axis.x.scrollbar.rect)) {
957
- _this.onDragStart(e, 'x');
958
- }
959
- else {
960
- _this.onTrackClick(e, 'x');
961
- }
962
- }
963
- if (isWithinTrackYBounds) {
964
- _this.axis.y.scrollbar.rect =
965
- _this.axis.y.scrollbar.el.getBoundingClientRect();
966
- if (_this.isWithinBounds(_this.axis.y.scrollbar.rect)) {
967
- _this.onDragStart(e, 'y');
968
- }
969
- else {
970
- _this.onTrackClick(e, 'y');
971
- }
972
- }
973
- }
974
- }
975
- };
976
- /**
977
- * Drag scrollbar handle
978
- */
979
- this.drag = function (e) {
980
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
981
- if (!_this.draggedAxis || !_this.contentWrapperEl)
982
- return;
983
- var eventOffset;
984
- var track = _this.axis[_this.draggedAxis].track;
985
- var trackSize = (_b = (_a = track.rect) === null || _a === void 0 ? void 0 : _a[_this.axis[_this.draggedAxis].sizeAttr]) !== null && _b !== void 0 ? _b : 0;
986
- var scrollbar = _this.axis[_this.draggedAxis].scrollbar;
987
- var contentSize = (_d = (_c = _this.contentWrapperEl) === null || _c === void 0 ? void 0 : _c[_this.axis[_this.draggedAxis].scrollSizeAttr]) !== null && _d !== void 0 ? _d : 0;
988
- var hostSize = parseInt((_f = (_e = _this.elStyles) === null || _e === void 0 ? void 0 : _e[_this.axis[_this.draggedAxis].sizeAttr]) !== null && _f !== void 0 ? _f : '0px', 10);
989
- e.preventDefault();
990
- e.stopPropagation();
991
- if (_this.draggedAxis === 'y') {
992
- eventOffset = e.pageY;
993
- }
994
- else {
995
- eventOffset = e.pageX;
996
- }
997
- // Calculate how far the user's mouse is from the top/left of the scrollbar (minus the dragOffset).
998
- var dragPos = eventOffset -
999
- ((_h = (_g = track.rect) === null || _g === void 0 ? void 0 : _g[_this.axis[_this.draggedAxis].offsetAttr]) !== null && _h !== void 0 ? _h : 0) -
1000
- _this.axis[_this.draggedAxis].dragOffset;
1001
- dragPos = _this.draggedAxis === 'x' && _this.isRtl
1002
- ? ((_k = (_j = track.rect) === null || _j === void 0 ? void 0 : _j[_this.axis[_this.draggedAxis].sizeAttr]) !== null && _k !== void 0 ? _k : 0) -
1003
- scrollbar.size -
1004
- dragPos
1005
- : dragPos;
1006
- // Convert the mouse position into a percentage of the scrollbar height/width.
1007
- var dragPerc = dragPos / (trackSize - scrollbar.size);
1008
- // Scroll the content by the same percentage.
1009
- var scrollPos = dragPerc * (contentSize - hostSize);
1010
- // Fix browsers inconsistency on RTL
1011
- if (_this.draggedAxis === 'x' && _this.isRtl) {
1012
- scrollPos = ((_l = SimpleBarCore.getRtlHelpers()) === null || _l === void 0 ? void 0 : _l.isScrollingToNegative)
1013
- ? -scrollPos
1014
- : scrollPos;
1015
- }
1016
- _this.contentWrapperEl[_this.axis[_this.draggedAxis].scrollOffsetAttr] =
1017
- scrollPos;
1018
- };
1019
- /**
1020
- * End scroll handle drag
1021
- */
1022
- this.onEndDrag = function (e) {
1023
- var elDocument = getElementDocument(_this.el);
1024
- var elWindow = getElementWindow(_this.el);
1025
- e.preventDefault();
1026
- e.stopPropagation();
1027
- removeClasses(_this.el, _this.classNames.dragging);
1028
- elDocument.removeEventListener('mousemove', _this.drag, true);
1029
- elDocument.removeEventListener('mouseup', _this.onEndDrag, true);
1030
- _this.removePreventClickId = elWindow.setTimeout(function () {
1031
- // Remove these asynchronously so we still suppress click events
1032
- // generated simultaneously with mouseup.
1033
- elDocument.removeEventListener('click', _this.preventClick, true);
1034
- elDocument.removeEventListener('dblclick', _this.preventClick, true);
1035
- _this.removePreventClickId = null;
1036
- });
1037
- };
1038
- /**
1039
- * Handler to ignore click events during drag
1040
- */
1041
- this.preventClick = function (e) {
1042
- e.preventDefault();
1043
- e.stopPropagation();
1044
- };
1045
- this.el = element;
1046
- this.options = __assign$1(__assign$1({}, SimpleBarCore.defaultOptions), options);
1047
- this.classNames = __assign$1(__assign$1({}, SimpleBarCore.defaultOptions.classNames), options.classNames);
1048
- this.axis = {
1049
- x: {
1050
- scrollOffsetAttr: 'scrollLeft',
1051
- sizeAttr: 'width',
1052
- scrollSizeAttr: 'scrollWidth',
1053
- offsetSizeAttr: 'offsetWidth',
1054
- offsetAttr: 'left',
1055
- overflowAttr: 'overflowX',
1056
- dragOffset: 0,
1057
- isOverflowing: true,
1058
- forceVisible: false,
1059
- track: { size: null, el: null, rect: null, isVisible: false },
1060
- scrollbar: { size: null, el: null, rect: null, isVisible: false }
1061
- },
1062
- y: {
1063
- scrollOffsetAttr: 'scrollTop',
1064
- sizeAttr: 'height',
1065
- scrollSizeAttr: 'scrollHeight',
1066
- offsetSizeAttr: 'offsetHeight',
1067
- offsetAttr: 'top',
1068
- overflowAttr: 'overflowY',
1069
- dragOffset: 0,
1070
- isOverflowing: true,
1071
- forceVisible: false,
1072
- track: { size: null, el: null, rect: null, isVisible: false },
1073
- scrollbar: { size: null, el: null, rect: null, isVisible: false }
1074
- }
1075
- };
1076
- if (typeof this.el !== 'object' || !this.el.nodeName) {
1077
- throw new Error("Argument passed to SimpleBar must be an HTML element instead of ".concat(this.el));
1078
- }
1079
- this.onMouseMove = throttle(this._onMouseMove, 64);
1080
- this.onWindowResize = debounce(this._onWindowResize, 64, { leading: true });
1081
- this.onStopScrolling = debounce(this._onStopScrolling, this.stopScrollDelay);
1082
- this.onMouseEntered = debounce(this._onMouseEntered, this.stopScrollDelay);
1083
- this.init();
1084
- }
1085
- /**
1086
- * Helper to fix browsers inconsistency on RTL:
1087
- * - Firefox inverts the scrollbar initial position
1088
- * - IE11 inverts both scrollbar position and scrolling offset
1089
- * Directly inspired by @KingSora's OverlayScrollbars https://github.com/KingSora/OverlayScrollbars/blob/master/js/OverlayScrollbars.js#L1634
1090
- */
1091
- SimpleBarCore.getRtlHelpers = function () {
1092
- if (SimpleBarCore.rtlHelpers) {
1093
- return SimpleBarCore.rtlHelpers;
1094
- }
1095
- var dummyDiv = document.createElement('div');
1096
- dummyDiv.innerHTML =
1097
- '<div class="simplebar-dummy-scrollbar-size"><div></div></div>';
1098
- var scrollbarDummyEl = dummyDiv.firstElementChild;
1099
- var dummyChild = scrollbarDummyEl === null || scrollbarDummyEl === void 0 ? void 0 : scrollbarDummyEl.firstElementChild;
1100
- if (!dummyChild)
1101
- return null;
1102
- document.body.appendChild(scrollbarDummyEl);
1103
- scrollbarDummyEl.scrollLeft = 0;
1104
- var dummyContainerOffset = SimpleBarCore.getOffset(scrollbarDummyEl);
1105
- var dummyChildOffset = SimpleBarCore.getOffset(dummyChild);
1106
- scrollbarDummyEl.scrollLeft = -999;
1107
- var dummyChildOffsetAfterScroll = SimpleBarCore.getOffset(dummyChild);
1108
- document.body.removeChild(scrollbarDummyEl);
1109
- SimpleBarCore.rtlHelpers = {
1110
- // determines if the scrolling is responding with negative values
1111
- isScrollOriginAtZero: dummyContainerOffset.left !== dummyChildOffset.left,
1112
- // determines if the origin scrollbar position is inverted or not (positioned on left or right)
1113
- isScrollingToNegative: dummyChildOffset.left !== dummyChildOffsetAfterScroll.left
1114
- };
1115
- return SimpleBarCore.rtlHelpers;
1116
- };
1117
- SimpleBarCore.prototype.getScrollbarWidth = function () {
1118
- // Try/catch for FF 56 throwing on undefined computedStyles
1119
- try {
1120
- // Detect browsers supporting CSS scrollbar styling and do not calculate
1121
- if ((this.contentWrapperEl &&
1122
- getComputedStyle(this.contentWrapperEl, '::-webkit-scrollbar')
1123
- .display === 'none') ||
1124
- 'scrollbarWidth' in document.documentElement.style ||
1125
- '-ms-overflow-style' in document.documentElement.style) {
1126
- return 0;
1127
- }
1128
- else {
1129
- return scrollbarWidth();
1130
- }
1131
- }
1132
- catch (e) {
1133
- return scrollbarWidth();
1134
- }
1135
- };
1136
- SimpleBarCore.getOffset = function (el) {
1137
- var rect = el.getBoundingClientRect();
1138
- var elDocument = getElementDocument(el);
1139
- var elWindow = getElementWindow(el);
1140
- return {
1141
- top: rect.top +
1142
- (elWindow.pageYOffset || elDocument.documentElement.scrollTop),
1143
- left: rect.left +
1144
- (elWindow.pageXOffset || elDocument.documentElement.scrollLeft)
1145
- };
1146
- };
1147
- SimpleBarCore.prototype.init = function () {
1148
- // We stop here on server-side
1149
- if (canUseDOM$1) {
1150
- this.initDOM();
1151
- this.rtlHelpers = SimpleBarCore.getRtlHelpers();
1152
- this.scrollbarWidth = this.getScrollbarWidth();
1153
- this.recalculate();
1154
- this.initListeners();
1155
- }
1156
- };
1157
- SimpleBarCore.prototype.initDOM = function () {
1158
- var _a, _b;
1159
- // assume that element has his DOM already initiated
1160
- this.wrapperEl = this.el.querySelector(classNamesToQuery(this.classNames.wrapper));
1161
- this.contentWrapperEl =
1162
- this.options.scrollableNode ||
1163
- this.el.querySelector(classNamesToQuery(this.classNames.contentWrapper));
1164
- this.contentEl =
1165
- this.options.contentNode ||
1166
- this.el.querySelector(classNamesToQuery(this.classNames.contentEl));
1167
- this.offsetEl = this.el.querySelector(classNamesToQuery(this.classNames.offset));
1168
- this.maskEl = this.el.querySelector(classNamesToQuery(this.classNames.mask));
1169
- this.placeholderEl = this.findChild(this.wrapperEl, classNamesToQuery(this.classNames.placeholder));
1170
- this.heightAutoObserverWrapperEl = this.el.querySelector(classNamesToQuery(this.classNames.heightAutoObserverWrapperEl));
1171
- this.heightAutoObserverEl = this.el.querySelector(classNamesToQuery(this.classNames.heightAutoObserverEl));
1172
- this.axis.x.track.el = this.findChild(this.el, "".concat(classNamesToQuery(this.classNames.track)).concat(classNamesToQuery(this.classNames.horizontal)));
1173
- this.axis.y.track.el = this.findChild(this.el, "".concat(classNamesToQuery(this.classNames.track)).concat(classNamesToQuery(this.classNames.vertical)));
1174
- this.axis.x.scrollbar.el =
1175
- ((_a = this.axis.x.track.el) === null || _a === void 0 ? void 0 : _a.querySelector(classNamesToQuery(this.classNames.scrollbar))) || null;
1176
- this.axis.y.scrollbar.el =
1177
- ((_b = this.axis.y.track.el) === null || _b === void 0 ? void 0 : _b.querySelector(classNamesToQuery(this.classNames.scrollbar))) || null;
1178
- if (!this.options.autoHide) {
1179
- addClasses(this.axis.x.scrollbar.el, this.classNames.visible);
1180
- addClasses(this.axis.y.scrollbar.el, this.classNames.visible);
1181
- }
1182
- };
1183
- SimpleBarCore.prototype.initListeners = function () {
1184
- var _this = this;
1185
- var _a;
1186
- var elWindow = getElementWindow(this.el);
1187
- // Event listeners
1188
- this.el.addEventListener('mouseenter', this.onMouseEnter);
1189
- this.el.addEventListener('pointerdown', this.onPointerEvent, true);
1190
- this.el.addEventListener('mousemove', this.onMouseMove);
1191
- this.el.addEventListener('mouseleave', this.onMouseLeave);
1192
- (_a = this.contentWrapperEl) === null || _a === void 0 ? void 0 : _a.addEventListener('scroll', this.onScroll);
1193
- // Browser zoom triggers a window resize
1194
- elWindow.addEventListener('resize', this.onWindowResize);
1195
- if (!this.contentEl)
1196
- return;
1197
- if (window.ResizeObserver) {
1198
- // Hack for https://github.com/WICG/ResizeObserver/issues/38
1199
- var resizeObserverStarted_1 = false;
1200
- var resizeObserver = elWindow.ResizeObserver || ResizeObserver;
1201
- this.resizeObserver = new resizeObserver(function () {
1202
- if (!resizeObserverStarted_1)
1203
- return;
1204
- elWindow.requestAnimationFrame(function () {
1205
- _this.recalculate();
1206
- });
1207
- });
1208
- this.resizeObserver.observe(this.el);
1209
- this.resizeObserver.observe(this.contentEl);
1210
- elWindow.requestAnimationFrame(function () {
1211
- resizeObserverStarted_1 = true;
1212
- });
1213
- }
1214
- // This is required to detect horizontal scroll. Vertical scroll only needs the resizeObserver.
1215
- this.mutationObserver = new elWindow.MutationObserver(function () {
1216
- elWindow.requestAnimationFrame(function () {
1217
- _this.recalculate();
1218
- });
1219
- });
1220
- this.mutationObserver.observe(this.contentEl, {
1221
- childList: true,
1222
- subtree: true,
1223
- characterData: true
1224
- });
1225
- };
1226
- SimpleBarCore.prototype.recalculate = function () {
1227
- if (!this.heightAutoObserverEl ||
1228
- !this.contentEl ||
1229
- !this.contentWrapperEl ||
1230
- !this.wrapperEl ||
1231
- !this.placeholderEl)
1232
- return;
1233
- var elWindow = getElementWindow(this.el);
1234
- this.elStyles = elWindow.getComputedStyle(this.el);
1235
- this.isRtl = this.elStyles.direction === 'rtl';
1236
- var contentElOffsetWidth = this.contentEl.offsetWidth;
1237
- var isHeightAuto = this.heightAutoObserverEl.offsetHeight <= 1;
1238
- var isWidthAuto = this.heightAutoObserverEl.offsetWidth <= 1 || contentElOffsetWidth > 0;
1239
- var contentWrapperElOffsetWidth = this.contentWrapperEl.offsetWidth;
1240
- var elOverflowX = this.elStyles.overflowX;
1241
- var elOverflowY = this.elStyles.overflowY;
1242
- this.contentEl.style.padding = "".concat(this.elStyles.paddingTop, " ").concat(this.elStyles.paddingRight, " ").concat(this.elStyles.paddingBottom, " ").concat(this.elStyles.paddingLeft);
1243
- this.wrapperEl.style.margin = "-".concat(this.elStyles.paddingTop, " -").concat(this.elStyles.paddingRight, " -").concat(this.elStyles.paddingBottom, " -").concat(this.elStyles.paddingLeft);
1244
- var contentElScrollHeight = this.contentEl.scrollHeight;
1245
- var contentElScrollWidth = this.contentEl.scrollWidth;
1246
- this.contentWrapperEl.style.height = isHeightAuto ? 'auto' : '100%';
1247
- // Determine placeholder size
1248
- this.placeholderEl.style.width = isWidthAuto
1249
- ? "".concat(contentElOffsetWidth || contentElScrollWidth, "px")
1250
- : 'auto';
1251
- this.placeholderEl.style.height = "".concat(contentElScrollHeight, "px");
1252
- var contentWrapperElOffsetHeight = this.contentWrapperEl.offsetHeight;
1253
- this.axis.x.isOverflowing =
1254
- contentElOffsetWidth !== 0 && contentElScrollWidth > contentElOffsetWidth;
1255
- this.axis.y.isOverflowing =
1256
- contentElScrollHeight > contentWrapperElOffsetHeight;
1257
- // Set isOverflowing to false if user explicitely set hidden overflow
1258
- this.axis.x.isOverflowing =
1259
- elOverflowX === 'hidden' ? false : this.axis.x.isOverflowing;
1260
- this.axis.y.isOverflowing =
1261
- elOverflowY === 'hidden' ? false : this.axis.y.isOverflowing;
1262
- this.axis.x.forceVisible =
1263
- this.options.forceVisible === 'x' || this.options.forceVisible === true;
1264
- this.axis.y.forceVisible =
1265
- this.options.forceVisible === 'y' || this.options.forceVisible === true;
1266
- this.hideNativeScrollbar();
1267
- // Set isOverflowing to false if scrollbar is not necessary (content is shorter than offset)
1268
- var offsetForXScrollbar = this.axis.x.isOverflowing
1269
- ? this.scrollbarWidth
1270
- : 0;
1271
- var offsetForYScrollbar = this.axis.y.isOverflowing
1272
- ? this.scrollbarWidth
1273
- : 0;
1274
- this.axis.x.isOverflowing =
1275
- this.axis.x.isOverflowing &&
1276
- contentElScrollWidth > contentWrapperElOffsetWidth - offsetForYScrollbar;
1277
- this.axis.y.isOverflowing =
1278
- this.axis.y.isOverflowing &&
1279
- contentElScrollHeight >
1280
- contentWrapperElOffsetHeight - offsetForXScrollbar;
1281
- this.axis.x.scrollbar.size = this.getScrollbarSize('x');
1282
- this.axis.y.scrollbar.size = this.getScrollbarSize('y');
1283
- if (this.axis.x.scrollbar.el)
1284
- this.axis.x.scrollbar.el.style.width = "".concat(this.axis.x.scrollbar.size, "px");
1285
- if (this.axis.y.scrollbar.el)
1286
- this.axis.y.scrollbar.el.style.height = "".concat(this.axis.y.scrollbar.size, "px");
1287
- this.positionScrollbar('x');
1288
- this.positionScrollbar('y');
1289
- this.toggleTrackVisibility('x');
1290
- this.toggleTrackVisibility('y');
1291
- };
1292
- /**
1293
- * Calculate scrollbar size
1294
- */
1295
- SimpleBarCore.prototype.getScrollbarSize = function (axis) {
1296
- var _a, _b;
1297
- if (axis === void 0) { axis = 'y'; }
1298
- if (!this.axis[axis].isOverflowing || !this.contentEl) {
1299
- return 0;
1300
- }
1301
- var contentSize = this.contentEl[this.axis[axis].scrollSizeAttr];
1302
- var trackSize = (_b = (_a = this.axis[axis].track.el) === null || _a === void 0 ? void 0 : _a[this.axis[axis].offsetSizeAttr]) !== null && _b !== void 0 ? _b : 0;
1303
- var scrollbarRatio = trackSize / contentSize;
1304
- var scrollbarSize;
1305
- // Calculate new height/position of drag handle.
1306
- scrollbarSize = Math.max(~~(scrollbarRatio * trackSize), this.options.scrollbarMinSize);
1307
- if (this.options.scrollbarMaxSize) {
1308
- scrollbarSize = Math.min(scrollbarSize, this.options.scrollbarMaxSize);
1309
- }
1310
- return scrollbarSize;
1311
- };
1312
- SimpleBarCore.prototype.positionScrollbar = function (axis) {
1313
- var _a, _b, _c;
1314
- if (axis === void 0) { axis = 'y'; }
1315
- var scrollbar = this.axis[axis].scrollbar;
1316
- if (!this.axis[axis].isOverflowing ||
1317
- !this.contentWrapperEl ||
1318
- !scrollbar.el ||
1319
- !this.elStyles) {
1320
- return;
1321
- }
1322
- var contentSize = this.contentWrapperEl[this.axis[axis].scrollSizeAttr];
1323
- var trackSize = ((_a = this.axis[axis].track.el) === null || _a === void 0 ? void 0 : _a[this.axis[axis].offsetSizeAttr]) || 0;
1324
- var hostSize = parseInt(this.elStyles[this.axis[axis].sizeAttr], 10);
1325
- var scrollOffset = this.contentWrapperEl[this.axis[axis].scrollOffsetAttr];
1326
- scrollOffset =
1327
- axis === 'x' &&
1328
- this.isRtl &&
1329
- ((_b = SimpleBarCore.getRtlHelpers()) === null || _b === void 0 ? void 0 : _b.isScrollOriginAtZero)
1330
- ? -scrollOffset
1331
- : scrollOffset;
1332
- if (axis === 'x' && this.isRtl) {
1333
- scrollOffset = ((_c = SimpleBarCore.getRtlHelpers()) === null || _c === void 0 ? void 0 : _c.isScrollingToNegative)
1334
- ? scrollOffset
1335
- : -scrollOffset;
1336
- }
1337
- var scrollPourcent = scrollOffset / (contentSize - hostSize);
1338
- var handleOffset = ~~((trackSize - scrollbar.size) * scrollPourcent);
1339
- handleOffset =
1340
- axis === 'x' && this.isRtl
1341
- ? -handleOffset + (trackSize - scrollbar.size)
1342
- : handleOffset;
1343
- scrollbar.el.style.transform =
1344
- axis === 'x'
1345
- ? "translate3d(".concat(handleOffset, "px, 0, 0)")
1346
- : "translate3d(0, ".concat(handleOffset, "px, 0)");
1347
- };
1348
- SimpleBarCore.prototype.toggleTrackVisibility = function (axis) {
1349
- if (axis === void 0) { axis = 'y'; }
1350
- var track = this.axis[axis].track.el;
1351
- var scrollbar = this.axis[axis].scrollbar.el;
1352
- if (!track || !scrollbar || !this.contentWrapperEl)
1353
- return;
1354
- if (this.axis[axis].isOverflowing || this.axis[axis].forceVisible) {
1355
- track.style.visibility = 'visible';
1356
- this.contentWrapperEl.style[this.axis[axis].overflowAttr] = 'scroll';
1357
- this.el.classList.add("".concat(this.classNames.scrollable, "-").concat(axis));
1358
- }
1359
- else {
1360
- track.style.visibility = 'hidden';
1361
- this.contentWrapperEl.style[this.axis[axis].overflowAttr] = 'hidden';
1362
- this.el.classList.remove("".concat(this.classNames.scrollable, "-").concat(axis));
1363
- }
1364
- // Even if forceVisible is enabled, scrollbar itself should be hidden
1365
- if (this.axis[axis].isOverflowing) {
1366
- scrollbar.style.display = 'block';
1367
- }
1368
- else {
1369
- scrollbar.style.display = 'none';
1370
- }
1371
- };
1372
- SimpleBarCore.prototype.showScrollbar = function (axis) {
1373
- if (axis === void 0) { axis = 'y'; }
1374
- if (this.axis[axis].isOverflowing && !this.axis[axis].scrollbar.isVisible) {
1375
- addClasses(this.axis[axis].scrollbar.el, this.classNames.visible);
1376
- this.axis[axis].scrollbar.isVisible = true;
1377
- }
1378
- };
1379
- SimpleBarCore.prototype.hideScrollbar = function (axis) {
1380
- if (axis === void 0) { axis = 'y'; }
1381
- if (this.axis[axis].isOverflowing && this.axis[axis].scrollbar.isVisible) {
1382
- removeClasses(this.axis[axis].scrollbar.el, this.classNames.visible);
1383
- this.axis[axis].scrollbar.isVisible = false;
1384
- }
1385
- };
1386
- SimpleBarCore.prototype.hideNativeScrollbar = function () {
1387
- if (!this.offsetEl)
1388
- return;
1389
- this.offsetEl.style[this.isRtl ? 'left' : 'right'] =
1390
- this.axis.y.isOverflowing || this.axis.y.forceVisible
1391
- ? "-".concat(this.scrollbarWidth, "px")
1392
- : '0px';
1393
- this.offsetEl.style.bottom =
1394
- this.axis.x.isOverflowing || this.axis.x.forceVisible
1395
- ? "-".concat(this.scrollbarWidth, "px")
1396
- : '0px';
1397
- };
1398
- SimpleBarCore.prototype.onMouseMoveForAxis = function (axis) {
1399
- if (axis === void 0) { axis = 'y'; }
1400
- var currentAxis = this.axis[axis];
1401
- if (!currentAxis.track.el || !currentAxis.scrollbar.el)
1402
- return;
1403
- currentAxis.track.rect = currentAxis.track.el.getBoundingClientRect();
1404
- currentAxis.scrollbar.rect =
1405
- currentAxis.scrollbar.el.getBoundingClientRect();
1406
- if (this.isWithinBounds(currentAxis.track.rect)) {
1407
- this.showScrollbar(axis);
1408
- addClasses(currentAxis.track.el, this.classNames.hover);
1409
- if (this.isWithinBounds(currentAxis.scrollbar.rect)) {
1410
- addClasses(currentAxis.scrollbar.el, this.classNames.hover);
1411
- }
1412
- else {
1413
- removeClasses(currentAxis.scrollbar.el, this.classNames.hover);
1414
- }
1415
- }
1416
- else {
1417
- removeClasses(currentAxis.track.el, this.classNames.hover);
1418
- if (this.options.autoHide) {
1419
- this.hideScrollbar(axis);
1420
- }
1421
- }
1422
- };
1423
- SimpleBarCore.prototype.onMouseLeaveForAxis = function (axis) {
1424
- if (axis === void 0) { axis = 'y'; }
1425
- removeClasses(this.axis[axis].track.el, this.classNames.hover);
1426
- removeClasses(this.axis[axis].scrollbar.el, this.classNames.hover);
1427
- if (this.options.autoHide) {
1428
- this.hideScrollbar(axis);
1429
- }
1430
- };
1431
- /**
1432
- * on scrollbar handle drag movement starts
1433
- */
1434
- SimpleBarCore.prototype.onDragStart = function (e, axis) {
1435
- var _a;
1436
- if (axis === void 0) { axis = 'y'; }
1437
- var elDocument = getElementDocument(this.el);
1438
- var elWindow = getElementWindow(this.el);
1439
- var scrollbar = this.axis[axis].scrollbar;
1440
- // Measure how far the user's mouse is from the top of the scrollbar drag handle.
1441
- var eventOffset = axis === 'y' ? e.pageY : e.pageX;
1442
- this.axis[axis].dragOffset =
1443
- eventOffset - (((_a = scrollbar.rect) === null || _a === void 0 ? void 0 : _a[this.axis[axis].offsetAttr]) || 0);
1444
- this.draggedAxis = axis;
1445
- addClasses(this.el, this.classNames.dragging);
1446
- elDocument.addEventListener('mousemove', this.drag, true);
1447
- elDocument.addEventListener('mouseup', this.onEndDrag, true);
1448
- if (this.removePreventClickId === null) {
1449
- elDocument.addEventListener('click', this.preventClick, true);
1450
- elDocument.addEventListener('dblclick', this.preventClick, true);
1451
- }
1452
- else {
1453
- elWindow.clearTimeout(this.removePreventClickId);
1454
- this.removePreventClickId = null;
1455
- }
1456
- };
1457
- SimpleBarCore.prototype.onTrackClick = function (e, axis) {
1458
- var _this = this;
1459
- var _a, _b, _c, _d;
1460
- if (axis === void 0) { axis = 'y'; }
1461
- var currentAxis = this.axis[axis];
1462
- if (!this.options.clickOnTrack ||
1463
- !currentAxis.scrollbar.el ||
1464
- !this.contentWrapperEl)
1465
- return;
1466
- // Preventing the event's default to trigger click underneath
1467
- e.preventDefault();
1468
- var elWindow = getElementWindow(this.el);
1469
- this.axis[axis].scrollbar.rect =
1470
- currentAxis.scrollbar.el.getBoundingClientRect();
1471
- var scrollbar = this.axis[axis].scrollbar;
1472
- var scrollbarOffset = (_b = (_a = scrollbar.rect) === null || _a === void 0 ? void 0 : _a[this.axis[axis].offsetAttr]) !== null && _b !== void 0 ? _b : 0;
1473
- var hostSize = parseInt((_d = (_c = this.elStyles) === null || _c === void 0 ? void 0 : _c[this.axis[axis].sizeAttr]) !== null && _d !== void 0 ? _d : '0px', 10);
1474
- var scrolled = this.contentWrapperEl[this.axis[axis].scrollOffsetAttr];
1475
- var t = axis === 'y'
1476
- ? this.mouseY - scrollbarOffset
1477
- : this.mouseX - scrollbarOffset;
1478
- var dir = t < 0 ? -1 : 1;
1479
- var scrollSize = dir === -1 ? scrolled - hostSize : scrolled + hostSize;
1480
- var speed = 40;
1481
- var scrollTo = function () {
1482
- if (!_this.contentWrapperEl)
1483
- return;
1484
- if (dir === -1) {
1485
- if (scrolled > scrollSize) {
1486
- scrolled -= speed;
1487
- _this.contentWrapperEl[_this.axis[axis].scrollOffsetAttr] = scrolled;
1488
- elWindow.requestAnimationFrame(scrollTo);
1489
- }
1490
- }
1491
- else {
1492
- if (scrolled < scrollSize) {
1493
- scrolled += speed;
1494
- _this.contentWrapperEl[_this.axis[axis].scrollOffsetAttr] = scrolled;
1495
- elWindow.requestAnimationFrame(scrollTo);
1496
- }
1497
- }
1498
- };
1499
- scrollTo();
1500
- };
1501
- /**
1502
- * Getter for content element
1503
- */
1504
- SimpleBarCore.prototype.getContentElement = function () {
1505
- return this.contentEl;
1506
- };
1507
- /**
1508
- * Getter for original scrolling element
1509
- */
1510
- SimpleBarCore.prototype.getScrollElement = function () {
1511
- return this.contentWrapperEl;
1512
- };
1513
- SimpleBarCore.prototype.removeListeners = function () {
1514
- var elWindow = getElementWindow(this.el);
1515
- // Event listeners
1516
- this.el.removeEventListener('mouseenter', this.onMouseEnter);
1517
- this.el.removeEventListener('pointerdown', this.onPointerEvent, true);
1518
- this.el.removeEventListener('mousemove', this.onMouseMove);
1519
- this.el.removeEventListener('mouseleave', this.onMouseLeave);
1520
- if (this.contentWrapperEl) {
1521
- this.contentWrapperEl.removeEventListener('scroll', this.onScroll);
1522
- }
1523
- elWindow.removeEventListener('resize', this.onWindowResize);
1524
- if (this.mutationObserver) {
1525
- this.mutationObserver.disconnect();
1526
- }
1527
- if (this.resizeObserver) {
1528
- this.resizeObserver.disconnect();
1529
- }
1530
- // Cancel all debounced functions
1531
- this.onMouseMove.cancel();
1532
- this.onWindowResize.cancel();
1533
- this.onStopScrolling.cancel();
1534
- this.onMouseEntered.cancel();
1535
- };
1536
- /**
1537
- * Remove all listeners from DOM nodes
1538
- */
1539
- SimpleBarCore.prototype.unMount = function () {
1540
- this.removeListeners();
1541
- };
1542
- /**
1543
- * Check if mouse is within bounds
1544
- */
1545
- SimpleBarCore.prototype.isWithinBounds = function (bbox) {
1546
- return (this.mouseX >= bbox.left &&
1547
- this.mouseX <= bbox.left + bbox.width &&
1548
- this.mouseY >= bbox.top &&
1549
- this.mouseY <= bbox.top + bbox.height);
1550
- };
1551
- /**
1552
- * Find element children matches query
1553
- */
1554
- SimpleBarCore.prototype.findChild = function (el, query) {
1555
- var matches = el.matches ||
1556
- el.webkitMatchesSelector ||
1557
- el.mozMatchesSelector ||
1558
- el.msMatchesSelector;
1559
- return Array.prototype.filter.call(el.children, function (child) {
1560
- return matches.call(child, query);
1561
- })[0];
1562
- };
1563
- SimpleBarCore.rtlHelpers = null;
1564
- SimpleBarCore.defaultOptions = {
1565
- forceVisible: false,
1566
- clickOnTrack: true,
1567
- scrollbarMinSize: 25,
1568
- scrollbarMaxSize: 0,
1569
- ariaLabel: 'scrollable content',
1570
- classNames: {
1571
- contentEl: 'simplebar-content',
1572
- contentWrapper: 'simplebar-content-wrapper',
1573
- offset: 'simplebar-offset',
1574
- mask: 'simplebar-mask',
1575
- wrapper: 'simplebar-wrapper',
1576
- placeholder: 'simplebar-placeholder',
1577
- scrollbar: 'simplebar-scrollbar',
1578
- track: 'simplebar-track',
1579
- heightAutoObserverWrapperEl: 'simplebar-height-auto-observer-wrapper',
1580
- heightAutoObserverEl: 'simplebar-height-auto-observer',
1581
- visible: 'simplebar-visible',
1582
- horizontal: 'simplebar-horizontal',
1583
- vertical: 'simplebar-vertical',
1584
- hover: 'simplebar-hover',
1585
- dragging: 'simplebar-dragging',
1586
- scrolling: 'simplebar-scrolling',
1587
- scrollable: 'simplebar-scrollable',
1588
- mouseEntered: 'simplebar-mouse-entered'
1589
- },
1590
- scrollableNode: null,
1591
- contentNode: null,
1592
- autoHide: true
1593
- };
1594
- /**
1595
- * Static functions
1596
- */
1597
- SimpleBarCore.getOptions = getOptions;
1598
- SimpleBarCore.helpers = helpers;
1599
- return SimpleBarCore;
1600
- }());/**
1601
- * simplebar-react - v3.2.4
1602
- * React component for SimpleBar
1603
- * https://grsmto.github.io/simplebar/
1604
- *
1605
- * Made by Adrien Denat
1606
- * Under MIT License
1607
- */
1608
-
1609
-
1610
- /******************************************************************************
1611
- Copyright (c) Microsoft Corporation.
1612
-
1613
- Permission to use, copy, modify, and/or distribute this software for any
1614
- purpose with or without fee is hereby granted.
1615
-
1616
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1617
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1618
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1619
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1620
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1621
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1622
- PERFORMANCE OF THIS SOFTWARE.
1623
- ***************************************************************************** */
1624
-
1625
- var __assign = function() {
1626
- __assign = Object.assign || function __assign(t) {
1627
- for (var s, i = 1, n = arguments.length; i < n; i++) {
1628
- s = arguments[i];
1629
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1630
- }
1631
- return t;
1632
- };
1633
- return __assign.apply(this, arguments);
1634
- };
1635
-
1636
- function __rest(s, e) {
1637
- var t = {};
1638
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1639
- t[p] = s[p];
1640
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
1641
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1642
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1643
- t[p[i]] = s[p[i]];
1644
- }
1645
- return t;
1646
- }
1647
-
1648
- var SimpleBar = React.forwardRef(function (_a, ref) {
1649
- var children = _a.children, _b = _a.scrollableNodeProps, scrollableNodeProps = _b === void 0 ? {} : _b, otherProps = __rest(_a, ["children", "scrollableNodeProps"]);
1650
- var elRef = React.useRef();
1651
- var scrollableNodeRef = React.useRef();
1652
- var contentNodeRef = React.useRef();
1653
- var options = {};
1654
- var rest = {};
1655
- Object.keys(otherProps).forEach(function (key) {
1656
- if (Object.prototype.hasOwnProperty.call(SimpleBarCore.defaultOptions, key)) {
1657
- options[key] = otherProps[key];
1658
- }
1659
- else {
1660
- rest[key] = otherProps[key];
1661
- }
1662
- });
1663
- var classNames = __assign(__assign({}, SimpleBarCore.defaultOptions.classNames), options.classNames);
1664
- var scrollableNodeFullProps = __assign(__assign({}, scrollableNodeProps), { className: "".concat(classNames.contentWrapper).concat(scrollableNodeProps.className ? " ".concat(scrollableNodeProps.className) : ''), tabIndex: 0, role: 'region', 'aria-label': options.ariaLabel || SimpleBarCore.defaultOptions.ariaLabel });
1665
- React.useEffect(function () {
1666
- var instance;
1667
- scrollableNodeRef.current = scrollableNodeFullProps.ref
1668
- ? scrollableNodeFullProps.ref.current
1669
- : scrollableNodeRef.current;
1670
- if (elRef.current) {
1671
- instance = new SimpleBarCore(elRef.current, __assign(__assign(__assign({}, options), (scrollableNodeRef.current && {
1672
- scrollableNode: scrollableNodeRef.current
1673
- })), (contentNodeRef.current && {
1674
- contentNode: contentNodeRef.current
1675
- })));
1676
- if (typeof ref === 'function') {
1677
- ref(instance);
1678
- }
1679
- else if (ref) {
1680
- ref.current = instance;
1681
- }
1682
- }
1683
- return function () {
1684
- instance === null || instance === void 0 ? void 0 : instance.unMount();
1685
- instance = null;
1686
- if (typeof ref === 'function') {
1687
- ref(null);
1688
- }
1689
- };
1690
- }, []);
1691
- return (React.createElement("div", __assign({ "data-simplebar": "init", ref: elRef }, rest),
1692
- React.createElement("div", { className: classNames.wrapper },
1693
- React.createElement("div", { className: classNames.heightAutoObserverWrapperEl },
1694
- React.createElement("div", { className: classNames.heightAutoObserverEl })),
1695
- React.createElement("div", { className: classNames.mask },
1696
- React.createElement("div", { className: classNames.offset }, typeof children === 'function' ? (children({
1697
- scrollableNodeRef: scrollableNodeRef,
1698
- scrollableNodeProps: __assign(__assign({}, scrollableNodeFullProps), { ref: scrollableNodeRef }),
1699
- contentNodeRef: contentNodeRef,
1700
- contentNodeProps: {
1701
- className: classNames.contentEl,
1702
- ref: contentNodeRef
1703
- }
1704
- })) : (React.createElement("div", __assign({}, scrollableNodeFullProps),
1705
- React.createElement("div", { className: classNames.contentEl }, children))))),
1706
- React.createElement("div", { className: classNames.placeholder })),
1707
- React.createElement("div", { className: "".concat(classNames.track, " simplebar-horizontal") },
1708
- React.createElement("div", { className: classNames.scrollbar })),
1709
- React.createElement("div", { className: "".concat(classNames.track, " simplebar-vertical") },
1710
- React.createElement("div", { className: classNames.scrollbar }))));
1711
- });
1712
- SimpleBar.displayName = 'SimpleBar';var StyledSimpleBar = styled(SimpleBar)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n max-height: 100%;\n"], ["\n max-height: 100%;\n"])));
155
+ return (React.createElement(StyledList, null, list.map(function (info, idx) { return (React.createElement(SideMenuListItem, { key: idx, info: info, badgeVariant: badgeVariant, onClick: onClick })); })));
156
+ };var StyledSimpleBar = styled(SimpleBar)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n max-height: 100%;\n"], ["\n max-height: 100%;\n"])));
1713
157
  var StyledLogoContainerBox = styled(Box)(function (_a) {
1714
158
  var theme = _a.theme;
1715
159
  return theme.unstable_sx({
@@ -1717,38 +161,12 @@ var StyledLogoContainerBox = styled(Box)(function (_a) {
1717
161
  color: 'text.primary',
1718
162
  });
1719
163
  });
1720
- var templateObject_1$2;function styleInject(css, ref) {
1721
- if ( ref === void 0 ) ref = {};
1722
- var insertAt = ref.insertAt;
1723
-
1724
- if (!css || typeof document === 'undefined') { return; }
1725
-
1726
- var head = document.head || document.getElementsByTagName('head')[0];
1727
- var style = document.createElement('style');
1728
- style.type = 'text/css';
1729
-
1730
- if (insertAt === 'top') {
1731
- if (head.firstChild) {
1732
- head.insertBefore(style, head.firstChild);
1733
- } else {
1734
- head.appendChild(style);
1735
- }
1736
- } else {
1737
- head.appendChild(style);
1738
- }
1739
-
1740
- if (style.styleSheet) {
1741
- style.styleSheet.cssText = css;
1742
- } else {
1743
- style.appendChild(document.createTextNode(css));
1744
- }
1745
- }var css_248z = "[data-simplebar]{position:relative;flex-direction:column;flex-wrap:wrap;justify-content:flex-start;align-content:flex-start;align-items:flex-start}.simplebar-wrapper{overflow:hidden;width:inherit;height:inherit;max-width:inherit;max-height:inherit}.simplebar-mask{direction:inherit;position:absolute;overflow:hidden;padding:0;margin:0;left:0;top:0;bottom:0;right:0;width:auto!important;height:auto!important;z-index:0}.simplebar-offset{direction:inherit!important;box-sizing:inherit!important;resize:none!important;position:absolute;top:0;left:0;bottom:0;right:0;padding:0;margin:0;-webkit-overflow-scrolling:touch}.simplebar-content-wrapper{direction:inherit;box-sizing:border-box!important;position:relative;display:block;height:100%;width:auto;max-width:100%;max-height:100%;overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.simplebar-content-wrapper::-webkit-scrollbar,.simplebar-hide-scrollbar::-webkit-scrollbar{display:none;width:0;height:0}.simplebar-content:after,.simplebar-content:before{content:' ';display:table}.simplebar-placeholder{max-height:100%;max-width:100%;width:100%;pointer-events:none}.simplebar-height-auto-observer-wrapper{box-sizing:inherit!important;height:100%;width:100%;max-width:1px;position:relative;float:left;max-height:1px;overflow:hidden;z-index:-1;padding:0;margin:0;pointer-events:none;flex-grow:inherit;flex-shrink:0;flex-basis:0}.simplebar-height-auto-observer{box-sizing:inherit;display:block;opacity:0;position:absolute;top:0;left:0;height:1000%;width:1000%;min-height:1px;min-width:1px;overflow:hidden;pointer-events:none;z-index:-1}.simplebar-track{z-index:1;position:absolute;right:0;bottom:0;pointer-events:none;overflow:hidden}[data-simplebar].simplebar-dragging{pointer-events:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}[data-simplebar].simplebar-dragging .simplebar-content{pointer-events:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}[data-simplebar].simplebar-dragging .simplebar-track{pointer-events:all}.simplebar-scrollbar{position:absolute;left:0;right:0;min-height:10px}.simplebar-scrollbar:before{position:absolute;content:'';background:#000;border-radius:7px;left:2px;right:2px;opacity:0;transition:opacity .2s .5s linear}.simplebar-scrollbar.simplebar-visible:before{opacity:.5;transition-delay:0s;transition-duration:0s}.simplebar-track.simplebar-vertical{top:0;width:11px}.simplebar-scrollbar:before{top:2px;bottom:2px;left:2px;right:2px}.simplebar-track.simplebar-horizontal{left:0;height:11px}.simplebar-track.simplebar-horizontal .simplebar-scrollbar{right:auto;left:0;top:0;bottom:0;min-height:0;min-width:10px;width:auto}[data-simplebar-direction=rtl] .simplebar-track.simplebar-vertical{right:auto;left:0}.simplebar-dummy-scrollbar-size{direction:rtl;position:fixed;opacity:0;visibility:hidden;height:500px;width:500px;overflow-y:hidden;overflow-x:scroll;-ms-overflow-style:scrollbar!important}.simplebar-dummy-scrollbar-size>div{width:200%;height:200%;margin:10px 0}.simplebar-hide-scrollbar{position:fixed;left:0;visibility:hidden;overflow-y:scroll;scrollbar-width:none;-ms-overflow-style:none}\n";
1746
- styleInject(css_248z);var SideMenu = function (_a) {
164
+ var templateObject_1$2;var SideMenu = function (_a) {
1747
165
  var logo = _a.logo, badgeVariant = _a.badgeVariant, list = _a.list, onClick = _a.onClick;
1748
- return (React__default.createElement(StyledSimpleBar, null,
1749
- React__default.createElement(StyledLogoContainerBox, null,
1750
- React__default.createElement(Toolbar, null, logo)),
1751
- list && React__default.createElement(SideMenuList, { badgeVariant: badgeVariant, list: list, onClick: onClick })));
166
+ return (React.createElement(StyledSimpleBar, null,
167
+ React.createElement(StyledLogoContainerBox, null,
168
+ React.createElement(Toolbar, null, logo)),
169
+ list && React.createElement(SideMenuList, { badgeVariant: badgeVariant, list: list, onClick: onClick })));
1752
170
  };var StyledContainerBox$1 = styled(Box)(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
1753
171
  var StyledHeadContainerBox = styled(Box)(function (_a) {
1754
172
  var theme = _a.theme;
@@ -1771,15 +189,15 @@ var templateObject_1$1, templateObject_2$1, templateObject_3, templateObject_4,
1771
189
  : undefined;
1772
190
  }, [headIcon]);
1773
191
  var finalIcon = useMemo(function () { return (icon ? icon.replace(/[A-Z]/g, function (letter, idx) { return "".concat(idx > 0 ? '_' : '').concat(letter.toLowerCase()); }) : undefined); }, [icon]);
1774
- return (React__default.createElement(StyledContainerBox$1, null,
1775
- headTitle && (React__default.createElement(StyledHeadContainerBox, null,
1776
- finalHeadIcon && (React__default.createElement(StyledHeadIconContainerBox, null,
1777
- React__default.createElement(StyledHeadIcon, null, finalHeadIcon))),
1778
- React__default.createElement(StyledHeadTitleTypography, null, headTitle))),
1779
- React__default.createElement(StyledTitleContainerDiv, null,
1780
- finalIcon && (React__default.createElement(StyledTitleIconContainerDiv, null,
1781
- React__default.createElement(Icon, { fontSize: 'small' }, finalIcon))),
1782
- React__default.createElement("div", null, title))));
192
+ return (React.createElement(StyledContainerBox$1, null,
193
+ headTitle && (React.createElement(StyledHeadContainerBox, null,
194
+ finalHeadIcon && (React.createElement(StyledHeadIconContainerBox, null,
195
+ React.createElement(StyledHeadIcon, null, finalHeadIcon))),
196
+ React.createElement(StyledHeadTitleTypography, null, headTitle))),
197
+ React.createElement(StyledTitleContainerDiv, null,
198
+ finalIcon && (React.createElement(StyledTitleIconContainerDiv, null,
199
+ React.createElement(Icon, { fontSize: 'small' }, finalIcon))),
200
+ React.createElement("div", null, title))));
1783
201
  };var SIDE_MENU_WIDTH = 220;
1784
202
  var StyledContainerBox = styled(Box)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n height: 100%;\n"], ["\n display: flex;\n height: 100%;\n"])));
1785
203
  var StyledAppBar = styled(AppBar)(function (_a) {
@@ -1862,7 +280,7 @@ var DefaultLayout = function (_a) {
1862
280
  if (menuTitles) {
1863
281
  var titleData = menuTitles[location.pathname];
1864
282
  if (titleData) {
1865
- setTitle(React__default.createElement(Title, { title: titleData.name, icon: titleData.icon, headTitle: titleData.parentName, headIcon: titleData.parentIcon }));
283
+ setTitle(React.createElement(Title, { title: titleData.name, icon: titleData.icon, headTitle: titleData.parentName, headIcon: titleData.parentIcon }));
1866
284
  }
1867
285
  else {
1868
286
  setTitle(undefined);
@@ -1929,23 +347,23 @@ var DefaultLayout = function (_a) {
1929
347
  return { width: width };
1930
348
  }, [menuHideScreen]);
1931
349
  // -------------------------------------------------------------------------------------------------------------------
1932
- return (React__default.createElement(StyledContainerBox, null,
1933
- React__default.createElement(StyledAppBar, { position: 'fixed', elevation: 0, sx: appBarSx },
1934
- React__default.createElement(Toolbar, null,
1935
- React__default.createElement(IconButton, { color: 'inherit', "aria-label": 'open drawer', edge: 'start', onClick: toggleIsMobileOpen, sx: appBarIconButtonSx },
1936
- React__default.createElement(Menu, null)),
1937
- React__default.createElement(Typography, { variant: 'h6', noWrap: true, component: 'div', sx: { flexGrow: 1 } }, title),
350
+ return (React.createElement(StyledContainerBox, null,
351
+ React.createElement(StyledAppBar, { position: 'fixed', elevation: 0, sx: appBarSx },
352
+ React.createElement(Toolbar, null,
353
+ React.createElement(IconButton, { color: 'inherit', "aria-label": 'open drawer', edge: 'start', onClick: toggleIsMobileOpen, sx: appBarIconButtonSx },
354
+ React.createElement(Menu, null)),
355
+ React.createElement(Typography, { variant: 'h6', noWrap: true, component: 'div', sx: { flexGrow: 1 } }, title),
1938
356
  appBarControl)),
1939
- React__default.createElement(StyledSideMenuContainerBox, { component: 'nav', "aria-label": 'mailbox folders', sx: sideMenuContainerBoxSx },
1940
- React__default.createElement(StyledSideMenuTemporaryDrawer, { variant: 'temporary', open: isMobileOpen, onClose: toggleIsMobileOpen, sx: sideMenuTemporaryDrawerSx, ModalProps: {
357
+ React.createElement(StyledSideMenuContainerBox, { component: 'nav', "aria-label": 'mailbox folders', sx: sideMenuContainerBoxSx },
358
+ React.createElement(StyledSideMenuTemporaryDrawer, { variant: 'temporary', open: isMobileOpen, onClose: toggleIsMobileOpen, sx: sideMenuTemporaryDrawerSx, ModalProps: {
1941
359
  keepMounted: true, // Better open performance on mobile.
1942
- } }, menu && (React__default.createElement(SideMenu, { logo: logo, badgeVariant: badgeVariant, list: menu, onClick: function (menuItem) {
360
+ } }, menu && (React.createElement(SideMenu, { logo: logo, badgeVariant: badgeVariant, list: menu, onClick: function (menuItem) {
1943
361
  toggleIsMobileOpen();
1944
362
  if (onMenuClick)
1945
363
  onMenuClick(menuItem);
1946
364
  } }))),
1947
- React__default.createElement(StyledSideMenuPermanentDrawer, { variant: 'permanent', open: true, sx: sideMenuPermanentDrawerSx }, menu && React__default.createElement(SideMenu, { logo: logo, badgeVariant: badgeVariant, list: menu, onClick: onMenuClick }))),
1948
- React__default.createElement(StyledMainBox, { component: 'main', sx: mainBoxSx },
1949
- React__default.createElement(Toolbar, null),
1950
- React__default.createElement(StyledMainContentDiv, null, children))));
365
+ React.createElement(StyledSideMenuPermanentDrawer, { variant: 'permanent', open: true, sx: sideMenuPermanentDrawerSx }, menu && React.createElement(SideMenu, { logo: logo, badgeVariant: badgeVariant, list: menu, onClick: onMenuClick }))),
366
+ React.createElement(StyledMainBox, { component: 'main', sx: mainBoxSx },
367
+ React.createElement(Toolbar, null),
368
+ React.createElement(StyledMainContentDiv, null, children))));
1951
369
  };export{CardLayout,DefaultLayout};//# sourceMappingURL=index.esm.js.map