@panneau/element-modal 3.0.308 → 4.0.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.
Files changed (2) hide show
  1. package/es/index.js +30 -63
  2. package/package.json +7 -7
package/es/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import classNames from 'classnames';
3
- import PropTypes from 'prop-types';
4
3
  import React, { useMemo, useEffect, useRef } from 'react';
5
4
  import { getDisplayName } from '@panneau/core/utils';
6
5
  import ReactDOM from 'react-dom';
@@ -8,24 +7,13 @@ import { useModal } from '@panneau/core/contexts';
8
7
  import { useKeyboardKeys, KEYCODES } from '@panneau/core/hooks';
9
8
 
10
9
  /* eslint-disable react/no-array-index-key, react/jsx-props-no-spreading */
11
-
12
- // import ElementPortal from '@panneau/element-portal';
13
-
14
- var propTypes$2 = {
15
- id: PropTypes.string,
16
- data: PropTypes.object,
17
- // eslint-disable-line react/forbid-prop-types
18
- children: PropTypes.node
19
- };
20
- var defaultProps$2 = {
21
- id: null,
22
- data: null,
23
- children: null
24
- };
25
- var ModalPortal = function ModalPortal(_ref) {
26
- var id = _ref.id,
27
- data = _ref.data,
28
- children = _ref.children;
10
+ function ModalPortal(_ref) {
11
+ var _ref$id = _ref.id,
12
+ id = _ref$id === void 0 ? null : _ref$id,
13
+ _ref$data = _ref.data,
14
+ data = _ref$data === void 0 ? null : _ref$data,
15
+ _ref$children = _ref.children,
16
+ children = _ref$children === void 0 ? null : _ref$children;
29
17
  var _useModal = useModal(),
30
18
  _useModal$container = _useModal.container,
31
19
  container = _useModal$container === void 0 ? null : _useModal$container,
@@ -47,32 +35,21 @@ var ModalPortal = function ModalPortal(_ref) {
47
35
  };
48
36
  }, [finalId, data, register, unregister]);
49
37
  return container !== null ? /*#__PURE__*/ReactDOM.createPortal(children, container) : null;
50
- };
51
- ModalPortal.propTypes = propTypes$2;
52
- ModalPortal.defaultProps = defaultProps$2;
38
+ }
53
39
 
54
40
  var styles = {"modal":"panneau-element-modal-modal","center":"panneau-element-modal-center","inner":"panneau-element-modal-inner","top":"panneau-element-modal-top","button":"panneau-element-modal-button","modalsContainer":"panneau-element-modal-modalsContainer","modals":"panneau-element-modal-modals","hasModals":"panneau-element-modal-hasModals"};
55
41
 
56
- var propTypes$1 = {
57
- id: PropTypes.string,
58
- title: PropTypes.string,
59
- position: PropTypes.oneOf(['center', 'top']),
60
- onClose: PropTypes.func,
61
- children: PropTypes.node
62
- };
63
- var defaultProps$1 = {
64
- id: null,
65
- title: null,
66
- position: 'center',
67
- onClose: null,
68
- children: null
69
- };
70
- var Modal = function Modal(_ref) {
71
- var id = _ref.id,
72
- onClose = _ref.onClose,
73
- children = _ref.children,
74
- position = _ref.position,
75
- title = _ref.title;
42
+ function Modal(_ref) {
43
+ var _ref$id = _ref.id,
44
+ id = _ref$id === void 0 ? null : _ref$id,
45
+ _ref$onClose = _ref.onClose,
46
+ onClose = _ref$onClose === void 0 ? null : _ref$onClose,
47
+ _ref$children = _ref.children,
48
+ children = _ref$children === void 0 ? null : _ref$children,
49
+ _ref$position = _ref.position,
50
+ position = _ref$position === void 0 ? 'center' : _ref$position,
51
+ _ref$title = _ref.title,
52
+ title = _ref$title === void 0 ? null : _ref$title;
76
53
  var name = getDisplayName(children);
77
54
  var finalId = useMemo(function () {
78
55
  return id || name || 'Modal';
@@ -90,23 +67,15 @@ var Modal = function Modal(_ref) {
90
67
  className: classNames([styles.modal, _defineProperty({}, styles[position], position !== null)])
91
68
  }, /*#__PURE__*/React.createElement("div", {
92
69
  className: classNames(['modal', 'fade', 'show', 'd-block', styles.inner]),
93
- tabIndex: "-1"
70
+ tabIndex: -1
94
71
  }, children)));
95
- };
96
- Modal.propTypes = propTypes$1;
97
- Modal.defaultProps = defaultProps$1;
72
+ }
98
73
 
