react-pure-modal 2.2.7 → 2.3.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.
@@ -1,9 +1,3 @@
1
- /*
2
- object-assign
3
- (c) Sindre Sorhus
4
- @license MIT
5
- */
6
-
7
1
  /*! !!../node_modules/css-loader/dist/cjs.js!./react-pure-modal.min.css */
8
2
 
9
3
  /*! !../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */
@@ -18,28 +12,16 @@ object-assign
18
12
 
19
13
  /*! ./cjs/react.development.js */
20
14
 
21
- /*! ./cjs/scheduler-tracing.development.js */
22
-
23
15
  /*! ./cjs/scheduler.development.js */
24
16
 
25
17
  /*! ./content */
26
18
 
27
- /*! ./lib/ReactPropTypesSecret */
28
-
29
- /*! ./lib/has */
30
-
31
- /*! object-assign */
32
-
33
- /*! prop-types/checkPropTypes */
34
-
35
19
  /*! react */
36
20
 
37
21
  /*! react-dom */
38
22
 
39
23
  /*! scheduler */
40
24
 
41
- /*! scheduler/tracing */
42
-
43
25
  /*!****************************!*\
44
26
  !*** ./example/content.ts ***!
45
27
  \****************************/
@@ -68,22 +50,6 @@ object-assign
68
50
  !*** ./node_modules/scheduler/index.js ***!
69
51
  \*****************************************/
70
52
 
71
- /*!*******************************************!*\
72
- !*** ./node_modules/scheduler/tracing.js ***!
73
- \*******************************************/
74
-
75
- /*!********************************************!*\
76
- !*** ./node_modules/prop-types/lib/has.js ***!
77
- \********************************************/
78
-
79
- /*!*********************************************!*\
80
- !*** ./node_modules/object-assign/index.js ***!
81
- \*********************************************/
82
-
83
- /*!***************************************************!*\
84
- !*** ./node_modules/prop-types/checkPropTypes.js ***!
85
- \***************************************************/
86
-
87
53
  /*!*****************************************************!*\
88
54
  !*** ./node_modules/css-loader/dist/runtime/api.js ***!
89
55
  \*****************************************************/
@@ -92,10 +58,6 @@ object-assign
92
58
  !*** ./node_modules/react/cjs/react.development.js ***!
93
59
  \*****************************************************/
94
60
 
95
- /*!*************************************************************!*\
96
- !*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***!
97
- \*************************************************************/
98
-
99
61
  /*!*************************************************************!*\
100
62
  !*** ./node_modules/react-dom/cjs/react-dom.development.js ***!
101
63
  \*************************************************************/
@@ -104,10 +66,6 @@ object-assign
104
66
  !*** ./node_modules/scheduler/cjs/scheduler.development.js ***!
105
67
  \*************************************************************/
106
68
 
107
- /*!*********************************************************************!*\
108
- !*** ./node_modules/scheduler/cjs/scheduler-tracing.development.js ***!
109
- \*********************************************************************/
110
-
111
69
  /*!****************************************************************************!*\
112
70
  !*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***!
113
71
  \****************************************************************************/
@@ -117,21 +75,8 @@ object-assign
117
75
  \*****************************************************************************/
118
76
 
119
77
  /**
120
- * Checks if an event is supported in the current execution environment.
121
- *
122
- * NOTE: This will not work correctly for non-generic events such as `change`,
123
- * `reset`, `load`, `error`, and `select`.
124
- *
125
- * Borrows from Modernizr.
126
- *
127
- * @param {string} eventNameSuffix Event name, e.g. "click".
128
- * @return {boolean} True if the event is supported.
129
- * @internal
130
- * @license Modernizr 3.0.0pre (Custom Build) | MIT
131
- */
132
-
133
- /** @license React v0.19.1
134
- * scheduler-tracing.development.js
78
+ * @license React
79
+ * react-dom.development.js
135
80
  *
136
81
  * Copyright (c) Facebook, Inc. and its affiliates.
137
82
  *
@@ -139,7 +84,8 @@ object-assign
139
84
  * LICENSE file in the root directory of this source tree.
140
85
  */
141
86
 
142
- /** @license React v0.19.1
87
+ /**
88
+ * @license React
143
89
  * scheduler.development.js
144
90
  *
145
91
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -148,20 +94,16 @@ object-assign
148
94
  * LICENSE file in the root directory of this source tree.
149
95
  */
150
96
 
