@linzjs/lui 22.8.0 → 22.9.1
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
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [22.9.1](https://github.com/linz/lui/compare/v22.9.0...v22.9.1) (2025-03-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **SearchInput:** SEARCH-7090 additional control prop for LuiSearchInput disclaimer ([#1200](https://github.com/linz/lui/issues/1200)) ([8438af1](https://github.com/linz/lui/commit/8438af1e81ae084452a383925074efd16b80307c))
|
|
7
|
+
|
|
8
|
+
# [22.9.0](https://github.com/linz/lui/compare/v22.8.0...v22.9.0) (2025-02-26)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* Adding an accessible name to the modal via headingText making it easier to write tests for modals ([#1198](https://github.com/linz/lui/issues/1198)) ([d0a0441](https://github.com/linz/lui/commit/d0a04418f1915274cfddd7a3657d479c3b046bd5))
|
|
14
|
+
|
|
1
15
|
# [22.8.0](https://github.com/linz/lui/compare/v22.7.0...v22.8.0) (2025-02-25)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -21,5 +21,6 @@ export interface ISearchInputProps<SearchResult extends ISearchResult = ISearchR
|
|
|
21
21
|
externalSearch?: boolean;
|
|
22
22
|
onSearch?: (searchString: string) => void;
|
|
23
23
|
validateInput?: (input: string) => InputValidationResult | undefined;
|
|
24
|
+
hideDisclaimerOnFail?: boolean;
|
|
24
25
|
}
|
|
25
26
|
export declare const LuiSearchInput: <SearchResult extends ISearchResult = ISearchResult>(props: React.PropsWithChildren<ISearchInputProps<SearchResult>>) => JSX.Element;
|
|
@@ -14,3 +14,7 @@ export declare const useEscapeFunction: (onEscape: (e: KeyboardEvent) => void |
|
|
|
14
14
|
* @return a react ref which can be bound to an html element
|
|
15
15
|
*/
|
|
16
16
|
export declare const usePageClickFunction: <H extends Element>(onClickInsideArg: (event: MouseEvent) => void, onClickOutsideArg: (event: MouseEvent) => void) => import("react").RefObject<H>;
|
|
17
|
+
/**
|
|
18
|
+
* Provides a stable ID across renders, can be replaced in react 18+ by native implementation
|
|
19
|
+
*/
|
|
20
|
+
export declare function useId(): string;
|
package/dist/index.js
CHANGED
|
@@ -39925,7 +39925,17 @@ var usePageClickFunction = function (onClickInsideArg, onClickOutsideArg) {
|
|
|
39925
39925
|
};
|
|
39926
39926
|
}, [elementRef, onClickInside, onClickOutside]);
|
|
39927
39927
|
return elementRef;
|
|
39928
|
-
};
|
|
39928
|
+
};
|
|
39929
|
+
/**
|
|
39930
|
+
* Provides a stable ID across renders, can be replaced in react 18+ by native implementation
|
|
39931
|
+
*/
|
|
39932
|
+
function useId() {
|
|
39933
|
+
var idRef = React.useRef('');
|
|
39934
|
+
if (idRef.current === '') {
|
|
39935
|
+
idRef.current = v4();
|
|
39936
|
+
}
|
|
39937
|
+
return idRef.current;
|
|
39938
|
+
}
|
|
39929
39939
|
|
|
39930
39940
|
var sizes = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
39931
39941
|
var buildHideClassDict = function (_a) {
|
|
@@ -42299,6 +42309,8 @@ var _a;
|
|
|
42299
42309
|
var LuiModalV2 = function (props) {
|
|
42300
42310
|
var _a;
|
|
42301
42311
|
var modalRef = React.useRef(null);
|
|
42312
|
+
var rootId = useId();
|
|
42313
|
+
var headingTextId = "".concat(rootId, "_headingText");
|
|
42302
42314
|
var handleClickOutside = React.useCallback(function () { var _a; return props.shouldCloseOnOverlayClick && ((_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props)); }, [props.shouldCloseOnEsc, props.onClose]);
|
|
42303
42315
|
useClickedOutsideElement(modalRef, handleClickOutside);
|
|
42304
42316
|
var handleEsc = React.useCallback(function (e) {
|
|
@@ -42325,7 +42337,7 @@ var LuiModalV2 = function (props) {
|
|
|
42325
42337
|
// disble the `shouldClose` props as we handle them ourselves
|
|
42326
42338
|
shouldCloseOnOverlayClick: false, shouldCloseOnEsc: false, overlayClassName: "modal", className: props.lowContrast ? 'lui-scrim-low-contrast' : 'lui-scrim', appElement: document.getElementById('root'),
|
|
42327
42339
|
// required to prevent warnings that are not applicable in real usage
|
|
42328
|
-
ariaHideApp: !isTest, parentSelector: props.appendToElement },
|
|
42340
|
+
ariaHideApp: !isTest, parentSelector: props.appendToElement, aria: { labelledby: props.headingText ? headingTextId : undefined } },
|
|
42329
42341
|
React__default["default"].createElement("div", { ref: function (el) {
|
|
42330
42342
|
modalRef.current = el;
|
|
42331
42343
|
handleAutoFocus(el);
|
|
@@ -42334,7 +42346,7 @@ var LuiModalV2 = function (props) {
|
|
|
42334
42346
|
props.isLoading && (React__default["default"].createElement(LuiMiniSpinner, { size: 20, divProps: { className: 'lui-modal-v2-header-spinner' } })),
|
|
42335
42347
|
showHeadingIcon && (React__default["default"].createElement("div", { className: "lui-modal-v2-header-icon" },
|
|
42336
42348
|
React__default["default"].createElement(LuiIcon, __assign({ size: "md", name: "", alt: "Help" }, props.headingIcon, { className: clsx('', (_a = props.headingIcon) === null || _a === void 0 ? void 0 : _a.className) })))),
|
|
42337
|
-
props.headingText && (React__default["default"].createElement("h2", { className: "lui-modal-v2-header-title" }, props.headingText)),
|
|
42349
|
+
props.headingText && (React__default["default"].createElement("h2", { id: headingTextId, className: "lui-modal-v2-header-title" }, props.headingText)),
|
|
42338
42350
|
showButtons && (React__default["default"].createElement("div", { className: "lui-modal-v2-header-buttons" },
|
|
42339
42351
|
showHelpButton && React__default["default"].createElement(HelpButton, { helpLink: props.helpLink }),
|
|
42340
42352
|
showCloseButton && React__default["default"].createElement(CloseButton, { onClose: props.onClose })))),
|
|
@@ -42752,6 +42764,16 @@ var LuiSearchInput = function (props) {
|
|
|
42752
42764
|
}
|
|
42753
42765
|
return 'No results available. Please refine your search and try again.';
|
|
42754
42766
|
}
|
|
42767
|
+
function determineDisclaimer() {
|
|
42768
|
+
if (props.hideDisclaimerOnFail && noOptionsMessage(typedValue))
|
|
42769
|
+
return null;
|
|
42770
|
+
if (props.disclaimer && haveFocus) {
|
|
42771
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
42772
|
+
React__default["default"].createElement("hr", { className: "LuiSearchInput-resultSeparator" }),
|
|
42773
|
+
React__default["default"].createElement("div", { "data-testid": "disclaimer", className: "LuiSearchInput-disclaimer" }, props.disclaimer)));
|
|
42774
|
+
}
|
|
42775
|
+
return null;
|
|
42776
|
+
}
|
|
42755
42777
|
return props.onSearch ? (React__default["default"].createElement(ControlledPassiveSearchInputComponent, __assign({ typedValue: typedValue, setTypedValue: setTypedValue }, props, { minCharactersForSearch: props.minCharactersForSearch, placeholderText: props.placeholderText, onSearch: props.onSearch, disclaimer: props.disclaimer, initialValue: props.initialValue, inputTransformer: props.inputTransformer, focusUpdate: props.focusUpdate, onClearCallback: props.onClearCallback, onClickInput: props.onClickInput, validateInput: props.validateInput }))) : (React__default["default"].createElement("div", { className: "LuiSearchInput", onClick: props.onClickInput },
|
|
42756
42778
|
React__default["default"].createElement("span", { className: "LuiSearchInput-inputWrapper" },
|
|
42757
42779
|
searchIcon,
|
|
@@ -42771,9 +42793,7 @@ var LuiSearchInput = function (props) {
|
|
|
42771
42793
|
noOptionsMessage(typedValue) && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
42772
42794
|
React__default["default"].createElement("hr", { className: "LuiSearchInput-resultSeparator" }),
|
|
42773
42795
|
React__default["default"].createElement("div", { "data-testid": "no-result-msg", className: "LuiSearchInput-disclaimer" }, noOptionsMessage(typedValue)))),
|
|
42774
|
-
|
|
42775
|
-
React__default["default"].createElement("hr", { className: "LuiSearchInput-resultSeparator" }),
|
|
42776
|
-
React__default["default"].createElement("div", { "data-testid": "disclaimer", className: "LuiSearchInput-disclaimer" }, props.disclaimer)))));
|
|
42796
|
+
determineDisclaimer()));
|
|
42777
42797
|
};
|
|
42778
42798
|
|
|
42779
42799
|
var resultStyle = { verticalAlign: 'middle' };
|