@oliasoft-open-source/react-ui-library 4.14.0-beta-1 → 4.14.1-beta-1

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.js CHANGED
@@ -11,11 +11,11 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
11
11
  var _docChanged, _ignoreNextExit, _suggesters, _next, _prev, _handlerMatches, _ignored, _removed, _lastChangeFromAppend, _a;
12
12
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
13
13
  import * as React$4 from "react";
14
- import React__default, { useContext, isValidElement, useState, useRef, useEffect, useCallback as useCallback$1, createElement, forwardRef, useMemo as useMemo$1, useLayoutEffect as useLayoutEffect$1, createContext, useReducer, useDebugValue, Fragment as Fragment$2, Component as Component$1, PureComponent, useImperativeHandle, memo, cloneElement as cloneElement$1 } from "react";
14
+ import React__default, { useContext, isValidElement, useState, useRef, useEffect, useCallback as useCallback$1, createElement, forwardRef, useMemo as useMemo$1, useLayoutEffect as useLayoutEffect$1, createContext, useReducer, useDebugValue, Fragment as Fragment$2, PureComponent, useImperativeHandle, memo as memo$1, cloneElement as cloneElement$1 } from "react";
15
15
  import * as PropTypes from "prop-types";
16
16
  import PropTypes__default from "prop-types";
17
- import ReactDOM, { createPortal, unstable_batchedUpdates, render } from "react-dom";
18
- import { noop as noop$3, set, get as get$2, isString as isString$3, isNumber as isNumber$1, isBoolean as isBoolean$2, isFunction as isFunction$3, isEmpty, isArray as isArray$1, toNumber, debounce as debounce$2, isObject as isObject$5, isNil, isEqual as isEqual$4 } from "lodash";
17
+ import ReactDOM, { createPortal, unstable_batchedUpdates, flushSync as flushSync$1, render } from "react-dom";
18
+ import { noop as noop$3, set, get as get$2, isString as isString$3, isNumber as isNumber$1, isBoolean as isBoolean$2, isFunction as isFunction$3, isEmpty, isArray as isArray$1, toNumber, debounce as debounce$3, isObject as isObject$5, isEqual as isEqual$4 } from "lodash";
19
19
  import { toString as toString$1, isScientificStringNum, roundToPrecision, toNum, validateNumber, cleanNumStr, stripLeadingZeros, roundToFixed, roundByMagnitude, unitFromQuantity, getUnit, KNOWN_UNITS, ALT_UNITS, isValueWithUnit, getValue as getValue$1, withUnit, convertSamePrecision, convertAndGetValue, split as split$1, label as label$b, isValidNum, getAltUnitsListByQuantity, altUnitsList, getUnitsForQuantity, roundByMagnitudeToFixed } from "@oliasoft-open-source/units";
