react-pure-modal 2.2.8 → 3.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.
@@ -1,167 +0,0 @@
1
- /*
2
- object-assign
3
- (c) Sindre Sorhus
4
- @license MIT
5
- */
6
-
7
- /*! !!../node_modules/css-loader/dist/cjs.js!./react-pure-modal.min.css */
8
-
9
- /*! !../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */
10
-
11
- /*! ../dist/react-pure-modal.min.css */
12
-
13
- /*! ../dist/react-pure-modal.min.js */
14
-
15
- /*! ../node_modules/css-loader/dist/runtime/api.js */
16
-
17
- /*! ./cjs/react-dom.development.js */
18
-
19
- /*! ./cjs/react.development.js */
20
-
21
- /*! ./cjs/scheduler-tracing.development.js */
22
-
23
- /*! ./cjs/scheduler.development.js */
24
-
25
- /*! ./content */
26
-
27
- /*! ./lib/ReactPropTypesSecret */
28
-
29
- /*! ./lib/has */
30
-
31
- /*! object-assign */
32
-
33
- /*! prop-types/checkPropTypes */
34
-
35
- /*! react */
36
-
37
- /*! react-dom */
38
-
39
- /*! scheduler */
40
-
41
- /*! scheduler/tracing */
42
-
43
- /*!****************************!*\
44
- !*** ./example/content.ts ***!
45
- \****************************/
46
-
47
- /*!*****************************!*\
48
- !*** ./example/example.tsx ***!
49
- \*****************************/
50
-
51
- /*!*************************************!*\
52
- !*** ./node_modules/react/index.js ***!
53
- \*************************************/
54
-
55
- /*!**************************************!*\
56
- !*** ./dist/react-pure-modal.min.js ***!
57
- \**************************************/
58
-
59
- /*!***************************************!*\
60
- !*** ./dist/react-pure-modal.min.css ***!
61
- \***************************************/
62
-
63
- /*!*****************************************!*\
64
- !*** ./node_modules/react-dom/index.js ***!
65
- \*****************************************/
66
-
67
- /*!*****************************************!*\
68
- !*** ./node_modules/scheduler/index.js ***!
69
- \*****************************************/
70
-
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
- /*!*****************************************************!*\
88
- !*** ./node_modules/css-loader/dist/runtime/api.js ***!
89
- \*****************************************************/
90
-
91
- /*!*****************************************************!*\
92
- !*** ./node_modules/react/cjs/react.development.js ***!
93
- \*****************************************************/
94
-
95
- /*!*************************************************************!*\
96
- !*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***!
97
- \*************************************************************/
98
-
99
- /*!*************************************************************!*\
100
- !*** ./node_modules/react-dom/cjs/react-dom.development.js ***!
101
- \*************************************************************/
102
-
103
- /*!*************************************************************!*\
104
- !*** ./node_modules/scheduler/cjs/scheduler.development.js ***!
105
- \*************************************************************/
106
-
107
- /*!*********************************************************************!*\
108
- !*** ./node_modules/scheduler/cjs/scheduler-tracing.development.js ***!
109
- \*********************************************************************/
110
-
111
- /*!****************************************************************************!*\
112
- !*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***!
113
- \****************************************************************************/
114
-
115
- /*!*****************************************************************************!*\
116
- !*** ./node_modules/css-loader/dist/cjs.js!./dist/react-pure-modal.min.css ***!
117
- \*****************************************************************************/
118
-
119
- /**
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
135
- *
136
- * Copyright (c) Facebook, Inc. and its affiliates.
137
- *
138
- * This source code is licensed under the MIT license found in the
139
- * LICENSE file in the root directory of this source tree.
140
- */
141
-
142
- /** @license React v0.19.1
143
- * scheduler.development.js
144
- *
145
- * Copyright (c) Facebook, Inc. and its affiliates.
146
- *
147
- * This source code is licensed under the MIT license found in the
148
- * LICENSE file in the root directory of this source tree.
149
- */
150
-
151
- /** @license React v16.13.1
152
- * react-dom.development.js
153
- *
154
- * Copyright (c) Facebook, Inc. and its affiliates.
155
- *
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
162
- *
163
- * Copyright (c) Facebook, Inc. and its affiliates.
164
- *
165
- * This source code is licensed under the MIT license found in the
166
- * LICENSE file in the root directory of this source tree.
167
- */
@@ -1,109 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { render } from 'react-dom';
3
- import PureModal from '../dist/react-pure-modal.min.js';
4
- import { smallContent, largeContent } from './content';
5
- import '../dist/react-pure-modal.min.css';
6
-
7
- function ModalContainer() {
8
- const [modal, setModal] = useState(false);
9
- const [modalInnerScroll, setModalInnerScroll] = useState(false);
10
- const [modalCenter, setModalCenter] = useState(false);
11
- const [modalDrag, setModalDrag] = useState(false);
12
- const [modalNoScrollable, setModalNoScrollable] = useState(false);
13
-
14
- return (
15
- <div>
16
- <button type="button" className="button" onClick={() => setModal(true)}>
17
- Open simple modal
18
- </button>
19
- <button type="button" className="button" onClick={() => setModalInnerScroll(true)}>
20
- Open modal with inner scroll
21
- </button>
22
- <button type="button" className="button" onClick={() => setModalCenter(true)}>
23
- Open small modal on center scrollable or not
24
- </button>
25
- <button type="button" className="button" onClick={() => setModalDrag(true)}>
26
- Draggable
27
- </button>
28
- <button type="button" className="button" onClick={() => setModalNoScrollable(true)}>
29
- Open large modal on center without scroll
30
- </button>
31
- <PureModal
32
- header="Custom header with a lot of symbols. It's very important to have a dynamic header height and this modal supports it"
33
- footer="Buttons?"
34
- isOpen={modalInnerScroll}
35
- closeButtonPosition="bottom"
36
- onClose={() => {
37
- setModalInnerScroll(false);
38
- return true;
39
- }}
40
- >
41
- <input type="text" placeholder="with input" value="" />
42
- {largeContent}
43
- </PureModal>
44
- <PureModal
45
- header="Custom heading"
46
- footer="Buttons?"
47
- width="800px"
48
- scrollable={false}
49
- isOpen={modal}
50
- onClose={() => {
51
- setModal(false);
52
- return true;
53
- }}
54
- >
55
- {largeContent}
56
- </PureModal>
57
- <PureModal
58
- header="Custom heading"
59
- footer="Buttons?"
60
- scrollable={false}
61
- isOpen={modalCenter}
62
- closeButtonPosition="bottom"
63
- portal
64
- closeButton={<div>&#10007;</div>}
65
- onClose={() => {
66
- setModalCenter(false);
67
- return true;
68
- }}
69
- >
70
- <p>Center</p>
71
- </PureModal>
72
-
73
- <PureModal
74
- header="Custom heading"
75
- draggable
76
- footer="Buttons?"
77
- scrollable={false}
78
- isOpen={modalDrag}
79
- closeButtonPosition="bottom"
80
- portal
81
- closeButton={<div>&#10007;</div>}
82
- onClose={() => {
83
- setModalDrag(false);
84
- return true;
85
- }}
86
- >
87
- <p>Center</p>
88
- </PureModal>
89
-
90
- <PureModal
91
- header="Custom heading"
92
- footer="Buttons?"
93
- isOpen={modalNoScrollable}
94
- closeButtonPosition="bottom"
95
- scrollable={false}
96
- portal
97
- closeButton={<div>&#10007;</div>}
98
- onClose={() => {
99
- setModalNoScrollable(false);
100
- return true;
101
- }}
102
- >
103
- {largeContent}
104
- </PureModal>
105
- </div>
106
- );
107
- }
108
-
109
- render(<ModalContainer />, document.getElementById('js--modals'));
package/index.html DELETED
@@ -1,22 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta http-equiv="x-ua-compatible" content="ie=edge" />
6
- <title></title>
7
- <title>Example 1</title>
8
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
9
- <style>
10
- .button {
11
- padding: 10px 15px;
12
- background-color: #ffd34f;
13
- border: none;
14
- margin: 20px;
15
- }
16
- </style>
17
- </head>
18
- <body style="height: 150vh">
19
- <div id="js--modals"></div>
20
- <script src="./example/example.min.js"></script>
21
- </body>
22
- </html>
Binary file
Binary file
@@ -1,74 +0,0 @@
1
- import React from 'react';
2
-
3
- import type { MouseOrTouch } from './types';
4
-
5
- type Props = {
6
- replace: boolean;
7
- children: JSX.Element;
8
- onDragStart?: (event: MouseOrTouch) => unknown;
9
- onDragEnd?: (event: MouseOrTouch) => unknown;
10
- onClose?: (event: React.MouseEvent<HTMLDivElement>) => void;
11
- bodyClass?: string;
12
- header?: JSX.Element | string;
13
- footer?: JSX.Element | string;
14
- closeButton: JSX.Element | string;
15
- closeButtonPosition: string;
16
- draggable: boolean;
17
- };
18
-
19
- const defaultProps = {
20
- closeButton: '×',
21
- closeButtonPosition: 'header',
22
- replace: false,
23
- draggable: false,
24
- };
25
-
26
- function PureModalContent(props: Props): JSX.Element {
27
- const {
28
- children,
29
- replace,
30
- bodyClass,
31
- header,
32
- footer,
33
- onDragStart,
34
- onDragEnd,
35
- onClose,
36
- closeButton,
37
- closeButtonPosition,
38
- } = props;
39
-
40
- return replace ? (
41
- children
42
- ) : (
43
- <div
44
- className={`panel panel-default ${closeButtonPosition === 'bottom' ? 'additional-row' : ''}`}
45
- >
46
- <div
47
- className="panel-heading"
48
- onTouchStart={onDragStart}
49
- onMouseDown={onDragStart}
50
- onTouchEnd={onDragEnd}
51
- onMouseUp={onDragEnd}
52
- >
53
- {header && <h3 className="panel-title">{header}</h3>}
54
- </div>
55
-
56
- <div className={bodyClass}>{children}</div>
57
- {footer && <div className="panel-footer">{footer}</div>}
58
- <div
59
- className="close"
60
- onClick={onClose}
61
- style={{
62
- position: closeButtonPosition === 'header' ? 'absolute' : 'static',
63
- margin: closeButtonPosition === 'bottom' ? '10px auto' : '',
64
- }}
65
- >
66
- {closeButton}
67
- </div>
68
- </div>
69
- );
70
- }
71
-
72
- PureModalContent.defaultProps = defaultProps;
73
-
74
- export default PureModalContent;
@@ -1,123 +0,0 @@
1
- .body-modal-fix {
2
- height: 100%;
3
- width: 100%;
4
- overflow: hidden;
5
- }
6
-
7
- .pure-modal-backdrop {
8
- position: fixed;
9
- top: 0;
10
- right: 0;
11
- bottom: 0;
12
- left: 0;
13
- z-index: 1040;
14
- background-color: rgba(0, 0, 0, 0.4);
15
- display: flex;
16
- flex-direction: column;
17
- justify-content: center;
18
- align-items: center;
19
- }
20
-
21
- .backdrop-overflow-hidden {
22
- overflow: hidden !important;
23
- }
24
-
25
- .pure-modal-backdrop .pure-modal {
26
- width: 300px;
27
- max-width: 100%;
28
- box-sizing: border-box;
29
- transition: all 0.2s ease-in-out;
30
- max-height: 100%;
31
- }
32
-
33
- .pure-modal.auto-height {
34
- position: static;
35
- }
36
-
37
- .pure-modal-backdrop.scrollable {
38
- overflow-y: auto;
39
- }
40
-
41
- .pure-modal-backdrop .panel {
42
- display: grid;
43
- grid-template-rows: repeat(3, min-content);
44
- }
45
- .pure-modal-backdrop:not(.scrollable) .panel {
46
- grid-template-rows: min-content minmax(0, 1fr) min-content;
47
- max-height: -moz-available;
48
- max-height: -webkit-fill-available;
49
- max-height: fill-available;
50
- height: 100%;
51
- }
52
-
53
- .pure-modal > * > * {
54
- flex: 0 0 auto;
55
- }
56
-
57
- .pure-modal > * > .scrollable {
58
- overflow-x: hidden;
59
- overflow-scrolling: touch;
60
- }
61
-
62
- @media (max-width: 480px) {
63
- .pure-modal-backdrop .pure-modal {
64
- width: 100%;
65
- }
66
- }
67
-
68
- .pure-modal .panel-body {
69
- background-color: #fff;
70
- }
71
-
72
- .pure-modal .panel-heading {
73
- background: rgb(240, 240, 240);
74
- }
75
-
76
- .pure-modal .panel-title {
77
- padding: 12px 45px 12px 15px;
78
- margin: 0;
79
- }
80
-
81
- .pure-modal .close {
82
- right: 10px;
83
- top: 10px;
84
- z-index: 1;
85
- background: rgba(240, 240, 240, 0.8);
86
- width: 30px;
87
- color: rgb(140, 140, 140);
88
- transition: color ease-in-out 0.1s;
89
- height: 30px;
90
- border-radius: 15px;
91
- text-align: center;
92
- line-height: 30px;
93
- cursor: pointer;
94
- }
95
-
96
- .pure-modal .panel-heading .close:hover {
97
- color: #000;
98
- }
99
-
100
- .pure-modal .panel-body {
101
- padding: 15px;
102
- }
103
-
104
- .pure-modal .panel-footer {
105
- padding: 12px 45px 12px 15px;
106
- background: rgb(240, 240, 240);
107
- }
108
-
109
- .pure-modal .panel-body,
110
- .pure-modal .panel-footer,
111
- .pure-modal .panel-title {
112
- word-break: break-all;
113
- }
114
-
115
- .pure-modal-backdrop .additional-row {
116
- display: grid;
117
- grid-template-rows: min-content minmax(0, 1fr) min-content min-content;
118
- }
119
-
120
- .pure-modal-backdrop:not(.scrollable) .additional-row {
121
- display: grid;
122
- grid-template-rows: min-content minmax(0, 1fr) min-content min-content;
123
- }