151
- /** @license React v16.13.1
152
- * react-dom.development.js
153
- *
154
- * Copyright (c) Facebook, Inc. and its affiliates.
97
+ /**
98
+ * Checks if an event is supported in the current execution environment.
155
99
  *
156
- * This source code is licensed under the MIT license found in the
157
- * LICENSE file in the root directory of this source tree.
158
- */
159
-
160
- /** @license React v16.13.1
161
- * react.development.js
100
+ * NOTE: This will not work correctly for non-generic events such as `change`,
101
+ * `reset`, `load`, `error`, and `select`.
162
102
  *
163
- * Copyright (c) Facebook, Inc. and its affiliates.
103
+ * Borrows from Modernizr.
164
104
  *
165
- * This source code is licensed under the MIT license found in the
166
- * LICENSE file in the root directory of this source tree.
105
+ * @param {string} eventNameSuffix Event name, e.g. "click".
106
+ * @return {boolean} True if the event is supported.
107
+ * @internal
108
+ * @license Modernizr 3.0.0pre (Custom Build) | MIT
167
109
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-pure-modal",
3
- "version": "2.2.7",
3
+ "version": "2.3.4",
4
4
  "description": "React modal",
5
5
  "main": "dist/react-pure-modal.min.js",
6
6
  "types": "dist/react-pure-modal.d.ts",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "git+https://github.com/max-mykhailenko/react-pure-modal.git"
18
+ "url": "https://github.com/Memcrab/react-pure-modal.git"
19
19
  },
20
20
  "keywords": [
21
21
  "react",
@@ -25,9 +25,9 @@
25
25
  "author": "Max Mykhailenko",
26
26
  "license": "ISC",
27
27
  "bugs": {
28
- "url": "https://github.com/max-mykhailenko/react-pure-modal/issues"
28
+ "url": "https://github.com/Memcrab/react-pure-modal/issues"
29
29
  },
30
- "homepage": "https://github.com/max-mykhailenko/react-pure-modal#readme",
30
+ "homepage": "https://github.com/Memcrab/react-pure-modal#readme",
31
31
  "devDependencies": {
32
32
  "@babel/core": "7.22.1",
33
33
  "@babel/plugin-proposal-class-properties": "7.10.4",
@@ -36,8 +36,8 @@
36
36
  "@babel/preset-react": "7.10.4",
37
37
  "@babel/preset-typescript": "7.10.4",
38
38
  "@types/node": "^15.14.1",
39
- "@types/react": "16.9.48",
40
- "@types/react-dom": "16.9.9",
39
+ "@types/react": "18.2.67",
40
+ "@types/react-dom": "18.2.22",
41
41
  "autoprefixer": "9.8.6",
42
42
  "babel-eslint": "10.1.0",
43
43
  "babel-jest": "26.3.0",
@@ -54,9 +54,9 @@
54
54
  "postcss-csso": "4.0.0",
55
55
  "postcss-loader": "3.0.0",
56
56
  "prettier": "2.1.1",
57
- "react": "16.13.1",
58
- "react-dom": "16.13.1",
59
- "react-test-renderer": "16.13.1",
57
+ "react": "18.2.0",
58
+ "react-dom": "18.2.0",
59
+ "react-test-renderer": "18.2.0",
60
60
  "rimraf": "3.0.2",
61
61
  "style-loader": "1.2.1",
62
62
  "terser-webpack-plugin": "4.1.0",
@@ -67,7 +67,7 @@
67
67
  "yargs": "15.4.1"
68
68
  },
69
69
  "peerDependencies": {
70
- "react": "^15.3.0 || ^16.0 || ^17.0 || ^18.0",
71
- "react-dom": "^15.3.0 || ^16.0 || ^17.0 || ^18.0"
70
+ "react": "^18.0.0 || ^19.0.0",
71
+ "react-dom": "^18.0.0 || ^19.0.0"
72
72
  }
73
73
  }
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, useCallback } from 'react';
1
+ import React, { useState, useEffect, useCallback, useId } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
 
4
4
  // components
@@ -26,8 +26,10 @@ type Props = {
26
26
  portal?: boolean;
27
27
  };
28
28
 
29
+ type CloseInteractionEvent = MouseOrTouch | KeyboardEvent;
30
+
29
31
  function PureModal(props: Props) {
30
- let hash = Math.random().toString();
32
+ const hash = useId();
31
33
  const [isDragged, setIsDragged] = useState(false);
32
34
  const [x, setX] = useState<number | null>(null);
33
35
  const [y, setY] = useState<number | null>(null);
@@ -79,7 +81,7 @@ function PureModal(props: Props) {
79
81
  }, [isOpen]);
80
82
 
81
83
  const handleEsc = useCallback(
82
- event => {
84
+ (event: KeyboardEvent) => {
83
85
  const allModals = document.querySelectorAll('.pure-modal');
84
86
  const isManyModalsOpen = allModals.length > 1; // open modal in modal
85
87
  const firstModalData = allModals[allModals.length - 1];
@@ -107,7 +109,7 @@ function PureModal(props: Props) {
107
109
  *
108
110
  * click on close btn, click on backdrop, press on esc
109
111
  */
110
- function close(event?: MouseOrTouch) {
112
+ function close(event?: CloseInteractionEvent) {
111
113
  if (event) {
112
114
  event.stopPropagation();
113
115
  event.preventDefault();
package/tsconfig.json CHANGED
@@ -15,7 +15,11 @@
15
15
  "importsNotUsedAsValues": "error",
16
16
  "resolveJsonModule": true,
17
17
  "allowSyntheticDefaultImports": true,
18
- "typeRoots": ["./@types/**", "./node_modules/@types"],
18
+ "baseUrl": ".",
19
+ "paths": {
20
+ "scheduler/tracing": ["@types/scheduler/tracing"]
21
+ },
22
+ "typeRoots": ["./@types", "./node_modules/@types"],
19
23
  "types": ["node", "jest"]
20
24
  }
21
25
  }