@linzjs/lui 21.26.2 → 21.26.3
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/components/Splitter/helpers/transition.d.ts +1 -1
- package/dist/index.js +50 -41
- package/dist/index.js.map +1 -1
- package/dist/lui.esm.js +50 -41
- package/dist/lui.esm.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [21.26.3](https://github.com/linz/lui/compare/v21.26.2...v21.26.3) (2024-04-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **Splitter:** make transition be triggered manually ([#1112](https://github.com/linz/lui/issues/1112)) ([f07a612](https://github.com/linz/lui/commit/f07a612e9c28d8f88186d3d038b1a3334c7cb065))
|
|
7
|
+
|
|
1
8
|
## [21.26.2](https://github.com/linz/lui/compare/v21.26.1...v21.26.2) (2024-04-18)
|
|
2
9
|
|
|
3
10
|
|
package/dist/index.js
CHANGED
|
@@ -58439,7 +58439,7 @@ var LuiPagination = function (_a) {
|
|
|
58439
58439
|
React__default["default"].createElement("div", { className: "pagination" }, renderPaginationNumbers())))));
|
|
58440
58440
|
};
|
|
58441
58441
|
|
|
58442
|
-
var css_248z$2 = "/**\n @deprecated\n */\n/**\n @deprecated\n */\n/**\n @deprecated\n */\n.Separator {\n background-color: #eaeaea;\n position: absolute;\n display: flex;\n justify-content: space-around;\n transition-property: background-color;\n transition-delay: 750ms;\n transition-duration:
|
|
58442
|
+
var css_248z$2 = "/**\n @deprecated\n */\n/**\n @deprecated\n */\n/**\n @deprecated\n */\n.Separator {\n background-color: #eaeaea;\n position: absolute;\n display: flex;\n justify-content: space-around;\n transition-property: background-color;\n transition-delay: 750ms;\n transition-duration: 0ms;\n}\n.Separator-arrows {\n align-self: center;\n position: relative;\n opacity: 0;\n transition-property: opacity;\n transition-delay: 750ms;\n transition-duration: 0ms;\n}\n.Separator:focus-within, .Separator:hover, .Separator:focus, .Separator:active {\n background-color: #73c8e1;\n transition-delay: 0ms;\n transition-duration: 0ms;\n}\n.Separator:focus-within .Separator-arrows, .Separator:hover .Separator-arrows, .Separator:focus .Separator-arrows, .Separator:active .Separator-arrows {\n opacity: 1;\n transition-delay: 0ms;\n transition-duration: 0ms;\n display: inline-block;\n}";
|
|
58443
58443
|
styleInject(css_248z$2);
|
|
58444
58444
|
|
|
58445
58445
|
var css_248z$1 = ".Control {\n transition: opacity 0.2s ease;\n position: absolute;\n margin-left: 0 !important;\n display: flex;\n justify-content: space-around;\n align-items: center;\n}";
|
|
@@ -58681,29 +58681,6 @@ var getSeparatorPosition = function (separatorRef, drag) {
|
|
|
58681
58681
|
return clampSeparator({ value: value });
|
|
58682
58682
|
};
|
|
58683
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
|
-
|
|
58707
58684
|
/**
|
|
58708
58685
|
* It captures window events to report a new position.
|
|
58709
58686
|
* Provides necessary handlers for separator.
|
|
@@ -58747,7 +58724,6 @@ var animateSeparator = function (separatorRef, animate) {
|
|
|
58747
58724
|
var splitter = separator === null || separator === void 0 ? void 0 : separator.parentElement;
|
|
58748
58725
|
if (separator && splitter) {
|
|
58749
58726
|
if (animate === 'clear-transition') {
|
|
58750
|
-
transition(separatorRef).stop();
|
|
58751
58727
|
splitter.style.cursor =
|
|
58752
58728
|
separator.getAttribute('aria-orientation') === 'vertical'
|
|
58753
58729
|
? 'col-resize'
|
|
@@ -58755,22 +58731,40 @@ var animateSeparator = function (separatorRef, animate) {
|
|
|
58755
58731
|
splitter.classList.add('resizing');
|
|
58756
58732
|
}
|
|
58757
58733
|
else {
|
|
58758
|
-
transition(separatorRef).resume();
|
|
58759
58734
|
splitter.style.cursor = '';
|
|
58760
58735
|
splitter.classList.remove('resizing');
|
|
58761
58736
|
}
|
|
58762
58737
|
}
|
|
58763
58738
|
};
|
|
58764
58739
|
|
|
58765
|
-
var
|
|
58766
|
-
|
|
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]);
|
|
58740
|
+
var transitionFactory = function (attrs, ms) {
|
|
58741
|
+
return attrs.map(function (key) { return "".concat(key, " ").concat(ms, "ms"); }).join(', ');
|
|
58773
58742
|
};
|
|
58743
|
+
var barTransition = function (ms) {
|
|
58744
|
+
return transitionFactory(['left', 'top', 'right', 'bottom'], ms);
|
|
58745
|
+
};
|
|
58746
|
+
var gridTransition = function (ms) {
|
|
58747
|
+
return transitionFactory(['grid-template-columns', 'grid-template-rows'], ms);
|
|
58748
|
+
};
|
|
58749
|
+
var transition = function (props) {
|
|
58750
|
+
var _a;
|
|
58751
|
+
var separator = Object.hasOwn(props, 'current')
|
|
58752
|
+
? props
|
|
58753
|
+
: { current: props };
|
|
58754
|
+
var splitter = (_a = separator.current) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
58755
|
+
var delay = function (ms) {
|
|
58756
|
+
if (splitter) {
|
|
58757
|
+
separator.current.style.transition = barTransition(ms);
|
|
58758
|
+
splitter.style.transition = gridTransition(ms);
|
|
58759
|
+
}
|
|
58760
|
+
};
|
|
58761
|
+
var stop = function () { return delay(0); };
|
|
58762
|
+
var resume = function () {
|
|
58763
|
+
return delay((splitter === null || splitter === void 0 ? void 0 : splitter.classList.contains('resizing')) ? 0 : 300);
|
|
58764
|
+
};
|
|
58765
|
+
return { stop: stop, resume: resume };
|
|
58766
|
+
};
|
|
58767
|
+
|
|
58774
58768
|
/**
|
|
58775
58769
|
* Moves separator as per ratio changes. Centers on first render if ratio is undefined.
|
|
58776
58770
|
*/
|
|
@@ -58779,6 +58773,9 @@ var useRatioEffect = function (setValueNow, separator, ratio, startAt) {
|
|
|
58779
58773
|
var _a = getSeparatorAttributes({ ref: separator }), valueMax = _a.valueMax, valueMin = _a.valueMin;
|
|
58780
58774
|
var isCalculating = valueMax === Infinity || valueMin === -Infinity;
|
|
58781
58775
|
React.useEffect(function () {
|
|
58776
|
+
if (!firstRun.current && ratio !== undefined && !isCalculating) {
|
|
58777
|
+
transition(separator).resume();
|
|
58778
|
+
}
|
|
58782
58779
|
if (firstRun.current || ratio !== undefined || isCalculating) {
|
|
58783
58780
|
firstRun.current = false;
|
|
58784
58781
|
// If ratio is undefined, setValueNow will place the separator in the middle as a starting point.
|
|
@@ -58791,7 +58788,6 @@ var useRatioEffect = function (setValueNow, separator, ratio, startAt) {
|
|
|
58791
58788
|
* Re-arranges the splitter if the limits or orientation change.
|
|
58792
58789
|
*/
|
|
58793
58790
|
var useConfigEffect = function (setValueNow, separator) {
|
|
58794
|
-
var setValueNow_static = useSetValueNow_static(setValueNow, separator);
|
|
58795
58791
|
React.useEffect(function () {
|
|
58796
58792
|
var callback = function (attr) {
|
|
58797
58793
|
return function (_a) {
|
|
@@ -58808,7 +58804,7 @@ var useConfigEffect = function (setValueNow, separator) {
|
|
|
58808
58804
|
// In such case, the newValueNow is moved along with the delimiter.
|
|
58809
58805
|
var newValueNow = !wasInBoundary ? valueNow : newValue;
|
|
58810
58806
|
if (wasInBoundary || valueMax < valueNow || valueMin > valueNow) {
|
|
58811
|
-
|
|
58807
|
+
setValueNow(newValueNow, { min: valueMin, max: valueMax });
|
|
58812
58808
|
}
|
|
58813
58809
|
else {
|
|
58814
58810
|
var threshold = 0.01;
|
|
@@ -58827,7 +58823,7 @@ var useConfigEffect = function (setValueNow, separator) {
|
|
|
58827
58823
|
}
|
|
58828
58824
|
var newVal = ((primary + offset) / container) * 100;
|
|
58829
58825
|
if (Math.abs(newVal - valueNow) >= threshold) {
|
|
58830
|
-
|
|
58826
|
+
setValueNow(newVal, { min: valueMin, max: valueMax });
|
|
58831
58827
|
}
|
|
58832
58828
|
}
|
|
58833
58829
|
};
|
|
@@ -58857,16 +58853,22 @@ var useConfigEffect = function (setValueNow, separator) {
|
|
|
58857
58853
|
var useValueNowEffect = function (setValueNow, separator) {
|
|
58858
58854
|
React.useEffect(function () {
|
|
58859
58855
|
var observer = new MutationObserver(function (_a) {
|
|
58860
|
-
var
|
|
58856
|
+
var _b = _a[0], target = _b.target, oldValue = _b.oldValue;
|
|
58861
58857
|
var el = target;
|
|
58862
58858
|
var splitter = target.parentElement;
|
|
58863
58859
|
var newValueNow = Number(el.getAttribute('aria-valuenow'));
|
|
58864
58860
|
if (!splitter.classList.contains('resizing')) {
|
|
58865
|
-
|
|
58861
|
+
if (Number(oldValue) !== newValueNow) {
|
|
58862
|
+
transition(separator).resume();
|
|
58863
|
+
setValueNow(newValueNow);
|
|
58864
|
+
}
|
|
58866
58865
|
}
|
|
58867
58866
|
});
|
|
58868
58867
|
var attributeFilter = ['aria-valuenow'];
|
|
58869
|
-
observer.observe(separator.current, {
|
|
58868
|
+
observer.observe(separator.current, {
|
|
58869
|
+
attributeFilter: attributeFilter,
|
|
58870
|
+
attributeOldValue: true
|
|
58871
|
+
});
|
|
58870
58872
|
return function () { return observer.disconnect(); };
|
|
58871
58873
|
}, [separator, setValueNow]);
|
|
58872
58874
|
};
|
|
@@ -59155,19 +59157,26 @@ var Separator = React.forwardRef(function (_a, forwardRef) {
|
|
|
59155
59157
|
var _a;
|
|
59156
59158
|
var newValueNow = keyDownHandler(e);
|
|
59157
59159
|
if (values().valueNow !== newValueNow) {
|
|
59160
|
+
transition(separator).resume();
|
|
59158
59161
|
setValueNow(newValueNow);
|
|
59159
59162
|
e.preventDefault();
|
|
59160
59163
|
}
|
|
59161
59164
|
(_a = props === null || props === void 0 ? void 0 : props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
59162
|
-
}, className: clsx('Separator', props.className)
|
|
59165
|
+
}, className: clsx('Separator', props.className), onTransitionEnd: function (e) {
|
|
59166
|
+
var _a;
|
|
59167
|
+
transition(separator).stop();
|
|
59168
|
+
(_a = props.onTransitionEnd) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
59169
|
+
} }),
|
|
59163
59170
|
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 }),
|
|
59164
59171
|
React__default["default"].createElement(Control, __assign({}, parts === null || parts === void 0 ? void 0 : parts.primary, { side: "primary", onClick: function (e) {
|
|
59165
59172
|
var _a, _b;
|
|
59173
|
+
transition(separator).resume();
|
|
59166
59174
|
setValueNow(controlClickHandler(e, 'primary'));
|
|
59167
59175
|
(_b = (_a = parts === null || parts === void 0 ? void 0 : parts.primary) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
59168
59176
|
} })),
|
|
59169
59177
|
React__default["default"].createElement(Control, __assign({}, parts === null || parts === void 0 ? void 0 : parts.secondary, { side: "secondary", onClick: function (e) {
|
|
59170
59178
|
var _a, _b;
|
|
59179
|
+
transition(separator).resume();
|
|
59171
59180
|
setValueNow(controlClickHandler(e, 'secondary'));
|
|
59172
59181
|
(_b = (_a = parts === null || parts === void 0 ? void 0 : parts.secondary) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
59173
59182
|
} })))));
|