@linzjs/lui 21.25.0 → 21.26.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,77 @@ 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
+ else {
58808
+ var dim = values.orientation === 'vertical' ? 'width' : 'height';
58809
+ var offset = target.getBoundingClientRect()[dim] / 2;
58810
+ var splitter = target.parentElement;
58811
+ var primary = splitter.childNodes[0];
58812
+ var splitterRect = splitter.getBoundingClientRect();
58813
+ var primaryRect = primary.getBoundingClientRect();
58814
+ var newVal = ((primaryRect[dim] + offset) / splitterRect[dim]) * 100;
58815
+ if (Math.abs(newVal - valueNow) >= 0.01) {
58816
+ setValueNow(newVal, { min: valueMin, max: valueMax });
58817
+ }
58818
+ }
58819
+ };
58706
58820
  };
58707
- callback();
58708
- var observer = new MutationObserver(callback);
58709
- observer.observe(separator.current, {
58710
- attributeFilter: ['aria-orientation', 'aria-valuemin', 'aria-valuemax']
58821
+ var config = function (attr) { return ({
58822
+ attributeFilter: ["aria-value".concat(attr)],
58823
+ attributeOldValue: true
58824
+ }); };
58825
+ var minObserver = new MutationObserver(callback('min'));
58826
+ var maxObserver = new MutationObserver(callback('max'));
58827
+ var orientationObserver = new MutationObserver(function () { return setValueNow(); });
58828
+ minObserver.observe(separator.current, config('min'));
58829
+ maxObserver.observe(separator.current, config('max'));
58830
+ orientationObserver.observe(separator.current, {
58831
+ attributeFilter: ['aria-orientation']
58711
58832
  });
58712
- return function () { return observer.disconnect(); };
58713
- }, [separator, setValueNow]);
58833
+ return function () {
58834
+ minObserver.disconnect();
58835
+ maxObserver.disconnect();
58836
+ orientationObserver.disconnect();
58837
+ };
58838
+ }, [separator]);
58714
58839
  };
58715
58840
  /**
58716
58841
  * Broadcasts changes if separator aria-valuenow was altered.
@@ -58734,12 +58859,49 @@ var useValueNowEffect = function (setValueNow, separator) {
58734
58859
  /**
58735
58860
  * Calls setValueNow when the separator attributes change.
58736
58861
  */
