@linzjs/lui 21.24.3 → 21.24.5-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -58450,6 +58450,56 @@ var useForkRef = function (forwardedRef) {
58450
58450
  return forwardedRef || localRef;
58451
58451
  };
58452
58452
 
58453
+ var attrBoundary = 'data-boundary';
58454
+ var dataBoundary = function (_a) {
58455
+ var min = _a.min, max = _a.max;
58456
+ if (typeof min === 'undefined' && typeof max !== 'undefined') {
58457
+ if (typeof max === 'string') {
58458
+ return parseInt(max) < 0 ? 'keep-secondary' : 'keep-primary';
58459
+ }
58460
+ }
58461
+ if (typeof max === 'undefined' && typeof min !== 'undefined') {
58462
+ if (typeof min === 'string') {
58463
+ return parseInt(min) < 0 ? 'keep-secondary' : 'keep-primary';
58464
+ }
58465
+ }
58466
+ if (typeof max === 'string' && typeof min === 'string') {
58467
+ if (parseInt(max) > 0 && parseInt(min) > 0) {
58468
+ return 'keep-primary';
58469
+ }
58470
+ if (parseInt(max) < 0 && parseInt(min) < 0) {
58471
+ return 'keep-secondary';
58472
+ }
58473
+ }
58474
+ return 'keep-both';
58475
+ };
58476
+ /**
58477
+ * Given boundaries passed as prop, it defines how the grid column/row template will be arranged.
58478
+ * and whether the separator will be positioned using right or left absolute values (top or bottom for horizontal).
58479
+ * It will use a data- attribute to store this prop derived information for later processing.
58480
+ */
58481
+ var setDataBoundary = function (props) {
58482
+ var _a;
58483
+ return (_a = {},
58484
+ _a[attrBoundary] = dataBoundary(props),
58485
+ _a);
58486
+ };
58487
+ /**
58488
+ * Util to get what grid arrangement needs to be used to avoid jumps/flashes.
58489
+ * The return value is derived from the Splitter props, and stored in a data- attribute.
58490
+ */
58491
+ var getDataBoundary = function (separator) {
58492
+ var boundaryType = separator === null || separator === void 0 ? void 0 : separator.getAttribute(attrBoundary);
58493
+ switch (boundaryType) {
58494
+ case 'keep-primary':
58495
+ case 'keep-secondary':
58496
+ case 'keep-both':
58497
+ return boundaryType;
58498
+ default:
58499
+ return undefined;
58500
+ }
58501
+ };
58502
+
58453
58503
  /**
58454
58504
  * Given a ref/element if finds the Separator and returns the most useful attributes
58455
58505
  */
@@ -58465,7 +58515,8 @@ var getValues = function (el) {
58465
58515
  valueMin: parseValue(el === null || el === void 0 ? void 0 : el.getAttribute('aria-valuemin')),
58466
58516
  valueMax: parseValue(el === null || el === void 0 ? void 0 : el.getAttribute('aria-valuemax')),
58467
58517
  orientation: parseOrientation(el === null || el === void 0 ? void 0 : el.getAttribute('aria-orientation')),
58468
- thickness: getSeparatorThickness(el)
58518
+ thickness: getSeparatorThickness(el),
58519
+ boundary: getDataBoundary(el)
58469
58520
  };
58470
58521
  };
