@linzjs/lui 21.23.0 → 21.24.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/CHANGELOG.md +14 -0
- package/dist/components/LuiTabs/LuiTab/LuiTab.d.ts +1 -0
- package/dist/components/Splitter/helpers/useValueSeparator.d.ts +2 -0
- package/dist/components/Splitter/helpers/useValueSeparatorEffects.d.ts +5 -0
- package/dist/index.js +53 -18
- package/dist/index.js.map +1 -1
- package/dist/lui.css +20 -0
- package/dist/lui.css.map +1 -1
- package/dist/lui.esm.js +53 -18
- package/dist/lui.esm.js.map +1 -1
- package/dist/scss/Components/LuiTabs/LuiTab/LuiTab.scss +23 -0
- package/dist/scss/Components/LuiTabs/LuiTabsGroup/LuiTabsGroup.scss +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [21.24.0](https://github.com/linz/lui/compare/v21.23.1...v21.24.0) (2024-02-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **LuiTab errors:** create release for single tab to error state ([#1100](https://github.com/linz/lui/issues/1100)) ([2ce2fef](https://github.com/linz/lui/commit/2ce2fef18551183f3a609d483a01f8bfbfce1faf))
|
|
7
|
+
|
|
8
|
+
## [21.23.1](https://github.com/linz/lui/compare/v21.23.0...v21.23.1) (2024-02-22)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **Splitter:** stop flashing behavior ([#1074](https://github.com/linz/lui/issues/1074)) ([3ebae79](https://github.com/linz/lui/commit/3ebae794183327d144d0d6c8d8985f3bb3326fdf))
|
|
14
|
+
|
|
1
15
|
# [21.23.0](https://github.com/linz/lui/compare/v21.22.0...v21.23.0) (2024-02-21)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -2,6 +2,8 @@ import { RefObject } from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* Ensures valueNow is set to a valid value within its allowed boundaries.
|
|
4
4
|
* If boundaries and/or initialRatio are not specified, they will be defaulted.
|
|
5
|
+
* It's possible that multiple events trigger setValueNow simultaneosly with the same value.
|
|
6
|
+
* This multiple calls are expected, and setValueNow will resize only once.
|
|
5
7
|
*/
|
|
6
8
|
export declare const useValueSeparator: ({ separator, ratio, onResized, boundaries: { min, max }, }: {
|
|
7
9
|
ratio?: number | undefined;
|
package/dist/index.js
CHANGED
|
@@ -31661,7 +31661,9 @@ var LuiTabs = function (props) {
|
|
|
31661
31661
|
};
|
|
31662
31662
|
|
|
31663
31663
|
var LuiTab = function (props) {
|
|
31664
|
-
return (React__default["default"].createElement("button", __assign({ className: clsx('LuiTab', props.active && 'LuiTab--active'), id: props.id, role: "tab", type: "button", "aria-selected": props.active, "aria-controls": "".concat(props.ariaControls), title: props.titleAttribute, onClick: props.onClick }, props.buttonProps),
|
|
31664
|
+
return (React__default["default"].createElement("button", __assign({ className: clsx('LuiTab', props.active && 'LuiTab--active', props.inError && 'LuiTab--error'), id: props.id, role: "tab", type: "button", "aria-selected": props.active, "aria-controls": "".concat(props.ariaControls), title: props.titleAttribute, onClick: props.onClick }, props.buttonProps),
|
|
31665
|
+
props.inError && (React__default["default"].createElement(LuiIcon, { name: "ic_error_outline", size: "md", className: "tabErrorIcon", alt: "There is an error in this tabs content" })),
|
|
31666
|
+
props.children));
|
|
31665
31667
|
};
|
|
31666
31668
|
|
|
31667
31669
|
// import './LuiTabsGroup.scss';
|
|
@@ -58680,25 +58682,23 @@ var animateSeparator = function (separatorRef, animate) {
|
|
|
58680
58682
|
};
|
|
58681
58683
|
|
|
58682
58684
|
/**
|
|
58683
|
-
*
|
|
58684
|
-
* If boundaries and/or initialRatio are not specified, they will be defaulted.
|
|
58685
|
+
* Moves separator as per ratio changes. Centers on first render if ratio is undefined.
|
|
58685
58686
|
*/
|
|
58686
|
-
var
|
|
58687
|
-
var
|
|
58688
|
-
var prev = React.useRef();
|
|
58689
|
-
var setValueNow = React.useCallback(function (val) {
|
|
58690
|
-
var valueNow = getSeparatorAttributes({ ref: separator }).valueNow;
|
|
58691
|
-
var value = val !== null && val !== void 0 ? val : (valueNow || min + (max - min) / 2);
|
|
58692
|
-
var newValue = clampSeparator({ value: value, max: max, min: min });
|
|
58693
|
-
resize(separator, newValue);
|
|
58694
|
-
if (prev.current !== newValue) {
|
|
58695
|
-
prev.current = newValue;
|
|
58696
|
-
onResized === null || onResized === void 0 ? void 0 : onResized(newValue);
|
|
58697
|
-
}
|
|
58698
|
-
}, [onResized, min, max, prev]);
|
|
58687
|
+
var useRatioEffect = function (setValueNow, ratio) {
|
|
58688
|
+
var firstRun = React.useRef(true);
|
|
58699
58689
|
React.useEffect(function () {
|
|
58700
|
-
|
|
58701
|
-
|
|
58690
|
+
if (firstRun.current || ratio !== undefined) {
|
|
58691
|
+
firstRun.current = false;
|
|
58692
|
+
// If ratio is undefined, setValueNow will place the separator in the middle as a starting point.
|
|
58693
|
+
// Whatever value is `the middle` will be determined by setValueNow
|
|
58694
|
+
setValueNow(ratio);
|
|
58695
|
+
}
|
|
58696
|
+
}, [setValueNow, ratio, firstRun]);
|
|
58697
|
+
};
|
|
58698
|
+
/**
|
|
58699
|
+
* Re-arranges the splitter if the limits or orientation change.
|
|
58700
|
+
*/
|
|
58701
|
+
var useConfigEffect = function (setValueNow, separator) {
|
|
58702
58702
|
React.useEffect(function () {
|
|
58703
58703
|
var callback = function () {
|
|
58704
58704
|
var value = getSeparatorAttributes({ ref: separator }).valueNow;
|
|
@@ -58711,6 +58711,11 @@ var useValueSeparator = function (_a) {
|
|
|
58711
58711
|
});
|
|
58712
58712
|
return function () { return observer.disconnect(); };
|
|
58713
58713
|
}, [separator, setValueNow]);
|
|
58714
|
+
};
|
|
58715
|
+
/**
|
|
58716
|
+
* Broadcasts changes if separator aria-valuenow was altered.
|
|
58717
|
+
*/
|
|
58718
|
+
var useValueNowEffect = function (setValueNow, separator) {
|
|
58714
58719
|
React.useEffect(function () {
|
|
58715
58720
|
var observer = new MutationObserver(function (_a) {
|
|
58716
58721
|
var target = _a[0].target;
|
|
@@ -58725,6 +58730,36 @@ var useValueSeparator = function (_a) {
|
|
|
58725
58730
|
observer.observe(separator.current, { attributeFilter: attributeFilter });
|
|
58726
58731
|
return function () { return observer.disconnect(); };
|
|
58727
58732
|
}, [separator, setValueNow]);
|
|
58733
|
+
};
|
|
58734
|
+
/**
|
|
58735
|
+
* Calls setValueNow when the separator attributes change.
|
|
58736
|
+
*/
|
|
58737
|
+
var useValueSeparatorEffects = function (setValueNow, separator, ratio) {
|
|
58738
|
+
useRatioEffect(setValueNow, ratio);
|
|
58739
|
+
useConfigEffect(setValueNow, separator);
|
|
58740
|
+
useValueNowEffect(setValueNow, separator);
|
|
58741
|
+
};
|
|
58742
|
+
|
|
58743
|
+
/**
|
|
58744
|
+
* Ensures valueNow is set to a valid value within its allowed boundaries.
|
|
58745
|
+
* If boundaries and/or initialRatio are not specified, they will be defaulted.
|
|
58746
|
+
* It's possible that multiple events trigger setValueNow simultaneosly with the same value.
|
|
58747
|
+
* This multiple calls are expected, and setValueNow will resize only once.
|
|
58748
|
+
*/
|
|
58749
|
+
var useValueSeparator = function (_a) {
|
|
58750
|
+
var separator = _a.separator, ratio = _a.ratio, onResized = _a.onResized, _b = _a.boundaries, min = _b.min, max = _b.max;
|
|
58751
|
+
var prev = React.useRef(null);
|
|
58752
|
+
var setValueNow = React.useCallback(function (val) {
|
|
58753
|
+
var valueNow = getSeparatorAttributes({ ref: separator }).valueNow;
|
|
58754
|
+
var value = val !== null && val !== void 0 ? val : (valueNow || min + (max - min) / 2);
|
|
58755
|
+
var newValue = clampSeparator({ value: value, max: max, min: min });
|
|
58756
|
+
resize(separator, newValue);
|
|
58757
|
+
if (prev.current !== newValue) {
|
|
58758
|
+
prev.current = newValue;
|
|
58759
|
+
onResized === null || onResized === void 0 ? void 0 : onResized(newValue);
|
|
58760
|
+
}
|
|
58761
|
+
}, [onResized, min, max, prev]);
|
|
58762
|
+
useValueSeparatorEffects(setValueNow, separator, ratio);
|
|
58728
58763
|
return { setValueNow: setValueNow };
|
|
58729
58764
|
};
|
|
58730
58765
|
var resize = function (separator, value) {
|