20
20
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
21
21
  function getDefaultExportFromCjs(x2) {
@@ -222,32 +222,32 @@ function _setPrototypeOf$3(t, e2) {
222
222
  function _inheritsLoose$3(t, o) {
223
223
  t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf$3(t, o);
224
224
  }
225
- var extendStatics$1 = function(d2, b2) {
226
- extendStatics$1 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
225
+ var extendStatics = function(d2, b2) {
226
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
227
227
  d3.__proto__ = b3;
228
228
  } || function(d3, b3) {
229
229
  for (var p in b3) if (Object.prototype.hasOwnProperty.call(b3, p)) d3[p] = b3[p];
230
230
  };
231
- return extendStatics$1(d2, b2);
231
+ return extendStatics(d2, b2);
232
232
  };
233
- function __extends$1(d2, b2) {
233
+ function __extends(d2, b2) {
234
234
  if (typeof b2 !== "function" && b2 !== null)
235
235
  throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
236
- extendStatics$1(d2, b2);
236
+ extendStatics(d2, b2);
237
237
  function __() {
238
238
  this.constructor = d2;
239
239
  }
240
240
  d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
241
241
  }
242
- var __assign$4 = function() {
243
- __assign$4 = Object.assign || function __assign2(t) {
242
+ var __assign$3 = function() {
243
+ __assign$3 = Object.assign || function __assign2(t) {
244
244
  for (var s, i = 1, n2 = arguments.length; i < n2; i++) {
245
245
  s = arguments[i];
246
246
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
247
247
  }
248
248
  return t;
249
249
  };
250
- return __assign$4.apply(this, arguments);
250
+ return __assign$3.apply(this, arguments);
251
251
  };
252
252
  function __rest$1(s, e2) {
253
253
  var t = {};
@@ -883,15 +883,15 @@ var DefaultContext = {
883
883
  attr: void 0
884
884
  };
885
885
  var IconContext = React__default.createContext && React__default.createContext(DefaultContext);
886
- var __assign$3 = function() {
887
- __assign$3 = Object.assign || function(t) {
886
+ var __assign$2 = function() {
887
+ __assign$2 = Object.assign || function(t) {
888
888
  for (var s, i = 1, n2 = arguments.length; i < n2; i++) {
889
889
  s = arguments[i];
890
890
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
891
891
  }
892
892
  return t;
893
893
  };
894
- return __assign$3.apply(this, arguments);
894
+ return __assign$2.apply(this, arguments);
895
895
  };
896
896
  var __rest = function(s, e2) {
897
897
  var t = {};
@@ -903,15 +903,15 @@ var __rest = function(s, e2) {
903
903
  };
904
904
  function Tree2Element(tree2) {
905
905
  return tree2 && tree2.map(function(node2, i) {
906
- return React__default.createElement(node2.tag, __assign$3({
906
+ return React__default.createElement(node2.tag, __assign$2({
907
907
  key: i
908
908
  }, node2.attr), Tree2Element(node2.child));
909
909
  });
910
910
  }
911
911
  function GenIcon(data) {
912
912
  return function(props) {
913
- return React__default.createElement(IconBase, __assign$3({
914
- attr: __assign$3({}, data.attr)
913
+ return React__default.createElement(IconBase, __assign$2({
914
+ attr: __assign$2({}, data.attr)
915
915
  }, props), Tree2Element(data.child));
916
916
  };
917
917
  }
@@ -922,13 +922,13 @@ function IconBase(props) {
922
922
  var className;
923
923
  if (conf.className) className = conf.className;
924
924
  if (props.className) className = (className ? className + " " : "") + props.className;
925
- return React__default.createElement("svg", __assign$3({
925
+ return React__default.createElement("svg", __assign$2({
926
926
  stroke: "currentColor",
927
927
  fill: "currentColor",
928
928
  strokeWidth: "0"
929
929
  }, conf.attr, attr, svgProps, {
930
930
  className,
931
- style: __assign$3(__assign$3({
931
+ style: __assign$2(__assign$2({
932
932
  color: props.color || conf.color
933
933
  }, conf.style), props.style),
934
934
  height: computedSize,
@@ -1808,7 +1808,7 @@ var requestAnimationFrame$1 = function() {
1808
1808
  };
1809
1809
  }();
1810
1810
  var trailingTimeout = 2;
1811
- function throttle$2(callback, delay) {
1811
+ function throttle$1(callback, delay) {
1812
1812
  var leadingCall = false, trailingCall = false, lastCallTime = 0;
1813
1813
  function resolvePending() {
1814
1814
  if (leadingCall) {
@@ -1850,7 +1850,7 @@ var ResizeObserverController$1 = (
1850
1850
  this.mutationsObserver_ = null;
1851
1851
  this.observers_ = [];
1852
1852
  this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
1853
- this.refresh = throttle$2(this.refresh.bind(this), REFRESH_DELAY);
1853
+ this.refresh = throttle$1(this.refresh.bind(this), REFRESH_DELAY);
1854
1854
  }
1855
1855
  ResizeObserverController2.prototype.addObserver = function(observer) {
1856
1856
  if (!~this.observers_.indexOf(observer)) {
@@ -2354,7 +2354,7 @@ function useEventSubscriptions() {
2354
2354
  };
2355
2355
  }, []);
2356
2356
  }
2357
- var useIsomorphicLayoutEffect$6 = typeof window !== "undefined" ? useLayoutEffect$1 : useEffect;
2357
+ var useIsomorphicLayoutEffect$7 = typeof window !== "undefined" ? useLayoutEffect$1 : useEffect;
2358
2358
  function useLastState(currentState, enabled) {
2359
2359
  var lastState = useRef(currentState);
2360
2360
  if (!enabled) {
@@ -2602,7 +2602,7 @@ function useTrackElements(_ref) {
2602
2602
  resetWhenReferenceChangedWhileTracking(previousTrigger, trigger2);
2603
2603
  }, [get4, set2, resetWhenReferenceChangedWhileTracking, getScrollContainers]));
2604
2604
  var triggerOptionParent = triggerOption == null ? void 0 : triggerOption.getParent == null ? void 0 : triggerOption.getParent();
2605
- useIsomorphicLayoutEffect$6(function() {
2605
+ useIsomorphicLayoutEffect$7(function() {
2606
2606
  if (!triggerOptionParent) {
2607
2607
  return;
2608
2608
  }
@@ -2612,7 +2612,7 @@ function useTrackElements(_ref) {
2612
2612
  });
2613
2613
  });
2614
2614
  }, [triggerOptionParent, set2, getScrollContainers]);
2615
- useIsomorphicLayoutEffect$6(function() {
2615
+ useIsomorphicLayoutEffect$7(function() {
2616
2616
  if (enabled) {
2617
2617
  if (!hasEventSubscriptions()) {
2618
2618
  addEventListeners();
@@ -2624,7 +2624,7 @@ function useTrackElements(_ref) {
2624
2624
  }
2625
2625
  };
2626
2626
  }, [enabled, hasEventSubscriptions, addEventListeners, removeAllEventSubscriptions]);
2627
- useIsomorphicLayoutEffect$6(function() {
2627
+ useIsomorphicLayoutEffect$7(function() {
2628
2628
  if (enabled) {
2629
2629
  handleChange();
2630
2630
  }
@@ -3888,9 +3888,14 @@ const CheckBox = ({
3888
3888
  if (!isDisabled) {
3889
3889
  const target = evt.target;
3890
3890
  target.name = name2;
3891
- target.value = !checked;
3892
3891
  target.checked = !checked;
3893
- onChange(evt);
3892
+ onChange({
3893
+ ...evt,
3894
+ target: {
3895
+ ...target,
3896
+ value: target.checked
3897
+ }
3898
+ });
3894
3899
  }
3895
3900
  },
3896
3901
  "data-testid": testId,
@@ -5301,15 +5306,15 @@ const Card = ({
5301
5306
  }
5302
5307
  );
5303
5308
  };
5304
- var __assign$2 = function() {
5305
- __assign$2 = Object.assign || function __assign2(t) {
5309
+ var __assign$1 = function() {
5310
+ __assign$1 = Object.assign || function __assign2(t) {
5306
5311
  for (var s, i = 1, n2 = arguments.length; i < n2; i++) {
5307
5312
  s = arguments[i];
5308
5313
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
5309
5314
  }
5310
5315
  return t;
5311
5316
  };
5312
- return __assign$2.apply(this, arguments);
5317
+ return __assign$1.apply(this, arguments);
5313
5318
  };
5314
5319
  function __spreadArray$1(to2, from3, pack) {
5315
5320
  if (pack || arguments.length === 2) for (var i = 0, l = from3.length, ar2; i < l; i++) {
@@ -6142,7 +6147,7 @@ var Ie = function(e2) {
6142
6147
  function e2(e3, n2, o) {
6143
6148
  void 0 === e3 && (e3 = C), void 0 === n2 && (n2 = {});
6144
6149
  var r2 = this;
6145
- this.options = __assign$2(__assign$2({}, Te), e3), this.gs = n2, this.names = new Map(o), this.server = !!e3.isServer, !this.server && S && Re && (Re = false, _e(this)), ue(this, function() {
6150
+ this.options = __assign$1(__assign$1({}, Te), e3), this.gs = n2, this.names = new Map(o), this.server = !!e3.isServer, !this.server && S && Re && (Re = false, _e(this)), ue(this, function() {
6146
6151
  return function(e4) {
6147
6152
  for (var t = e4.getTag(), n3 = t.length, o2 = "", r3 = function(n4) {
6148
6153
  var r4 = function(e5) {
@@ -6165,7 +6170,7 @@ var Ie = function(e2) {
6165
6170
  }, e2.prototype.rehydrate = function() {
6166
6171
  !this.server && S && _e(this);
6167
6172
  }, e2.prototype.reconstructWithOptions = function(n2, o) {
6168
- return void 0 === o && (o = true), new e2(__assign$2(__assign$2({}, this.options), n2), this.gs, o && this.names || void 0);
6173
+ return void 0 === o && (o = true), new e2(__assign$1(__assign$1({}, this.options), n2), this.gs, o && this.names || void 0);
6169
6174
  }, e2.prototype.allocateGSInstance = function(e3) {
6170
6175
  return this.gs[e3] = (this.gs[e3] || 0) + 1;
6171
6176
  }, e2.prototype.getTag = function() {
@@ -6338,9 +6343,9 @@ function it$1(e2, r2, s) {
6338
6343
  var i2 = e4.attrs, a3 = e4.componentStyle, c3 = e4.defaultProps, p2 = e4.foldedComponentIds, d3 = e4.styledComponentId, h2 = e4.target, f3 = React__default.useContext(et$1), m3 = Ge(), y3 = e4.shouldForwardProp || m3.shouldForwardProp;
6339
6344
  "production" !== process.env.NODE_ENV && useDebugValue(d3);
6340
6345
  var v2 = I(r4, f3, c3) || C, g3 = function(e5, n2, o) {
6341
- for (var r5, s3 = __assign$2(__assign$2({}, n2), { className: void 0, theme: o }), i3 = 0; i3 < e5.length; i3 += 1) {
6346
+ for (var r5, s3 = __assign$1(__assign$1({}, n2), { className: void 0, theme: o }), i3 = 0; i3 < e5.length; i3 += 1) {
6342
6347
  var a4 = re(r5 = e5[i3]) ? r5(s3) : r5;
6343
- for (var c4 in a4) s3[c4] = "className" === c4 ? ie$2(s3[c4], a4[c4]) : "style" === c4 ? __assign$2(__assign$2({}, s3[c4]), a4[c4]) : a4[c4];
6348
+ for (var c4 in a4) s3[c4] = "className" === c4 ? ie$2(s3[c4], a4[c4]) : "style" === c4 ? __assign$1(__assign$1({}, s3[c4]), a4[c4]) : a4[c4];
6344
6349
  }
6345
6350
  return n2.className && (s3.className = ie$2(s3.className, n2.className)), s3;
6346
6351
  }(i2, r4, v2), S3 = g3.as || h2, w3 = {};
@@ -6396,9 +6401,9 @@ function ut(n2, o, r2) {
6396
6401
  return n2(o, r2, lt$1.apply(void 0, __spreadArray$1([t], s2, false)));
6397
6402
  };
6398
6403
  return s.attrs = function(e2) {
6399
- return ut(n2, o, __assign$2(__assign$2({}, r2), { attrs: Array.prototype.concat(r2.attrs, e2).filter(Boolean) }));
6404
+ return ut(n2, o, __assign$1(__assign$1({}, r2), { attrs: Array.prototype.concat(r2.attrs, e2).filter(Boolean) }));
6400
6405
  }, s.withConfig = function(e2) {
6401
- return ut(n2, o, __assign$2(__assign$2({}, r2), e2));
6406
+ return ut(n2, o, __assign$1(__assign$1({}, r2), e2));
6402
6407
  }, s;
6403
6408
  }
6404
6409
  var pt$1 = function(e2) {
@@ -9924,7 +9929,7 @@ function createSubscription(store, parentSub) {
9924
9929
  };
9925
9930
  return subscription;
9926
9931
  }
9927
- var useIsomorphicLayoutEffect$5 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined" ? useLayoutEffect$1 : useEffect;
9932
+ var useIsomorphicLayoutEffect$6 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined" ? useLayoutEffect$1 : useEffect;
9928
9933
  function Provider(_ref) {
9929
9934
  var store = _ref.store, context2 = _ref.context, children = _ref.children;
9930
9935
  var contextValue = useMemo$1(function() {
@@ -9937,7 +9942,7 @@ function Provider(_ref) {
9937
9942
  var previousState = useMemo$1(function() {
9938
9943
  return store.getState();
9939
9944
  }, [store]);
9940
- useIsomorphicLayoutEffect$5(function() {
9945
+ useIsomorphicLayoutEffect$6(function() {
9941
9946
  var subscription = contextValue.subscription;
9942
9947
  subscription.onStateChange = subscription.notifyNestedSubs;
9943
9948
  subscription.trySubscribe();
@@ -10657,7 +10662,7 @@ function storeStateUpdatesReducer(state, action2) {
10657
10662
  return [action2.payload, updateCount2 + 1];
10658
10663
  }
10659
10664
  function useIsomorphicLayoutEffectWithArgs(effectFunc, effectArgs, dependencies) {
10660
- useIsomorphicLayoutEffect$5(function() {
10665
+ useIsomorphicLayoutEffect$6(function() {
10661
10666
  return effectFunc.apply(void 0, effectArgs);
10662
10667
  }, dependencies);
10663
10668
  }
@@ -15362,7 +15367,7 @@ var getStyles$1 = function(contextId) {
15362
15367
  userCancel: getStyles(rules2, "userCancel")
15363
15368
  };
15364
15369
  };
15365
- var useIsomorphicLayoutEffect$4 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined" ? useLayoutEffect$1 : useEffect;
15370
+ var useIsomorphicLayoutEffect$5 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined" ? useLayoutEffect$1 : useEffect;
15366
15371
  var getHead = function getHead2() {
15367
15372
  var head = document.querySelector("head");
15368
15373
  !head ? process.env.NODE_ENV !== "production" ? invariant$3(false, "Cannot find the head to append a style to") : invariant$3() : void 0;
@@ -15392,7 +15397,7 @@ function useStyleMarshal(contextId, nonce) {
15392
15397
  !el2 ? process.env.NODE_ENV !== "production" ? invariant$3(false, "Cannot set dynamic style element if it is not set") : invariant$3() : void 0;
15393
15398
  el2.textContent = proposed;
15394
15399
  }, []);
15395
- useIsomorphicLayoutEffect$4(function() {
15400
+ useIsomorphicLayoutEffect$5(function() {
15396
15401
  !(!alwaysRef.current && !dynamicRef.current) ? process.env.NODE_ENV !== "production" ? invariant$3(false, "style elements already mounted") : invariant$3() : void 0;
15397
15402
  var always = createStyleEl(nonce);
15398
15403
  var dynamic = createStyleEl(nonce);
@@ -15522,7 +15527,7 @@ function useFocusMarshal(contextId) {
15522
15527
  }
15523
15528
  recordRef.current = id2;
15524
15529
  }, []);
15525
- useIsomorphicLayoutEffect$4(function() {
15530
+ useIsomorphicLayoutEffect$5(function() {
15526
15531
  isMountedRef.current = true;
15527
15532
  return function clearFrameOnUnmount() {
15528
15533
  isMountedRef.current = false;
@@ -16139,7 +16144,7 @@ function useMouseSensor(api) {
16139
16144
  };
16140
16145
  bindCapturingEvents();
16141
16146
  }, [bindCapturingEvents]);
16142
- useIsomorphicLayoutEffect$4(function mount() {
16147
+ useIsomorphicLayoutEffect$5(function mount() {
16143
16148
  listenForCapture();
16144
16149
  return function unmount() {
16145
16150
  unbindEventsRef.current();
@@ -16270,7 +16275,7 @@ function useKeyboardSensor(api) {
16270
16275
  };
16271
16276
  unbindEventsRef.current = bindEvents(window, [startCaptureBinding], options);
16272
16277
  }, [startCaptureBinding]);
16273
- useIsomorphicLayoutEffect$4(function mount() {
16278
+ useIsomorphicLayoutEffect$5(function mount() {
16274
16279
  listenForCapture();
16275
16280
  return function unmount() {
16276
16281
  unbindEventsRef.current();
@@ -16499,7 +16504,7 @@ function useTouchSensor(api) {
16499
16504
  });
16500
16505
  bindCapturingEvents();
16501
16506
  }, [bindCapturingEvents, getPhase, setPhase, startDragging]);
16502
- useIsomorphicLayoutEffect$4(function mount() {
16507
+ useIsomorphicLayoutEffect$5(function mount() {
16503
16508
  listenForCapture();
16504
16509
  return function unmount() {
16505
16510
  unbindEventsRef.current();
@@ -16510,7 +16515,7 @@ function useTouchSensor(api) {
16510
16515
  }
16511
16516
  };
16512
16517
  }, [getPhase, listenForCapture, setPhase]);
16513
- useIsomorphicLayoutEffect$4(function webkitHack() {
16518
+ useIsomorphicLayoutEffect$5(function webkitHack() {
16514
16519
  var unbind = bindEvents(window, [{
16515
16520
  eventName: "touchmove",
16516
16521
  fn: function fn() {
@@ -16857,7 +16862,7 @@ function useSensorMarshal(_ref4) {
16857
16862
  lockAPI.tryAbandon();
16858
16863
  }
16859
16864
  }, [lockAPI]);
16860
- useIsomorphicLayoutEffect$4(function listenToStore() {
16865
+ useIsomorphicLayoutEffect$5(function listenToStore() {
16861
16866
  var previous = store.getState();
16862
16867
  var unsubscribe = store.subscribe(function() {
16863
16868
  var current = store.getState();
@@ -16866,7 +16871,7 @@ function useSensorMarshal(_ref4) {
16866
16871
  });
16867
16872
  return unsubscribe;
16868
16873
  }, [lockAPI, store, tryAbandonLock]);
16869
- useIsomorphicLayoutEffect$4(function() {
16874
+ useIsomorphicLayoutEffect$5(function() {
16870
16875
  return lockAPI.tryAbandon;
16871
16876
  }, [lockAPI.tryAbandon]);
16872
16877
  var canGetLock = useCallback(function(draggableId) {
@@ -17407,7 +17412,7 @@ function useDroppablePublisher(args) {
17407
17412
  callbacks: callbacks2
17408
17413
  };
17409
17414
  }, [callbacks2, descriptor, uniqueId3]);
17410
- useIsomorphicLayoutEffect$4(function() {
17415
+ useIsomorphicLayoutEffect$5(function() {
17411
17416
  publishedDescriptorRef.current = entry.descriptor;
17412
17417
  registry.droppable.register(entry);
17413
17418
  return function() {
@@ -17418,13 +17423,13 @@ function useDroppablePublisher(args) {
17418
17423
  registry.droppable.unregister(entry);
17419
17424
  };
17420
17425
  }, [callbacks2, descriptor, dragStopped, entry, marshal, registry.droppable]);
17421
- useIsomorphicLayoutEffect$4(function() {
17426
+ useIsomorphicLayoutEffect$5(function() {
17422
17427
  if (!whileDraggingRef.current) {
17423
17428
  return;
17424
17429
  }
17425
17430
  marshal.updateDroppableIsEnabled(publishedDescriptorRef.current.id, !args.isDropDisabled);
17426
17431
  }, [args.isDropDisabled, marshal]);
17427
- useIsomorphicLayoutEffect$4(function() {
17432
+ useIsomorphicLayoutEffect$5(function() {
17428
17433
  if (!whileDraggingRef.current) {
17429
17434
  return;
17430
17435
  }
@@ -17752,13 +17757,13 @@ function useDraggablePublisher(args) {
17752
17757
  }, [descriptor, getDimension2, options, uniqueId3]);
17753
17758
  var publishedRef = useRef(entry);
17754
17759
  var isFirstPublishRef = useRef(true);
17755
- useIsomorphicLayoutEffect$4(function() {
17760
+ useIsomorphicLayoutEffect$5(function() {
17756
17761
  registry.draggable.register(publishedRef.current);
17757
17762
  return function() {
17758
17763
  return registry.draggable.unregister(publishedRef.current);
17759
17764
  };
17760
17765
  }, [registry.draggable]);
17761
- useIsomorphicLayoutEffect$4(function() {
17766
+ useIsomorphicLayoutEffect$5(function() {
17762
17767
  if (isFirstPublishRef.current) {
17763
17768
  isFirstPublishRef.current = false;
17764
17769
  return;
@@ -18335,343 +18340,755 @@ var ConnectedDroppable = connect(makeMapStateToProps$1, mapDispatchToProps$1, nu
18335
18340
  areStatePropsEqual: isStrictEqual
18336
18341
  })(Droppable);
18337
18342
  ConnectedDroppable.defaultProps = defaultProps;
18338
- /*! *****************************************************************************
18339
- Copyright (c) Microsoft Corporation. All rights reserved.
18340
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
18341
- this file except in compliance with the License. You may obtain a copy of the
18342
- License at http://www.apache.org/licenses/LICENSE-2.0
18343
-
18344
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18345
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
18346
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
18347
- MERCHANTABLITY OR NON-INFRINGEMENT.
18348
-
18349
- See the Apache Version 2.0 License for specific language governing permissions
18350
- and limitations under the License.
18351
- ***************************************************************************** */
18352
- var extendStatics = function(d2, b2) {
18353
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
18354
- d3.__proto__ = b3;
18355
- } || function(d3, b3) {
18356
- for (var p in b3) if (b3.hasOwnProperty(p)) d3[p] = b3[p];
18343
+ function memo(getDeps, fn, opts) {
18344
+ let deps = opts.initialDeps ?? [];
18345
+ let result;
18346
+ return () => {
18347
+ var _a2, _b, _c, _d;
18348
+ let depTime;
18349
+ if (opts.key && ((_a2 = opts.debug) == null ? void 0 : _a2.call(opts))) depTime = Date.now();
18350
+ const newDeps = getDeps();
18351
+ const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index2) => deps[index2] !== dep);
18352
+ if (!depsChanged) {
18353
+ return result;
18354
+ }
18355
+ deps = newDeps;
18356
+ let resultTime;
18357
+ if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) resultTime = Date.now();
18358
+ result = fn(...newDeps);
18359
+ if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
18360
+ const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
18361
+ const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
18362
+ const resultFpsPercentage = resultEndTime / 16;
18363
+ const pad = (str, num) => {
18364
+ str = String(str);
18365
+ while (str.length < num) {
18366
+ str = " " + str;
18367
+ }
18368
+ return str;
18369
+ };
18370
+ console.info(
18371
+ `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
18372
+ `
18373
+ font-size: .6rem;
18374
+ font-weight: bold;
18375
+ color: hsl(${Math.max(
18376
+ 0,
18377
+ Math.min(120 - 120 * resultFpsPercentage, 120)
18378
+ )}deg 100% 31%);`,
18379
+ opts == null ? void 0 : opts.key
18380
+ );
18381
+ }
18382
+ (_d = opts == null ? void 0 : opts.onChange) == null ? void 0 : _d.call(opts, result);
18383
+ return result;
18357
18384
  };
18358
- return extendStatics(d2, b2);
18359
- };
18360
- function __extends(d2, b2) {
18361
- extendStatics(d2, b2);
18362
- function __() {
18363
- this.constructor = d2;
18385
+ }
18386
+ function notUndefined(value, msg2) {
18387
+ if (value === void 0) {
18388
+ throw new Error(`Unexpected undefined${""}`);
18389
+ } else {
18390
+ return value;
18364
18391
  }
18365
- d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
18366
18392
  }
18367
- var __assign$1 = function() {
18368
- __assign$1 = Object.assign || function __assign2(t) {
18369
- for (var s, i = 1, n2 = arguments.length; i < n2; i++) {
18370
- s = arguments[i];
18371
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
18372
- }
18373
- return t;
18393
+ const approxEqual = (a2, b2) => Math.abs(a2 - b2) < 1;
18394
+ const debounce$2 = (targetWindow, fn, ms2) => {
18395
+ let timeoutId;
18396
+ return function(...args) {
18397
+ targetWindow.clearTimeout(timeoutId);
18398
+ timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms2);
18374
18399
  };
18375
- return __assign$1.apply(this, arguments);
18376
18400
  };
18377
- function throttle$1(delay, noTrailing, callback, debounceMode) {
18378
- var timeoutID;
18379
- var cancelled = false;
18380
- var lastExec = 0;
18381
- function clearExistingTimeout() {
18382
- if (timeoutID) {
18383
- clearTimeout(timeoutID);
18384
- }
18401
+ const defaultKeyExtractor = (index2) => index2;
18402
+ const defaultRangeExtractor = (range2) => {
18403
+ const start3 = Math.max(range2.startIndex - range2.overscan, 0);
18404
+ const end2 = Math.min(range2.endIndex + range2.overscan, range2.count - 1);
18405
+ const arr = [];
18406
+ for (let i = start3; i <= end2; i++) {
18407
+ arr.push(i);
18385
18408
  }
18386
- function cancel() {
18387
- clearExistingTimeout();
18388
- cancelled = true;
18409
+ return arr;
18410
+ };
18411
+ const observeElementRect = (instance, cb2) => {
18412
+ const element = instance.scrollElement;
18413
+ if (!element) {
18414
+ return;
18389
18415
  }
18390
- if (typeof noTrailing !== "boolean") {
18391
- debounceMode = callback;
18392
- callback = noTrailing;
18393
- noTrailing = void 0;
18416
+ const targetWindow = instance.targetWindow;
18417
+ if (!targetWindow) {
18418
+ return;
18394
18419
  }
18395
- function wrapper2() {
18396
- var self2 = this;
18397
- var elapsed = Date.now() - lastExec;
18398
- var args = arguments;
18399
- if (cancelled) {
18400
- return;
18401
- }
18402
- function exec() {
18403
- lastExec = Date.now();
18404
- callback.apply(self2, args);
18405
- }
18406
- function clear() {
18407
- timeoutID = void 0;
18408
- }
18409
- if (debounceMode && !timeoutID) {
18410
- exec();
18420
+ const handler = (rect) => {
18421
+ const { width: width2, height: height2 } = rect;
18422
+ cb2({ width: Math.round(width2), height: Math.round(height2) });
18423
+ };
18424
+ handler(element.getBoundingClientRect());
18425
+ if (!targetWindow.ResizeObserver) {
18426
+ return () => {
18427
+ };
18428
+ }
18429
+ const observer = new targetWindow.ResizeObserver((entries2) => {
18430
+ const entry = entries2[0];
18431
+ if (entry == null ? void 0 : entry.borderBoxSize) {
18432
+ const box = entry.borderBoxSize[0];
18433
+ if (box) {
18434
+ handler({ width: box.inlineSize, height: box.blockSize });
18435
+ return;
18436
+ }
18411
18437
  }
18412
- clearExistingTimeout();
18413
- if (debounceMode === void 0 && elapsed > delay) {
18414
- exec();
18415
- } else if (noTrailing !== true) {
18416
- timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === void 0 ? delay - elapsed : delay);
18438
+ handler(element.getBoundingClientRect());
18439
+ });
18440
+ observer.observe(element, { box: "border-box" });
18441
+ return () => {
18442
+ observer.unobserve(element);
18443
+ };
18444
+ };
18445
+ const addEventListenerOptions = {
18446
+ passive: true
18447
+ };
18448
+ const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
18449
+ const observeElementOffset = (instance, cb2) => {
18450
+ const element = instance.scrollElement;
18451
+ if (!element) {
18452
+ return;
18453
+ }
18454
+ const targetWindow = instance.targetWindow;
18455
+ if (!targetWindow) {
18456
+ return;
18457
+ }
18458
+ let offset3 = 0;
18459
+ const fallback = supportsScrollend ? () => void 0 : debounce$2(
18460
+ targetWindow,
18461
+ () => {
18462
+ cb2(offset3, false);
18463
+ },
18464
+ instance.options.isScrollingResetDelay
18465
+ );
18466
+ const createHandler = (isScrolling) => () => {
18467
+ const { horizontal: horizontal2, isRtl } = instance.options;
18468
+ offset3 = horizontal2 ? element["scrollLeft"] * (isRtl && -1 || 1) : element["scrollTop"];
18469
+ fallback();
18470
+ cb2(offset3, isScrolling);
18471
+ };
18472
+ const handler = createHandler(true);
18473
+ const endHandler = createHandler(false);
18474
+ endHandler();
18475
+ element.addEventListener("scroll", handler, addEventListenerOptions);
18476
+ element.addEventListener("scrollend", endHandler, addEventListenerOptions);
18477
+ return () => {
18478
+ element.removeEventListener("scroll", handler);
18479
+ element.removeEventListener("scrollend", endHandler);
18480
+ };
18481
+ };
18482
+ const measureElement = (element, entry, instance) => {
18483
+ if (entry == null ? void 0 : entry.borderBoxSize) {
18484
+ const box = entry.borderBoxSize[0];
18485
+ if (box) {
18486
+ const size2 = Math.round(
18487
+ box[instance.options.horizontal ? "inlineSize" : "blockSize"]
18488
+ );
18489
+ return size2;
18417
18490
  }
18418
18491
  }
18419
- wrapper2.cancel = cancel;
18420
- return wrapper2;
18421
- }
18422
- var ThresholdUnits = {
18423
- Pixel: "Pixel",
18424
- Percent: "Percent"
18492
+ return Math.round(
18493
+ element.getBoundingClientRect()[instance.options.horizontal ? "width" : "height"]
18494
+ );
18425
18495
  };
18426
- var defaultThreshold = {
18427
- unit: ThresholdUnits.Percent,
18428
- value: 0.8
18496
+ const elementScroll = (offset3, {
18497
+ adjustments = 0,
18498
+ behavior
18499
+ }, instance) => {
18500
+ var _a2, _b;
18501
+ const toOffset = offset3 + adjustments;
18502
+ (_b = (_a2 = instance.scrollElement) == null ? void 0 : _a2.scrollTo) == null ? void 0 : _b.call(_a2, {
18503
+ [instance.options.horizontal ? "left" : "top"]: toOffset,
18504
+ behavior
18505
+ });
18429
18506
  };
18430
- function parseThreshold(scrollThreshold) {
18431
- if (typeof scrollThreshold === "number") {
18432
- return {
18433
- unit: ThresholdUnits.Percent,
18434
- value: scrollThreshold * 100
18435
- };
18436
- }
18437
- if (typeof scrollThreshold === "string") {
18438
- if (scrollThreshold.match(/^(\d*(\.\d+)?)px$/)) {
18439
- return {
18440
- unit: ThresholdUnits.Pixel,
18441
- value: parseFloat(scrollThreshold)
18507
+ class Virtualizer {
18508
+ constructor(opts) {
18509
+ this.unsubs = [];
18510
+ this.scrollElement = null;
18511
+ this.targetWindow = null;
18512
+ this.isScrolling = false;
18513
+ this.scrollToIndexTimeoutId = null;
18514
+ this.measurementsCache = [];
18515
+ this.itemSizeCache = /* @__PURE__ */ new Map();
18516
+ this.pendingMeasuredCacheIndexes = [];
18517
+ this.scrollRect = null;
18518
+ this.scrollOffset = null;
18519
+ this.scrollDirection = null;
18520
+ this.scrollAdjustments = 0;
18521
+ this.elementsCache = /* @__PURE__ */ new Map();
18522
+ this.observer = /* @__PURE__ */ (() => {
18523
+ let _ro = null;
18524
+ const get4 = () => {
18525
+ if (_ro) {
18526
+ return _ro;
18527
+ }
18528
+ if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
18529
+ return null;
18530
+ }
18531
+ return _ro = new this.targetWindow.ResizeObserver((entries2) => {
18532
+ entries2.forEach((entry) => {
18533
+ this._measureElement(entry.target, entry);
18534
+ });
18535
+ });
18442
18536
  };
18443
- }
18444
- if (scrollThreshold.match(/^(\d*(\.\d+)?)%$/)) {
18445
18537
  return {
18446
- unit: ThresholdUnits.Percent,
18447
- value: parseFloat(scrollThreshold)
18448
- };
18449
- }
18450
- console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...');
18451
- return defaultThreshold;
18452
- }
18453
- console.warn("scrollThreshold should be string or number");
18454
- return defaultThreshold;
18455
- }
18456
- var InfiniteScroll = (
18457
- /** @class */
18458
- function(_super) {
18459
- __extends(InfiniteScroll2, _super);
18460
- function InfiniteScroll2(props) {
18461
- var _this = _super.call(this, props) || this;
18462
- _this.lastScrollTop = 0;
18463
- _this.actionTriggered = false;
18464
- _this.startY = 0;
18465
- _this.currentY = 0;
18466
- _this.dragging = false;
18467
- _this.maxPullDownDistance = 0;
18468
- _this.getScrollableTarget = function() {
18469
- if (_this.props.scrollableTarget instanceof HTMLElement)
18470
- return _this.props.scrollableTarget;
18471
- if (typeof _this.props.scrollableTarget === "string") {
18472
- return document.getElementById(_this.props.scrollableTarget);
18473
- }
18474
- if (_this.props.scrollableTarget === null) {
18475
- console.warn("You are trying to pass scrollableTarget but it is null. This might\n happen because the element may not have been added to DOM yet.\n See https://github.com/ankeetmaini/react-infinite-scroll-component/issues/59 for more info.\n ");
18538
+ disconnect: () => {
18539
+ var _a2;
18540
+ return (_a2 = get4()) == null ? void 0 : _a2.disconnect();
18541
+ },
18542
+ observe: (target) => {
18543
+ var _a2;
18544
+ return (_a2 = get4()) == null ? void 0 : _a2.observe(target, { box: "border-box" });
18545
+ },
18546
+ unobserve: (target) => {
18547
+ var _a2;
18548
+ return (_a2 = get4()) == null ? void 0 : _a2.unobserve(target);
18476
18549
  }
18477
- return null;
18478
18550
  };
18479
- _this.onStart = function(evt) {
18480
- if (_this.lastScrollTop)
18551
+ })();
18552
+ this.range = null;
18553
+ this.setOptions = (opts2) => {
18554
+ Object.entries(opts2).forEach(([key2, value]) => {
18555
+ if (typeof value === "undefined") delete opts2[key2];
18556
+ });
18557
+ this.options = {
18558
+ debug: false,
18559
+ initialOffset: 0,
18560
+ overscan: 1,
18561
+ paddingStart: 0,
18562
+ paddingEnd: 0,
18563
+ scrollPaddingStart: 0,
18564
+ scrollPaddingEnd: 0,
18565
+ horizontal: false,
18566
+ getItemKey: defaultKeyExtractor,
18567
+ rangeExtractor: defaultRangeExtractor,
18568
+ onChange: () => {
18569
+ },
18570
+ measureElement,
18571
+ initialRect: { width: 0, height: 0 },
18572
+ scrollMargin: 0,
18573
+ gap: 0,
18574
+ indexAttribute: "data-index",
18575
+ initialMeasurementsCache: [],
18576
+ lanes: 1,
18577
+ isScrollingResetDelay: 150,
18578
+ enabled: true,
18579
+ isRtl: false,
18580
+ ...opts2
18581
+ };
18582
+ };
18583
+ this.notify = (sync2) => {
18584
+ var _a2, _b;
18585
+ (_b = (_a2 = this.options).onChange) == null ? void 0 : _b.call(_a2, this, sync2);
18586
+ };
18587
+ this.maybeNotify = memo(
18588
+ () => {
18589
+ this.calculateRange();
18590
+ return [
18591
+ this.isScrolling,
18592
+ this.range ? this.range.startIndex : null,
18593
+ this.range ? this.range.endIndex : null
18594
+ ];
18595
+ },
18596
+ (isScrolling) => {
18597
+ this.notify(isScrolling);
18598
+ },
18599
+ {
18600
+ key: process.env.NODE_ENV !== "production" && "maybeNotify",
18601
+ debug: () => this.options.debug,
18602
+ initialDeps: [
18603
+ this.isScrolling,
18604
+ this.range ? this.range.startIndex : null,
18605
+ this.range ? this.range.endIndex : null
18606
+ ]
18607
+ }
18608
+ );
18609
+ this.cleanup = () => {
18610
+ this.unsubs.filter(Boolean).forEach((d2) => d2());
18611
+ this.unsubs = [];
18612
+ this.scrollElement = null;
18613
+ this.targetWindow = null;
18614
+ this.observer.disconnect();
18615
+ this.elementsCache.clear();
18616
+ };
18617
+ this._didMount = () => {
18618
+ return () => {
18619
+ this.cleanup();
18620
+ };
18621
+ };
18622
+ this._willUpdate = () => {
18623
+ var _a2;
18624
+ const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
18625
+ if (this.scrollElement !== scrollElement) {
18626
+ this.cleanup();
18627
+ if (!scrollElement) {
18628
+ this.maybeNotify();
18481
18629
  return;
18482
- _this.dragging = true;
18483
- if (evt instanceof MouseEvent) {
18484
- _this.startY = evt.pageY;
18485
- } else if (evt instanceof TouchEvent) {
18486
- _this.startY = evt.touches[0].pageY;
18487
18630
  }
18488
- _this.currentY = _this.startY;
18489
- if (_this._infScroll) {
18490
- _this._infScroll.style.willChange = "transform";
18491
- _this._infScroll.style.transition = "transform 0.2s cubic-bezier(0,0,0.31,1)";
18631
+ this.scrollElement = scrollElement;
18632
+ if (this.scrollElement && "ownerDocument" in this.scrollElement) {
18633
+ this.targetWindow = this.scrollElement.ownerDocument.defaultView;
18634
+ } else {
18635
+ this.targetWindow = ((_a2 = this.scrollElement) == null ? void 0 : _a2.window) ?? null;
18492
18636
  }
18493
- };
18494
- _this.onMove = function(evt) {
18495
- if (!_this.dragging)
18496
- return;
18497
- if (evt instanceof MouseEvent) {
18498
- _this.currentY = evt.pageY;
18499
- } else if (evt instanceof TouchEvent) {
18500
- _this.currentY = evt.touches[0].pageY;
18637
+ this._scrollToOffset(this.getScrollOffset(), {
18638
+ adjustments: void 0,
18639
+ behavior: void 0
18640
+ });
18641
+ this.unsubs.push(
18642
+ this.options.observeElementRect(this, (rect) => {
18643
+ this.scrollRect = rect;
18644
+ this.maybeNotify();
18645
+ })
18646
+ );
18647
+ this.unsubs.push(
18648
+ this.options.observeElementOffset(this, (offset3, isScrolling) => {
18649
+ this.scrollAdjustments = 0;
18650
+ this.scrollDirection = isScrolling ? this.getScrollOffset() < offset3 ? "forward" : "backward" : null;
18651
+ this.scrollOffset = offset3;
18652
+ this.isScrolling = isScrolling;
18653
+ this.maybeNotify();
18654
+ })
18655
+ );
18656
+ }
18657
+ };
18658
+ this.getSize = () => {
18659
+ if (!this.options.enabled) {
18660
+ this.scrollRect = null;
18661
+ return 0;
18662
+ }
18663
+ this.scrollRect = this.scrollRect ?? this.options.initialRect;
18664
+ return this.scrollRect[this.options.horizontal ? "width" : "height"];
18665
+ };
18666
+ this.getScrollOffset = () => {
18667
+ if (!this.options.enabled) {
18668
+ this.scrollOffset = null;
18669
+ return 0;
18670
+ }
18671
+ this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
18672
+ return this.scrollOffset;
18673
+ };
18674
+ this.getFurthestMeasurement = (measurements, index2) => {
18675
+ const furthestMeasurementsFound = /* @__PURE__ */ new Map();
18676
+ const furthestMeasurements = /* @__PURE__ */ new Map();
18677
+ for (let m2 = index2 - 1; m2 >= 0; m2--) {
18678
+ const measurement = measurements[m2];
18679
+ if (furthestMeasurementsFound.has(measurement.lane)) {
18680
+ continue;
18501
18681
  }
18502
- if (_this.currentY < _this.startY)
18503
- return;
18504
- if (_this.currentY - _this.startY >= Number(_this.props.pullDownToRefreshThreshold)) {
18505
- _this.setState({
18506
- pullToRefreshThresholdBreached: true
18507
- });
18682
+ const previousFurthestMeasurement = furthestMeasurements.get(
18683
+ measurement.lane
18684
+ );
18685
+ if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
18686
+ furthestMeasurements.set(measurement.lane, measurement);
18687
+ } else if (measurement.end < previousFurthestMeasurement.end) {
18688
+ furthestMeasurementsFound.set(measurement.lane, true);
18508
18689
  }
18509
- if (_this.currentY - _this.startY > _this.maxPullDownDistance * 1.5)
18510
- return;
18511
- if (_this._infScroll) {
18512
- _this._infScroll.style.overflow = "visible";
18513
- _this._infScroll.style.transform = "translate3d(0px, " + (_this.currentY - _this.startY) + "px, 0px)";
18690
+ if (furthestMeasurementsFound.size === this.options.lanes) {
18691
+ break;
18514
18692
  }
18515
- };
18516
- _this.onEnd = function() {
18517
- _this.startY = 0;
18518
- _this.currentY = 0;
18519
- _this.dragging = false;
18520
- if (_this.state.pullToRefreshThresholdBreached) {
18521
- _this.props.refreshFunction && _this.props.refreshFunction();
18522
- _this.setState({
18523
- pullToRefreshThresholdBreached: false
18693
+ }
18694
+ return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a2, b2) => {
18695
+ if (a2.end === b2.end) {
18696
+ return a2.index - b2.index;
18697
+ }
18698
+ return a2.end - b2.end;
18699
+ })[0] : void 0;
18700
+ };
18701
+ this.getMeasurementOptions = memo(
18702
+ () => [
18703
+ this.options.count,
18704
+ this.options.paddingStart,
18705
+ this.options.scrollMargin,
18706
+ this.options.getItemKey,
18707
+ this.options.enabled
18708
+ ],
18709
+ (count2, paddingStart, scrollMargin, getItemKey, enabled) => {
18710
+ this.pendingMeasuredCacheIndexes = [];
18711
+ return {
18712
+ count: count2,
18713
+ paddingStart,
18714
+ scrollMargin,
18715
+ getItemKey,
18716
+ enabled
18717
+ };
18718
+ },
18719
+ {
18720
+ key: false
18721
+ }
18722
+ );
18723
+ this.getMeasurements = memo(
18724
+ () => [this.getMeasurementOptions(), this.itemSizeCache],
18725
+ ({ count: count2, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
18726
+ if (!enabled) {
18727
+ this.measurementsCache = [];
18728
+ this.itemSizeCache.clear();
18729
+ return [];
18730
+ }
18731
+ if (this.measurementsCache.length === 0) {
18732
+ this.measurementsCache = this.options.initialMeasurementsCache;
18733
+ this.measurementsCache.forEach((item2) => {
18734
+ this.itemSizeCache.set(item2.key, item2.size);
18524
18735
  });
18525
18736
  }
18526
- requestAnimationFrame(function() {
18527
- if (_this._infScroll) {
18528
- _this._infScroll.style.overflow = "auto";
18529
- _this._infScroll.style.transform = "none";
18530
- _this._infScroll.style.willChange = "unset";
18531
- }
18737
+ const min = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
18738
+ this.pendingMeasuredCacheIndexes = [];
18739
+ const measurements = this.measurementsCache.slice(0, min);
18740
+ for (let i = min; i < count2; i++) {
18741
+ const key2 = getItemKey(i);
18742
+ const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
18743
+ const start3 = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
18744
+ const measuredSize = itemSizeCache.get(key2);
18745
+ const size2 = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
18746
+ const end2 = start3 + size2;
18747
+ const lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
18748
+ measurements[i] = {
18749
+ index: i,
18750
+ start: start3,
18751
+ size: size2,
18752
+ end: end2,
18753
+ key: key2,
18754
+ lane
18755
+ };
18756
+ }
18757
+ this.measurementsCache = measurements;
18758
+ return measurements;
18759
+ },
18760
+ {
18761
+ key: process.env.NODE_ENV !== "production" && "getMeasurements",
18762
+ debug: () => this.options.debug
18763
+ }
18764
+ );
18765
+ this.calculateRange = memo(
18766
+ () => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
18767
+ (measurements, outerSize, scrollOffset) => {
18768
+ return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
18769
+ measurements,
18770
+ outerSize,
18771
+ scrollOffset
18772
+ }) : null;
18773
+ },
18774
+ {
18775
+ key: process.env.NODE_ENV !== "production" && "calculateRange",
18776
+ debug: () => this.options.debug
18777
+ }
18778
+ );
18779
+ this.getIndexes = memo(
18780
+ () => [
18781
+ this.options.rangeExtractor,
18782
+ this.calculateRange(),
18783
+ this.options.overscan,
18784
+ this.options.count
18785
+ ],
18786
+ (rangeExtractor, range2, overscan, count2) => {
18787
+ return range2 === null ? [] : rangeExtractor({
18788
+ startIndex: range2.startIndex,
18789
+ endIndex: range2.endIndex,
18790
+ overscan,
18791
+ count: count2
18532
18792
  });
18533
- };
18534
- _this.onScrollListener = function(event) {
18535
- if (typeof _this.props.onScroll === "function") {
18536
- setTimeout(function() {
18537
- return _this.props.onScroll && _this.props.onScroll(event);
18538
- }, 0);
18793
+ },
18794
+ {
18795
+ key: process.env.NODE_ENV !== "production" && "getIndexes",
18796
+ debug: () => this.options.debug
18797
+ }
18798
+ );
18799
+ this.indexFromElement = (node2) => {
18800
+ const attributeName = this.options.indexAttribute;
18801
+ const indexStr = node2.getAttribute(attributeName);
18802
+ if (!indexStr) {
18803
+ console.warn(
18804
+ `Missing attribute name '${attributeName}={index}' on measured element.`
18805
+ );
18806
+ return -1;
18807
+ }
18808
+ return parseInt(indexStr, 10);
18809
+ };
18810
+ this._measureElement = (node2, entry) => {
18811
+ const index2 = this.indexFromElement(node2);
18812
+ const item2 = this.measurementsCache[index2];
18813
+ if (!item2) {
18814
+ return;
18815
+ }
18816
+ const key2 = item2.key;
18817
+ const prevNode = this.elementsCache.get(key2);
18818
+ if (prevNode !== node2) {
18819
+ if (prevNode) {
18820
+ this.observer.unobserve(prevNode);
18539
18821
  }
18540
- var target = _this.props.height || _this._scrollableNode ? event.target : document.documentElement.scrollTop ? document.documentElement : document.body;
18541
- if (_this.actionTriggered)
18542
- return;
18543
- var atBottom = _this.props.inverse ? _this.isElementAtTop(target, _this.props.scrollThreshold) : _this.isElementAtBottom(target, _this.props.scrollThreshold);
18544
- if (atBottom && _this.props.hasMore) {
18545
- _this.actionTriggered = true;
18546
- _this.setState({ showLoader: true });
18547
- _this.props.next && _this.props.next();
18822
+ this.observer.observe(node2);
18823
+ this.elementsCache.set(key2, node2);
18824
+ }
18825
+ if (node2.isConnected) {
18826
+ this.resizeItem(index2, this.options.measureElement(node2, entry, this));
18827
+ }
18828
+ };
18829
+ this.resizeItem = (index2, size2) => {
18830
+ const item2 = this.measurementsCache[index2];
18831
+ if (!item2) {
18832
+ return;
18833
+ }
18834
+ const itemSize = this.itemSizeCache.get(item2.key) ?? item2.size;
18835
+ const delta = size2 - itemSize;
18836
+ if (delta !== 0) {
18837
+ if (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item2, delta, this) : item2.start < this.getScrollOffset() + this.scrollAdjustments) {
18838
+ if (process.env.NODE_ENV !== "production" && this.options.debug) {
18839
+ console.info("correction", delta);
18840
+ }
18841
+ this._scrollToOffset(this.getScrollOffset(), {
18842
+ adjustments: this.scrollAdjustments += delta,
18843
+ behavior: void 0
18844
+ });
18548
18845
  }
18549
- _this.lastScrollTop = target.scrollTop;
18550
- };
18551
- _this.state = {
18552
- showLoader: false,
18553
- pullToRefreshThresholdBreached: false,
18554
- prevDataLength: props.dataLength
18555
- };
18556
- _this.throttledOnScrollListener = throttle$1(150, _this.onScrollListener).bind(_this);
18557
- _this.onStart = _this.onStart.bind(_this);
18558
- _this.onMove = _this.onMove.bind(_this);
18559
- _this.onEnd = _this.onEnd.bind(_this);
18560
- return _this;
18561
- }
18562
- InfiniteScroll2.prototype.componentDidMount = function() {
18563
- if (typeof this.props.dataLength === "undefined") {
18564
- throw new Error('mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage');
18565
- }
18566
- this._scrollableNode = this.getScrollableTarget();
18567
- this.el = this.props.height ? this._infScroll : this._scrollableNode || window;
18568
- if (this.el) {
18569
- this.el.addEventListener("scroll", this.throttledOnScrollListener);
18570
- }
18571
- if (typeof this.props.initialScrollY === "number" && this.el && this.el instanceof HTMLElement && this.el.scrollHeight > this.props.initialScrollY) {
18572
- this.el.scrollTo(0, this.props.initialScrollY);
18573
- }
18574
- if (this.props.pullDownToRefresh && this.el) {
18575
- this.el.addEventListener("touchstart", this.onStart);
18576
- this.el.addEventListener("touchmove", this.onMove);
18577
- this.el.addEventListener("touchend", this.onEnd);
18578
- this.el.addEventListener("mousedown", this.onStart);
18579
- this.el.addEventListener("mousemove", this.onMove);
18580
- this.el.addEventListener("mouseup", this.onEnd);
18581
- this.maxPullDownDistance = this._pullDown && this._pullDown.firstChild && this._pullDown.firstChild.getBoundingClientRect().height || 0;
18582
- this.forceUpdate();
18583
- if (typeof this.props.refreshFunction !== "function") {
18584
- throw new Error(`Mandatory prop "refreshFunction" missing.
18585
- Pull Down To Refresh functionality will not work
18586
- as expected. Check README.md for usage'`);
18846
+ this.pendingMeasuredCacheIndexes.push(item2.index);
18847
+ this.itemSizeCache = new Map(this.itemSizeCache.set(item2.key, size2));
18848
+ this.notify(false);
18849
+ }
18850
+ };
18851
+ this.measureElement = (node2) => {
18852
+ if (!node2) {
18853
+ this.elementsCache.forEach((cached, key2) => {
18854
+ if (!cached.isConnected) {
18855
+ this.observer.unobserve(cached);
18856
+ this.elementsCache.delete(key2);
18857
+ }
18858
+ });
18859
+ return;
18860
+ }
18861
+ this._measureElement(node2, void 0);
18862
+ };
18863
+ this.getVirtualItems = memo(
18864
+ () => [this.getIndexes(), this.getMeasurements()],
18865
+ (indexes, measurements) => {
18866
+ const virtualItems = [];
18867
+ for (let k2 = 0, len = indexes.length; k2 < len; k2++) {
18868
+ const i = indexes[k2];
18869
+ const measurement = measurements[i];
18870
+ virtualItems.push(measurement);
18871
+ }
18872
+ return virtualItems;
18873
+ },
18874
+ {
18875
+ key: process.env.NODE_ENV !== "production" && "getVirtualItems",
18876
+ debug: () => this.options.debug
18877
+ }
18878
+ );
18879
+ this.getVirtualItemForOffset = (offset3) => {
18880
+ const measurements = this.getMeasurements();
18881
+ if (measurements.length === 0) {
18882
+ return void 0;
18883
+ }
18884
+ return notUndefined(
18885
+ measurements[findNearestBinarySearch(
18886
+ 0,
18887
+ measurements.length - 1,
18888
+ (index2) => notUndefined(measurements[index2]).start,
18889
+ offset3
18890
+ )]
18891
+ );
18892
+ };
18893
+ this.getOffsetForAlignment = (toOffset, align) => {
18894
+ const size2 = this.getSize();
18895
+ const scrollOffset = this.getScrollOffset();
18896
+ if (align === "auto") {
18897
+ if (toOffset <= scrollOffset) {
18898
+ align = "start";
18899
+ } else if (toOffset >= scrollOffset + size2) {
18900
+ align = "end";
18901
+ } else {
18902
+ align = "start";
18587
18903
  }
18588
18904
  }
18905
+ if (align === "start") {
18906
+ toOffset = toOffset;
18907
+ } else if (align === "end") {
18908
+ toOffset = toOffset - size2;
18909
+ } else if (align === "center") {
18910
+ toOffset = toOffset - size2 / 2;
18911
+ }
18912
+ const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
18913
+ const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
18914
+ const maxOffset = scrollSize - size2;
18915
+ return Math.max(Math.min(maxOffset, toOffset), 0);
18589
18916
  };
18590
- InfiniteScroll2.prototype.componentWillUnmount = function() {
18591
- if (this.el) {
18592
- this.el.removeEventListener("scroll", this.throttledOnScrollListener);
18593
- if (this.props.pullDownToRefresh) {
18594
- this.el.removeEventListener("touchstart", this.onStart);
18595
- this.el.removeEventListener("touchmove", this.onMove);
18596
- this.el.removeEventListener("touchend", this.onEnd);
18597
- this.el.removeEventListener("mousedown", this.onStart);
18598
- this.el.removeEventListener("mousemove", this.onMove);
18599
- this.el.removeEventListener("mouseup", this.onEnd);
18917
+ this.getOffsetForIndex = (index2, align = "auto") => {
18918
+ index2 = Math.max(0, Math.min(index2, this.options.count - 1));
18919
+ const item2 = this.measurementsCache[index2];
18920
+ if (!item2) {
18921
+ return void 0;
18922
+ }
18923
+ const size2 = this.getSize();
18924
+ const scrollOffset = this.getScrollOffset();
18925
+ if (align === "auto") {
18926
+ if (item2.end >= scrollOffset + size2 - this.options.scrollPaddingEnd) {
18927
+ align = "end";
18928
+ } else if (item2.start <= scrollOffset + this.options.scrollPaddingStart) {
18929
+ align = "start";
18930
+ } else {
18931
+ return [scrollOffset, align];
18600
18932
  }
18601
18933
  }
18934
+ const toOffset = align === "end" ? item2.end + this.options.scrollPaddingEnd : item2.start - this.options.scrollPaddingStart;
18935
+ return [this.getOffsetForAlignment(toOffset, align), align];
18602
18936
  };
18603
- InfiniteScroll2.prototype.componentDidUpdate = function(prevProps) {
18604
- if (this.props.dataLength === prevProps.dataLength)
18605
- return;
18606
- this.actionTriggered = false;
18607
- this.setState({
18608
- showLoader: false
18609
- });
18937
+ this.isDynamicMode = () => this.elementsCache.size > 0;
18938
+ this.cancelScrollToIndex = () => {
18939
+ if (this.scrollToIndexTimeoutId !== null && this.targetWindow) {
18940
+ this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId);
18941
+ this.scrollToIndexTimeoutId = null;
18942
+ }
18610
18943
  };
18611
- InfiniteScroll2.getDerivedStateFromProps = function(nextProps, prevState) {
18612
- var dataLengthChanged = nextProps.dataLength !== prevState.prevDataLength;
18613
- if (dataLengthChanged) {
18614
- return __assign$1(__assign$1({}, prevState), { prevDataLength: nextProps.dataLength });
18944
+ this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
18945
+ this.cancelScrollToIndex();
18946
+ if (behavior === "smooth" && this.isDynamicMode()) {
18947
+ console.warn(
18948
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
18949
+ );
18615
18950
  }
18616
- return null;
18951
+ this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), {
18952
+ adjustments: void 0,
18953
+ behavior
18954
+ });
18617
18955
  };
18618
- InfiniteScroll2.prototype.isElementAtTop = function(target, scrollThreshold) {
18619
- if (scrollThreshold === void 0) {
18620
- scrollThreshold = 0.8;
18956
+ this.scrollToIndex = (index2, { align: initialAlign = "auto", behavior } = {}) => {
18957
+ index2 = Math.max(0, Math.min(index2, this.options.count - 1));
18958
+ this.cancelScrollToIndex();
18959
+ if (behavior === "smooth" && this.isDynamicMode()) {
18960
+ console.warn(
18961
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
18962
+ );
18621
18963
  }
18622
- var clientHeight = target === document.body || target === document.documentElement ? window.screen.availHeight : target.clientHeight;
18623
- var threshold = parseThreshold(scrollThreshold);
18624
- if (threshold.unit === ThresholdUnits.Pixel) {
18625
- return target.scrollTop <= threshold.value + clientHeight - target.scrollHeight + 1;
18964
+ const offsetAndAlign = this.getOffsetForIndex(index2, initialAlign);
18965
+ if (!offsetAndAlign) return;
18966
+ const [offset3, align] = offsetAndAlign;
18967
+ this._scrollToOffset(offset3, { adjustments: void 0, behavior });
18968
+ if (behavior !== "smooth" && this.isDynamicMode() && this.targetWindow) {
18969
+ this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
18970
+ this.scrollToIndexTimeoutId = null;
18971
+ const elementInDOM = this.elementsCache.has(
18972
+ this.options.getItemKey(index2)
18973
+ );
18974
+ if (elementInDOM) {
18975
+ const [latestOffset] = notUndefined(
18976
+ this.getOffsetForIndex(index2, align)
18977
+ );
18978
+ if (!approxEqual(latestOffset, this.getScrollOffset())) {
18979
+ this.scrollToIndex(index2, { align, behavior });
18980
+ }
18981
+ } else {
18982
+ this.scrollToIndex(index2, { align, behavior });
18983
+ }
18984
+ });
18626
18985
  }
18627
- return target.scrollTop <= threshold.value / 100 + clientHeight - target.scrollHeight + 1;
18628
18986
  };
18629
- InfiniteScroll2.prototype.isElementAtBottom = function(target, scrollThreshold) {
18630
- if (scrollThreshold === void 0) {
18631
- scrollThreshold = 0.8;
18987
+ this.scrollBy = (delta, { behavior } = {}) => {
18988
+ this.cancelScrollToIndex();
18989
+ if (behavior === "smooth" && this.isDynamicMode()) {
18990
+ console.warn(
18991
+ "The `smooth` scroll behavior is not fully supported with dynamic size."
18992
+ );
18632
18993
  }
18633
- var clientHeight = target === document.body || target === document.documentElement ? window.screen.availHeight : target.clientHeight;
18634
- var threshold = parseThreshold(scrollThreshold);
18635
- if (threshold.unit === ThresholdUnits.Pixel) {
18636
- return target.scrollTop + clientHeight >= target.scrollHeight - threshold.value;
18994
+ this._scrollToOffset(this.getScrollOffset() + delta, {
18995
+ adjustments: void 0,
18996
+ behavior
18997
+ });
18998
+ };
18999
+ this.getTotalSize = () => {
19000
+ var _a2;
19001
+ const measurements = this.getMeasurements();
19002
+ let end2;
19003
+ if (measurements.length === 0) {
19004
+ end2 = this.options.paddingStart;
19005
+ } else {
19006
+ end2 = this.options.lanes === 1 ? ((_a2 = measurements[measurements.length - 1]) == null ? void 0 : _a2.end) ?? 0 : Math.max(
19007
+ ...measurements.slice(-this.options.lanes).map((m2) => m2.end)
19008
+ );
18637
19009
  }
18638
- return target.scrollTop + clientHeight >= threshold.value / 100 * target.scrollHeight;
19010
+ return end2 - this.options.scrollMargin + this.options.paddingEnd;
18639
19011
  };
18640
- InfiniteScroll2.prototype.render = function() {
18641
- var _this = this;
18642
- var style2 = __assign$1({ height: this.props.height || "auto", overflow: "auto", WebkitOverflowScrolling: "touch" }, this.props.style);
18643
- var hasChildren2 = this.props.hasChildren || !!(this.props.children && this.props.children instanceof Array && this.props.children.length);
18644
- var outerDivStyle = this.props.pullDownToRefresh && this.props.height ? { overflow: "auto" } : {};
18645
- return React__default.createElement(
18646
- "div",
18647
- { style: outerDivStyle, className: "infinite-scroll-component__outerdiv" },
18648
- React__default.createElement(
18649
- "div",
18650
- { className: "infinite-scroll-component " + (this.props.className || ""), ref: function(infScroll) {
18651
- return _this._infScroll = infScroll;
18652
- }, style: style2 },
18653
- this.props.pullDownToRefresh && React__default.createElement(
18654
- "div",
18655
- { style: { position: "relative" }, ref: function(pullDown) {
18656
- return _this._pullDown = pullDown;
18657
- } },
18658
- React__default.createElement("div", { style: {
18659
- position: "absolute",
18660
- left: 0,
18661
- right: 0,
18662
- top: -1 * this.maxPullDownDistance
18663
- } }, this.state.pullToRefreshThresholdBreached ? this.props.releaseToRefreshContent : this.props.pullDownToRefreshContent)
18664
- ),
18665
- this.props.children,
18666
- !this.state.showLoader && !hasChildren2 && this.props.hasMore && this.props.loader,
18667
- this.state.showLoader && this.props.hasMore && this.props.loader,
18668
- !this.props.hasMore && this.props.endMessage
18669
- )
18670
- );
19012
+ this._scrollToOffset = (offset3, {
19013
+ adjustments,
19014
+ behavior
19015
+ }) => {
19016
+ this.options.scrollToFn(offset3, { behavior, adjustments }, this);
18671
19017
  };
18672
- return InfiniteScroll2;
18673
- }(Component$1)
18674
- );
19018
+ this.measure = () => {
19019
+ this.itemSizeCache = /* @__PURE__ */ new Map();
19020
+ this.notify(false);
19021
+ };
19022
+ this.setOptions(opts);
19023
+ }
19024
+ }
19025
+ const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
19026
+ while (low <= high) {
19027
+ const middle = (low + high) / 2 | 0;
19028
+ const currentValue = getCurrentValue(middle);
19029
+ if (currentValue < value) {
19030
+ low = middle + 1;
19031
+ } else if (currentValue > value) {
19032
+ high = middle - 1;
19033
+ } else {
19034
+ return middle;
19035
+ }
19036
+ }
19037
+ if (low > 0) {
19038
+ return low - 1;
19039
+ } else {
19040
+ return 0;
19041
+ }
19042
+ };
19043
+ function calculateRange({
19044
+ measurements,
19045
+ outerSize,
19046
+ scrollOffset
19047
+ }) {
19048
+ const count2 = measurements.length - 1;
19049
+ const getOffset2 = (index2) => measurements[index2].start;
19050
+ const startIndex = findNearestBinarySearch(0, count2, getOffset2, scrollOffset);
19051
+ let endIndex = startIndex;
19052
+ while (endIndex < count2 && measurements[endIndex].end < scrollOffset + outerSize) {
19053
+ endIndex++;
19054
+ }
19055
+ return { startIndex, endIndex };
19056
+ }
19057
+ const useIsomorphicLayoutEffect$4 = typeof document !== "undefined" ? React$4.useLayoutEffect : React$4.useEffect;
19058
+ function useVirtualizerBase(options) {
19059
+ const rerender = React$4.useReducer(() => ({}), {})[1];
19060
+ const resolvedOptions = {
19061
+ ...options,
19062
+ onChange: (instance2, sync2) => {
19063
+ var _a2;
19064
+ if (sync2) {
19065
+ flushSync$1(rerender);
19066
+ } else {
19067
+ rerender();
19068
+ }
19069
+ (_a2 = options.onChange) == null ? void 0 : _a2.call(options, instance2, sync2);
19070
+ }
19071
+ };
19072
+ const [instance] = React$4.useState(
19073
+ () => new Virtualizer(resolvedOptions)
19074
+ );
19075
+ instance.setOptions(resolvedOptions);
19076
+ React$4.useEffect(() => {
19077
+ return instance._didMount();
19078
+ }, []);
19079
+ useIsomorphicLayoutEffect$4(() => {
19080
+ return instance._willUpdate();
19081
+ });
19082
+ return instance;
19083
+ }
19084
+ function useVirtualizer(options) {
19085
+ return useVirtualizerBase({
19086
+ observeElementRect,
19087
+ observeElementOffset,
19088
+ scrollToFn: elementScroll,
19089
+ ...options
19090
+ });
19091
+ }
18675
19092
  const inputInTable$8 = "_inputInTable_1llou_1";
18676
19093
  const inputHover$8 = "_inputHover_1llou_13";
18677
19094
  const inputFocus$8 = "_inputFocus_1llou_18";
@@ -18876,95 +19293,264 @@ const getItemStyle = (draggableProps, item2) => {
18876
19293
  };
18877
19294
  };
18878
19295
  const ListRow = forwardRef(
18879
- ({ items, expanding, invokeEditOnRowClick, provided, draggable: draggable2 }, listRowRefs) => {
19296
+ ({ item: item2, index: index2, expanding, invokeEditOnRowClick, provided, draggable: draggable2 }, listRowRefs) => {
18880
19297
  const disabledContext = useContext(DisabledContext);
18881
- const listElement = (index2, provided2, item2, indent, hasOnClick, edit2) => {
18882
- const Component2 = item2.component || "a";
18883
- return /* @__PURE__ */ createElement(
19298
+ const listElement = (index22, provided2, item22, indent2, hasOnClick2, edit22) => {
19299
+ const Component2 = item22.component || "a";
19300
+ return /* @__PURE__ */ jsx(
18884
19301
  Component2,
18885
19302
  {
18886
- href: item2.url,
18887
- to: item2.url,
18888
- ref: provided2 == null ? void 0 : provided2.innerRef,
18889
- ...provided2.draggableProps,
18890
- style: getItemStyle(provided2.draggableProps, item2),
19303
+ href: item22.url,
19304
+ to: item22.url,
19305
+ style: getItemStyle(provided2 == null ? void 0 : provided2.draggableProps, item22),
18891
19306
  className: cx$2(
18892
19307
  listStyles.item,
18893
- item2.active ? listStyles.active : "",
18894
- item2.disabled || disabledContext ? listStyles.disabled : "",
18895
- hasOnClick ? listStyles.action : ""
19308
+ item22.active ? listStyles.active : "",
19309
+ item22.disabled || disabledContext ? listStyles.disabled : "",
19310
+ hasOnClick2 ? listStyles.action : ""
18896
19311
  ),
18897
19312
  onClick: (evt) => {
18898
- if (invokeEditOnRowClick && edit2) {
18899
- if (edit2.onClick) edit2.onClick(evt, item2.id);
19313
+ if (invokeEditOnRowClick && edit22) {
19314
+ if (edit22.onClick) edit22.onClick(evt, item22.id);
18900
19315
  }
18901
- if (item2.onClick) {
18902
- return item2.onClick(evt);
19316
+ if (item22.onClick) {
19317
+ return item22.onClick(evt);
18903
19318
  }
18904
19319
  },
18905
- key: index2,
18906
- "data-id": index2,
18907
- title: item2.title,
18908
- "data-testid": item2.testId
19320
+ "data-id": index22,
19321
+ title: item22.title,
19322
+ "data-testid": item22.testId,
19323
+ children: /* @__PURE__ */ jsxs("div", { style: { paddingLeft: indent2 }, children: [
19324
+ /* @__PURE__ */ jsxs("div", { className: listStyles.itemHeader, children: [
19325
+ draggable2 && /* @__PURE__ */ jsx(
19326
+ "div",
19327
+ {
19328
+ className: listStyles.drag,
19329
+ ...provided2.dragHandleProps,
19330
+ children: /* @__PURE__ */ jsx(Icon, { icon: IconType.DRAG })
19331
+ }
19332
+ ),
19333
+ item22.level && item22.level > 0 ? /* @__PURE__ */ jsx("div", { className: listStyles.indentIcon, children: /* @__PURE__ */ jsx(Icon, { icon: IconType.INDENT }) }) : null,
19334
+ /* @__PURE__ */ jsx(Label$1, { label: item22.label }),
19335
+ /* @__PURE__ */ jsx(MetaContent, { item: item22 }),
19336
+ /* @__PURE__ */ jsxs("div", { className: listStyles.right, children: [
19337
+ /* @__PURE__ */ jsx(MetaCount, { item: item22 }),
19338
+ !(item22.disabled || disabledContext) && item22.actions && /* @__PURE__ */ jsx("div", { className: listStyles.actions, children: /* @__PURE__ */ jsx(Actions, { actions: item22.actions }) })
19339
+ ] })
19340
+ ] }),
19341
+ /* @__PURE__ */ jsx(ItemContent, { item: item22, expanding })
19342
+ ] })
18909
19343
  },
18910
- /* @__PURE__ */ jsxs(
18911
- "div",
18912
- {
18913
- ref: (el2) => {
18914
- if (listRowRefs && "current" in listRowRefs && Array.isArray(listRowRefs.current) && index2 !== void 0) {
18915
- listRowRefs.current[index2] = el2;
18916
- }
18917
- },
18918
- style: { paddingLeft: indent },
18919
- children: [
18920
- /* @__PURE__ */ jsxs("div", { className: listStyles.itemHeader, children: [
18921
- draggable2 && /* @__PURE__ */ jsx(
18922
- "div",
19344
+ index22
19345
+ );
19346
+ };
19347
+ const isSubheading = item2.type === "Heading";
19348
+ const edit2 = item2.actions && item2.actions.find(
19349
+ (a2) => {
19350
+ var _a2;
19351
+ return a2.label && ((_a2 = String(a2.label)) == null ? void 0 : _a2.toLowerCase()) === "edit";
19352
+ }
19353
+ );
19354
+ const hasOnClick = !!(edit2 || item2.url || item2.onClick);
19355
+ const indent = item2.level && item2.level > 1 ? (item2.level - 1) * 20 : 0;
19356
+ return isSubheading ? /* @__PURE__ */ jsx(ListSubheading, { item: item2, index: index2 }) : listElement(index2, provided, item2, indent, hasOnClick, edit2);
19357
+ }
19358
+ );
19359
+ const ListDroppableWrapper = ({
19360
+ onListReorder,
19361
+ children,
19362
+ list: list2,
19363
+ draggable: draggable2,
19364
+ expanding
19365
+ }) => {
19366
+ if (!draggable2) {
19367
+ return children();
19368
+ }
19369
+ return /* @__PURE__ */ jsx(
19370
+ DragDropContext,
19371
+ {
19372
+ onDragEnd: (result) => {
19373
+ var _a2, _b;
19374
+ const from3 = (_a2 = result == null ? void 0 : result.source) == null ? void 0 : _a2.index;
19375
+ const to2 = (_b = result == null ? void 0 : result.destination) == null ? void 0 : _b.index;
19376
+ onListReorder({ from: from3, to: to2 });
19377
+ },
19378
+ children: /* @__PURE__ */ jsx(
19379
+ ConnectedDroppable,
19380
+ {
19381
+ droppableId: "droppable",
19382
+ mode: "virtual",
19383
+ renderClone: (provided, snapshot, rubric) => {
19384
+ return /* @__PURE__ */ jsx(
19385
+ "div",
19386
+ {
19387
+ ...provided.draggableProps,
19388
+ ref: provided.innerRef,
19389
+ style: {
19390
+ height: 36,
19391
+ width: "100%",
19392
+ display: "flex",
19393
+ alignItems: "center"
19394
+ },
19395
+ children: /* @__PURE__ */ jsx(
19396
+ ListRow,
18923
19397
  {
18924
- className: listStyles.drag,
18925
- ...provided2.dragHandleProps,
18926
- children: /* @__PURE__ */ jsx(Icon, { icon: IconType.DRAG })
19398
+ draggable: draggable2,
19399
+ item: list2.items[rubric.source.index],
19400
+ expanding,
19401
+ onListReorder,
19402
+ index: rubric.source.index,
19403
+ provided
18927
19404
  }
18928
- ),
18929
- item2.level && item2.level > 0 ? /* @__PURE__ */ jsx("div", { className: listStyles.indentIcon, children: /* @__PURE__ */ jsx(Icon, { icon: IconType.INDENT }) }) : null,
18930
- /* @__PURE__ */ jsx(Label$1, { label: item2.label }),
18931
- /* @__PURE__ */ jsx(MetaContent, { item: item2 }),
18932
- /* @__PURE__ */ jsxs("div", { className: listStyles.right, children: [
18933
- /* @__PURE__ */ jsx(MetaCount, { item: item2 }),
18934
- !(item2.disabled || disabledContext) && item2.actions && /* @__PURE__ */ jsx("div", { className: listStyles.actions, children: /* @__PURE__ */ jsx(Actions, { actions: item2.actions }) })
18935
- ] })
18936
- ] }),
18937
- /* @__PURE__ */ jsx(ItemContent, { item: item2, expanding })
18938
- ]
18939
- }
18940
- )
19405
+ )
19406
+ }
19407
+ );
19408
+ },
19409
+ children: (provided) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
19410
+ children(provided),
19411
+ provided.placeholder
19412
+ ] })
19413
+ }
19414
+ )
19415
+ }
19416
+ );
19417
+ };
19418
+ const List = ({
19419
+ list: list2,
19420
+ bordered: bordered2 = false,
19421
+ expanding = false,
19422
+ narrow: narrow2 = false,
19423
+ toggleNarrow: toggleNarrow2 = false,
19424
+ onToggleNarrow = () => {
19425
+ },
19426
+ invokeEditOnRowClick = true,
19427
+ noHeader = false,
19428
+ stickyHeader: stickyHeader2,
19429
+ draggable: draggable2 = false,
19430
+ onListReorder = () => {
19431
+ },
19432
+ marginBottom = 0,
19433
+ height: height2,
19434
+ testId,
19435
+ scrollDetails = {
19436
+ scrollable: false,
19437
+ hideScrollbar: false,
19438
+ triggerScrollToActiveItem: false,
19439
+ infiniteScroll: false,
19440
+ limit: 10,
19441
+ infiniteScrollTarget: void 0
19442
+ }
19443
+ }) => {
19444
+ const { scrollable, hideScrollbar: hideScrollbar2, triggerScrollToActiveItem } = scrollDetails;
19445
+ const listContainerRef = useRef(null);
19446
+ const virtualizer = useVirtualizer({
19447
+ count: list2.items.length,
19448
+ getScrollElement: () => listContainerRef.current,
19449
+ estimateSize: () => 36,
19450
+ overscan: 5
19451
+ });
19452
+ useEffect(() => {
19453
+ if (triggerScrollToActiveItem) {
19454
+ const activeItemIndex = list2.items.findIndex(
19455
+ (item2) => item2.active === true
18941
19456
  );
18942
- };
18943
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
18944
- items.map((item2, index2) => {
18945
- const isSubheading = item2.type === "Heading";
18946
- const edit2 = item2.actions && item2.actions.find(
18947
- (a2) => {
18948
- var _a2;
18949
- return a2.label && ((_a2 = String(a2.label)) == null ? void 0 : _a2.toLowerCase()) === "edit";
19457
+ if (activeItemIndex !== -1) {
19458
+ virtualizer.scrollToIndex(activeItemIndex, { align: "center" });
19459
+ }
19460
+ }
19461
+ }, [list2.items, triggerScrollToActiveItem]);
19462
+ const renderItem = (virtualRow, dragProvided) => {
19463
+ return /* @__PURE__ */ jsx(
19464
+ "div",
19465
+ {
19466
+ ref: dragProvided == null ? void 0 : dragProvided.innerRef,
19467
+ ...dragProvided == null ? void 0 : dragProvided.draggableProps,
19468
+ "data-index": virtualRow.index,
19469
+ style: {
19470
+ ...dragProvided == null ? void 0 : dragProvided.draggableProps.style,
19471
+ position: "absolute",
19472
+ top: 0,
19473
+ left: 0,
19474
+ width: "100%",
19475
+ height: `${virtualRow.size}px`,
19476
+ transform: `translateY(${virtualRow.start}px)`
19477
+ },
19478
+ children: /* @__PURE__ */ jsx("div", { ref: virtualizer.measureElement, "data-index": virtualRow.index, children: /* @__PURE__ */ jsx(
19479
+ ListRow,
19480
+ {
19481
+ index: virtualRow.index,
19482
+ draggable: draggable2,
19483
+ item: list2.items[virtualRow.index],
19484
+ expanding,
19485
+ invokeEditOnRowClick,
19486
+ onListReorder,
19487
+ provided: dragProvided
18950
19488
  }
18951
- );
18952
- const hasOnClick = !!(edit2 || item2.url || item2.onClick);
18953
- const indent = item2.level && item2.level > 1 ? (item2.level - 1) * 20 : 0;
18954
- return isSubheading ? /* @__PURE__ */ jsx(
18955
- ListSubheading,
19489
+ ) })
19490
+ }
19491
+ );
19492
+ };
19493
+ return /* @__PURE__ */ jsx(Card, { bordered: bordered2, padding: false, children: /* @__PURE__ */ jsxs(
19494
+ "div",
19495
+ {
19496
+ className: cx$2(
19497
+ listStyles.scrollableList,
19498
+ narrow2 ? listStyles.narrow : "",
19499
+ hideScrollbar2 ? listStyles.hideScrollbar : ""
19500
+ ),
19501
+ "data-testid": testId,
19502
+ style: { height: height2, marginBottom },
19503
+ ref: listContainerRef,
19504
+ children: [
19505
+ !noHeader && /* @__PURE__ */ jsx(
19506
+ ListHeading,
18956
19507
  {
18957
- ref: listRowRefs,
18958
- item: item2,
18959
- index: index2
18960
- },
18961
- index2
18962
- ) : draggable2 ? /* @__PURE__ */ jsx(PublicDraggable, { draggableId: item2.id + "", index: index2, children: (provided2) => listElement(index2, provided2, item2, indent, hasOnClick, edit2) }, item2.id) : listElement(index2, provided, item2, indent, hasOnClick, edit2);
18963
- }),
18964
- provided.placeholder
18965
- ] });
18966
- }
18967
- );
19508
+ name: list2.name,
19509
+ actions: list2.actions,
19510
+ toggleNarrow: toggleNarrow2,
19511
+ onToggleNarrow,
19512
+ stickyHeader: stickyHeader2
19513
+ }
19514
+ ),
19515
+ /* @__PURE__ */ jsx(
19516
+ ListDroppableWrapper,
19517
+ {
19518
+ onListReorder,
19519
+ list: list2,
19520
+ draggable: draggable2,
19521
+ expanding,
19522
+ children: (provided, snapshot) => {
19523
+ return /* @__PURE__ */ jsx(
19524
+ "div",
19525
+ {
19526
+ className: cx$2(listStyles.list, bordered2 ? listStyles.bordered : ""),
19527
+ style: {
19528
+ height: `${virtualizer.getTotalSize()}px`,
19529
+ width: "100%",
19530
+ position: "relative"
19531
+ },
19532
+ ref: provided == null ? void 0 : provided.innerRef,
19533
+ ...provided == null ? void 0 : provided.droppableProps,
19534
+ children: virtualizer.getVirtualItems().map(
19535
+ (virtualRow) => draggable2 ? /* @__PURE__ */ jsx(
19536
+ PublicDraggable,
19537
+ {
19538
+ draggableId: virtualRow.index.toString(),
19539
+ index: virtualRow.index,
19540
+ children: (dragProvided, dragSnapshot) => renderItem(virtualRow, dragProvided)
19541
+ },
19542
+ virtualRow.index
19543
+ ) : /* @__PURE__ */ jsx(Fragment$2, { children: renderItem(virtualRow) }, virtualRow.index)
19544
+ )
19545
+ }
19546
+ );
19547
+ }
19548
+ }
19549
+ )
19550
+ ]
19551
+ }
19552
+ ) });
19553
+ };
18968
19554
  const loader = "_loader_477i5_1";
18969
19555
  const fullViewPortSize = "_fullViewPortSize_477i5_7";
18970
19556
  const cover = "_cover_477i5_14";
@@ -19031,178 +19617,6 @@ const Loader = ({
19031
19617
  }
19032
19618
  );
19033
19619
  };
19034
- const List = ({
19035
- list: list2,
19036
- bordered: bordered2 = false,
19037
- expanding = false,
19038
- narrow: narrow2 = false,
19039
- toggleNarrow: toggleNarrow2 = false,
19040
- onToggleNarrow = () => {
19041
- },
19042
- invokeEditOnRowClick = true,
19043
- noHeader = false,
19044
- stickyHeader: stickyHeader2,
19045
- draggable: draggable2 = false,
19046
- onListReorder = () => {
19047
- },
19048
- marginBottom = 0,
19049
- height: height2,
19050
- testId,
19051
- scrollDetails = {
19052
- scrollable: false,
19053
- hideScrollbar: false,
19054
- triggerScrollToActiveItem: false,
19055
- infiniteScroll: false,
19056
- limit: 10,
19057
- infiniteScrollTarget: void 0
19058
- }
19059
- }) => {
19060
- const {
19061
- scrollable,
19062
- hideScrollbar: hideScrollbar2,
19063
- triggerScrollToActiveItem,
19064
- infiniteScroll,
19065
- infiniteScrollTarget
19066
- } = scrollDetails;
19067
- const listHeadingRef = useRef(null);
19068
- const listRowRefs = useRef([]);
19069
- const listContainerRef = useRef(null);
19070
- const MIN_ITEM_HEIGHT = 44;
19071
- const pageSize = infiniteScroll ? Math.ceil(window.innerHeight / MIN_ITEM_HEIGHT) : list2.items.length;
19072
- const [numVisibleRows, setNumVisibleRows] = useState(pageSize);
19073
- const [hasMore, setHasMore] = useState(numVisibleRows < (list2 == null ? void 0 : list2.items.length));
19074
- useEffect(() => {
19075
- listRowRefs.current = listRowRefs.current.slice(0, list2.items.length);
19076
- }, [list2.items.length]);
19077
- const loadMoreItems = () => {
19078
- if (numVisibleRows >= list2.items.length) {
19079
- setHasMore(false);
19080
- return;
19081
- }
19082
- const newVisibleRows = pageSize + numVisibleRows;
19083
- setNumVisibleRows(newVisibleRows);
19084
- };
19085
- const findFirstActiveItemIndex = (items) => items.findIndex((item2) => item2.active === true);
19086
- const setScrollToActiveItem = (activeItemIndex) => {
19087
- if (!listContainerRef.current || !listHeadingRef.current) return;
19088
- const itemBorderLength = 1;
19089
- if (triggerScrollToActiveItem && activeItemIndex >= 0) {
19090
- const itemOffsets = listRowRefs.current.reduce((acc, val, index2) => {
19091
- if (index2 < activeItemIndex) {
19092
- return acc + val.clientHeight + itemBorderLength;
19093
- }
19094
- return acc;
19095
- }, 0);
19096
- const centerOffset = listContainerRef.current.clientHeight / 2 - listRowRefs.current[activeItemIndex].clientHeight / 2;
19097
- const scrollOffset = itemOffsets - centerOffset;
19098
- if (stickyHeader2) {
19099
- const headingOffset2 = listHeadingRef.current.clientHeight / 2;
19100
- listContainerRef.current.scrollTop = scrollOffset + headingOffset2;
19101
- }
19102
- const headingOffset = listHeadingRef.current.clientHeight;
19103
- listContainerRef.current.scrollTop = scrollOffset + headingOffset;
19104
- }
19105
- };
19106
- useEffect(() => {
19107
- if (triggerScrollToActiveItem) {
19108
- const activeItemIndex = findFirstActiveItemIndex(list2 == null ? void 0 : list2.items);
19109
- setScrollToActiveItem(activeItemIndex);
19110
- }
19111
- }, [
19112
- listContainerRef.current,
19113
- listHeadingRef.current,
19114
- triggerScrollToActiveItem
19115
- ]);
19116
- return /* @__PURE__ */ jsx(
19117
- DragDropContext,
19118
- {
19119
- onDragEnd: (result) => {
19120
- var _a2, _b;
19121
- const from3 = (_a2 = result == null ? void 0 : result.source) == null ? void 0 : _a2.index;
19122
- const to2 = (_b = result == null ? void 0 : result.destination) == null ? void 0 : _b.index;
19123
- onListReorder({ from: from3, to: to2 });
19124
- },
19125
- children: /* @__PURE__ */ jsx(ConnectedDroppable, { droppableId: "droppable", children: (provided, snapshot) => {
19126
- return /* @__PURE__ */ jsx(
19127
- "div",
19128
- {
19129
- className: cx$2(
19130
- narrow2 ? listStyles.narrow : "",
19131
- scrollable ? listStyles.scrollableList : "",
19132
- hideScrollbar2 ? listStyles.hideScrollbar : ""
19133
- ),
19134
- "data-testid": testId,
19135
- id: "scrollableDiv",
19136
- style: { height: height2, marginBottom },
19137
- ref: listContainerRef,
19138
- children: /* @__PURE__ */ jsx(
19139
- "div",
19140
- {
19141
- ref: provided.innerRef,
19142
- ...provided.droppableProps,
19143
- children: /* @__PURE__ */ jsxs(Card, { bordered: bordered2, padding: false, children: [
19144
- !noHeader && /* @__PURE__ */ jsx(
19145
- ListHeading,
19146
- {
19147
- name: list2.name,
19148
- actions: list2.actions,
19149
- toggleNarrow: toggleNarrow2,
19150
- onToggleNarrow,
19151
- stickyHeader: stickyHeader2,
19152
- ref: listHeadingRef
19153
- }
19154
- ),
19155
- /* @__PURE__ */ jsx(
19156
- "div",
19157
- {
19158
- className: cx$2(listStyles.list, bordered2 ? listStyles.bordered : ""),
19159
- children: infiniteScroll ? /* @__PURE__ */ jsx(
19160
- InfiniteScroll,
19161
- {
19162
- dataLength: numVisibleRows,
19163
- next: loadMoreItems,
19164
- hasMore,
19165
- scrollableTarget: infiniteScrollTarget || "scrollableDiv",
19166
- loader: /* @__PURE__ */ jsx(Loader, {}),
19167
- className: listStyles.infiniteScrollContainer,
19168
- children: /* @__PURE__ */ jsx(
19169
- ListRow,
19170
- {
19171
- draggable: draggable2,
19172
- items: list2.items.slice(0, numVisibleRows),
19173
- expanding,
19174
- invokeEditOnRowClick,
19175
- onListReorder,
19176
- provided,
19177
- snapshot,
19178
- ref: listRowRefs
19179
- }
19180
- )
19181
- }
19182
- ) : /* @__PURE__ */ jsx(
19183
- ListRow,
19184
- {
19185
- draggable: draggable2,
19186
- items: list2.items,
19187
- expanding,
19188
- invokeEditOnRowClick,
19189
- onListReorder,
19190
- provided,
19191
- snapshot,
19192
- ref: listRowRefs
19193
- }
19194
- )
19195
- }
19196
- )
19197
- ] })
19198
- }
19199
- )
19200
- }
19201
- );
19202
- } })
19203
- }
19204
- );
19205
- };
19206
19620
  const inputInTable$7 = "_inputInTable_1okhq_1";
19207
19621
  const inputHover$7 = "_inputHover_1okhq_13";
19208
19622
  const inputFocus$7 = "_inputFocus_1okhq_18";
@@ -19962,7 +20376,7 @@ const useFontsReady = () => {
19962
20376
  const getWidth = () => window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
19963
20377
  const useWindowWidth = () => {
19964
20378
  const [width2, setWidth] = useState(getWidth());
19965
- const resizeListener = debounce$2(() => setWidth(getWidth()), 150);
20379
+ const resizeListener = debounce$3(() => setWidth(getWidth()), 150);
19966
20380
  useEffect(() => {
19967
20381
  window.addEventListener("resize", resizeListener);
19968
20382
  return () => {
@@ -52650,7 +53064,7 @@ const styles$d = {
52650
53064
  active: active$2,
52651
53065
  icon: icon$1
52652
53066
  };
52653
- const TooltipIcon = memo(
53067
+ const TooltipIcon = memo$1(
52654
53068
  ({ isOpen: isOpen2, label: label2, icon: icon2, invalid }) => {
52655
53069
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
52656
53070
  /* @__PURE__ */ jsx(
@@ -52725,7 +53139,7 @@ const Sections = ({
52725
53139
  )
52726
53140
  ] }, i)) });
52727
53141
  };
52728
- const SideBar = memo(
53142
+ const SideBar = memo$1(
52729
53143
  ({
52730
53144
  options,
52731
53145
  startOpen = false,
@@ -55322,18 +55736,18 @@ const Spacer = ({
55322
55736
  }
55323
55737
  }
55324
55738
  );
55325
- const inputInTable$2 = "_inputInTable_1dg3w_1";
55326
- const inputHover$2 = "_inputHover_1dg3w_13";
55327
- const inputFocus$2 = "_inputFocus_1dg3w_18";
55328
- const inputError$2 = "_inputError_1dg3w_25";
55329
- const inputWarning$2 = "_inputWarning_1dg3w_26";
55330
- const inputDisabled$2 = "_inputDisabled_1dg3w_61";
55331
- const hideScrollbars$2 = "_hideScrollbars_1dg3w_67";
55332
- const wrapper = "_wrapper_1dg3w_85";
55333
- const bordered = "_bordered_1dg3w_93";
55334
- const scroll2 = "_scroll_1dg3w_98";
55335
- const table = "_table_1dg3w_108";
55336
- const striped = "_striped_1dg3w_188";
55739
+ const inputInTable$2 = "_inputInTable_sqhcz_1";
55740
+ const inputHover$2 = "_inputHover_sqhcz_13";
55741
+ const inputFocus$2 = "_inputFocus_sqhcz_18";
55742
+ const inputError$2 = "_inputError_sqhcz_25";
55743
+ const inputWarning$2 = "_inputWarning_sqhcz_26";
55744
+ const inputDisabled$2 = "_inputDisabled_sqhcz_61";
55745
+ const hideScrollbars$2 = "_hideScrollbars_sqhcz_67";
55746
+ const wrapper = "_wrapper_sqhcz_85";
55747
+ const bordered = "_bordered_sqhcz_93";
55748
+ const scroll2 = "_scroll_sqhcz_98";
55749
+ const table = "_table_sqhcz_108";
55750
+ const striped = "_striped_sqhcz_186";
55337
55751
  const styles$b = {
55338
55752
  inputInTable: inputInTable$2,
55339
55753
  inputHover: inputHover$2,
@@ -55432,33 +55846,24 @@ const hasRowActions = (rows, headers) => {
55432
55846
  };
55433
55847
  const TableScrollWrapper = ({
55434
55848
  table: table2,
55435
- children
55849
+ children,
55850
+ headerRef
55436
55851
  }) => {
55852
+ var _a2;
55437
55853
  const { rows, infiniteScroll } = table2;
55438
- const pageSize = Math.ceil(window.innerHeight / 30);
55439
- const [visibleRows, setVisibleRows] = infiniteScroll ? useState(pageSize) : [rows.length, null];
55440
- const [hasMore, setHasMore] = infiniteScroll ? useState(visibleRows < rows.length) : [false, null];
55441
- const loadMoreItems = () => {
55442
- if (visibleRows >= rows.length && setHasMore) {
55443
- setHasMore(false);
55444
- return;
55445
- }
55446
- if (setVisibleRows) {
55447
- setVisibleRows(visibleRows + pageSize);
55448
- }
55449
- };
55450
- return /* @__PURE__ */ jsx("div", { id: "scrollWrapper", className: styles$b.scroll, children: infiniteScroll ? /* @__PURE__ */ jsx(
55451
- InfiniteScroll,
55452
- {
55453
- dataLength: Math.min(rows.length, visibleRows + pageSize),
55454
- next: loadMoreItems,
55455
- hasMore,
55456
- scrollableTarget: "scrollWrapper",
55457
- style: { overflow: "initial" },
55458
- loader: null,
55459
- children: children({ visibleRows })
55460
- }
55461
- ) : children({ visibleRows }) });
55854
+ const scrollRef = useRef(null);
55855
+ const virtualizer = useVirtualizer({
55856
+ count: rows.length,
55857
+ getScrollElement: () => scrollRef.current,
55858
+ estimateSize: () => 31,
55859
+ overscan: 10
55860
+ });
55861
+ const totalHeight = virtualizer.getTotalSize() + (((_a2 = headerRef == null ? void 0 : headerRef.current) == null ? void 0 : _a2.clientHeight) || 0);
55862
+ return /* @__PURE__ */ jsx("div", { ref: scrollRef, className: styles$b.scroll, children: /* @__PURE__ */ jsx("div", { style: { minHeight: totalHeight }, children: children({
55863
+ virtualItems: virtualizer.getVirtualItems(),
55864
+ isScrolling: virtualizer.isScrolling,
55865
+ scrollOffset: virtualizer.scrollOffset
55866
+ }) }) });
55462
55867
  };
55463
55868
  const clickableRow = "_clickableRow_m64j5_1";
55464
55869
  const hoverableRow = "_hoverableRow_m64j5_4";
@@ -56169,9 +56574,11 @@ const Row = ({
56169
56574
  provided = null,
56170
56575
  width: width2,
56171
56576
  columnWidths,
56577
+ style: style2,
56172
56578
  testId
56173
56579
  //TODO: add testId
56174
56580
  }) => {
56581
+ var _a2;
56175
56582
  const targetRef = useRef(null);
56176
56583
  const columnHeaderAlignment = getHeaderAlignment(
56177
56584
  columnHeaderAlignments,
@@ -56215,7 +56622,8 @@ const Row = ({
56215
56622
  },
56216
56623
  columnCount
56217
56624
  );
56218
- const getItemStyle2 = (isDragging, draggableStyle) => {
56625
+ const getDraggingStyle2 = (isDragging, draggableStyle) => {
56626
+ if (!snapshot || !provided) return null;
56219
56627
  return {
56220
56628
  minWidth: isDragging && `${width2}px`,
56221
56629
  width: isDragging && "100%",
@@ -56231,7 +56639,7 @@ const Row = ({
56231
56639
  if (row2.noDrag) {
56232
56640
  return /* @__PURE__ */ jsx("td", { "aria-labelledby": "unique-label-id" });
56233
56641
  }
56234
- return /* @__PURE__ */ jsx("td", { className: styles$8.dragIconCell, children: /* @__PURE__ */ jsx("div", { ...provided.dragHandleProps, className: styles$8.dragIcon, children: /* @__PURE__ */ jsx(Icon, { icon: IconType.DRAG }) }) });
56642
+ return /* @__PURE__ */ jsx("td", { className: styles$8.dragIconCell, children: /* @__PURE__ */ jsx("div", { ...provided == null ? void 0 : provided.dragHandleProps, className: styles$8.dragIcon, children: /* @__PURE__ */ jsx(Icon, { icon: IconType.DRAG }) }) });
56235
56643
  };
56236
56644
  return isHeader ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
56237
56645
  /* @__PURE__ */ jsxs(
@@ -56283,7 +56691,13 @@ const Row = ({
56283
56691
  "data-warning": warning2 || null,
56284
56692
  ref: (provided == null ? void 0 : provided.innerRef) || null,
56285
56693
  ...(provided == null ? void 0 : provided.draggableProps) || null,
56286
- style: snapshot && provided ? getItemStyle2(snapshot.isDragging, provided.draggableProps.style) : null,
56694
+ style: {
56695
+ ...style2,
56696
+ ...getDraggingStyle2(
56697
+ snapshot == null ? void 0 : snapshot.isDragging,
56698
+ (_a2 = provided == null ? void 0 : provided.draggableProps) == null ? void 0 : _a2.style
56699
+ )
56700
+ },
56287
56701
  children: [
56288
56702
  draggableTable ? getDragItem() : null,
56289
56703
  cells,
@@ -56325,16 +56739,8 @@ const Table = (props) => {
56325
56739
  maxHeight,
56326
56740
  fixedWidth: width2
56327
56741
  } = propTable;
56328
- const targetRef = useRef(null);
56329
- const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
56330
- useEffect(() => {
56331
- if (targetRef.current) {
56332
- setDimensions({
56333
- width: targetRef.current.offsetWidth,
56334
- height: targetRef.current.offsetHeight
56335
- });
56336
- }
56337
- }, []);
56742
+ useRef(null);
56743
+ const headerRef = useRef(null);
56338
56744
  const headers = get$2(props, "table.headers", []);
56339
56745
  const columnCount = getColumnCount(propRows, headers);
56340
56746
  const rowActions = hasRowActions(propRows, headers);
@@ -56385,7 +56791,7 @@ const Table = (props) => {
56385
56791
  // Collapse width if width = auto
56386
56792
  display: width2 === "auto" ? "inline-flex" : "flex"
56387
56793
  };
56388
- return draggable2 ? /* @__PURE__ */ jsxs("div", { ref: targetRef, className: wrapperClass, style: wrapperStyles, children: [
56794
+ return /* @__PURE__ */ jsxs("div", { className: wrapperClass, style: wrapperStyles, children: [
56389
56795
  /* @__PURE__ */ jsx(
56390
56796
  Title$1,
56391
56797
  {
@@ -56406,40 +56812,96 @@ const Table = (props) => {
56406
56812
  onListReorder({ from: from3, to: to2 });
56407
56813
  }
56408
56814
  },
56409
- children: /* @__PURE__ */ jsx(ConnectedDroppable, { droppableId: "droppable", children: (provided) => {
56410
- return /* @__PURE__ */ jsx(TableScrollWrapper, { table: table2, children: ({ visibleRows }) => /* @__PURE__ */ jsxs(
56411
- "table",
56412
- {
56413
- className: cx$2(styles$b.table, striped2 ? styles$b.striped : ""),
56414
- "data-testid": testId,
56415
- ref: provided.innerRef,
56416
- children: [
56417
- /* @__PURE__ */ jsx("thead", { children: headers.map((row2, rowIndex) => {
56418
- return /* @__PURE__ */ jsx(
56419
- Row,
56420
- {
56421
- rowIndex,
56422
- isHeader: true,
56423
- row: row2,
56424
- columnCount,
56425
- columnWidths,
56426
- colSpan,
56427
- hasRowActions: rowActions,
56428
- columnAlignment,
56429
- columnHeaderAlignments,
56430
- draggableTable: draggable2
56431
- },
56432
- `0_${rowIndex}`
56433
- );
56434
- }) }),
56435
- /* @__PURE__ */ jsxs("tbody", { children: [
56436
- rows.slice(0, visibleRows).map((row2, rowIndex) => /* @__PURE__ */ jsx(
56437
- PublicDraggable,
56438
- {
56439
- draggableId: rowIndex + "",
56440
- index: rowIndex,
56441
- isDragDisabled: row2.noDrag,
56442
- children: (provided2, snapshot) => /* @__PURE__ */ jsx(
56815
+ children: /* @__PURE__ */ jsx(
56816
+ ConnectedDroppable,
56817
+ {
56818
+ droppableId: "droppable",
56819
+ mode: "virtual",
56820
+ renderClone: (provided, snapshot, rubric) => {
56821
+ return /* @__PURE__ */ jsx(
56822
+ Row,
56823
+ {
56824
+ rowIndex: rubric.source.index,
56825
+ row: rows[rubric.source.index],
56826
+ columnCount,
56827
+ columnWidths,
56828
+ colSpan,
56829
+ hasRowActions: rowActions,
56830
+ columnAlignment,
56831
+ columnHeaderAlignments,
56832
+ draggableTable: draggable2,
56833
+ ...provided.draggableProps
56834
+ }
56835
+ );
56836
+ },
56837
+ children: (provided) => {
56838
+ return /* @__PURE__ */ jsx(TableScrollWrapper, { table: table2, headerRef, children: ({ virtualItems, isScrolling, scrollOffset }) => /* @__PURE__ */ jsxs(
56839
+ "table",
56840
+ {
56841
+ className: cx$2(styles$b.table, striped2 ? styles$b.striped : ""),
56842
+ "data-testid": testId,
56843
+ ref: provided.innerRef,
56844
+ children: [
56845
+ /* @__PURE__ */ jsx(
56846
+ "thead",
56847
+ {
56848
+ ref: headerRef,
56849
+ style: {
56850
+ position: "relative",
56851
+ transition: "transform 0.2s",
56852
+ transform: !isScrolling ? `translateY(${scrollOffset}px)` : "translateY(0px)"
56853
+ },
56854
+ children: headers.map((row2, rowIndex) => {
56855
+ return /* @__PURE__ */ jsx(
56856
+ Row,
56857
+ {
56858
+ rowIndex,
56859
+ isHeader: true,
56860
+ row: row2,
56861
+ columnCount,
56862
+ columnWidths,
56863
+ colSpan,
56864
+ hasRowActions: rowActions,
56865
+ columnAlignment,
56866
+ columnHeaderAlignments,
56867
+ draggableTable: draggable2
56868
+ },
56869
+ `0_${rowIndex}`
56870
+ );
56871
+ })
56872
+ }
56873
+ ),
56874
+ /* @__PURE__ */ jsx("tbody", { children: virtualItems.map((virtualRow, rowIndex) => {
56875
+ const row2 = rows[virtualRow.index];
56876
+ return draggable2 ? /* @__PURE__ */ jsx(
56877
+ PublicDraggable,
56878
+ {
56879
+ draggableId: rowIndex + "",
56880
+ index: rowIndex,
56881
+ isDragDisabled: row2.noDrag,
56882
+ children: (provided2, snapshot) => /* @__PURE__ */ jsx(
56883
+ Row,
56884
+ {
56885
+ rowIndex,
56886
+ row: row2,
56887
+ columnCount,
56888
+ columnWidths,
56889
+ colSpan,
56890
+ hasRowActions: rowActions,
56891
+ columnAlignment,
56892
+ style: {
56893
+ height: `${virtualRow.size}px`,
56894
+ transform: `translateY(${virtualRow.start - rowIndex * virtualRow.size}px)`
56895
+ },
56896
+ provided: provided2,
56897
+ snapshot,
56898
+ draggableTable: draggable2
56899
+ },
56900
+ `1_${rowIndex}`
56901
+ )
56902
+ },
56903
+ `index_${rowIndex}`
56904
+ ) : /* @__PURE__ */ jsx(
56443
56905
  Row,
56444
56906
  {
56445
56907
  rowIndex,
@@ -56449,81 +56911,22 @@ const Table = (props) => {
56449
56911
  colSpan,
56450
56912
  hasRowActions: rowActions,
56451
56913
  columnAlignment,
56452
- provided: provided2,
56453
- snapshot,
56454
- draggableTable: draggable2,
56455
- width: dimensions.width
56914
+ style: {
56915
+ height: `${virtualRow.size}px`,
56916
+ transform: `translateY(${virtualRow.start - rowIndex * virtualRow.size}px)`
56917
+ }
56456
56918
  },
56457
56919
  `1_${rowIndex}`
56458
- )
56459
- },
56460
- `index_${rowIndex}`
56461
- )),
56462
- provided.placeholder
56463
- ] })
56464
- ]
56920
+ );
56921
+ }) })
56922
+ ]
56923
+ }
56924
+ ) });
56465
56925
  }
56466
- ) });
56467
- } })
56926
+ }
56927
+ )
56468
56928
  }
56469
56929
  ),
56470
- footer2 && /* @__PURE__ */ jsx(
56471
- Footer,
56472
- {
56473
- pagination: footer2.pagination,
56474
- actions: footer2.actions,
56475
- content: footer2.content
56476
- }
56477
- )
56478
- ] }) : /* @__PURE__ */ jsxs("div", { className: wrapperClass, style: wrapperStyles, children: [
56479
- /* @__PURE__ */ jsx(
56480
- Title$1,
56481
- {
56482
- actions: actions2,
56483
- actionsRight,
56484
- name: name2,
56485
- testId: testId && `${testId}-title`
56486
- }
56487
- ),
56488
- /* @__PURE__ */ jsx(TableScrollWrapper, { table: table2, children: ({ visibleRows }) => /* @__PURE__ */ jsxs(
56489
- "table",
56490
- {
56491
- className: cx$2(styles$b.table, striped2 ? styles$b.striped : ""),
56492
- "data-testid": testId,
56493
- children: [
56494
- /* @__PURE__ */ jsx("thead", { children: headers.map((row2, rowIndex) => {
56495
- return /* @__PURE__ */ jsx(
56496
- Row,
56497
- {
56498
- rowIndex,
56499
- isHeader: true,
56500
- row: row2,
56501
- columnCount,
56502
- columnWidths,
56503
- colSpan,
56504
- hasRowActions: rowActions,
56505
- columnAlignment,
56506
- columnHeaderAlignments
56507
- },
56508
- `0_${rowIndex}`
56509
- );
56510
- }) }),
56511
- /* @__PURE__ */ jsx("tbody", { children: rows.slice(0, visibleRows).map((row2, rowIndex) => /* @__PURE__ */ jsx(
56512
- Row,
56513
- {
56514
- rowIndex,
56515
- row: row2,
56516
- columnCount,
56517
- columnWidths,
56518
- colSpan,
56519
- hasRowActions: rowActions,
56520
- columnAlignment
56521
- },
56522
- `1_${rowIndex}`
56523
- )) })
56524
- ]
56525
- }
56526
- ) }),
56527
56930
  footer2 && /* @__PURE__ */ jsx(
56528
56931
  Footer,
56529
56932
  {
@@ -59437,7 +59840,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
59437
59840
  }
59438
59841
  let refCount = 0;
59439
59842
  const INSTANCE_SYM = Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");
59440
- var DndProvider = /* @__PURE__ */ memo(function DndProvider2(_param) {
59843
+ var DndProvider = /* @__PURE__ */ memo$1(function DndProvider2(_param) {
59441
59844
  var { children } = _param, props = _objectWithoutProperties(_param, [
59442
59845
  "children"
59443
59846
  ]);
@@ -61798,7 +62201,7 @@ function useFeatures(props, visualElement2, preloadedFeatures) {
61798
62201
  var name_1 = featureNames[i];
61799
62202
  var _a2 = featureDefinitions[name_1], isEnabled = _a2.isEnabled, Component2 = _a2.Component;
61800
62203
  if (isEnabled(props) && Component2) {
61801
- features.push(React$4.createElement(Component2, __assign$4({ key: name_1 }, props, { visualElement: visualElement2 })));
62204
+ features.push(React$4.createElement(Component2, __assign$3({ key: name_1 }, props, { visualElement: visualElement2 })));
61802
62205
  }
61803
62206
  }
61804
62207
  return features;
@@ -62039,7 +62442,7 @@ function useProjection(projectionId, _a2, visualElement2, ProjectionNodeConstruc
62039
62442
  var VisualElementHandler = (
62040
62443
  /** @class */
62041
62444
  function(_super) {
62042
- __extends$1(VisualElementHandler2, _super);
62445
+ __extends(VisualElementHandler2, _super);
62043
62446
  function VisualElementHandler2() {
62044
62447
  return _super !== null && _super.apply(this, arguments) || this;
62045
62448
  }
@@ -62065,20 +62468,20 @@ function createMotionComponent(_a2) {
62065
62468
  preloadedFeatures && loadFeatures(preloadedFeatures);
62066
62469
  function MotionComponent(props, externalRef) {
62067
62470
  var layoutId = useLayoutId(props);
62068
- props = __assign$4(__assign$4({}, props), { layoutId });
62471
+ props = __assign$3(__assign$3({}, props), { layoutId });
62069
62472
  var config2 = useContext(MotionConfigContext);
62070
62473
  var features = null;
62071
62474
  var context2 = useCreateMotionContext(props);
62072
62475
  var projectionId = config2.isStatic ? void 0 : useProjectionId();
62073
62476
  var visualState = useVisualState(props, config2.isStatic);
62074
62477
  if (!config2.isStatic && isBrowser) {
62075
- context2.visualElement = useVisualElement(Component2, visualState, __assign$4(__assign$4({}, config2), props), createVisualElement);
62478
+ context2.visualElement = useVisualElement(Component2, visualState, __assign$3(__assign$3({}, config2), props), createVisualElement);
62076
62479
  useProjection(projectionId, props, context2.visualElement, projectionNodeConstructor || featureDefinitions.projectionNodeConstructor);
62077
62480
  features = useFeatures(props, context2.visualElement, preloadedFeatures);
62078
62481
  }
62079
62482
  return React$4.createElement(
62080
62483
  VisualElementHandler,
62081
- { visualElement: context2.visualElement, props: __assign$4(__assign$4({}, config2), props) },
62484
+ { visualElement: context2.visualElement, props: __assign$3(__assign$3({}, config2), props) },
62082
62485
  features,
62083
62486
  React$4.createElement(MotionContext.Provider, { value: context2 }, useRender(Component2, props, projectionId, useMotionRef(visualState, context2.visualElement, externalRef), visualState, config2.isStatic, context2.visualElement))
62084
62487
  );
@@ -62404,7 +62807,7 @@ const filter = Object.assign(Object.assign({}, complex), { getAnimatableNone: (v
62404
62807
  const functions = v2.match(functionRegex);
62405
62808
  return functions ? functions.map(applyDefaultFilter).join(" ") : v2;
62406
62809
  } });
62407
- var int = __assign$4(__assign$4({}, number), { transform: Math.round });
62810
+ var int = __assign$3(__assign$3({}, number), { transform: Math.round });
62408
62811
  var numberValueTypes = {
62409
62812
  // Border props
62410
62813
  borderWidth: px,
@@ -62534,7 +62937,7 @@ function useInitialMotionValues(_a2, visualState, isStatic) {
62534
62937
  var state = createHtmlRenderState();
62535
62938
  buildHTMLStyles(state, visualState, { enableHardwareAcceleration: !isStatic }, transformTemplate);
62536
62939
  var vars = state.vars, style2 = state.style;
62537
- return __assign$4(__assign$4({}, vars), style2);
62940
+ return __assign$3(__assign$3({}, vars), style2);
62538
62941
  }, [visualState]);
62539
62942
  }
62540
62943
  function useStyle(props, visualState, isStatic) {
@@ -62692,18 +63095,18 @@ function buildSVGAttrs(state, _a2, options, transformTemplate) {
62692
63095
  }
62693
63096
  }
62694
63097
  var createSvgRenderState = function() {
62695
- return __assign$4(__assign$4({}, createHtmlRenderState()), { attrs: {} });
63098
+ return __assign$3(__assign$3({}, createHtmlRenderState()), { attrs: {} });
62696
63099
  };
62697
63100
  function useSVGProps(props, visualState) {
62698
63101
  var visualProps = useMemo$1(function() {
62699
63102
  var state = createSvgRenderState();
62700
63103
  buildSVGAttrs(state, visualState, { enableHardwareAcceleration: false }, props.transformTemplate);
62701
- return __assign$4(__assign$4({}, state.attrs), { style: __assign$4({}, state.style) });
63104
+ return __assign$3(__assign$3({}, state.attrs), { style: __assign$3({}, state.style) });
62702
63105
  }, [visualState]);
62703
63106
  if (props.style) {
62704
63107
  var rawStyles = {};
62705
63108
  copyRawValuesOnly(rawStyles, props.style, props);
62706
- visualProps.style = __assign$4(__assign$4({}, rawStyles), visualProps.style);
63109
+ visualProps.style = __assign$3(__assign$3({}, rawStyles), visualProps.style);
62707
63110
  }
62708
63111
  return visualProps;
62709
63112
  }
@@ -62716,7 +63119,7 @@ function createUseRender(forwardMotionProps) {
62716
63119
  var useVisualProps = isSVGComponent(Component2) ? useSVGProps : useHTMLProps;
62717
63120
  var visualProps = useVisualProps(props, latestValues, isStatic);
62718
63121
  var filteredProps = filterProps(props, typeof Component2 === "string", forwardMotionProps);
62719
- var elementProps = __assign$4(__assign$4(__assign$4({}, filteredProps), visualProps), { ref: ref2 });
63122
+ var elementProps = __assign$3(__assign$3(__assign$3({}, filteredProps), visualProps), { ref: ref2 });
62720
63123
  if (projectionId) {
62721
63124
  elementProps["data-projection-id"] = projectionId;
62722
63125
  }
@@ -62893,7 +63296,7 @@ var htmlMotionConfig = {
62893
63296
  function createDomMotionConfig(Component2, _a2, preloadedFeatures, createVisualElement, projectionNodeConstructor) {
62894
63297
  var _b = _a2.forwardMotionProps, forwardMotionProps = _b === void 0 ? false : _b;
62895
63298
  var baseConfig = isSVGComponent(Component2) ? svgMotionConfig : htmlMotionConfig;
62896
- return __assign$4(__assign$4({}, baseConfig), { preloadedFeatures, useRender: createUseRender(forwardMotionProps), createVisualElement, projectionNodeConstructor, Component: Component2 });
63299
+ return __assign$3(__assign$3({}, baseConfig), { preloadedFeatures, useRender: createUseRender(forwardMotionProps), createVisualElement, projectionNodeConstructor, Component: Component2 });
62897
63300
  }
62898
63301
  var AnimationType;
62899
63302
  (function(AnimationType2) {
@@ -63980,7 +64383,7 @@ function initIntersectionObserver(_a2) {
63980
64383
  var rootObservers = observers.get(lookupRoot);
63981
64384
  var key2 = JSON.stringify(options);
63982
64385
  if (!rootObservers[key2]) {
63983
- rootObservers[key2] = new IntersectionObserver(fireAllObserverCallbacks, __assign$4({ root: root2 }, options));
64386
+ rootObservers[key2] = new IntersectionObserver(fireAllObserverCallbacks, __assign$3({ root: root2 }, options));
63984
64387
  }
63985
64388
  return rootObservers[key2];
63986
64389
  }
@@ -64198,9 +64601,9 @@ var getDefaultTransition = function(valueKey, to2) {
64198
64601
  } else {
64199
64602
  transitionFactory = defaultTransitions[valueKey] || defaultTransitions.default;
64200
64603
  }
64201
- return __assign$4({ to: to2 }, transitionFactory(to2));
64604
+ return __assign$3({ to: to2 }, transitionFactory(to2));
64202
64605
  };
64203
- var defaultValueTypes = __assign$4(__assign$4({}, numberValueTypes), {
64606
+ var defaultValueTypes = __assign$3(__assign$3({}, numberValueTypes), {
64204
64607
  // Color props
64205
64608
  color,
64206
64609
  backgroundColor: color,
@@ -64242,7 +64645,7 @@ function isTransitionDefined(_a2) {
64242
64645
  var legacyRepeatWarning = false;
64243
64646
  function convertTransitionToAnimationOptions(_a2) {
64244
64647
  var ease2 = _a2.ease, times = _a2.times, yoyo = _a2.yoyo, flip = _a2.flip, loop = _a2.loop, transition = __rest$1(_a2, ["ease", "times", "yoyo", "flip", "loop"]);
64245
- var options = __assign$4({}, transition);
64648
+ var options = __assign$3({}, transition);
64246
64649
  if (times)
64247
64650
  options["offset"] = times;
64248
64651
  if (transition.duration)
@@ -64289,9 +64692,9 @@ function getPopmotionAnimationOptions(transition, options, key2) {
64289
64692
  }
64290
64693
  hydrateKeyframes(options);
64291
64694
  if (!isTransitionDefined(transition)) {
64292
- transition = __assign$4(__assign$4({}, transition), getDefaultTransition(key2, options.to));
64695
+ transition = __assign$3(__assign$3({}, transition), getDefaultTransition(key2, options.to));
64293
64696
  }
64294
- return __assign$4(__assign$4({}, options), convertTransitionToAnimationOptions(transition));
64697
+ return __assign$3(__assign$3({}, options), convertTransitionToAnimationOptions(transition));
64295
64698
  }
64296
64699
  function getAnimation(key2, value, target, transition, onComplete) {
64297
64700
  var _a2;
@@ -64317,7 +64720,7 @@ function getAnimation(key2, value, target, transition, onComplete) {
64317
64720
  return value.set(v2);
64318
64721
  }
64319
64722
  };
64320
- return valueTransition.type === "inertia" || valueTransition.type === "decay" ? inertia(__assign$4(__assign$4({}, options), valueTransition)) : animate$1(__assign$4(__assign$4({}, getPopmotionAnimationOptions(valueTransition, options, key2)), { onUpdate: function(v2) {
64723
+ return valueTransition.type === "inertia" || valueTransition.type === "decay" ? inertia(__assign$3(__assign$3({}, options), valueTransition)) : animate$1(__assign$3(__assign$3({}, getPopmotionAnimationOptions(valueTransition, options, key2)), { onUpdate: function(v2) {
64321
64724
  var _a3;
64322
64725
  options.onUpdate(v2);
64323
64726
  (_a3 = valueTransition.onUpdate) === null || _a3 === void 0 ? void 0 : _a3.call(valueTransition, v2);
@@ -64570,7 +64973,7 @@ function setTarget(visualElement2, definition) {
64570
64973
  var _a2 = resolved ? visualElement2.makeTargetAnimatable(resolved, false) : {}, _b = _a2.transitionEnd, transitionEnd = _b === void 0 ? {} : _b;
64571
64974
  _a2.transition;
64572
64975
  var target = __rest$1(_a2, ["transitionEnd", "transition"]);
64573
- target = __assign$4(__assign$4({}, target), transitionEnd);
64976
+ target = __assign$3(__assign$3({}, target), transitionEnd);
64574
64977
  for (var key2 in target) {
64575
64978
  var value = resolveFinalValueInKeyframes(target[key2]);
64576
64979
  setMotionValue(visualElement2, key2, value);
@@ -64688,9 +65091,9 @@ function animateTarget(visualElement2, definition, _a2) {
64688
65091
  if (!value || valueTarget === void 0 || animationTypeState && shouldBlockAnimation(animationTypeState, key2)) {
64689
65092
  continue;
64690
65093
  }
64691
- var valueTransition = __assign$4({ delay }, transition);
65094
+ var valueTransition = __assign$3({ delay }, transition);
64692
65095
  if (visualElement2.shouldReduceMotion && isTransformProp(key2)) {
64693
- valueTransition = __assign$4(__assign$4({}, valueTransition), { type: false, delay: 0 });
65096
+ valueTransition = __assign$3(__assign$3({}, valueTransition), { type: false, delay: 0 });
64694
65097
  }
64695
65098
  var animation = startAnimation(key2, value, valueTarget, valueTransition);
64696
65099
  animations2.push(animation);
@@ -64723,7 +65126,7 @@ function animateChildren(visualElement2, variant, delayChildren, staggerChildren
64723
65126
  return maxStaggerDuration - i * staggerChildren;
64724
65127
  };
64725
65128
  Array.from(visualElement2.variantChildren).sort(sortByTreeOrder).forEach(function(child, i) {
64726
- animations2.push(animateVariant(child, variant, __assign$4(__assign$4({}, options), { delay: delayChildren + generateStaggerDuration(i) })).then(function() {
65129
+ animations2.push(animateVariant(child, variant, __assign$3(__assign$3({}, options), { delay: delayChildren + generateStaggerDuration(i) })).then(function() {
64727
65130
  return child.notifyAnimationComplete(variant);
64728
65131
  }));
64729
65132
  });
@@ -64767,7 +65170,7 @@ function createAnimationState(visualElement2) {
64767
65170
  if (resolved) {
64768
65171
  resolved.transition;
64769
65172
  var transitionEnd = resolved.transitionEnd, target = __rest$1(resolved, ["transition", "transitionEnd"]);
64770
- acc = __assign$4(__assign$4(__assign$4({}, acc), target), transitionEnd);
65173
+ acc = __assign$3(__assign$3(__assign$3({}, acc), target), transitionEnd);
64771
65174
  }
64772
65175
  return acc;
64773
65176
  };
@@ -64797,7 +65200,7 @@ function createAnimationState(visualElement2) {
64797
65200
  if (isInherited && isInitialRender && visualElement2.manuallyAnimateOnMount) {
64798
65201
  isInherited = false;
64799
65202
  }
64800
- typeState.protectedKeys = __assign$4({}, encounteredKeys);
65203
+ typeState.protectedKeys = __assign$3({}, encounteredKeys);
64801
65204
  if (
64802
65205
  // If it isn't active and hasn't *just* been set as inactive
64803
65206
  !typeState.isActive && activeDelta === null || // If we didn't and don't have any defined prop for this animation type
@@ -64815,7 +65218,7 @@ function createAnimationState(visualElement2) {
64815
65218
  if (activeDelta === false)
64816
65219
  resolvedValues = {};
64817
65220
  var _b = typeState.prevResolvedValues, prevResolvedValues = _b === void 0 ? {} : _b;
64818
- var allKeys = __assign$4(__assign$4({}, prevResolvedValues), resolvedValues);
65221
+ var allKeys = __assign$3(__assign$3({}, prevResolvedValues), resolvedValues);
64819
65222
  var markToAnimate = function(key3) {
64820
65223
  shouldAnimateType = true;
64821
65224
  removedKeys.delete(key3);
@@ -64847,7 +65250,7 @@ function createAnimationState(visualElement2) {
64847
65250
  typeState.prevProp = prop;
64848
65251
  typeState.prevResolvedValues = resolvedValues;
64849
65252
  if (typeState.isActive) {
64850
- encounteredKeys = __assign$4(__assign$4({}, encounteredKeys), resolvedValues);
65253
+ encounteredKeys = __assign$3(__assign$3({}, encounteredKeys), resolvedValues);
64851
65254
  }
64852
65255
  if (isInitialRender && visualElement2.blockInitialAnimation) {
64853
65256
  shouldAnimateType = false;
@@ -64856,7 +65259,7 @@ function createAnimationState(visualElement2) {
64856
65259
  animations2.push.apply(animations2, __spreadArray$2([], __read(definitionList.map(function(animation) {
64857
65260
  return {
64858
65261
  animation,
64859
- options: __assign$4({ type }, options)
65262
+ options: __assign$3({ type }, options)
64860
65263
  };
64861
65264
  })), false));
64862
65265
  }
@@ -64864,7 +65267,7 @@ function createAnimationState(visualElement2) {
64864
65267
  for (var i = 0; i < numAnimationTypes; i++) {
64865
65268
  _loop_1(i);
64866
65269
  }
64867
- allAnimatedKeys = __assign$4({}, encounteredKeys);
65270
+ allAnimatedKeys = __assign$3({}, encounteredKeys);
64868
65271
  if (removedKeys.size) {
64869
65272
  var fallbackAnimation_1 = {};
64870
65273
  removedKeys.forEach(function(key2) {
@@ -64972,7 +65375,7 @@ var PanSession = (
64972
65375
  return;
64973
65376
  var point2 = info3.point;
64974
65377
  var timestamp2 = getFrameData().timestamp;
64975
- _this.history.push(__assign$4(__assign$4({}, point2), { timestamp: timestamp2 }));
65378
+ _this.history.push(__assign$3(__assign$3({}, point2), { timestamp: timestamp2 }));
64976
65379
  var _a3 = _this.handlers, onStart = _a3.onStart, onMove = _a3.onMove;
64977
65380
  if (!isPanStarted) {
64978
65381
  onStart && onStart(_this.lastMoveEvent, info3);
@@ -65006,7 +65409,7 @@ var PanSession = (
65006
65409
  var initialInfo = transformPoint(info2, this.transformPagePoint);
65007
65410
  var point = initialInfo.point;
65008
65411
  var timestamp = getFrameData().timestamp;
65009
- this.history = [__assign$4(__assign$4({}, point), { timestamp })];
65412
+ this.history = [__assign$3(__assign$3({}, point), { timestamp })];
65010
65413
  var onSessionStart = handlers2.onSessionStart;
65011
65414
  onSessionStart && onSessionStart(event, getPanInfo(initialInfo, this.history));
65012
65415
  this.removeListeners = pipe(addPointerEvent(window, "pointermove", this.handlePointerMove), addPointerEvent(window, "pointerup", this.handlePointerUp), addPointerEvent(window, "pointercancel", this.handlePointerUp));
@@ -65527,7 +65930,7 @@ var VisualElementDragControls = (
65527
65930
  transition = { min: 0, max: 0 };
65528
65931
  var bounceStiffness = dragElastic ? 200 : 1e6;
65529
65932
  var bounceDamping = dragElastic ? 40 : 1e7;
65530
- var inertia2 = __assign$4(__assign$4({ type: "inertia", velocity: dragMomentum ? velocity[axis] : 0, bounceStiffness, bounceDamping, timeConstant: 750, restDelta: 1, restSpeed: 10 }, dragTransition), transition);
65933
+ var inertia2 = __assign$3(__assign$3({ type: "inertia", velocity: dragMomentum ? velocity[axis] : 0, bounceStiffness, bounceDamping, timeConstant: 750, restDelta: 1, restSpeed: 10 }, dragTransition), transition);
65531
65934
  return _this.startAxisValueAnimation(axis, inertia2);
65532
65935
  });
65533
65936
  return Promise.all(momentumAnimations).then(onDragTransitionEnd);
@@ -65638,7 +66041,7 @@ var VisualElementDragControls = (
65638
66041
  VisualElementDragControls2.prototype.getProps = function() {
65639
66042
  var props = this.visualElement.getProps();
65640
66043
  var _a2 = props.drag, drag2 = _a2 === void 0 ? false : _a2, _b = props.dragDirectionLock, dragDirectionLock = _b === void 0 ? false : _b, _c = props.dragPropagation, dragPropagation = _c === void 0 ? false : _c, _d = props.dragConstraints, dragConstraints = _d === void 0 ? false : _d, _e2 = props.dragElastic, dragElastic = _e2 === void 0 ? defaultElastic : _e2, _f = props.dragMomentum, dragMomentum = _f === void 0 ? true : _f;
65641
- return __assign$4(__assign$4({}, props), { drag: drag2, dragDirectionLock, dragPropagation, dragConstraints, dragElastic, dragMomentum });
66044
+ return __assign$3(__assign$3({}, props), { drag: drag2, dragDirectionLock, dragPropagation, dragConstraints, dragElastic, dragMomentum });
65642
66045
  };
65643
66046
  return VisualElementDragControls2;
65644
66047
  }()
@@ -65795,7 +66198,7 @@ var visualElement = function(_a2) {
65795
66198
  var values2 = /* @__PURE__ */ new Map();
65796
66199
  var valueSubscriptions = /* @__PURE__ */ new Map();
65797
66200
  var prevMotionValues = {};
65798
- var baseTarget = __assign$4({}, latestValues);
66201
+ var baseTarget = __assign$3({}, latestValues);
65799
66202
  var removeFromVariantTree;
65800
66203
  function render2() {
65801
66204
  if (!instance || !isMounted)
@@ -65829,7 +66232,7 @@ var visualElement = function(_a2) {
65829
66232
  }
65830
66233
  var isControllingVariants = checkIfControllingVariants(props);
65831
66234
  var isVariantNode = checkIfVariantNode(props);
65832
- var element = __assign$4(__assign$4({
66235
+ var element = __assign$3(__assign$3({
65833
66236
  treeType,
65834
66237
  /**
65835
66238
  * This is a mirror of the internal instance prop, which keeps
@@ -66194,7 +66597,7 @@ function resolveCSSVariables(visualElement2, _a2, transitionEnd) {
66194
66597
  if (!(element instanceof Element))
66195
66598
  return { target, transitionEnd };
66196
66599
  if (transitionEnd) {
66197
- transitionEnd = __assign$4({}, transitionEnd);
66600
+ transitionEnd = __assign$3({}, transitionEnd);
66198
66601
  }
66199
66602
  visualElement2.forEachValue(function(value) {
66200
66603
  var current2 = value.get();
@@ -66349,8 +66752,8 @@ var checkAndConvertChangedValueTypes = function(visualElement2, target, origin2,
66349
66752
  if (transitionEnd === void 0) {
66350
66753
  transitionEnd = {};
66351
66754
  }
66352
- target = __assign$4({}, target);
66353
- transitionEnd = __assign$4({}, transitionEnd);
66755
+ target = __assign$3({}, target);
66756
+ transitionEnd = __assign$3({}, transitionEnd);
66354
66757
  var targetPositionalKeys = Object.keys(target).filter(isPositionalKey);
66355
66758
  var removedTransformValues = [];
66356
66759
  var hasAttemptedToRemoveTransformValues = false;
@@ -66503,7 +66906,7 @@ var htmlConfig = {
66503
66906
  transitionEnd = parsed.transitionEnd;
66504
66907
  target = parsed.target;
66505
66908
  }
66506
- return __assign$4({ transition, transitionEnd }, target);
66909
+ return __assign$3({ transition, transitionEnd }, target);
66507
66910
  },
66508
66911
  scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1,
66509
66912
  build: function(element, renderState, latestValues, options, props) {
@@ -66515,7 +66918,7 @@ var htmlConfig = {
66515
66918
  render: renderHTML
66516
66919
  };
66517
66920
  var htmlVisualElement = visualElement(htmlConfig);
66518
- var svgVisualElement = visualElement(__assign$4(__assign$4({}, htmlConfig), { getBaseTarget: function(props, key2) {
66921
+ var svgVisualElement = visualElement(__assign$3(__assign$3({}, htmlConfig), { getBaseTarget: function(props, key2) {
66519
66922
  return props[key2];
66520
66923
  }, readValueFromInstance: function(domElement, key2) {
66521
66924
  var _a2;
@@ -66593,7 +66996,7 @@ var correctBoxShadow = {
66593
66996
  var MeasureLayoutWithContext = (
66594
66997
  /** @class */
66595
66998
  function(_super) {
66596
- __extends$1(MeasureLayoutWithContext2, _super);
66999
+ __extends(MeasureLayoutWithContext2, _super);
66597
67000
  function MeasureLayoutWithContext2() {
66598
67001
  return _super !== null && _super.apply(this, arguments) || this;
66599
67002
  }
@@ -66612,7 +67015,7 @@ var MeasureLayoutWithContext = (
66612
67015
  projection.addEventListener("animationComplete", function() {
66613
67016
  _this.safeToRemove();
66614
67017
  });
66615
- projection.setOptions(__assign$4(__assign$4({}, projection.options), { onExitComplete: function() {
67018
+ projection.setOptions(__assign$3(__assign$3({}, projection.options), { onExitComplete: function() {
66616
67019
  return _this.safeToRemove();
66617
67020
  } }));
66618
67021
  }
@@ -66677,10 +67080,10 @@ var MeasureLayoutWithContext = (
66677
67080
  function MeasureLayout(props) {
66678
67081
  var _a2 = __read(usePresence(), 2), isPresent = _a2[0], safeToRemove = _a2[1];
66679
67082
  var layoutGroup = useContext(LayoutGroupContext);
66680
- return React__default.createElement(MeasureLayoutWithContext, __assign$4({}, props, { layoutGroup, switchLayoutGroup: useContext(SwitchLayoutGroupContext), isPresent, safeToRemove }));
67083
+ return React__default.createElement(MeasureLayoutWithContext, __assign$3({}, props, { layoutGroup, switchLayoutGroup: useContext(SwitchLayoutGroupContext), isPresent, safeToRemove }));
66681
67084
  }
66682
67085
  var defaultScaleCorrectors = {
66683
- borderRadius: __assign$4(__assign$4({}, correctBorderRadius), { applyTo: [
67086
+ borderRadius: __assign$3(__assign$3({}, correctBorderRadius), { applyTo: [
66684
67087
  "borderTopLeftRadius",
66685
67088
  "borderTopRightRadius",
66686
67089
  "borderBottomLeftRadius",
@@ -67103,7 +67506,7 @@ function createProjectionNode(_a2) {
67103
67506
  _this.resumingFrom.resumingFrom = void 0;
67104
67507
  }
67105
67508
  _this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
67106
- var animationOptions = __assign$4(__assign$4({}, getValueTransition(layoutTransition, "layout")), { onPlay: onLayoutAnimationStart, onComplete: onLayoutAnimationComplete });
67509
+ var animationOptions = __assign$3(__assign$3({}, getValueTransition(layoutTransition, "layout")), { onPlay: onLayoutAnimationStart, onComplete: onLayoutAnimationComplete });
67107
67510
  if (visualElement2.shouldReduceMotion) {
67108
67511
  animationOptions.delay = 0;
67109
67512
  animationOptions.type = false;
@@ -67357,7 +67760,7 @@ function createProjectionNode(_a2) {
67357
67760
  };
67358
67761
  ProjectionNode.prototype.setOptions = function(options) {
67359
67762
  var _a3;
67360
- this.options = __assign$4(__assign$4(__assign$4({}, this.options), options), { crossfade: (_a3 = options.crossfade) !== null && _a3 !== void 0 ? _a3 : true });
67763
+ this.options = __assign$3(__assign$3(__assign$3({}, this.options), options), { crossfade: (_a3 = options.crossfade) !== null && _a3 !== void 0 ? _a3 : true });
67361
67764
  };
67362
67765
  ProjectionNode.prototype.clearMeasurements = function() {
67363
67766
  this.scroll = void 0;
@@ -67475,7 +67878,7 @@ function createProjectionNode(_a2) {
67475
67878
  }
67476
67879
  var snapshot = this.snapshot;
67477
67880
  var snapshotLatestValues = (snapshot === null || snapshot === void 0 ? void 0 : snapshot.latestValues) || {};
67478
- var mixedValues = __assign$4({}, this.latestValues);
67881
+ var mixedValues = __assign$3({}, this.latestValues);
67479
67882
  var targetDelta = createDelta();
67480
67883
  this.relativeTarget = this.relativeTargetOrigin = void 0;
67481
67884
  this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;
@@ -67518,7 +67921,7 @@ function createProjectionNode(_a2) {
67518
67921
  }
67519
67922
  this.pendingAnimation = sync.update(function() {
67520
67923
  globalProjectionState.hasAnimatedSinceResize = true;
67521
- _this.currentAnimation = animate(0, animationTarget, __assign$4(__assign$4({}, options), { onUpdate: function(latest) {
67924
+ _this.currentAnimation = animate(0, animationTarget, __assign$3(__assign$3({}, options), { onUpdate: function(latest) {
67522
67925
  var _a4;
67523
67926
  _this.mixTargetDelta(latest);
67524
67927
  (_a4 = options.onUpdate) === null || _a4 === void 0 ? void 0 : _a4.call(options, latest);
@@ -67886,7 +68289,7 @@ var HTMLProjectionNode = createProjectionNode({
67886
68289
  return Boolean(window.getComputedStyle(instance).position === "fixed");
67887
68290
  }
67888
68291
  });
67889
- var featureBundle = __assign$4(__assign$4(__assign$4(__assign$4({}, animations), gestureAnimations), drag), layoutFeatures);
68292
+ var featureBundle = __assign$3(__assign$3(__assign$3(__assign$3({}, animations), gestureAnimations), drag), layoutFeatures);
67890
68293
  var motion = /* @__PURE__ */ createMotionProxy(function(Component2, config2) {
67891
68294
  return createDomMotionConfig(Component2, config2, featureBundle, createDomVisualElement, HTMLProjectionNode);
67892
68295
  });
@@ -70244,7 +70647,6 @@ const safeConvertValue = ({
70244
70647
  }) => {
70245
70648
  const rawValue = getValue$1(value);
70246
70649
  const isInvalidInput = isWrongValue(rawValue);
70247
- const availableUnits = ALT_UNITS[unitkey];
70248
70650
  if (isValueWithUnknownUnit(value)) {
70249
70651
  return { value: rawValue };
70250
70652
  }
@@ -70254,9 +70656,6 @@ const safeConvertValue = ({
70254
70656
  if (!isValueWithUnit(value)) {
70255
70657
  return { value };
70256
70658
  }
70257
- if (!(availableUnits == null ? void 0 : availableUnits.includes(getUnit(value)))) {
70258
- return { value: rawValue };
70259
- }
70260
70659
  return convertUnit({
70261
70660
  value,
70262
70661
  unitkey,
@@ -70291,144 +70690,6 @@ const initializeContext = (context2) => {
70291
70690
  UnitContext = context2;
70292
70691
  }
70293
70692
  };
70294
- const extractValue = (value) => {
70295
- if (isNil(value)) return value;
70296
- return isValueWithUnit(value) ? getValue$1(value) : value;
70297
- };
70298
- const PredefinedOptionsMenu = ({
70299
- predefinedOptions,
70300
- displayLayer,
70301
- unitkey: rootUnitKey,
70302
- unitTemplate,
70303
- onPredefinedOptionSelect,
70304
- disabled: disabled2,
70305
- initialPredefinedOption,
70306
- predefinedOptionLinked,
70307
- predefinedOptionsMenuState,
70308
- setPredefinedOptionsMenuState,
70309
- testId
70310
- }) => {
70311
- const extractedValue = extractValue(displayLayer == null ? void 0 : displayLayer.value);
70312
- const [foundPredefinedMenuOption, setFoundPredefinedMenuOption] = useState(void 0);
70313
- const convertPredefinedOptions = ({
70314
- value,
70315
- unit: optionUnitKey
70316
- }) => {
70317
- if (!value || !rootUnitKey) return value;
70318
- if (!isValueWithUnit(value)) return value;
70319
- const selectedUnitKey = optionUnitKey || rootUnitKey;
70320
- const preferredOptionUnit = getPreferredUnit(selectedUnitKey, unitTemplate);
70321
- const { value: resultValue } = safeConvertValue({
70322
- value,
70323
- toUnit: preferredOptionUnit,
70324
- unitkey: selectedUnitKey,
70325
- defaultFromUnit: "",
70326
- doNotConvertValue: false
70327
- });
70328
- return withUnit(resultValue, preferredOptionUnit);
70329
- };
70330
- const createPredefinedOption = (el2) => {
70331
- const convertedValue = convertPredefinedOptions(el2);
70332
- const [inputValue = "", unit2 = ""] = split$1(convertedValue);
70333
- return {
70334
- type: MenuType.OPTION,
70335
- inline: true,
70336
- onClick: () => {
70337
- const validation = validateNumber(inputValue);
70338
- const optionState = {
70339
- predefinedSelected: true,
70340
- predefinedOption: el2
70341
- };
70342
- if (validation.valid && !disabled2) {
70343
- setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
70344
- onPredefinedOptionSelect(convertedValue, optionState);
70345
- setFoundPredefinedMenuOption(el2);
70346
- }
70347
- },
70348
- label: /* @__PURE__ */ jsxs(Fragment$1, { children: [
70349
- /* @__PURE__ */ jsx(Text, { children: el2.label }),
70350
- /* @__PURE__ */ jsx(Spacer, { width: "20px", height: "0" })
70351
- ] }),
70352
- description: `${inputValue} ${unit2}`,
70353
- selected: isEqual$4(foundPredefinedMenuOption, el2) && predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED
70354
- };
70355
- };
70356
- const initialPredefinedOptionObject = useMemo$1(() => {
70357
- return predefinedOptions.find(
70358
- (option2) => [option2.value, option2.label, option2.valueKey].includes(
70359
- initialPredefinedOption
70360
- )
70361
- );
70362
- }, [initialPredefinedOption, predefinedOptionLinked]);
70363
- useEffect(() => {
70364
- if (initialPredefinedOptionObject) {
70365
- setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
70366
- setFoundPredefinedMenuOption(initialPredefinedOptionObject);
70367
- if (predefinedOptionLinked) {
70368
- onPredefinedOptionSelect(initialPredefinedOptionObject.value, {
70369
- predefinedSelected: true,
70370
- predefinedOption: initialPredefinedOptionObject
70371
- });
70372
- }
70373
- }
70374
- }, [
70375
- initialPredefinedOptionObject == null ? void 0 : initialPredefinedOptionObject.value,
70376
- initialPredefinedOptionObject == null ? void 0 : initialPredefinedOptionObject.label
70377
- ]);
70378
- useEffect(() => {
70379
- const foundOption = predefinedOptionLinked && predefinedOptions.find((option2) => {
70380
- const convertedValue = convertPredefinedOptions(option2);
70381
- return convertedValue === withUnit(displayLayer == null ? void 0 : displayLayer.value, (displayLayer == null ? void 0 : displayLayer.unit) ?? "");
70382
- });
70383
- if (foundOption || initialPredefinedOptionObject) {
70384
- setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
70385
- setFoundPredefinedMenuOption(
70386
- foundOption || initialPredefinedOptionObject
70387
- );
70388
- } else {
70389
- setPredefinedOptionsMenuState(PredefinedOptionsMenuState.CUSTOM);
70390
- setFoundPredefinedMenuOption(void 0);
70391
- }
70392
- }, [extractedValue, predefinedOptionLinked]);
70393
- const sectionsPredefinedMenu = [
70394
- {
70395
- type: MenuType.OPTION,
70396
- inline: true,
70397
- onClick: () => {
70398
- if (!disabled2) {
70399
- setPredefinedOptionsMenuState(PredefinedOptionsMenuState.CUSTOM);
70400
- }
70401
- },
70402
- label: "Custom",
70403
- selected: predefinedOptionsMenuState === PredefinedOptionsMenuState.CUSTOM
70404
- },
70405
- ...predefinedOptions.map(createPredefinedOption)
70406
- ];
70407
- return /* @__PURE__ */ jsx(
70408
- Menu,
70409
- {
70410
- testId: testId && `${testId}-predefined-menu`,
70411
- maxHeight: 380,
70412
- groupOrder: "first",
70413
- disabled: disabled2,
70414
- menu: {
70415
- colored: true,
70416
- trigger: "Component",
70417
- component: /* @__PURE__ */ jsx(
70418
- Button$1,
70419
- {
70420
- groupOrder: "first",
70421
- active: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED,
70422
- icon: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink"
70423
- }
70424
- ),
70425
- small: true,
70426
- sections: sectionsPredefinedMenu
70427
- },
70428
- tooltip: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? foundPredefinedMenuOption == null ? void 0 : foundPredefinedMenuOption.label : ""
70429
- }
70430
- );
70431
- };
70432
70693
  const predefinedMenuActive = "_predefinedMenuActive_ye9w9_1";
70433
70694
  const inputWrapper = "_inputWrapper_ye9w9_4";
70434
70695
  const styles = {
@@ -70453,14 +70714,17 @@ const UnitInput = ({
70453
70714
  onFocus = noop$3,
70454
70715
  onSwitchUnit = noop$3,
70455
70716
  unitTemplate,
70717
+ doNotConvertValue = false,
70456
70718
  testId,
70457
70719
  warning: warning2 = null,
70458
70720
  predefinedOptions,
70459
- initialPredefinedOption = "",
70460
- predefinedOptionLinked = true,
70721
+ initialPredefinedOption = false,
70722
+ shouldLinkAutomaticly = true,
70723
+ selectedPredefinedOptionKey,
70461
70724
  validationCallback = () => ({ name: "", error: null }),
70462
70725
  disabledValidation = false,
70463
70726
  allowEmpty = false,
70727
+ autoValue,
70464
70728
  convertBackToStorageUnit = false,
70465
70729
  enableCosmeticRounding = true,
70466
70730
  enableDisplayRounding = false,
@@ -70468,11 +70732,11 @@ const UnitInput = ({
70468
70732
  }) => {
70469
70733
  const context2 = useUnitContext();
70470
70734
  const runAfterUpdate = useRunAfterUpdate();
70471
- const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(PredefinedOptionsMenuState.CUSTOM);
70472
70735
  if (typeof value === "number") {
70473
70736
  value = `${value}`;
70474
70737
  }
70475
70738
  const [propValue = "", propUnit = ""] = value !== void 0 ? split$1(value) : [];
70739
+ const propAutoUnit = autoValue ? getUnit(autoValue) : "";
70476
70740
  const preferredUnit = useMemo$1(
70477
70741
  () => getPreferredUnit(unitkey, unitTemplate || (context2 == null ? void 0 : context2.unitTemplate)),
70478
70742
  [unitkey, unitTemplate, context2 == null ? void 0 : context2.unitTemplate]
@@ -70485,15 +70749,39 @@ const UnitInput = ({
70485
70749
  toUnit: initDisplayUnit,
70486
70750
  unitkey,
70487
70751
  defaultFromUnit: propUnit,
70488
- doNotConvertValue: noConversion
70752
+ doNotConvertValue
70489
70753
  });
70490
- const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
70754
+ const { value: convertedAutoValue } = safeConvertValue({
70755
+ value: autoValue,
70756
+ toUnit: initDisplayUnit,
70757
+ unitkey,
70758
+ defaultFromUnit: propAutoUnit,
70759
+ doNotConvertValue
70760
+ });
70761
+ const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : convertedAutoValue !== "" ? { value: convertedAutoValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
70491
70762
  const [displayLayer, setDisplayLayer] = useState(initDisplayLayer);
70492
70763
  const derivedAllowEmpty = allowEmpty || (displayLayer == null ? void 0 : displayLayer.value) === void 0;
70493
- const disableInternalErrorValidationMessages = !!disabledValidation || disabled2;
70764
+ const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(
70765
+ initialPredefinedOption ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM
70766
+ );
70767
+ const isAutoValue = propValue === "" && autoValue;
70768
+ const disableInternalErrorValidationMessages = !!(disabledValidation || autoValue || disabled2);
70769
+ const foundPredefinedMenuOption = predefinedOptions && predefinedOptions.find((el2) => {
70770
+ if (!(el2 == null ? void 0 : el2.value)) return;
70771
+ if (selectedPredefinedOptionKey) {
70772
+ return selectedPredefinedOptionKey === el2.valueKey;
70773
+ }
70774
+ const predefinedMenuItemUnit = isValueWithUnit(el2.value) ? getUnit(el2.value) : "";
70775
+ const { value: resultValue = value } = convertUnit({
70776
+ value: String(value),
70777
+ unitkey,
70778
+ toUnit: predefinedMenuItemUnit
70779
+ });
70780
+ return withUnit(resultValue, predefinedMenuItemUnit) === el2.value;
70781
+ });
70494
70782
  const getAlternativeUnits = () => {
70495
- const valueToList = value ?? "";
70496
- const initToUnit = displayLayer == null ? void 0 : displayLayer.unit;
70783
+ const valueToList = isAutoValue ? autoValue : value ?? "";
70784
+ const initToUnit = displayLayer.unit;
70497
70785
  const shouldConvert = checkConversion({
70498
70786
  value: valueToList,
70499
70787
  unitkey,
@@ -70551,7 +70839,7 @@ const UnitInput = ({
70551
70839
  toUnit: initDisplayUnit,
70552
70840
  unitkey,
70553
70841
  defaultFromUnit: propUnit,
70554
- doNotConvertValue: noConversion
70842
+ doNotConvertValue
70555
70843
  });
70556
70844
  newValue = resultValue;
70557
70845
  newUnit = initDisplayUnit;
@@ -70561,29 +70849,96 @@ const UnitInput = ({
70561
70849
  toUnit: displayLayer.unit,
70562
70850
  unitkey,
70563
70851
  defaultFromUnit: propUnit,
70564
- doNotConvertValue: noConversion
70852
+ doNotConvertValue
70565
70853
  });
70566
70854
  newValue = resultValue;
70567
70855
  newUnit = displayLayer.unit;
70568
70856
  }
70569
- if (newValue !== void 0 && !initialPredefinedOption) {
70857
+ if (newValue !== void 0) {
70570
70858
  setDisplayLayer({ value: newValue, unit: newUnit });
70571
70859
  }
70860
+ if (predefinedOptions) {
70861
+ if (foundPredefinedMenuOption && shouldLinkAutomaticly) {
70862
+ setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
70863
+ } else {
70864
+ setPredefinedOptionsMenuState(PredefinedOptionsMenuState.CUSTOM);
70865
+ }
70866
+ }
70572
70867
  }
70573
- }, [initDisplayUnit, value, error2]);
70868
+ }, [initDisplayUnit, value, error2, shouldLinkAutomaticly]);
70574
70869
  const alternativeUnits = getAlternativeUnits();
70575
70870
  const displayUnitLabel = label$b(displayLayer.unit) || displayLayer.unit || "";
70576
70871
  const noConvert = noConversion || !alternativeUnits || alternativeUnits && alternativeUnits.length === 1;
70577
70872
  const stringName = getStringName(name2);
70873
+ let sectionsPredefinedMenu;
70874
+ const createPredefinedOption = (el2) => {
70875
+ const elementValue = (el2 == null ? void 0 : el2.value) ? el2.value : "";
70876
+ const [value2 = "", unit2 = ""] = isValueWithUnit(elementValue) ? split$1(elementValue) : [elementValue];
70877
+ return {
70878
+ type: MenuType.OPTION,
70879
+ inline: true,
70880
+ onClick: () => {
70881
+ const validation = validateNumber(value2);
70882
+ if (validation.valid && !disabled2) {
70883
+ setPredefinedOptionsMenuState(PredefinedOptionsMenuState.PREDEFINED);
70884
+ onChange({
70885
+ target: {
70886
+ value: elementValue,
70887
+ name: typeof name2 === "string" ? name2 : (name2 == null ? void 0 : name2.fieldName) || "",
70888
+ predefinedSelected: true,
70889
+ predefinedOption: el2
70890
+ }
70891
+ });
70892
+ }
70893
+ },
70894
+ label: /* @__PURE__ */ jsxs(Fragment$1, { children: [
70895
+ /* @__PURE__ */ jsx(Text, { children: el2.label }),
70896
+ /* @__PURE__ */ jsx(Spacer, { width: "20px", height: "0" })
70897
+ ] }),
70898
+ description: isValueWithUnit(elementValue) ? `${value2} ${unit2}` : elementValue,
70899
+ selected: foundPredefinedMenuOption === el2 && predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED
70900
+ };
70901
+ };
70902
+ sectionsPredefinedMenu = [
70903
+ {
70904
+ type: MenuType.OPTION,
70905
+ inline: true,
70906
+ onClick: () => {
70907
+ if (predefinedOptionsMenuState !== PredefinedOptionsMenuState.CUSTOM && !disabled2) {
70908
+ onChange({
70909
+ target: {
70910
+ value: withUnit(displayLayer.value, displayLayer.unit),
70911
+ name: typeof name2 === "string" ? name2 : (name2 == null ? void 0 : name2.fieldName) || ""
70912
+ }
70913
+ });
70914
+ }
70915
+ },
70916
+ label: "Custom",
70917
+ selected: predefinedOptionsMenuState === PredefinedOptionsMenuState.CUSTOM
70918
+ }
70919
+ ];
70920
+ if (predefinedOptions == null ? void 0 : predefinedOptions.length) {
70921
+ const dynamicOptions = predefinedOptions.map(createPredefinedOption);
70922
+ sectionsPredefinedMenu = [...sectionsPredefinedMenu, ...dynamicOptions];
70923
+ }
70578
70924
  const getPlaceholder = (placeholder22) => {
70579
- if (isValueWithUnit(placeholder22)) {
70925
+ if (isAutoValue) {
70926
+ const { value: resultValue } = safeConvertValue({
70927
+ value: autoValue,
70928
+ toUnit: displayLayer.unit,
70929
+ unitkey,
70930
+ defaultFromUnit: propAutoUnit,
70931
+ doNotConvertValue
70932
+ });
70933
+ return resultValue;
70934
+ } else if (isValueWithUnit(placeholder22)) {
70580
70935
  const placeholderUnit = getUnit(placeholder22);
70581
70936
  const { value: resultValue } = safeConvertValue({
70582
70937
  value: placeholder22,
70583
70938
  toUnit: displayLayer.unit,
70584
70939
  unitkey,
70585
70940
  defaultFromUnit: placeholderUnit,
70586
- doNotConvertValue: noConversion
70941
+ doNotConvertValue
70587
70942
  });
70588
70943
  return resultValue;
70589
70944
  }
@@ -70595,44 +70950,32 @@ const UnitInput = ({
70595
70950
  className: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? cx$2(styles.predefinedMenuActive) : "",
70596
70951
  children: /* @__PURE__ */ jsxs(InputGroup, { small: small2, width: width2, children: [
70597
70952
  predefinedOptions && /* @__PURE__ */ jsx(
70598
- PredefinedOptionsMenu,
70953
+ Tooltip,
70599
70954
  {
70600
- testId,
70601
- unitTemplate: unitTemplate || (context2 == null ? void 0 : context2.unitTemplate),
70602
- unitkey,
70603
- predefinedOptions,
70604
- displayLayer,
70605
- onPredefinedOptionSelect: (newValue, optionState) => {
70606
- var _a2;
70607
- if (predefinedOptionLinked && ((_a2 = optionState == null ? void 0 : optionState.predefinedOption) == null ? void 0 : _a2.unit)) {
70608
- onChange({
70609
- target: {
70610
- value: withUnit(displayLayer == null ? void 0 : displayLayer.value, displayLayer == null ? void 0 : displayLayer.unit),
70611
- name: stringName,
70612
- predefinedSelected: optionState == null ? void 0 : optionState.predefinedSelected,
70613
- predefinedOption: optionState == null ? void 0 : optionState.predefinedOption
70614
- }
70615
- });
70616
- } else {
70617
- onChange({
70618
- target: {
70619
- value: newValue,
70620
- name: stringName,
70621
- predefinedSelected: optionState == null ? void 0 : optionState.predefinedSelected,
70622
- predefinedOption: optionState == null ? void 0 : optionState.predefinedOption
70623
- }
70624
- });
70625
- setDisplayLayer({
70626
- value: newValue,
70627
- unit: getUnit(newValue) || displayLayer.unit
70628
- });
70955
+ text: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? foundPredefinedMenuOption == null ? void 0 : foundPredefinedMenuOption.label : "",
70956
+ children: /* @__PURE__ */ jsx(
70957
+ Menu,
70958
+ {
70959
+ maxHeight: 380,
70960
+ groupOrder: "first",
70961
+ testId: testId && `${testId}-predefined-menu`,
70962
+ disabled: disabled2,
70963
+ menu: {
70964
+ colored: true,
70965
+ trigger: "Component",
70966
+ component: /* @__PURE__ */ jsx(
70967
+ Button$1,
70968
+ {
70969
+ groupOrder: "first",
70970
+ active: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED,
70971
+ icon: predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink"
70972
+ }
70973
+ ),
70974
+ small: small2,
70975
+ sections: sectionsPredefinedMenu
70976
+ }
70629
70977
  }
70630
- },
70631
- disabled: disabled2,
70632
- initialPredefinedOption,
70633
- predefinedOptionLinked,
70634
- predefinedOptionsMenuState,
70635
- setPredefinedOptionsMenuState
70978
+ )
70636
70979
  }
70637
70980
  ),
70638
70981
  /* @__PURE__ */ jsx("div", { className: styles.inputWrapper, children: /* @__PURE__ */ jsx(
@@ -70680,7 +71023,7 @@ const UnitInput = ({
70680
71023
  inline: true,
70681
71024
  onClick: (evt) => {
70682
71025
  evt.stopPropagation();
70683
- onClickUnit(value2, altUnit);
71026
+ onClickUnit(isAutoValue ? "" : value2, altUnit);
70684
71027
  },
70685
71028
  description: displayUnit,
70686
71029
  selected: displayUnit === displayUnitLabel,