@ballistix.digital/react-components 9.2.2-rc-341.0 → 9.2.2-rc-342.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/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +38 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +38 -3
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4947,8 +4947,8 @@ var $58654b0ec0449aca$export$2e2bcd8739ae039 = $58654b0ec0449aca$var$styles;
|
|
|
4947
4947
|
|
|
4948
4948
|
|
|
4949
4949
|
var $4d17f0429978b255$var$ModalOverlay = function(props) {
|
|
4950
|
-
var children = props.children, trigger = props.trigger, _a = props.size, size = _a === void 0 ? 'md' : _a, stylesOverrides = props.styles, dataCy = props.dataCy, onOpen = props.onOpen, onClose = props.onClose;
|
|
4951
|
-
var
|
|
4950
|
+
var children = props.children, trigger = props.trigger, _a = props.size, size = _a === void 0 ? 'md' : _a, stylesOverrides = props.styles, dataCy = props.dataCy, onOpen = props.onOpen, onClose = props.onClose, _b = props.closeOnOutsideClick, closeOnOutsideClick = _b === void 0 ? true : _b, _c = props.closeOnEscape, closeOnEscape = _c === void 0 ? true : _c;
|
|
4951
|
+
var _d = (0, $iA2ta$react.useState)(trigger ? false : true), isOpen = _d[0], setIsOpen = _d[1];
|
|
4952
4952
|
var handleClose = (0, $iA2ta$react.useCallback)(function() {
|
|
4953
4953
|
setIsOpen(false);
|
|
4954
4954
|
if (onClose) setTimeout(onClose, 180);
|
|
@@ -4980,6 +4980,39 @@ var $4d17f0429978b255$var$ModalOverlay = function(props) {
|
|
|
4980
4980
|
isOpen,
|
|
4981
4981
|
onOpen
|
|
4982
4982
|
]);
|
|
4983
|
+
(0, $iA2ta$react.useEffect)(function() {
|
|
4984
|
+
if (!closeOnEscape || !isOpen) return;
|
|
4985
|
+
var onKeyDown = function(event) {
|
|
4986
|
+
if (event.key === 'Escape') handleClose();
|
|
4987
|
+
};
|
|
4988
|
+
window.addEventListener('keydown', onKeyDown);
|
|
4989
|
+
return function() {
|
|
4990
|
+
window.removeEventListener('keydown', onKeyDown);
|
|
4991
|
+
};
|
|
4992
|
+
}, [
|
|
4993
|
+
closeOnEscape,
|
|
4994
|
+
handleClose,
|
|
4995
|
+
isOpen
|
|
4996
|
+
]);
|
|
4997
|
+
var isStatic = (0, $iA2ta$react.useMemo)(function() {
|
|
4998
|
+
return !closeOnOutsideClick || !closeOnEscape;
|
|
4999
|
+
}, [
|
|
5000
|
+
closeOnOutsideClick,
|
|
5001
|
+
closeOnEscape
|
|
5002
|
+
]);
|
|
5003
|
+
var handleClickOutsideDialog = (0, $iA2ta$react.useCallback)(function() {
|
|
5004
|
+
if (isStatic && closeOnOutsideClick) handleClose();
|
|
5005
|
+
}, [
|
|
5006
|
+
isStatic,
|
|
5007
|
+
closeOnOutsideClick,
|
|
5008
|
+
handleClose
|
|
5009
|
+
]);
|
|
5010
|
+
var handleCloseDialog = (0, $iA2ta$react.useCallback)(function() {
|
|
5011
|
+
if (!isStatic) handleClose();
|
|
5012
|
+
}, [
|
|
5013
|
+
isStatic,
|
|
5014
|
+
handleClose
|
|
5015
|
+
]);
|
|
4983
5016
|
return (0, $iA2ta$reactjsxruntime.jsxs)((0, $iA2ta$reactjsxruntime.Fragment), {
|
|
4984
5017
|
children: [
|
|
4985
5018
|
(0, $iA2ta$reactjsxruntime.jsx)((0, $iA2ta$headlessuireact.Transition), {
|
|
@@ -4988,7 +5021,8 @@ var $4d17f0429978b255$var$ModalOverlay = function(props) {
|
|
|
4988
5021
|
children: (0, $iA2ta$reactjsxruntime.jsxs)((0, $iA2ta$headlessuireact.Dialog), {
|
|
4989
5022
|
as: "div",
|
|
4990
5023
|
className: styles.container,
|
|
4991
|
-
onClose:
|
|
5024
|
+
onClose: handleCloseDialog,
|
|
5025
|
+
static: isStatic,
|
|
4992
5026
|
children: [
|
|
4993
5027
|
(0, $iA2ta$reactjsxruntime.jsx)((0, $iA2ta$headlessuireact.TransitionChild), {
|
|
4994
5028
|
as: (0, $iA2ta$react.Fragment),
|
|
@@ -5005,6 +5039,7 @@ var $4d17f0429978b255$var$ModalOverlay = function(props) {
|
|
|
5005
5039
|
(0, $iA2ta$reactjsxruntime.jsx)("div", {
|
|
5006
5040
|
className: styles.layout.container,
|
|
5007
5041
|
children: (0, $iA2ta$reactjsxruntime.jsx)("div", {
|
|
5042
|
+
onClick: handleClickOutsideDialog,
|
|
5008
5043
|
className: styles.layout.content,
|
|
5009
5044
|
"data-cy": dataCy,
|
|
5010
5045
|
children: (0, $iA2ta$reactjsxruntime.jsx)((0, $iA2ta$headlessuireact.TransitionChild), {
|