99
- var propTypes = {
100
- theme: PropTypes.string,
101
- className: PropTypes.string
102
- };
103
- var defaultProps = {
104
- theme: null,
105
- className: null
106
- };
107
- var Modals = function Modals(_ref) {
108
- var theme = _ref.theme,
109
- className = _ref.className;
74
+ function Modals(_ref) {
75
+ var _ref$theme = _ref.theme,
76
+ theme = _ref$theme === void 0 ? null : _ref$theme,
77
+ _ref$className = _ref.className,
78
+ className = _ref$className === void 0 ? null : _ref$className;
110
79
  var _useModal = useModal(),
111
80
  _useModal$modals = _useModal.modals,
112
81
  modals = _useModal$modals === void 0 ? null : _useModal$modals,
@@ -131,17 +100,15 @@ var Modals = function Modals(_ref) {
131
100
  }, [modals]);
132
101
  useKeyboardKeys(_defineProperty({}, KEYCODES.ESCAPE, closeLastModal));
133
102
  return /*#__PURE__*/React.createElement("div", {
134
- className: classNames([styles.modalsContainer, _defineProperty({}, className, className)]),
135
- "data-bs-theme": theme !== null ? theme : null,
103
+ className: classNames([styles.modalsContainer, _defineProperty({}, className, className !== null)]),
104
+ "data-bs-theme": theme !== null ? theme : undefined,
136
105
  style: {
137
- color: theme === 'dark' ? '#FFF' : null
106
+ color: theme === 'dark' ? '#FFF' : undefined
138
107
  }
139
108
  }, /*#__PURE__*/React.createElement("div", {
140
109
  className: classNames([styles.modals, _defineProperty({}, styles.hasModals, modals !== null && modals.length > 0)]),
141
110
  ref: containerRef
142
111
  }));
143
- };
144
- Modals.propTypes = propTypes;
145
- Modals.defaultProps = defaultProps;
112
+ }
146
113
 
147
114
  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": "3.0.308",
3
+ "version": "4.0.0",
4
4
  "description": "Modal element",
5
5
  "keywords": [
6
6
  "javascript"
@@ -51,16 +51,16 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@babel/runtime": "^7.12.5",
54
- "@panneau/core": "^3.0.307",
55
- "@panneau/element-button": "^3.0.308",
56
- "@panneau/element-icon": "^3.0.307",
57
- "@panneau/element-label": "^3.0.307",
54
+ "@panneau/core": "^4.0.0",
55
+ "@panneau/element-button": "^4.0.0",
56
+ "@panneau/element-icon": "^4.0.0",
57
+ "@panneau/element-label": "^4.0.0",
58
58
  "classnames": "^2.5.1",
59
59
  "prop-types": "^15.7.2",
60
- "react-intl": "^5.15.8||^6.0.0"
60
+ "react-intl": "^5.15.8 || ^6.0.0 || ^7.0.0"
61
61
  },
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "8711276a09fcda499a4a2f206554f9cd995976f5"
65
+ "gitHead": "2cca874e0388b4a20c39aadb205c0e67d5a946fc"
66
66
  }