@linzjs/lui 21.26.1 → 21.26.2
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/CHANGELOG.md +7 -0
- package/dist/index.js +22 -15
- package/dist/index.js.map +1 -1
- package/dist/lui.esm.js +22 -15
- package/dist/lui.esm.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [21.26.2](https://github.com/linz/lui/compare/v21.26.1...v21.26.2) (2024-04-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **Splitter:** calculation based on aria-valuenow ([#1111](https://github.com/linz/lui/issues/1111)) ([1b60dad](https://github.com/linz/lui/commit/1b60dad8bfe401d5d6ce30176ef2139e8c5a7626))
|
|
7
|
+
|
|
1
8
|
## [21.26.1](https://github.com/linz/lui/compare/v21.26.0...v21.26.1) (2024-04-15)
|
|
2
9
|
|
|
3
10
|
|
package/dist/index.js
CHANGED
|
@@ -58762,6 +58762,15 @@ var animateSeparator = function (separatorRef, animate) {
|
|
|
58762
58762
|
}
|
|
58763
58763
|
};
|
|
58764
58764
|
|
|
58765
|
+
var useSetValueNow_static = function (setValueNow, separator) {
|
|
58766
|
+
var _a = React.useState(0), count = _a[0], setCount = _a[1];
|
|
58767
|
+
React.useEffect(function () { return transition(separator).resume(); }, [count]);
|
|
58768
|
+
return React.useCallback(function (val, config) {
|
|
58769
|
+
transition(separator).stop();
|
|
58770
|
+
setValueNow(val, config);
|
|
58771
|
+
setCount(function (p) { return p + 1; });
|
|
58772
|
+
}, [setValueNow]);
|
|
58773
|
+
};
|
|
58765
58774
|
/**
|
|
58766
58775
|
* Moves separator as per ratio changes. Centers on first render if ratio is undefined.
|
|
58767
58776
|
*/
|
|
@@ -58782,8 +58791,7 @@ var useRatioEffect = function (setValueNow, separator, ratio, startAt) {
|
|
|
58782
58791
|
* Re-arranges the splitter if the limits or orientation change.
|
|
58783
58792
|
*/
|
|
58784
58793
|
var useConfigEffect = function (setValueNow, separator) {
|
|
58785
|
-
var
|
|
58786
|
-
React.useEffect(function () { return transition(separator).resume(); }, [count]);
|
|
58794
|
+
var setValueNow_static = useSetValueNow_static(setValueNow, separator);
|
|
58787
58795
|
React.useEffect(function () {
|
|
58788
58796
|
var callback = function (attr) {
|
|
58789
58797
|
return function (_a) {
|
|
@@ -58800,27 +58808,26 @@ var useConfigEffect = function (setValueNow, separator) {
|
|
|
58800
58808
|
// In such case, the newValueNow is moved along with the delimiter.
|
|
58801
58809
|
var newValueNow = !wasInBoundary ? valueNow : newValue;
|
|
58802
58810
|
if (wasInBoundary || valueMax < valueNow || valueMin > valueNow) {
|
|
58803
|
-
|
|
58804
|
-
setValueNow(newValueNow, { min: valueMin, max: valueMax });
|
|
58805
|
-
setCount(function (p) { return p + 1; });
|
|
58811
|
+
setValueNow_static(newValueNow, { min: valueMin, max: valueMax });
|
|
58806
58812
|
}
|
|
58807
58813
|
else {
|
|
58814
|
+
var threshold = 0.01;
|
|
58808
58815
|
var dim = values.orientation === 'vertical' ? 'width' : 'height';
|
|
58809
|
-
var
|
|
58816
|
+
var abs = values.orientation === 'vertical' ? 'left' : 'top';
|
|
58817
|
+
var separatorRect = target.getBoundingClientRect();
|
|
58818
|
+
var gap = separatorRect[dim];
|
|
58810
58819
|
var offset = gap / 2;
|
|
58811
58820
|
var splitterEl = target.parentElement;
|
|
58812
|
-
var primaryEl = splitterEl.childNodes[0];
|
|
58813
58821
|
var splitterRect = splitterEl.getBoundingClientRect();
|
|
58814
|
-
var primaryRect = primaryEl.getBoundingClientRect();
|
|
58815
58822
|
var container = splitterRect[dim];
|
|
58816
|
-
var primary =
|
|
58817
|
-
var
|
|
58818
|
-
if (primary
|
|
58823
|
+
var primary = Math.max(separatorRect[abs] - splitterRect[abs], 0);
|
|
58824
|
+
var secondary = Math.max(container - primary - gap, 0);
|
|
58825
|
+
if (primary < threshold || secondary < threshold) {
|
|
58819
58826
|
return;
|
|
58820
58827
|
}
|
|
58821
58828
|
var newVal = ((primary + offset) / container) * 100;
|
|
58822
|
-
if (Math.abs(newVal - valueNow) >=
|
|
58823
|
-
|
|
58829
|
+
if (Math.abs(newVal - valueNow) >= threshold) {
|
|
58830
|
+
setValueNow_static(newVal, { min: valueMin, max: valueMax });
|
|
58824
58831
|
}
|
|
58825
58832
|
}
|
|
58826
58833
|
};
|
|
@@ -59124,7 +59131,7 @@ var useBoundary = function (separator, boundaries) {
|
|
|
59124
59131
|
}
|
|
59125
59132
|
};
|
|
59126
59133
|
|
|
59127
|
-
var
|
|
59134
|
+
var cancelEvent = function (e) {
|
|
59128
59135
|
if (e.currentTarget !== e.target) {
|
|
59129
59136
|
e.preventDefault();
|
|
59130
59137
|
e.stopPropagation();
|
|
@@ -59153,7 +59160,7 @@ var Separator = React.forwardRef(function (_a, forwardRef) {
|
|
|
59153
59160
|
}
|
|
59154
59161
|
(_a = props === null || props === void 0 ? void 0 : props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
59155
59162
|
}, className: clsx('Separator', props.className) }),
|
|
59156
|
-
React__default["default"].createElement("span", __assign({}, parts === null || parts === void 0 ? void 0 : parts.container, { className: clsx('Separator-arrows', (_b = parts === null || parts === void 0 ? void 0 : parts.container) === null || _b === void 0 ? void 0 : _b.className), onMouseDown:
|
|
59163
|
+
React__default["default"].createElement("span", __assign({}, parts === null || parts === void 0 ? void 0 : parts.container, { className: clsx('Separator-arrows', (_b = parts === null || parts === void 0 ? void 0 : parts.container) === null || _b === void 0 ? void 0 : _b.className), onMouseDown: cancelEvent, onTouchStart: cancelEvent }),
|
|
59157
59164
|
React__default["default"].createElement(Control, __assign({}, parts === null || parts === void 0 ? void 0 : parts.primary, { side: "primary", onClick: function (e) {
|
|
59158
59165
|
var _a, _b;
|
|
59159
59166
|
setValueNow(controlClickHandler(e, 'primary'));
|