58471
58522
  var parseValue = function (val) {
@@ -58543,6 +58594,9 @@ var Control = React.forwardRef(function (props, forwardRef) {
58543
58594
  React.useEffect(function () {
58544
58595
  var callback = function () {
58545
58596
  var control = ref.current;
58597
+ if (!control) {
58598
+ return;
58599
+ }
58546
58600
  var _a = getButtonProps(ref, side), hide = _a.hide, offset = _a.offset, orientation = _a.orientation;
58547
58601
  var vertical = orientation === 'vertical';
58548
58602
  control.style.left = vertical ? "".concat(offset, "px") : '50%';
@@ -58555,7 +58609,14 @@ var Control = React.forwardRef(function (props, forwardRef) {
58555
58609
  var separator = ref.current.closest('[role="separator"]');
58556
58610
  callback();
58557
58611
  var observer = new MutationObserver(callback);
58558
- observer.observe(separator, { attributeFilter: ['aria-valuenow'] });
58612
+ observer.observe(separator, {
58613
+ attributeFilter: [
58614
+ 'aria-valuenow',
58615
+ 'aria-valuemin',
58616
+ 'aria-valuemax',
58617
+ 'aria-orientation',
58618
+ ]
58619
+ });
58559
58620
  return function () { return observer.disconnect(); };
58560
58621
  }, [ref, side]);
58561
58622
  return (React__default["default"].createElement(LuiButton, __assign({ ref: ref, level: "primary", type: "button" }, rest, { style: __assign(__assign({}, rest === null || rest === void 0 ? void 0 : rest.style), { width: squareButtonSide, height: squareButtonSide, borderRadius: '50%' }), className: clsx('Control', 'lui-button-icon-only', 'lui-box-shadow', rest === null || rest === void 0 ? void 0 : rest.className) }), (rest === null || rest === void 0 ? void 0 : rest.children) || React__default["default"].createElement(ControlIcon, { parent: ref, side: side })));
@@ -58620,6 +58681,29 @@ var getSeparatorPosition = function (separatorRef, drag) {
58620
58681
  return clampSeparator({ value: value });
58621
58682
  };
58622
58683
 
58684
+ var transitionFactory = function (attrs, ms) {
58685
+ return attrs.map(function (key) { return "".concat(key, " ").concat(ms, "ms"); }).join(', ');
58686
+ };
58687
+ var barTransition = function (ms) {
58688
+ return transitionFactory(['left', 'top', 'right', 'bottom'], ms);
58689
+ };
58690
+ var gridTransition = function (ms) {
58691
+ return transitionFactory(['grid-template-columns', 'grid-template-rows'], ms);
58692
+ };
58693
+ var transition = function (separator) {
58694
+ var _a;
58695
+ var splitter = (_a = separator.current) === null || _a === void 0 ? void 0 : _a.parentElement;
58696
+ var delay = function (ms) {
58697
+ if (splitter) {
58698
+ separator.current.style.transition = barTransition(ms);
58699
+ splitter.style.transition = gridTransition(ms);
58700
+ }
58701
+ };
58702
+ var stop = function () { return delay(0); };
58703
+ var resume = function () { return delay(300); };
58704
+ return { stop: stop, resume: resume };
58705
+ };
58706
+
58623
58707
  /**
58624
58708
  * It captures window events to report a new position.
58625
58709
  * Provides necessary handlers for separator.
@@ -58663,8 +58747,7 @@ var animateSeparator = function (separatorRef, animate) {
58663
58747
  var splitter = separator === null || separator === void 0 ? void 0 : separator.parentElement;
58664
58748
  if (separator && splitter) {
58665
58749
  if (animate === 'clear-transition') {
58666
- separator.style.transition = '';
58667
- splitter.style.transition = '';
58750
+ transition(separatorRef).stop();
58668
58751
  splitter.style.cursor =
58669
58752
  separator.getAttribute('aria-orientation') === 'vertical'
58670
58753
  ? 'col-resize'
@@ -58672,9 +58755,7 @@ var animateSeparator = function (separatorRef, animate) {
58672
58755
  splitter.classList.add('resizing');
58673
58756
  }
58674
58757
  else {
58675
- separator.style.transition = 'left 300ms, top 300ms';
58676
- splitter.style.transition =
58677
- 'grid-template-columns 300ms, grid-template-rows 300ms';
58758
+ transition(separatorRef).resume();
58678
58759
  splitter.style.cursor = '';
58679
58760
  splitter.classList.remove('resizing');
58680
58761
  }
@@ -58684,33 +58765,65 @@ var animateSeparator = function (separatorRef, animate) {
58684
58765
  /**
58685
58766
  * Moves separator as per ratio changes. Centers on first render if ratio is undefined.
58686
58767
  */
58687
- var useRatioEffect = function (setValueNow, ratio) {
58768
+ var useRatioEffect = function (setValueNow, separator, ratio, startAt) {
58688
58769
  var firstRun = React.useRef(true);
58770
+ var _a = getSeparatorAttributes({ ref: separator }), valueMax = _a.valueMax, valueMin = _a.valueMin;
58771
+ var isCalculating = valueMax === Infinity || valueMin === -Infinity;
58689
58772
  React.useEffect(function () {
58690
- if (firstRun.current || ratio !== undefined) {
58773
+ if (firstRun.current || ratio !== undefined || isCalculating) {
58691
58774
  firstRun.current = false;
58692
58775
  // If ratio is undefined, setValueNow will place the separator in the middle as a starting point.
58693
58776
  // Whatever value is `the middle` will be determined by setValueNow
58694
- setValueNow(ratio);
58777
+ setValueNow(ratio !== null && ratio !== void 0 ? ratio : startAt);
58695
58778
  }
58696
- }, [setValueNow, ratio, firstRun]);
58779
+ }, [setValueNow, ratio, firstRun, startAt]);
58697
58780
  };
58698
58781
  /**
58699
58782
  * Re-arranges the splitter if the limits or orientation change.
58700
58783
  */
58701
58784
  var useConfigEffect = function (setValueNow, separator) {
58785
+ var _a = React.useState(0), count = _a[0], setCount = _a[1];
58786
+ React.useEffect(function () { return transition(separator).resume(); }, [count]);
58702
58787
  React.useEffect(function () {
58703
- var callback = function () {
58704
- var value = getSeparatorAttributes({ ref: separator }).valueNow;
58705
- setValueNow(value);
58788
+ var callback = function (attr) {
58789
+ return function (_a) {
58790
+ var record = _a[0];
58791
+ var target = record.target;
58792
+ var values = getSeparatorAttributes({ separator: target });
58793
+ var oldValue = Number(record.oldValue);
58794
+ var valueMax = values.valueMax, valueMin = values.valueMin, valueNow = values.valueNow;
58795
+ var newValue = attr === 'min' ? valueMin : valueMax;
58796
+ // Determine if separator was collapsed/expanded fully
58797
+ var wasInBoundary = oldValue === valueNow;
58798
+ // To remain collapsed/expanded, it is necessary to call setValueNow with the latest boundaries.
58799
+ // The useBoundaries hook haven't yet reflected the change, and it would cause an unwanted flash.
58800
+ // In such case, the newValueNow is moved along with the delimiter.
58801
+ var newValueNow = !wasInBoundary ? valueNow : newValue;
58802
+ if (wasInBoundary || valueMax < valueNow || valueMin > valueNow) {
58803
+ transition(separator).stop();
58804
+ setValueNow(newValueNow, { min: valueMin, max: valueMax });
58805
+ setCount(function (p) { return p + 1; });
58806
+ }
58807
+ };
58706
58808
  };
58707
- callback();
58708
- var observer = new MutationObserver(callback);
58709
- observer.observe(separator.current, {
58710
- attributeFilter: ['aria-orientation', 'aria-valuemin', 'aria-valuemax']
58809
+ var config = function (attr) { return ({
58810
+ attributeFilter: ["aria-value".concat(attr)],
58811
+ attributeOldValue: true
58812
+ }); };
58813
+ var minObserver = new MutationObserver(callback('min'));
58814
+ var maxObserver = new MutationObserver(callback('max'));
58815
+ var orientationObserver = new MutationObserver(function () { return setValueNow(); });
58816
+ minObserver.observe(separator.current, config('min'));
58817
+ maxObserver.observe(separator.current, config('max'));
58818
+ orientationObserver.observe(separator.current, {
58819
+ attributeFilter: ['aria-orientation']
58711
58820
  });
58712
- return function () { return observer.disconnect(); };
58713
- }, [separator, setValueNow]);
58821
+ return function () {
58822
+ minObserver.disconnect();
58823
+ maxObserver.disconnect();
58824
+ orientationObserver.disconnect();
58825
+ };
58826
+ }, [separator]);
58714
58827
  };
58715
58828
  /**
58716
58829
  * Broadcasts changes if separator aria-valuenow was altered.
@@ -58734,12 +58847,49 @@ var useValueNowEffect = function (setValueNow, separator) {
58734
58847
  /**
58735
58848
  * Calls setValueNow when the separator attributes change.
58736
58849
  */
58737
- var useValueSeparatorEffects = function (setValueNow, separator, ratio) {
58738
- useRatioEffect(setValueNow, ratio);
58850
+ var useValueSeparatorEffects = function (setValueNow, separator, ratio, startAt) {
58851
+ useRatioEffect(setValueNow, separator, ratio, startAt);
58739
58852
  useConfigEffect(setValueNow, separator);
58740
58853
  useValueNowEffect(setValueNow, separator);
58741
58854
  };
58742
58855
 
58856
+ /**
58857
+ * It will calculate the best grid arrangement, based on the min/max props passed to the Splitter.
58858
+ * All grid options work. The preference `1fr XXpx` over `(width - XXpx) 1fr` depends on the type of boundary
58859
+ * to avoid calculation of position when the window is being resized while trying to retain the collapsed state
58860
+ * on a min/max value fixed in pixels (e.g. 200px). Such calculation adds unnecessary lagging on the separator
58861
+ * to catch up. This function aims to avoid such lagging during resizing.
58862
+ * primary relates to top/left
58863
+ * secondary relates to right/bottom
58864
+ */
58865
+ var getGridTemplate = function (separator) {
58866
+ var _a = getSeparatorAttributes({ separator: separator }), valueNow = _a.valueNow, gap = _a.thickness, boundary = _a.boundary, orientation = _a.orientation;
58867
+ var rect = separator.parentElement.getBoundingClientRect();
58868
+ var dimension = orientation === 'horizontal' ? 'height' : 'width';
58869
+ var seperatorAbsolutePx = (rect[dimension] / 100) * valueNow;
58870
+ var offset = gap / 2;
58871
+ if (boundary === 'keep-primary') {
58872
+ return {
58873
+ grid: "".concat(seperatorAbsolutePx - offset, "px 1fr"),
58874
+ primary: "".concat(seperatorAbsolutePx, "px"),
58875
+ secondary: ''
58876
+ };
58877
+ }
58878
+ if (boundary === 'keep-secondary') {
58879
+ return {
58880
+ grid: "1fr ".concat(rect[dimension] - seperatorAbsolutePx - offset, "px"),
58881
+ primary: '',
58882
+ secondary: "".concat(rect[dimension] - seperatorAbsolutePx, "px")
58883
+ };
58884
+ }
58885
+ var primary = "clamp(".concat(offset, "px, ").concat(valueNow, "%, calc(100% - ").concat(offset, "px))");
58886
+ return {
58887
+ grid: "min(calc(".concat(valueNow, "% - ").concat(gap / 2, "px), calc(100% - ").concat(gap, "px)) 1fr"),
58888
+ primary: primary,
58889
+ secondary: "calc(100% - ".concat(primary, ")")
58890
+ };
58891
+ };
58892
+
58743
58893
  /**
58744
58894
  * Ensures valueNow is set to a valid value within its allowed boundaries.
58745
58895
  * If boundaries and/or initialRatio are not specified, they will be defaulted.
@@ -58747,19 +58897,24 @@ var useValueSeparatorEffects = function (setValueNow, separator, ratio) {
58747
58897
  * This multiple calls are expected, and setValueNow will resize only once.
58748
58898
  */
58749
58899
  var useValueSeparator = function (_a) {
58750
- var separator = _a.separator, ratio = _a.ratio, onResized = _a.onResized, _b = _a.boundaries, min = _b.min, max = _b.max;
58900
+ var separator = _a.separator, ratio = _a.ratio, onResized = _a.onResized, _b = _a.boundaries, minProp = _b.min, maxProp = _b.max, startAt = _a.startAt;
58751
58901
  var prev = React.useRef(null);
58752
- var setValueNow = React.useCallback(function (val) {
58902
+ var setValueNow = React.useCallback(function (val, config) {
58903
+ var _a, _b;
58753
58904
  var valueNow = getSeparatorAttributes({ ref: separator }).valueNow;
58905
+ // Prioritize min/max from callback, they are updated before the boundaries prop.
58906
+ var min = (_a = config === null || config === void 0 ? void 0 : config.min) !== null && _a !== void 0 ? _a : minProp;
58907
+ var max = (_b = config === null || config === void 0 ? void 0 : config.max) !== null && _b !== void 0 ? _b : maxProp;
58754
58908
  var value = val !== null && val !== void 0 ? val : (valueNow || min + (max - min) / 2);
58755
58909
  var newValue = clampSeparator({ value: value, max: max, min: min });
58910
+ var isCalculating = min === -Infinity || max === Infinity;
58756
58911
  resize(separator, newValue);
58757
- if (prev.current !== newValue) {
58912
+ if (prev.current !== newValue && !isCalculating) {
58758
58913
  prev.current = newValue;
58759
58914
  onResized === null || onResized === void 0 ? void 0 : onResized(newValue);
58760
58915
  }
58761
- }, [onResized, min, max, prev]);
58762
- useValueSeparatorEffects(setValueNow, separator, ratio);
58916
+ }, [onResized, minProp, maxProp, prev]);
58917
+ useValueSeparatorEffects(setValueNow, separator, ratio, startAt);
58763
58918
  return { setValueNow: setValueNow };
58764
58919
  };
58765
58920
  var resize = function (separator, value) {
@@ -58775,12 +58930,8 @@ var resize = function (separator, value) {
58775
58930
  separator.current.setAttribute('aria-valuenow', newValue);
58776
58931
  }
58777
58932
  var panels = (_a = separator.current.parentElement.childNodes.length) !== null && _a !== void 0 ? _a : 0;
58778
- var valueNow = Number(separator.current.getAttribute('aria-valuenow'));
58779
- var offset = gap / 2;
58780
- var absolute = "clamp(".concat(offset, "px, ").concat(valueNow, "%, calc(100% - ").concat(offset, "px))");
58781
- var gridTemplate = panels === 1
58782
- ? '1fr'
58783
- : "min(calc(".concat(valueNow, "% - ").concat(gap / 2, "px), calc(100% - ").concat(gap, "px)) 1fr");
58933
+ var _d = getGridTemplate(separator.current), grid = _d.grid, primary = _d.primary, secondary = _d.secondary;
58934
+ var gridTemplate = panels === 1 ? '1fr' : grid;
58784
58935
  var splitter = (_b = separator.current) === null || _b === void 0 ? void 0 : _b.parentElement;
58785
58936
  if (splitter) {
58786
58937
  splitter.style.opacity = '1';
@@ -58788,25 +58939,29 @@ var resize = function (separator, value) {
58788
58939
  splitter.style.columnGap = "".concat(gap, "px");
58789
58940
  splitter.style.gridTemplateColumns = gridTemplate;
58790
58941
  separator.current.style.width = "".concat(gap, "px");
58791
- separator.current.style.left = absolute;
58942
+ separator.current.style.left = primary;
58943
+ separator.current.style.right = secondary;
58792
58944
  separator.current.style.height = '100%';
58793
- separator.current.style.transform = 'translateX(-50%)';
58945
+ separator.current.style.transform = "translateX(".concat(primary && '-', "50%)");
58794
58946
  separator.current.style.cursor = 'col-resize';
58795
58947
  splitter.style.rowGap = '';
58796
58948
  splitter.style.gridTemplateRows = '';
58797
58949
  separator.current.style.top = '';
58950
+ separator.current.style.bottom = '';
58798
58951
  }
58799
58952
  else {
58800
58953
  splitter.style.rowGap = "".concat(gap, "px");
58801
58954
  splitter.style.gridTemplateRows = gridTemplate;
58802
58955
  separator.current.style.height = "".concat(gap, "px");
58803
- separator.current.style.top = absolute;
58956
+ separator.current.style.top = primary;
58957
+ separator.current.style.bottom = secondary;
58804
58958
  separator.current.style.width = '100%';
58805
- separator.current.style.transform = 'translateY(-50%)';
58959
+ separator.current.style.transform = "translateY(".concat(primary && '-', "50%)");
58806
58960
  separator.current.style.cursor = 'row-resize';
58807
58961
  splitter.style.columnGap = '';
58808
58962
  splitter.style.gridTemplateColumns = '';
58809
58963
  separator.current.style.left = '';
58964
+ separator.current.style.right = '';
58810
58965
  }
58811
58966
  }
58812
58967
  };
@@ -58890,6 +59045,62 @@ var getNewValueNow = function (_a, valueNow, pixelUnit) {
58890
59045
  return valueNow;
58891
59046
  };
58892
59047
 
59048
+ var isPxProps = function (_a) {
59049
+ var min = _a.min, max = _a.max;
59050
+ var isPercentage = typeof max === 'number' || typeof min === 'number';
59051
+ var isNull = min === undefined && max === undefined;
59052
+ return !isPercentage && !isNull;
59053
+ };
59054
+ /**
59055
+ * Maps min and max values if they are provided in 'XXXpx' format.
59056
+ */
59057
+ var useBoundary = function (separator, boundaries) {
59058
+ var _a = React.useState({ min: -Infinity, max: Infinity }), mapped = _a[0], setMapped = _a[1];
59059
+ var isPx = isPxProps(boundaries);
59060
+ var min = boundaries.min, max = boundaries.max;
59061
+ React.useEffect(function () {
59062
+ var _a;
59063
+ var element = (_a = separator === null || separator === void 0 ? void 0 : separator.current) === null || _a === void 0 ? void 0 : _a.parentElement;
59064
+ var shouldMap = element && isPx;
59065
+ var observer = new ResizeObserver(function (_a) {
59066
+ var rect = _a[0].contentRect;
59067
+ var _b = getSeparatorAttributes({
59068
+ ref: separator
59069
+ }), thickness = _b.thickness, orientation = _b.orientation;
59070
+ var halfThickness = thickness / 2;
59071
+ var length = orientation === 'vertical' ? rect.width : rect.height;
59072
+ var parse = function (boundary) {
59073
+ if (typeof boundary === 'number') {
59074
+ return boundary;
59075
+ }
59076
+ var boundaryAsNumber = parseFloat(boundary);
59077
+ var offset = boundaryAsNumber > 0
59078
+ ? boundaryAsNumber + halfThickness
59079
+ : length - Math.abs(boundaryAsNumber) - halfThickness;
59080
+ return (offset / length) * 100;
59081
+ };
59082
+ setMapped({ min: parse(min !== null && min !== void 0 ? min : 0), max: parse(max !== null && max !== void 0 ? max : 100) });
59083
+ });
59084
+ if (shouldMap) {
59085
+ observer.observe(element);
59086
+ }
59087
+ return function () {
59088
+ if (shouldMap) {
59089
+ observer.disconnect();
59090
+ }
59091
+ };
59092
+ }, [separator, max, min, isPx]);
59093
+ if (isPx) {
59094
+ return mapped;
59095
+ }
59096
+ else {
59097
+ return {
59098
+ min: Math.max(Number(min !== null && min !== void 0 ? min : 0), 0),
59099
+ max: Math.min(Number(max !== null && max !== void 0 ? max : 100), 100)
59100
+ };
59101
+ }
59102
+ };
59103
+
58893
59104
  var canceEvent = function (e) {
58894
59105
  if (e.currentTarget !== e.target) {
58895
59106
  e.preventDefault();
@@ -58898,21 +59109,19 @@ var canceEvent = function (e) {
58898
59109
  };
58899
59110
  var Separator = React.forwardRef(function (_a, forwardRef) {
58900
59111
  var _b;
58901
- var parts = _a.parts, ratio = _a.ratio, onResized = _a.onResized, props = __rest(_a, ["parts", "ratio", "onResized"]);
59112
+ var parts = _a.parts, ratio = _a.ratio, onResized = _a.onResized, min = _a.min, max = _a.max, startAt = _a.startAt, props = __rest(_a, ["parts", "ratio", "onResized", "min", "max", "startAt"]);
58902
59113
  var separator = useForkRef(forwardRef);
58903
- var boundaries = {
58904
- min: props['aria-valuemin'],
58905
- max: props['aria-valuemax']
58906
- };
59114
+ var boundaries = useBoundary(separator, { min: min, max: max });
58907
59115
  var setValueNow = useValueSeparator({
58908
59116
  ratio: ratio,
58909
59117
  separator: separator,
58910
59118
  onResized: onResized,
58911
- boundaries: boundaries
59119
+ boundaries: boundaries,
59120
+ startAt: startAt
58912
59121
  }).setValueNow;
58913
59122
  useShowSeparator(separator);
58914
59123
  var values = function () { return getSeparatorAttributes({ ref: separator }); };
58915
- return (React__default["default"].createElement("div", __assign({ ref: separator }, props, useMoveSeparator(separator, setValueNow), { onKeyDown: function (e) {
59124
+ return (React__default["default"].createElement("div", __assign({ ref: separator, "aria-valuemin": boundaries.min, "aria-valuemax": boundaries.max }, props, useMoveSeparator(separator, setValueNow), { onKeyDown: function (e) {
58916
59125
  var _a;
58917
59126
  var newValueNow = keyDownHandler(e);
58918
59127
  if (values().valueNow !== newValueNow) {
@@ -58962,12 +59171,31 @@ styleInject(css_248z);
58962
59171
  */
58963
59172
  var Splitter = React.forwardRef(function (props, ref) {
58964
59173
  if (props === void 0) { props = {}; }
58965
- var parts = props.parts, ratio = props.ratio, onResized = props.onResized, min = props.min, max = props.max, children = props.children, _a = props.orientation, orientation = _a === void 0 ? 'vertical' : _a, rest = __rest(props, ["parts", "ratio", "onResized", "min", "max", "children", "orientation"]);
59174
+ var parts = props.parts, ratio = props.ratio, onResized = props.onResized, min = props.min, max = props.max, children = props.children, _a = props.orientation, orientation = _a === void 0 ? 'vertical' : _a, startAt = props.startAt, rest = __rest(props, ["parts", "ratio", "onResized", "min", "max", "children", "orientation", "startAt"]);
58966
59175
  return (React__default["default"].createElement("div", __assign({ ref: ref }, rest, { className: clsx('Splitter', rest === null || rest === void 0 ? void 0 : rest.className) }),
58967
59176
  children,
58968
- React__default["default"].createElement(Separator, __assign({}, parts === null || parts === void 0 ? void 0 : parts.separator, { tabIndex: 0, "aria-valuemin": Math.max(min !== null && min !== void 0 ? min : 0, 0), "aria-valuemax": Math.min(max !== null && max !== void 0 ? max : 100, 100), role: "separator", "aria-orientation": orientation, ratio: ratio, onResized: onResized, parts: parts === null || parts === void 0 ? void 0 : parts.controls }))));
59177
+ React__default["default"].createElement(Separator, __assign({}, parts === null || parts === void 0 ? void 0 : parts.separator, { tabIndex: 0, min: min, max: max, role: "separator", "aria-orientation": orientation, ratio: ratio, onResized: onResized, parts: parts === null || parts === void 0 ? void 0 : parts.controls, startAt: mapStartAt({ ratio: ratio, startAt: startAt }) }, setDataBoundary({ min: min, max: max })))));
58969
59178
  });
58970
- Splitter.displayName = 'Splitter';
59179
+ Splitter.displayName = 'Splitter';
59180
+ var mapStartAt = function (props) {
59181
+ var _a;
59182
+ if (typeof props.ratio === 'number') {
59183
+ // Only consider startAt value when Splitter is uncontrolled (ratio is undefined)
59184
+ return undefined;
59185
+ }
59186
+ // Words describe better intent than numbers.
59187
+ // However, 0 & 100 are figurative numbers.
59188
+ // If there are boundaries, these will be respected.
59189
+ switch (props.startAt) {
59190
+ case '1st-collapsed':
59191
+ return 0;
59192
+ case '2nd-collapsed':
59193
+ return 100;
59194
+ default:
59195
+ // Can be started at any other number between 0 and 100.
59196
+ return (_a = props.startAt) !== null && _a !== void 0 ? _a : 50;
59197
+ }
59198
+ };
58971
59199
 
58972
59200
  var getSeparator = function (splitter) {
58973
59201
  var _a;