react-responsive-modal 4.0.1 → 5.0.3
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/LICENSE +1 -1
- package/README.md +4 -35
- package/dist/CloseIcon.d.ts +19 -0
- package/dist/FocusTrap.d.ts +6 -0
- package/dist/focusTrapJs.d.ts +3 -0
- package/dist/index.d.ts +118 -0
- package/dist/index.js +8 -0
- package/dist/modalManager.d.ts +26 -0
- package/dist/react-responsive-modal.cjs.development.js +439 -0
- package/dist/react-responsive-modal.cjs.development.js.map +1 -0
- package/dist/react-responsive-modal.cjs.production.min.js +2 -0
- package/dist/react-responsive-modal.cjs.production.min.js.map +1 -0
- package/dist/react-responsive-modal.esm.js +432 -0
- package/dist/react-responsive-modal.esm.js.map +1 -0
- package/dist/utils.d.ts +3 -0
- package/package.json +57 -85
- package/src/CloseIcon.tsx +54 -0
- package/src/FocusTrap.tsx +54 -0
- package/src/focusTrapJs.ts +79 -0
- package/src/index.tsx +339 -0
- package/src/modalManager.ts +37 -0
- package/src/utils.ts +17 -0
- package/{src/styles.css → styles.css} +25 -19
- package/lib/index.es.js +0 -629
- package/lib/index.es.js.map +0 -1
- package/lib/index.js +0 -634
- package/lib/index.js.map +0 -1
- package/src/close-icon.js +0 -47
- package/src/index.js +0 -3
- package/src/modal-manager.js +0 -36
- package/src/modal.js +0 -394
- package/types/index.d.ts +0 -113
- package/types/test.tsx +0 -29
- package/types/tsconfig.json +0 -16
- package/types/tslint.json +0 -3
package/src/close-icon.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
const CloseIcon = ({
|
|
6
|
-
classes,
|
|
7
|
-
classNames,
|
|
8
|
-
styles,
|
|
9
|
-
closeIconSize,
|
|
10
|
-
closeIconSvgPath,
|
|
11
|
-
onClickCloseIcon,
|
|
12
|
-
id,
|
|
13
|
-
}) => (
|
|
14
|
-
<button
|
|
15
|
-
className={cx(classes.closeButton, classNames.closeButton)}
|
|
16
|
-
style={styles.closeButton}
|
|
17
|
-
onClick={onClickCloseIcon}
|
|
18
|
-
id={id}
|
|
19
|
-
>
|
|
20
|
-
<svg
|
|
21
|
-
className={cx(classes.closeIcon, classNames.closeIcon)}
|
|
22
|
-
style={styles.closeIcon}
|
|
23
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
24
|
-
width={closeIconSize}
|
|
25
|
-
height={closeIconSize}
|
|
26
|
-
viewBox="0 0 36 36"
|
|
27
|
-
>
|
|
28
|
-
{closeIconSvgPath}
|
|
29
|
-
</svg>
|
|
30
|
-
</button>
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
CloseIcon.propTypes = {
|
|
34
|
-
classNames: PropTypes.object.isRequired,
|
|
35
|
-
styles: PropTypes.object.isRequired,
|
|
36
|
-
classes: PropTypes.object.isRequired,
|
|
37
|
-
closeIconSize: PropTypes.number.isRequired,
|
|
38
|
-
closeIconSvgPath: PropTypes.node.isRequired,
|
|
39
|
-
onClickCloseIcon: PropTypes.func.isRequired,
|
|
40
|
-
id: PropTypes.string,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
CloseIcon.defaultProps = {
|
|
44
|
-
id: null,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default CloseIcon;
|
package/src/index.js
DELETED
package/src/modal-manager.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
const modals = [];
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Handle the order of the modals.
|
|
5
|
-
* Inspired by the material-ui implementation.
|
|
6
|
-
*/
|
|
7
|
-
export default {
|
|
8
|
-
/**
|
|
9
|
-
* Return the modals array
|
|
10
|
-
*/
|
|
11
|
-
modals: () => modals,
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Register a new modal
|
|
15
|
-
*/
|
|
16
|
-
add: modal => {
|
|
17
|
-
if (modals.indexOf(modal) === -1) {
|
|
18
|
-
modals.push(modal);
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Remove a modal
|
|
24
|
-
*/
|
|
25
|
-
remove: modal => {
|
|
26
|
-
const index = modals.indexOf(modal);
|
|
27
|
-
if (index !== -1) {
|
|
28
|
-
modals.splice(index, 1);
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Check if the modal is the first one on the screen
|
|
34
|
-
*/
|
|
35
|
-
isTopModal: modal => !!modals.length && modals[modals.length - 1] === modal,
|
|
36
|
-
};
|
package/src/modal.js
DELETED
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import ReactDom from 'react-dom';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import CSSTransition from 'react-transition-group/CSSTransition';
|
|
5
|
-
import cx from 'classnames';
|
|
6
|
-
import noScroll from 'no-scroll';
|
|
7
|
-
import FocusTrap from 'focus-trap-react';
|
|
8
|
-
import CloseIcon from './close-icon';
|
|
9
|
-
import modalManager from './modal-manager';
|
|
10
|
-
import cssClasses from './styles.css';
|
|
11
|
-
|
|
12
|
-
const isBrowser = typeof window !== 'undefined';
|
|
13
|
-
|
|
14
|
-
class Modal extends Component {
|
|
15
|
-
static blockScroll() {
|
|
16
|
-
noScroll.on();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static unblockScroll = () => {
|
|
20
|
-
// Restore the scroll only if there is no modal on the screen
|
|
21
|
-
if (modalManager.modals().length === 0) {
|
|
22
|
-
noScroll.off();
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
shouldClose = null;
|
|
27
|
-
|
|
28
|
-
constructor(props) {
|
|
29
|
-
super(props);
|
|
30
|
-
this.container = isBrowser && document.createElement('div');
|
|
31
|
-
this.state = {
|
|
32
|
-
showPortal: this.props.open,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
componentDidMount() {
|
|
37
|
-
// Block scroll when initial prop is open
|
|
38
|
-
if (this.props.open) {
|
|
39
|
-
this.handleOpen();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
componentDidUpdate(prevProps, prevState) {
|
|
44
|
-
if (prevState.showPortal && !this.state.showPortal) {
|
|
45
|
-
this.handleClose();
|
|
46
|
-
} else if (!prevProps.open && this.props.open) {
|
|
47
|
-
this.handleOpen();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
componentWillUnmount() {
|
|
52
|
-
if (this.state.showPortal) {
|
|
53
|
-
this.handleClose();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
static getDerivedStateFromProps(nextProps, prevState) {
|
|
58
|
-
if (!prevState.showPortal && nextProps.open) {
|
|
59
|
-
return {
|
|
60
|
-
showPortal: true,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
handleOpen = () => {
|
|
67
|
-
modalManager.add(this);
|
|
68
|
-
if (isBrowser && !this.props.container) {
|
|
69
|
-
document.body.appendChild(this.container);
|
|
70
|
-
}
|
|
71
|
-
if (this.props.blockScroll) {
|
|
72
|
-
Modal.blockScroll();
|
|
73
|
-
}
|
|
74
|
-
document.addEventListener('keydown', this.handleKeydown);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
handleClose = () => {
|
|
78
|
-
modalManager.remove(this);
|
|
79
|
-
if (this.props.blockScroll) {
|
|
80
|
-
Modal.unblockScroll();
|
|
81
|
-
}
|
|
82
|
-
if (isBrowser && !this.props.container) {
|
|
83
|
-
document.body.removeChild(this.container);
|
|
84
|
-
}
|
|
85
|
-
document.removeEventListener('keydown', this.handleKeydown);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
handleClickOverlay = event => {
|
|
89
|
-
if (this.shouldClose === null) {
|
|
90
|
-
this.shouldClose = true;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (!this.shouldClose) {
|
|
94
|
-
this.shouldClose = null;
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (this.props.onOverlayClick) {
|
|
99
|
-
this.props.onOverlayClick(event);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (this.props.closeOnOverlayClick) {
|
|
103
|
-
this.props.onClose(event);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
this.shouldClose = null;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
handleClickCloseIcon = event => {
|
|
110
|
-
this.props.onClose(event);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
handleKeydown = event => {
|
|
114
|
-
// Only the last modal need to be escaped when pressing the esc key
|
|
115
|
-
if (event.keyCode !== 27 || !modalManager.isTopModal(this)) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (this.props.onEscKeyDown) {
|
|
120
|
-
this.props.onEscKeyDown(event);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (this.props.closeOnEsc) {
|
|
124
|
-
this.props.onClose(event);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
handleModalEvent = () => {
|
|
129
|
-
this.shouldClose = false;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
handleEntered = () => {
|
|
133
|
-
if (this.props.onEntered) {
|
|
134
|
-
this.props.onEntered();
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
handleExited = () => {
|
|
139
|
-
if (this.props.onExited) {
|
|
140
|
-
this.props.onExited();
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
this.setState({ showPortal: false });
|
|
144
|
-
|
|
145
|
-
if (this.props.blockScroll) {
|
|
146
|
-
Modal.unblockScroll();
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
render() {
|
|
151
|
-
const {
|
|
152
|
-
open,
|
|
153
|
-
center,
|
|
154
|
-
classes,
|
|
155
|
-
classNames,
|
|
156
|
-
styles,
|
|
157
|
-
showCloseIcon,
|
|
158
|
-
closeIconSize,
|
|
159
|
-
closeIconSvgPath,
|
|
160
|
-
animationDuration,
|
|
161
|
-
focusTrapped,
|
|
162
|
-
focusTrapOptions,
|
|
163
|
-
overlayId,
|
|
164
|
-
modalId,
|
|
165
|
-
closeIconId,
|
|
166
|
-
role,
|
|
167
|
-
ariaLabelledby,
|
|
168
|
-
ariaDescribedby,
|
|
169
|
-
} = this.props;
|
|
170
|
-
const { showPortal } = this.state;
|
|
171
|
-
|
|
172
|
-
if (!showPortal) {
|
|
173
|
-
return null;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const content = (
|
|
177
|
-
<React.Fragment>
|
|
178
|
-
{this.props.children}
|
|
179
|
-
{showCloseIcon && (
|
|
180
|
-
<CloseIcon
|
|
181
|
-
classes={classes}
|
|
182
|
-
classNames={classNames}
|
|
183
|
-
styles={styles}
|
|
184
|
-
closeIconSize={closeIconSize}
|
|
185
|
-
closeIconSvgPath={closeIconSvgPath}
|
|
186
|
-
onClickCloseIcon={this.handleClickCloseIcon}
|
|
187
|
-
id={closeIconId}
|
|
188
|
-
/>
|
|
189
|
-
)}
|
|
190
|
-
</React.Fragment>
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
return ReactDom.createPortal(
|
|
194
|
-
<CSSTransition
|
|
195
|
-
in={open}
|
|
196
|
-
appear
|
|
197
|
-
classNames={{
|
|
198
|
-
appear: classNames.transitionEnter || classes.transitionEnter,
|
|
199
|
-
appearActive:
|
|
200
|
-
classNames.transitionEnterActive || classes.transitionEnterActive,
|
|
201
|
-
enter: classNames.transitionEnter || classes.transitionEnter,
|
|
202
|
-
enterActive:
|
|
203
|
-
classNames.transitionEnterActive || classes.transitionEnterActive,
|
|
204
|
-
exit: classNames.transitionExit || classes.transitionExit,
|
|
205
|
-
exitActive:
|
|
206
|
-
classNames.transitionExitActive || classes.transitionExitActive,
|
|
207
|
-
}}
|
|
208
|
-
timeout={animationDuration}
|
|
209
|
-
onEntered={this.handleEntered}
|
|
210
|
-
onExited={this.handleExited}
|
|
211
|
-
>
|
|
212
|
-
<div
|
|
213
|
-
className={cx(classes.overlay, classNames.overlay)}
|
|
214
|
-
onClick={this.handleClickOverlay}
|
|
215
|
-
style={styles.overlay}
|
|
216
|
-
id={overlayId}
|
|
217
|
-
>
|
|
218
|
-
<div
|
|
219
|
-
className={cx(
|
|
220
|
-
classes.modal,
|
|
221
|
-
center && classes.modalCenter,
|
|
222
|
-
classNames.modal
|
|
223
|
-
)}
|
|
224
|
-
style={styles.modal}
|
|
225
|
-
onMouseDown={this.handleModalEvent}
|
|
226
|
-
onMouseUp={this.handleModalEvent}
|
|
227
|
-
onClick={this.handleModalEvent}
|
|
228
|
-
id={modalId}
|
|
229
|
-
role={role}
|
|
230
|
-
aria-modal="true"
|
|
231
|
-
aria-labelledby={ariaLabelledby}
|
|
232
|
-
aria-describedby={ariaDescribedby}
|
|
233
|
-
>
|
|
234
|
-
{focusTrapped ? (
|
|
235
|
-
<FocusTrap
|
|
236
|
-
focusTrapOptions={{
|
|
237
|
-
...{ clickOutsideDeactivates: true },
|
|
238
|
-
...focusTrapOptions,
|
|
239
|
-
}}
|
|
240
|
-
>
|
|
241
|
-
{content}
|
|
242
|
-
</FocusTrap>
|
|
243
|
-
) : (
|
|
244
|
-
content
|
|
245
|
-
)}
|
|
246
|
-
</div>
|
|
247
|
-
</div>
|
|
248
|
-
</CSSTransition>,
|
|
249
|
-
this.props.container || this.container
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
Modal.propTypes = {
|
|
255
|
-
/**
|
|
256
|
-
* Is the modal closable when user press esc key.
|
|
257
|
-
*/
|
|
258
|
-
closeOnEsc: PropTypes.bool,
|
|
259
|
-
/**
|
|
260
|
-
* Is the modal closable when user click on overlay.
|
|
261
|
-
*/
|
|
262
|
-
closeOnOverlayClick: PropTypes.bool,
|
|
263
|
-
/**
|
|
264
|
-
* Callback fired when the Modal is open and the animation is finished.
|
|
265
|
-
*/
|
|
266
|
-
onEntered: PropTypes.func,
|
|
267
|
-
/**
|
|
268
|
-
* Callback fired when the Modal has exited and the animation is finished.
|
|
269
|
-
*/
|
|
270
|
-
onExited: PropTypes.func,
|
|
271
|
-
/**
|
|
272
|
-
* Callback fired when the Modal is requested to be closed by a click on the overlay or when user press esc key.
|
|
273
|
-
*/
|
|
274
|
-
onClose: PropTypes.func.isRequired,
|
|
275
|
-
/**
|
|
276
|
-
* Callback fired when the escape key is pressed.
|
|
277
|
-
*/
|
|
278
|
-
onEscKeyDown: PropTypes.func,
|
|
279
|
-
/**
|
|
280
|
-
* Callback fired when the overlay is clicked.
|
|
281
|
-
*/
|
|
282
|
-
onOverlayClick: PropTypes.func,
|
|
283
|
-
/**
|
|
284
|
-
* Control if the modal is open or not.
|
|
285
|
-
*/
|
|
286
|
-
open: PropTypes.bool.isRequired,
|
|
287
|
-
/**
|
|
288
|
-
* An object containing classNames to style the modal, can have properties 'overlay' (classname for overlay div), 'modal' (classname for modal content div), 'closeButton' (classname for the button that contain the close icon), 'closeIcon' (classname for close icon svg). You can customize the transition with 'transitionEnter', 'transitionEnterActive', 'transitionExit', 'transitionExitActive'
|
|
289
|
-
*/
|
|
290
|
-
classNames: PropTypes.object,
|
|
291
|
-
/**
|
|
292
|
-
* An object containing the styles objects to style the modal, can have properties 'overlay', 'modal', 'closeButton', 'closeIcon'.
|
|
293
|
-
*/
|
|
294
|
-
styles: PropTypes.object,
|
|
295
|
-
/**
|
|
296
|
-
* The content of the modal.
|
|
297
|
-
*/
|
|
298
|
-
children: PropTypes.node,
|
|
299
|
-
/**
|
|
300
|
-
* @internal
|
|
301
|
-
*/
|
|
302
|
-
classes: PropTypes.object,
|
|
303
|
-
/**
|
|
304
|
-
* Should the dialog be centered.
|
|
305
|
-
*/
|
|
306
|
-
center: PropTypes.bool,
|
|
307
|
-
/**
|
|
308
|
-
* Show the close icon.
|
|
309
|
-
*/
|
|
310
|
-
showCloseIcon: PropTypes.bool,
|
|
311
|
-
/**
|
|
312
|
-
* Close icon size.
|
|
313
|
-
*/
|
|
314
|
-
closeIconSize: PropTypes.number,
|
|
315
|
-
/**
|
|
316
|
-
* A valid svg path to show as icon.
|
|
317
|
-
*/
|
|
318
|
-
closeIconSvgPath: PropTypes.node,
|
|
319
|
-
/**
|
|
320
|
-
* Animation duration in milliseconds.
|
|
321
|
-
*/
|
|
322
|
-
animationDuration: PropTypes.number,
|
|
323
|
-
/**
|
|
324
|
-
* You can specify a container prop which should be of type `Element`. The portal will be rendered inside that element. The default behavior will create a div node and render it at the at the end of document.body.
|
|
325
|
-
*/
|
|
326
|
-
container: PropTypes.object, // eslint-disable-line
|
|
327
|
-
/**
|
|
328
|
-
* Whether to block scrolling when dialog is open
|
|
329
|
-
*/
|
|
330
|
-
blockScroll: PropTypes.bool,
|
|
331
|
-
/**
|
|
332
|
-
* When the modal is open, trap focus within it
|
|
333
|
-
*/
|
|
334
|
-
focusTrapped: PropTypes.bool,
|
|
335
|
-
/**
|
|
336
|
-
* Options to be passed to the focus trap, details available at https://github.com/davidtheclark/focus-trap#focustrap--createfocustrapelement-createoptions
|
|
337
|
-
*/
|
|
338
|
-
focusTrapOptions: PropTypes.object,
|
|
339
|
-
/**
|
|
340
|
-
* id attribute for overlay
|
|
341
|
-
*/
|
|
342
|
-
overlayId: PropTypes.string,
|
|
343
|
-
/**
|
|
344
|
-
* id attribute for modal
|
|
345
|
-
*/
|
|
346
|
-
modalId: PropTypes.string,
|
|
347
|
-
/**
|
|
348
|
-
* id attribute for close icon
|
|
349
|
-
*/
|
|
350
|
-
closeIconId: PropTypes.string,
|
|
351
|
-
/**
|
|
352
|
-
* ARIA role for modal
|
|
353
|
-
*/
|
|
354
|
-
role: PropTypes.string,
|
|
355
|
-
/**
|
|
356
|
-
* ARIA label for modal
|
|
357
|
-
*/
|
|
358
|
-
ariaLabelledby: PropTypes.string,
|
|
359
|
-
/**
|
|
360
|
-
* ARIA description for modal
|
|
361
|
-
*/
|
|
362
|
-
ariaDescribedby: PropTypes.string,
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
Modal.defaultProps = {
|
|
366
|
-
classes: cssClasses,
|
|
367
|
-
closeOnEsc: true,
|
|
368
|
-
closeOnOverlayClick: true,
|
|
369
|
-
onEntered: undefined,
|
|
370
|
-
onExited: undefined,
|
|
371
|
-
onEscKeyDown: undefined,
|
|
372
|
-
onOverlayClick: undefined,
|
|
373
|
-
showCloseIcon: true,
|
|
374
|
-
closeIconSize: 28,
|
|
375
|
-
closeIconSvgPath: (
|
|
376
|
-
<path d="M28.5 9.62L26.38 7.5 18 15.88 9.62 7.5 7.5 9.62 15.88 18 7.5 26.38l2.12 2.12L18 20.12l8.38 8.38 2.12-2.12L20.12 18z" />
|
|
377
|
-
),
|
|
378
|
-
classNames: {},
|
|
379
|
-
styles: {},
|
|
380
|
-
children: null,
|
|
381
|
-
center: false,
|
|
382
|
-
animationDuration: 500,
|
|
383
|
-
blockScroll: true,
|
|
384
|
-
focusTrapped: true,
|
|
385
|
-
focusTrapOptions: {},
|
|
386
|
-
overlayId: undefined,
|
|
387
|
-
modalId: undefined,
|
|
388
|
-
closeIconId: undefined,
|
|
389
|
-
role: 'dialog',
|
|
390
|
-
ariaLabelledby: undefined,
|
|
391
|
-
ariaDescribedby: undefined,
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
export default Modal;
|
package/types/index.d.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
// TypeScript Version: 2.9
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
/**
|
|
7
|
-
* Is the modal closable when user press esc key.
|
|
8
|
-
*/
|
|
9
|
-
closeOnEsc?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Is the modal closable when user click on overlay.
|
|
12
|
-
*/
|
|
13
|
-
closeOnOverlayClick?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Callback fired when the Modal is open and the animation is finished.
|
|
16
|
-
*/
|
|
17
|
-
onEntered?: () => void;
|
|
18
|
-
/**
|
|
19
|
-
* Callback fired when the Modal has exited and the animation is finished.
|
|
20
|
-
*/
|
|
21
|
-
onExited?: () => void;
|
|
22
|
-
/**
|
|
23
|
-
* Callback fired when the Modal is requested to be closed by a click on the overlay or when user press esc key.
|
|
24
|
-
*/
|
|
25
|
-
onClose: () => void;
|
|
26
|
-
/**
|
|
27
|
-
* Callback fired when the escape key is pressed.
|
|
28
|
-
*/
|
|
29
|
-
onEscKeyDown?: () => void;
|
|
30
|
-
/**
|
|
31
|
-
* Callback fired when the overlay is clicked.
|
|
32
|
-
*/
|
|
33
|
-
onOverlayClick?: () => void;
|
|
34
|
-
/**
|
|
35
|
-
* Control if the modal is open or not.
|
|
36
|
-
*/
|
|
37
|
-
open: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* An object containing classNames to style the modal, can have properties 'overlay' (classname for overlay div), 'modal' (classname for modal content div),
|
|
40
|
-
* 'closeButton' (classname for the button that contain the close icon), 'closeIcon' (classname for close icon svg).
|
|
41
|
-
* You can customize the transition with 'transitionEnter', 'transitionEnterActive', 'transitionExit', 'transitionExitActive'
|
|
42
|
-
*/
|
|
43
|
-
classNames?: object;
|
|
44
|
-
/**
|
|
45
|
-
* An object containing the styles objects to style the modal, can have properties 'overlay', 'modal', 'closeButton', 'closeIcon'.
|
|
46
|
-
*/
|
|
47
|
-
styles?: object;
|
|
48
|
-
/**
|
|
49
|
-
* Should the dialog be centered.
|
|
50
|
-
*/
|
|
51
|
-
center?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Show the close icon.
|
|
54
|
-
*/
|
|
55
|
-
showCloseIcon?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Close icon size.
|
|
58
|
-
*/
|
|
59
|
-
closeIconSize?: number;
|
|
60
|
-
/**
|
|
61
|
-
* A valid svg path to show as icon.
|
|
62
|
-
*/
|
|
63
|
-
closeIconSvgPath?: any;
|
|
64
|
-
/**
|
|
65
|
-
* Animation duration in milliseconds.
|
|
66
|
-
*/
|
|
67
|
-
animationDuration?: number;
|
|
68
|
-
/**
|
|
69
|
-
* You can specify a container prop which should be of type `Element`. The portal will be rendered inside that element.
|
|
70
|
-
* The default behavior will create a div node and render it at the at the end of document.body.
|
|
71
|
-
*/
|
|
72
|
-
container?: any;
|
|
73
|
-
/**
|
|
74
|
-
* Whether to block scrolling when dialog is open
|
|
75
|
-
*/
|
|
76
|
-
blockScroll?: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* When the modal is open, trap focus within it
|
|
79
|
-
*/
|
|
80
|
-
focusTrapped?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Options to be passed to the focus trap, details available at https://github.com/davidtheclark/focus-trap#focustrap--createfocustrapelement-createoptions
|
|
83
|
-
*/
|
|
84
|
-
focusTrapOptions?: object;
|
|
85
|
-
/**
|
|
86
|
-
* id attribute for overlay
|
|
87
|
-
*/
|
|
88
|
-
overlayId?: string;
|
|
89
|
-
/**
|
|
90
|
-
* id attribute for modal
|
|
91
|
-
*/
|
|
92
|
-
modalId?: string;
|
|
93
|
-
/**
|
|
94
|
-
* id attribute for close icon
|
|
95
|
-
*/
|
|
96
|
-
closeIconId?: string;
|
|
97
|
-
/**
|
|
98
|
-
* ARIA role for modal
|
|
99
|
-
*/
|
|
100
|
-
role?: string;
|
|
101
|
-
/**
|
|
102
|
-
* ARIA label for modal
|
|
103
|
-
*/
|
|
104
|
-
ariaLabelledby?: string;
|
|
105
|
-
/**
|
|
106
|
-
* ARIA description for modal
|
|
107
|
-
*/
|
|
108
|
-
ariaDescribedby?: string;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
declare const ReactReponsiveModal: React.ComponentType<Props>;
|
|
112
|
-
|
|
113
|
-
export default ReactReponsiveModal;
|
package/types/test.tsx
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import Modal from 'react-responsive-modal';
|
|
3
|
-
|
|
4
|
-
const onClose = () => null;
|
|
5
|
-
const open = true;
|
|
6
|
-
|
|
7
|
-
function SimpleModal() {
|
|
8
|
-
return <Modal onClose={onClose} open={open} />;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function PropsModal() {
|
|
12
|
-
return (
|
|
13
|
-
<Modal
|
|
14
|
-
onClose={onClose}
|
|
15
|
-
open={open}
|
|
16
|
-
closeOnEsc={true}
|
|
17
|
-
center={true}
|
|
18
|
-
showCloseIcon={true}
|
|
19
|
-
closeIconSize={20}
|
|
20
|
-
animationDuration={20}
|
|
21
|
-
onEntered={() => null}
|
|
22
|
-
onExited={() => null}
|
|
23
|
-
onEscKeyDown={() => null}
|
|
24
|
-
onOverlayClick={() => null}
|
|
25
|
-
classNames={{}}
|
|
26
|
-
styles={{}}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
}
|
package/types/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"lib": ["es6", "dom"],
|
|
5
|
-
"noImplicitAny": true,
|
|
6
|
-
"noImplicitThis": true,
|
|
7
|
-
"strictFunctionTypes": true,
|
|
8
|
-
"strictNullChecks": true,
|
|
9
|
-
"jsx": "react",
|
|
10
|
-
"types": [],
|
|
11
|
-
"noEmit": true,
|
|
12
|
-
"baseUrl": "./",
|
|
13
|
-
"paths": { "react-responsive-modal": ["."] }
|
|
14
|
-
},
|
|
15
|
-
"files": ["index.d.ts", "test.tsx"]
|
|
16
|
-
}
|
package/types/tslint.json
DELETED