@linzjs/lui 21.27.0 → 21.28.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 +7 -0
- package/dist/components/LuiModal/LuiModal.d.ts +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/lui.esm.js +15 -2
- package/dist/lui.esm.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [21.28.0](https://github.com/linz/lui/compare/v21.27.0...v21.28.0) (2024-05-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Make change to trigger deploy to npm of LuiModal shouldCloseOnEsc key-up ([#1115](https://github.com/linz/lui/issues/1115)) ([f7a1215](https://github.com/linz/lui/commit/f7a1215d7ee8ec6a63180498f1a127f5cebd0fc7))
|
|
7
|
+
|
|
1
8
|
# [21.27.0](https://github.com/linz/lui/compare/v21.26.3...v21.27.0) (2024-04-24)
|
|
2
9
|
|
|
3
10
|
|
package/dist/index.js
CHANGED
|
@@ -42182,7 +42182,7 @@ var FeatureIFrame = function (_a) {
|
|
|
42182
42182
|
};
|
|
42183
42183
|
|
|
42184
42184
|
var LuiModal = function (props) {
|
|
42185
|
-
var _a
|
|
42185
|
+
var _a;
|
|
42186
42186
|
var node = React.useRef(null);
|
|
42187
42187
|
var handleClickOutside = React.useCallback(function (e) {
|
|
42188
42188
|
// current DOES have a contains!
|
|
@@ -42209,7 +42209,20 @@ var LuiModal = function (props) {
|
|
|
42209
42209
|
Modal.setAppElement('#root');
|
|
42210
42210
|
}
|
|
42211
42211
|
}
|
|
42212
|
-
|
|
42212
|
+
React.useEffect(function () {
|
|
42213
|
+
var handleKeyUp = function (e) {
|
|
42214
|
+
var _a;
|
|
42215
|
+
if (props.shouldCloseOnEsc === 'use-keyup' && e.key === 'Escape') {
|
|
42216
|
+
e.stopPropagation();
|
|
42217
|
+
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
42218
|
+
}
|
|
42219
|
+
};
|
|
42220
|
+
document.addEventListener('keyup', handleKeyUp);
|
|
42221
|
+
return function () {
|
|
42222
|
+
document.removeEventListener('keyup', handleKeyUp);
|
|
42223
|
+
};
|
|
42224
|
+
}, [props.shouldCloseOnEsc, props.onClose]);
|
|
42225
|
+
return (React__default["default"].createElement(Modal, __assign({ key: props.key, isOpen: true, shouldCloseOnOverlayClick: props.shouldCloseOnOverlayClick, shouldCloseOnEsc: props.shouldCloseOnEsc === true || props.shouldCloseOnEsc === undefined, onRequestClose: props.onClose, overlayClassName: "modal", className: props.lowContrast ? 'lui-scrim-low-contrast' : 'lui-scrim', ariaHideApp: !isTest }, (props.appendToElement && {
|
|
42213
42226
|
parentSelector: props.appendToElement
|
|
42214
42227
|
})),
|
|
42215
42228
|
React__default["default"].createElement("div", { ref: node, className: clsx('lui-modal lui-box-shadow', props.maxWidth && 'lui-max-width', props.headingText && 'lui-modal-no-padding', props.className) },
|