58737
- var useValueSeparatorEffects = function (setValueNow, separator, ratio) {
58738
- useRatioEffect(setValueNow, ratio);
58862
+ var useValueSeparatorEffects = function (setValueNow, separator, ratio, startAt) {
58863
+ useRatioEffect(setValueNow, separator, ratio, startAt);
58739
58864
  useConfigEffect(setValueNow, separator);
58740
58865
  useValueNowEffect(setValueNow, separator);
58741
58866
  };
58742
58867
 
58868
+ /**
58869
+ * It will calculate the best grid arrangement, based on the min/max props passed to the Splitter.
58870
+ * All grid options work. The preference `1fr XXpx` over `(width - XXpx) 1fr` depends on the type of boundary
58871
+ * to avoid calculation of position when the window is being resized while trying to retain the collapsed state
58872
+ * on a min/max value fixed in pixels (e.g. 200px). Such calculation adds unnecessary lagging on the separator
58873
+ * to catch up. This function aims to avoid such lagging during resizing.
58874
+ * primary relates to top/left
58875
+ * secondary relates to right/bottom
58876
+ */
58877
+ var getGridTemplate = function (separator) {
58878
+ var _a = getSeparatorAttributes({ separator: separator }), valueNow = _a.valueNow, gap = _a.thickness, boundary = _a.boundary, orientation = _a.orientation;
58879
+ var rect = separator.parentElement.getBoundingClientRect();
58880
+ var dimension = orientation === 'horizontal' ? 'height' : 'width';
58881
+ var seperatorAbsolutePx = (rect[dimension] / 100) * valueNow;
58882
+ var offset = gap / 2;
58883
+ if (boundary === 'keep-primary') {
58884
+ return {
58885
+ grid: "".concat(seperatorAbsolutePx - offset, "px 1fr"),
58886
+ primary: "".concat(seperatorAbsolutePx, "px"),
58887
+ secondary: ''
58888
+ };
58889
+ }
58890
+ if (boundary === 'keep-secondary') {
58891
+ return {
58892
+ grid: "1fr ".concat(rect[dimension] - seperatorAbsolutePx - offset, "px"),
58893
+ primary: '',
58894
+ secondary: "".concat(rect[dimension] - seperatorAbsolutePx, "px")
58895
+ };
58896
+ }
58897
+ var primary = "clamp(".concat(offset, "px, ").concat(valueNow, "%, calc(100% - ").concat(offset, "px))");
58898
+ return {
58899
+ grid: "min(calc(".concat(valueNow, "% - ").concat(gap / 2, "px), calc(100% - ").concat(gap, "px)) 1fr"),
58900
+ primary: primary,
58901
+ secondary: "calc(100% - ".concat(primary, ")")
58902
+ };
58903
+ };
58904
+
58743
58905
  /**
58744
58906
  * Ensures valueNow is set to a valid value within its allowed boundaries.
58745
58907
  * If boundaries and/or initialRatio are not specified, they will be defaulted.
@@ -58747,19 +58909,24 @@ var useValueSeparatorEffects = function (setValueNow, separator, ratio) {
58747
58909
  * This multiple calls are expected, and setValueNow will resize only once.
58748
58910
  */
58749
58911
  var useValueSeparator = function (_a) {
58750
- var separator = _a.separator, ratio = _a.ratio, onResized = _a.onResized, _b = _a.boundaries, min = _b.min, max = _b.max;
58912
+ var separator = _a.separator, ratio = _a.ratio, onResized = _a.onResized, _b = _a.boundaries, minProp = _b.min, maxProp = _b.max, startAt = _a.startAt;
58751
58913
  var prev = React.useRef(null);
58752
- var setValueNow = React.useCallback(function (val) {
58914
+ var setValueNow = React.useCallback(function (val, config) {
58915
+ var _a, _b;
58753
58916
  var valueNow = getSeparatorAttributes({ ref: separator }).valueNow;
58917
+ // Prioritize min/max from callback, they are updated before the boundaries prop.
58918
+ var min = (_a = config === null || config === void 0 ? void 0 : config.min) !== null && _a !== void 0 ? _a : minProp;
58919
+ var max = (_b = config === null || config === void 0 ? void 0 : config.max) !== null && _b !== void 0 ? _b : maxProp;
58754
58920
  var value = val !== null && val !== void 0 ? val : (valueNow || min + (max - min) / 2);
58755
58921
  var newValue = clampSeparator({ value: value, max: max, min: min });
58922
+ var isCalculating = min === -Infinity || max === Infinity;
58756
58923
  resize(separator, newValue);
58757
- if (prev.current !== newValue) {
58924
+ if (prev.current !== newValue && !isCalculating) {
58758
58925
  prev.current = newValue;
58759
58926
  onResized === null || onResized === void 0 ? void 0 : onResized(newValue);
58760
58927
  }
58761
- }, [onResized, min, max, prev]);
58762
- useValueSeparatorEffects(setValueNow, separator, ratio);
58928
+ }, [onResized, minProp, maxProp, prev]);
58929
+ useValueSeparatorEffects(setValueNow, separator, ratio, startAt);
58763
58930
  return { setValueNow: setValueNow };
58764
58931
  };
58765
58932
  var resize = function (separator, value) {
@@ -58775,12 +58942,8 @@ var resize = function (separator, value) {
58775
58942
  separator.current.setAttribute('aria-valuenow', newValue);
58776
58943
  }
58777
58944
  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");
58945
+ var _d = getGridTemplate(separator.current), grid = _d.grid, primary = _d.primary, secondary = _d.secondary;
58946
+ var gridTemplate = panels === 1 ? '1fr' : grid;
58784
58947
  var splitter = (_b = separator.current) === null || _b === void 0 ? void 0 : _b.parentElement;
58785
58948
  if (splitter) {
58786
58949
  splitter.style.opacity = '1';
@@ -58788,25 +58951,29 @@ var resize = function (separator, value) {
58788
58951
  splitter.style.columnGap = "".concat(gap, "px");
58789
58952
  splitter.style.gridTemplateColumns = gridTemplate;
58790
58953
  separator.current.style.width = "".concat(gap, "px");
58791
- separator.current.style.left = absolute;
58954
+ separator.current.style.left = primary;
58955
+ separator.current.style.right = secondary;
58792
58956
  separator.current.style.height = '100%';
58793
- separator.current.style.transform = 'translateX(-50%)';
58957
+ separator.current.style.transform = "translateX(".concat(primary && '-', "50%)");
58794
58958
  separator.current.style.cursor = 'col-resize';
58795
58959
  splitter.style.rowGap = '';
58796
58960
  splitter.style.gridTemplateRows = '';
58797
58961
  separator.current.style.top = '';
58962
+ separator.current.style.bottom = '';
58798
58963
  }
58799
58964
  else {
58800
58965
  splitter.style.rowGap = "".concat(gap, "px");
58801
58966
  splitter.style.gridTemplateRows = gridTemplate;
58802
58967
  separator.current.style.height = "".concat(gap, "px");
58803
- separator.current.style.top = absolute;
58968
+ separator.current.style.top = primary;
58969
+ separator.current.style.bottom = secondary;
58804
58970
  separator.current.style.width = '100%';
58805
- separator.current.style.transform = 'translateY(-50%)';
58971
+ separator.current.style.transform = "translateY(".concat(primary && '-', "50%)");
58806
58972
  separator.current.style.cursor = 'row-resize';
58807
58973
  splitter.style.columnGap = '';
58808
58974
  splitter.style.gridTemplateColumns = '';
58809
58975
  separator.current.style.left = '';
58976
+ separator.current.style.right = '';
58810
58977
  }
58811
58978
  }
58812
58979
  };
@@ -58890,6 +59057,62 @@ var getNewValueNow = function (_a, valueNow, pixelUnit) {
58890
59057
  return valueNow;
58891
59058
  };
58892
59059
 
59060
+ var isPxProps = function (_a) {
59061
+ var min = _a.min, max = _a.max;
59062
+ var isPercentage = typeof max === 'number' || typeof min === 'number';
59063
+ var isNull = min === undefined && max === undefined;
59064
+ return !isPercentage && !isNull;
59065
+ };
59066
+ /**
59067
+ * Maps min and max values if they are provided in 'XXXpx' format.
59068
+ */
59069
+ var useBoundary = function (separator, boundaries) {
59070
+ var _a = React.useState({ min: -Infinity, max: Infinity }), mapped = _a[0], setMapped = _a[1];
59071
+ var isPx = isPxProps(boundaries);
59072
+ var min = boundaries.min, max = boundaries.max;
59073
+ React.useEffect(function () {
59074
+ var _a;
59075
+ var element = (_a = separator === null || separator === void 0 ? void 0 : separator.current) === null || _a === void 0 ? void 0 : _a.parentElement;
59076
+ var shouldMap = element && isPx;
59077
+ var observer = new ResizeObserver(function (_a) {
59078
+ var rect = _a[0].contentRect;
59079
+ var _b = getSeparatorAttributes({
59080
+ ref: separator
59081
+ }), thickness = _b.thickness, orientation = _b.orientation;
59082
+ var halfThickness = thickness / 2;
59083
+ var length = orientation === 'vertical' ? rect.width : rect.height;
59084
+ var parse = function (boundary) {
59085
+ if (typeof boundary === 'number') {
59086
+ return boundary;
59087
+ }
59088
+ var boundaryAsNumber = parseFloat(boundary);
59089
+ var offset = boundaryAsNumber > 0
59090
+ ? boundaryAsNumber + halfThickness
59091
+ : length - Math.abs(boundaryAsNumber) - halfThickness;
59092
+ return (offset / length) * 100;
59093
+ };
59094
+ setMapped({ min: parse(min !== null && min !== void 0 ? min : 0), max: parse(max !== null && max !== void 0 ? max : 100) });
59095
+ });
59096
+ if (shouldMap) {
59097
+ observer.observe(element);
59098
+ }
59099
+ return function () {
59100
+ if (shouldMap) {
59101
+ observer.disconnect();
59102
+ }
59103
+ };
59104
+ }, [separator, max, min, isPx]);
59105
+ if (isPx) {
59106
+ return mapped;
59107
+ }
59108
+ else {
59109
+ return {
59110
+ min: Math.max(Number(min !== null && min !== void 0 ? min : 0), 0),
59111
+ max: Math.min(Number(max !== null && max !== void 0 ? max : 100), 100)
59112
+ };
59113
+ }
59114
+ };
59115
+
58893
59116
  var canceEvent = function (e) {
58894
59117
  if (e.currentTarget !== e.target) {
58895
59118
  e.preventDefault();
@@ -58898,21 +59121,19 @@ var canceEvent = function (e) {
58898
59121
  };
58899
59122
  var Separator = React.forwardRef(function (_a, forwardRef) {
58900
59123
  var _b;
58901
- var parts = _a.parts, ratio = _a.ratio, onResized = _a.onResized, props = __rest(_a, ["parts", "ratio", "onResized"]);
59124
+ 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
59125
  var separator = useForkRef(forwardRef);
58903
- var boundaries = {
58904
- min: props['aria-valuemin'],
58905
- max: props['aria-valuemax']
58906
- };
59126
+ var boundaries = useBoundary(separator, { min: min, max: max });
58907
59127
  var setValueNow = useValueSeparator({
58908
59128
  ratio: ratio,
58909
59129
  separator: separator,
58910
59130
  onResized: onResized,
58911
- boundaries: boundaries
59131
+ boundaries: boundaries,
59132
+ startAt: startAt
58912
59133
  }).setValueNow;
58913
59134
  useShowSeparator(separator);
58914
59135
  var values = function () { return getSeparatorAttributes({ ref: separator }); };
58915
- return (React__default["default"].createElement("div", __assign({ ref: separator }, props, useMoveSeparator(separator, setValueNow), { onKeyDown: function (e) {
59136
+ 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
59137
  var _a;
58917
59138
  var newValueNow = keyDownHandler(e);
58918
59139
  if (values().valueNow !== newValueNow) {
@@ -58962,12 +59183,31 @@ styleInject(css_248z);
58962
59183
  */
58963
59184
  var Splitter = React.forwardRef(function (props, ref) {
58964
59185
  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"]);
59186
+ 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
59187
  return (React__default["default"].createElement("div", __assign({ ref: ref }, rest, { className: clsx('Splitter', rest === null || rest === void 0 ? void 0 : rest.className) }),
58967
59188
  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 }))));
59189
+ 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
59190
  });
58970
- Splitter.displayName = 'Splitter';
59191
+ Splitter.displayName = 'Splitter';
59192
+ var mapStartAt = function (props) {
59193
+ var _a;
59194
+ if (typeof props.ratio === 'number') {
59195
+ // Only consider startAt value when Splitter is uncontrolled (ratio is undefined)
59196
+ return undefined;
59197
+ }
59198
+ // Words describe better intent than numbers.
59199
+ // However, 0 & 100 are figurative numbers.
59200
+ // If there are boundaries, these will be respected.
59201
+ switch (props.startAt) {
59202
+ case '1st-collapsed':
59203
+ return 0;
59204
+ case '2nd-collapsed':
59205
+ return 100;
59206
+ default:
59207
+ // Can be started at any other number between 0 and 100.
59208
+ return (_a = props.startAt) !== null && _a !== void 0 ? _a : 50;
59209
+ }
59210
+ };
58971
59211
 
58972
59212
  var getSeparator = function (splitter) {
58973
59213
  var _a;