@panneau/element-modal 4.0.1 → 4.0.4
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/es/index.js +20 -16
- package/package.json +6 -6
package/es/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import
|
|
3
|
+
import { useMemo, useEffect, useRef } from 'react';
|
|
4
4
|
import { getDisplayName } from '@panneau/core/utils';
|
|
5
5
|
import ReactDOM from 'react-dom';
|
|
6
6
|
import { useModal } from '@panneau/core/contexts';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
8
|
import { useKeyboardKeys, KEYCODES } from '@panneau/core/hooks';
|
|
8
9
|
|
|
9
|
-
/* eslint-disable react/no-array-index-key, react/jsx-props-no-spreading */
|
|
10
10
|
function ModalPortal(_ref) {
|
|
11
11
|
var _ref$id = _ref.id,
|
|
12
12
|
id = _ref$id === void 0 ? null : _ref$id,
|
|
@@ -60,15 +60,18 @@ function Modal(_ref) {
|
|
|
60
60
|
onClose: onClose
|
|
61
61
|
};
|
|
62
62
|
}, [title, onClose]);
|
|
63
|
-
return /*#__PURE__*/
|
|
63
|
+
return /*#__PURE__*/jsx(ModalPortal, {
|
|
64
64
|
id: finalId,
|
|
65
|
-
data: data
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
data: data,
|
|
66
|
+
children: /*#__PURE__*/jsx("div", {
|
|
67
|
+
className: classNames([styles.modal, _defineProperty({}, styles[position], position !== null)]),
|
|
68
|
+
children: /*#__PURE__*/jsx("div", {
|
|
69
|
+
className: classNames(['modal', 'fade', 'show', 'd-block', styles.inner]),
|
|
70
|
+
tabIndex: -1,
|
|
71
|
+
children: children
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
});
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
function Modals(_ref) {
|
|
@@ -99,16 +102,17 @@ function Modals(_ref) {
|
|
|
99
102
|
}
|
|
100
103
|
}, [modals]);
|
|
101
104
|
useKeyboardKeys(_defineProperty({}, KEYCODES.ESCAPE, closeLastModal));
|
|
102
|
-
return /*#__PURE__*/
|
|
105
|
+
return /*#__PURE__*/jsx("div", {
|
|
103
106
|
className: classNames([styles.modalsContainer, _defineProperty({}, className, className !== null)]),
|
|
104
107
|
"data-bs-theme": theme !== null ? theme : undefined,
|
|
105
108
|
style: {
|
|
106
109
|
color: theme === 'dark' ? '#FFF' : undefined
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
},
|
|
111
|
+
children: /*#__PURE__*/jsx("div", {
|
|
112
|
+
className: classNames([styles.modals, _defineProperty({}, styles.hasModals, modals !== null && modals.length > 0)]),
|
|
113
|
+
ref: containerRef
|
|
114
|
+
})
|
|
115
|
+
});
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
export { Modal, ModalPortal, Modals, Modal as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/element-modal",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "Modal element",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@babel/runtime": "^7.12.5",
|
|
54
|
-
"@panneau/core": "^4.0.
|
|
55
|
-
"@panneau/element-button": "^4.0.
|
|
56
|
-
"@panneau/element-icon": "^4.0.
|
|
57
|
-
"@panneau/element-label": "^4.0.
|
|
54
|
+
"@panneau/core": "^4.0.4",
|
|
55
|
+
"@panneau/element-button": "^4.0.4",
|
|
56
|
+
"@panneau/element-icon": "^4.0.4",
|
|
57
|
+
"@panneau/element-label": "^4.0.4",
|
|
58
58
|
"classnames": "^2.5.1",
|
|
59
59
|
"prop-types": "^15.7.2",
|
|
60
60
|
"react-intl": "^5.15.8 || ^6.0.0 || ^7.0.0"
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "e854451a718c6bc7dcde2b804c9913d8ac0297ff"
|
|
66
66
|
}
|