react-responsive-modal 5.2.6 → 6.2.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,7 +1,8 @@
1
1
  import React, { useRef, useEffect, useState } from 'react';
2
2
  import ReactDom from 'react-dom';
3
3
  import cx from 'classnames';
4
- import noScroll from 'no-scroll';
4
+ import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
5
+ import useForwardedRef from '@bedrock-layout/use-forwarded-ref';
5
6
 
6
7
  function _extends() {
7
8
  _extends = Object.assign || function (target) {
@@ -27,17 +28,16 @@ var CloseIcon = function CloseIcon(_ref) {
27
28
  styles = _ref.styles,
28
29
  id = _ref.id,
29
30
  closeIcon = _ref.closeIcon,
30
- onClickCloseIcon = _ref.onClickCloseIcon;
31
+ onClick = _ref.onClick;
31
32
  return React.createElement("button", {
32
33
  id: id,
33
34
  className: cx(classes.closeButton, classNames == null ? void 0 : classNames.closeButton),
34
35
  style: styles == null ? void 0 : styles.closeButton,
35
- onClick: onClickCloseIcon,
36
+ onClick: onClick,
36
37
  "data-testid": "close-button"
37
38
  }, closeIcon ? closeIcon : React.createElement("svg", {
38
39
  className: classNames == null ? void 0 : classNames.closeIcon,
39
40
  style: styles == null ? void 0 : styles.closeIcon,
40
- xmlns: "http://www.w3.org/2000/svg",
41
41
  width: 28,
42
42
  height: 28,
43
43
  viewBox: "0 0 36 36",
@@ -47,74 +47,9 @@ var CloseIcon = function CloseIcon(_ref) {
47
47
  })));
48
48
  };
49
49
 
50
- var _modals = [];
51
- /**
52
- * Handle the order of the modals.
53
- * Inspired by the material-ui implementation.
54
- */
55
-
56
- var modalManager = {
57
- /**
58
- * Return the modals array
59
- */
60
- modals: function modals() {
61
- return _modals;
62
- },
63
-
64
- /**
65
- * Register a new modal
66
- */
67
- add: function add(newModal, blockScroll) {
68
- if (_modals.findIndex(function (modal) {
69
- return modal.element === newModal;
70
- }) === -1) {
71
- _modals.push({
72
- element: newModal,
73
- blockScroll: blockScroll
74
- });
75
- }
76
- },
77
-
78
- /**
79
- * Remove a modal
80
- */
81
- remove: function remove(oldModal) {
82
- var index = _modals.findIndex(function (modal) {
83
- return modal.element === oldModal;
84
- });
85
-
86
- if (index !== -1) {
87
- _modals.splice(index, 1);
88
- }
89
- },
90
-
91
- /**
92
- * Check if the modal is the first one on the screen
93
- */
94
- isTopModal: function isTopModal(modal) {
95
- var _modals2;
96
-
97
- return !!_modals.length && ((_modals2 = _modals[_modals.length - 1]) == null ? void 0 : _modals2.element) === modal;
98
- }
99
- };
100
-
101
50
  var isBrowser = typeof window !== 'undefined';
102
- var blockNoScroll = function blockNoScroll() {
103
- noScroll.on();
104
- };
105
- var unblockNoScroll = function unblockNoScroll() {
106
- // Restore the scroll only if there is no modal on the screen
107
- // We filter the modals that are not affecting the scroll
108
- var modals = modalManager.modals().filter(function (modal) {
109
- return modal.blockScroll;
110
- });
111
-
112
- if (modals.length === 0) {
113
- noScroll.off();
114
- }
115
- };
116
51
 
117
- // https://github.com/alexandrzavalii/focus-trap-js/blob/master/src/index.js v1.0.9
52
+ // https://github.com/alexandrzavalii/focus-trap-js/blob/master/src/index.js v1.1.0
118
53
  var candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])'];
119
54
 
120
55
  function isHidden(node) {
@@ -123,14 +58,34 @@ function isHidden(node) {
123
58
  return node.offsetParent === null || getComputedStyle(node).visibility === 'hidden';
124
59
  }
125
60
 
61
+ function getCheckedRadio(nodes, form) {
62
+ for (var i = 0; i < nodes.length; i++) {
63
+ if (nodes[i].checked && nodes[i].form === form) {
64
+ return nodes[i];
65
+ }
66
+ }
67
+ }
68
+
69
+ function isNotRadioOrTabbableRadio(node) {
70
+ if (node.tagName !== 'INPUT' || node.type !== 'radio' || !node.name) {
71
+ return true;
72
+ }
73
+
74
+ var radioScope = node.form || node.ownerDocument;
75
+ var radioSet = radioScope.querySelectorAll('input[type="radio"][name="' + node.name + '"]');
76
+ var checked = getCheckedRadio(radioSet, node.form);
77
+ return checked === node || checked === undefined && radioSet[0] === node;
78
+ }
79
+
126
80
  function getAllTabbingElements(parentElem) {
81
+ var currentActiveElement = document.activeElement;
127
82
  var tabbableNodes = parentElem.querySelectorAll(candidateSelectors.join(','));
128
83
  var onlyTabbable = [];
129
84
 
130
85
  for (var i = 0; i < tabbableNodes.length; i++) {
131
86
  var node = tabbableNodes[i];
132
87
 
133
- if (!node.disabled && getTabindex(node) > -1 && !isHidden(node)) {
88
+ if (currentActiveElement === node || !node.disabled && getTabindex(node) > -1 && !isHidden(node) && isNotRadioOrTabbableRadio(node)) {
134
89
  onlyTabbable.push(node);
135
90
  }
136
91
  }
@@ -184,7 +139,8 @@ function isContentEditable(node) {
184
139
  }
185
140
 
186
141
  var FocusTrap = function FocusTrap(_ref) {
187
- var container = _ref.container;
142
+ var container = _ref.container,
143
+ initialFocusRef = _ref.initialFocusRef;
188
144
  var refLastFocus = useRef();
189
145
  /**
190
146
  * Handle focus lock on the modal
@@ -203,9 +159,7 @@ var FocusTrap = function FocusTrap(_ref) {
203
159
 
204
160
 
205
161
  if (isBrowser && (container == null ? void 0 : container.current)) {
206
- var allTabbingElements = getAllTabbingElements(container.current);
207
-
208
- if (allTabbingElements[0]) {
162
+ var savePreviousFocus = function savePreviousFocus() {
209
163
  // First we save the last focused element
210
164
  // only if it's a focusable element
211
165
  if (candidateSelectors.findIndex(function (selector) {
@@ -215,8 +169,23 @@ var FocusTrap = function FocusTrap(_ref) {
215
169
  }) !== -1) {
216
170
  refLastFocus.current = document.activeElement;
217
171
  }
172
+ };
173
+
174
+ if (initialFocusRef) {
175
+ savePreviousFocus(); // We need to schedule focusing on a next frame - this allows to focus on the modal root
176
+
177
+ requestAnimationFrame(function () {
178
+ var _initialFocusRef$curr;
218
179
 
219
- allTabbingElements[0].focus();
180
+ (_initialFocusRef$curr = initialFocusRef.current) == null ? void 0 : _initialFocusRef$curr.focus();
181
+ });
182
+ } else {
183
+ var allTabbingElements = getAllTabbingElements(container.current);
184
+
185
+ if (allTabbingElements[0]) {
186
+ savePreviousFocus();
187
+ allTabbingElements[0].focus();
188
+ }
220
189
  }
221
190
  }
222
191
 
@@ -229,20 +198,85 @@ var FocusTrap = function FocusTrap(_ref) {
229
198
  (_refLastFocus$current = refLastFocus.current) == null ? void 0 : _refLastFocus$current.focus();
230
199
  }
231
200
  };
232
- }, [container]);
201
+ }, [container, initialFocusRef]);
233
202
  return null;
234
203
  };
235
204
 
205
+ var modals = [];
206
+ /**
207
+ * Handle the order of the modals.
208
+ * Inspired by the material-ui implementation.
209
+ */
210
+
211
+ var modalManager = {
212
+ /**
213
+ * Register a new modal
214
+ */
215
+ add: function add(newModal) {
216
+ modals.push(newModal);
217
+ },
218
+
219
+ /**
220
+ * Remove a modal
221
+ */
222
+ remove: function remove(oldModal) {
223
+ modals = modals.filter(function (modal) {
224
+ return modal !== oldModal;
225
+ });
226
+ },
227
+
228
+ /**
229
+ * When multiple modals are rendered will return true if current modal is the last one
230
+ */
231
+ isTopModal: function isTopModal(modal) {
232
+ return !!modals.length && modals[modals.length - 1] === modal;
233
+ }
234
+ };
235
+ function useModalManager(ref, open) {
236
+ useEffect(function () {
237
+ if (open) {
238
+ modalManager.add(ref);
239
+ }
240
+
241
+ return function () {
242
+ modalManager.remove(ref);
243
+ };
244
+ }, [open, ref]);
245
+ }
246
+
247
+ var useScrollLock = function useScrollLock(refModal, open, showPortal, blockScroll, reserveScrollBarGap) {
248
+ var oldRef = useRef(null);
249
+ useEffect(function () {
250
+ if (open && refModal.current && blockScroll) {
251
+ oldRef.current = refModal.current;
252
+ disableBodyScroll(refModal.current, {
253
+ reserveScrollBarGap: reserveScrollBarGap
254
+ });
255
+ }
256
+
257
+ return function () {
258
+ if (oldRef.current) {
259
+ enableBodyScroll(oldRef.current);
260
+ oldRef.current = null;
261
+ }
262
+ };
263
+ }, [open, showPortal, refModal, blockScroll, reserveScrollBarGap]);
264
+ };
265
+
236
266
  var classes = {
267
+ root: 'react-responsive-modal-root',
237
268
  overlay: 'react-responsive-modal-overlay',
269
+ overlayAnimationIn: 'react-responsive-modal-overlay-in',
270
+ overlayAnimationOut: 'react-responsive-modal-overlay-out',
271
+ modalContainer: 'react-responsive-modal-container',
272
+ modalContainerCenter: 'react-responsive-modal-containerCenter',
238
273
  modal: 'react-responsive-modal-modal',
239
- modalCenter: 'react-responsive-modal-modalCenter',
240
- closeButton: 'react-responsive-modal-closeButton',
241
- animationIn: 'react-responsive-modal-fadeIn',
242
- animationOut: 'react-responsive-modal-fadeOut'
274
+ modalAnimationIn: 'react-responsive-modal-modal-in',
275
+ modalAnimationOut: 'react-responsive-modal-modal-out',
276
+ closeButton: 'react-responsive-modal-closeButton'
243
277
  };
244
- var Modal = function Modal(_ref) {
245
- var _classNames$animation, _classNames$animation2;
278
+ var Modal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
279
+ var _classNames$overlayAn, _classNames$overlayAn2, _classNames$modalAnim, _classNames$modalAnim2;
246
280
 
247
281
  var open = _ref.open,
248
282
  center = _ref.center,
@@ -259,8 +293,10 @@ var Modal = function Modal(_ref) {
259
293
  closeIcon = _ref.closeIcon,
260
294
  _ref$focusTrapped = _ref.focusTrapped,
261
295
  focusTrapped = _ref$focusTrapped === void 0 ? true : _ref$focusTrapped,
296
+ _ref$initialFocusRef = _ref.initialFocusRef,
297
+ initialFocusRef = _ref$initialFocusRef === void 0 ? undefined : _ref$initialFocusRef,
262
298
  _ref$animationDuratio = _ref.animationDuration,
263
- animationDuration = _ref$animationDuratio === void 0 ? 500 : _ref$animationDuratio,
299
+ animationDuration = _ref$animationDuratio === void 0 ? 300 : _ref$animationDuratio,
264
300
  classNames = _ref.classNames,
265
301
  styles = _ref.styles,
266
302
  _ref$role = _ref.role,
@@ -272,7 +308,9 @@ var Modal = function Modal(_ref) {
272
308
  onEscKeyDown = _ref.onEscKeyDown,
273
309
  onOverlayClick = _ref.onOverlayClick,
274
310
  onAnimationEnd = _ref.onAnimationEnd,
275
- children = _ref.children;
311
+ children = _ref.children,
312
+ reserveScrollBarGap = _ref.reserveScrollBarGap;
313
+ var refDialog = useForwardedRef(ref);
276
314
  var refModal = useRef(null);
277
315
  var refShouldClose = useRef(null);
278
316
  var refContainer = useRef(null); // Lazily create the ref instance
@@ -286,15 +324,14 @@ var Modal = function Modal(_ref) {
286
324
 
287
325
  var _useState = useState(false),
288
326
  showPortal = _useState[0],
289
- setShowPortal = _useState[1];
327
+ setShowPortal = _useState[1]; // Hook used to manage multiple modals opened at the same time
290
328
 
291
- var handleOpen = function handleOpen() {
292
- modalManager.add(refContainer.current, blockScroll);
293
329
 
294
- if (blockScroll) {
295
- blockNoScroll();
296
- }
330
+ useModalManager(refModal, open); // Hook used to manage the scroll
297
331
 
332
+ useScrollLock(refModal, open, showPortal, blockScroll, reserveScrollBarGap);
333
+
334
+ var handleOpen = function handleOpen() {
298
335
  if (refContainer.current && !container && !document.body.contains(refContainer.current)) {
299
336
  document.body.appendChild(refContainer.current);
300
337
  }
@@ -303,12 +340,6 @@ var Modal = function Modal(_ref) {
303
340
  };
304
341
 
305
342
  var handleClose = function handleClose() {
306
- modalManager.remove(refContainer.current);
307
-
308
- if (blockScroll) {
309
- unblockNoScroll();
310
- }
311
-
312
343
  if (refContainer.current && !container && document.body.contains(refContainer.current)) {
313
344
  document.body.removeChild(refContainer.current);
314
345
  }
@@ -318,7 +349,7 @@ var Modal = function Modal(_ref) {
318
349
 
319
350
  var handleKeydown = function handleKeydown(event) {
320
351
  // Only the last modal need to be escaped when pressing the esc key
321
- if (event.keyCode !== 27 || !modalManager.isTopModal(refContainer.current)) {
352
+ if (event.keyCode !== 27 || !modalManager.isTopModal(refModal)) {
322
353
  return;
323
354
  }
324
355
 
@@ -331,8 +362,8 @@ var Modal = function Modal(_ref) {
331
362
 
332
363
  useEffect(function () {
333
364
  return function () {
334
- // When the component is unmounted directly we want to unblock the scroll
335
365
  if (showPortal) {
366
+ // When the modal is closed or removed directly, cleanup the listeners
336
367
  handleClose();
337
368
  }
338
369
  };
@@ -369,10 +400,6 @@ var Modal = function Modal(_ref) {
369
400
  refShouldClose.current = false;
370
401
  };
371
402
 
372
- var handleClickCloseIcon = function handleClickCloseIcon() {
373
- onClose();
374
- };
375
-
376
403
  var handleAnimationEnd = function handleAnimationEnd() {
377
404
  if (!open) {
378
405
  setShowPortal(false);
@@ -382,38 +409,54 @@ var Modal = function Modal(_ref) {
382
409
  };
383
410
 
384
411
  var containerModal = container || refContainer.current;
412
+ var overlayAnimation = open ? (_classNames$overlayAn = classNames == null ? void 0 : classNames.overlayAnimationIn) != null ? _classNames$overlayAn : classes.overlayAnimationIn : (_classNames$overlayAn2 = classNames == null ? void 0 : classNames.overlayAnimationOut) != null ? _classNames$overlayAn2 : classes.overlayAnimationOut;
413
+ var modalAnimation = open ? (_classNames$modalAnim = classNames == null ? void 0 : classNames.modalAnimationIn) != null ? _classNames$modalAnim : classes.modalAnimationIn : (_classNames$modalAnim2 = classNames == null ? void 0 : classNames.modalAnimationOut) != null ? _classNames$modalAnim2 : classes.modalAnimationOut;
385
414
  return showPortal && containerModal ? ReactDom.createPortal(React.createElement("div", {
386
- style: _extends({
387
- animation: (open ? (_classNames$animation = classNames == null ? void 0 : classNames.animationIn) != null ? _classNames$animation : classes.animationIn : (_classNames$animation2 = classNames == null ? void 0 : classNames.animationOut) != null ? _classNames$animation2 : classes.animationOut) + " " + animationDuration + "ms"
388
- }, styles == null ? void 0 : styles.overlay),
389
- className: cx(classes.overlay, classNames == null ? void 0 : classNames.overlay),
390
- onClick: handleClickOverlay,
391
- onAnimationEnd: handleAnimationEnd,
392
- "data-testid": "overlay"
415
+ className: cx(classes.root, classNames == null ? void 0 : classNames.root),
416
+ style: styles == null ? void 0 : styles.root,
417
+ "data-testid": "root"
393
418
  }, React.createElement("div", {
419
+ className: cx(classes.overlay, classNames == null ? void 0 : classNames.overlay),
420
+ "data-testid": "overlay",
421
+ "aria-hidden": true,
422
+ style: _extends({
423
+ animation: overlayAnimation + " " + animationDuration + "ms"
424
+ }, styles == null ? void 0 : styles.overlay)
425
+ }), React.createElement("div", {
394
426
  ref: refModal,
395
- className: cx(classes.modal, center && classes.modalCenter, classNames == null ? void 0 : classNames.modal),
396
- style: styles == null ? void 0 : styles.modal,
427
+ className: cx(classes.modalContainer, center && classes.modalContainerCenter, classNames == null ? void 0 : classNames.modalContainer),
428
+ style: styles == null ? void 0 : styles.modalContainer,
429
+ "data-testid": "modal-container",
430
+ onClick: handleClickOverlay
431
+ }, React.createElement("div", {
432
+ ref: refDialog,
433
+ className: cx(classes.modal, classNames == null ? void 0 : classNames.modal),
434
+ style: _extends({
435
+ animation: modalAnimation + " " + animationDuration + "ms"
436
+ }, styles == null ? void 0 : styles.modal),
397
437
  onMouseDown: handleModalEvent,
398
438
  onMouseUp: handleModalEvent,
399
439
  onClick: handleModalEvent,
440
+ onAnimationEnd: handleAnimationEnd,
400
441
  id: modalId,
401
442
  role: role,
402
443
  "aria-modal": "true",
403
444
  "aria-labelledby": ariaLabelledby,
404
445
  "aria-describedby": ariaDescribedby,
405
- "data-testid": "modal"
446
+ "data-testid": "modal",
447
+ tabIndex: -1
406
448
  }, focusTrapped && React.createElement(FocusTrap, {
407
- container: refModal
449
+ container: refDialog,
450
+ initialFocusRef: initialFocusRef
408
451
  }), children, showCloseIcon && React.createElement(CloseIcon, {
409
452
  classes: classes,
410
453
  classNames: classNames,
411
454
  styles: styles,
412
455
  closeIcon: closeIcon,
413
- onClickCloseIcon: handleClickCloseIcon,
456
+ onClick: onClose,
414
457
  id: closeIconId
415
- }))), containerModal) : null;
416
- };
458
+ })))), containerModal) : null;
459
+ });
417
460
 
418
461
  export default Modal;
419
462
  export { Modal };
@@ -1 +1 @@
1
- {"version":3,"file":"react-responsive-modal.esm.js","sources":["../src/CloseIcon.tsx","../src/modalManager.ts","../src/utils.ts","../src/lib/focusTrapJs.ts","../src/FocusTrap.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\nimport cx from 'classnames';\n\ninterface CloseIconProps {\n id?: string;\n closeIcon?: React.ReactNode;\n styles?: {\n closeButton?: React.CSSProperties;\n closeIcon?: React.CSSProperties;\n };\n classNames?: {\n closeButton?: string;\n closeIcon?: string;\n };\n classes: {\n closeButton?: string;\n };\n onClickCloseIcon: () => void;\n}\n\nconst CloseIcon = ({\n classes,\n classNames,\n styles,\n id,\n closeIcon,\n onClickCloseIcon,\n}: CloseIconProps) => (\n <button\n id={id}\n className={cx(classes.closeButton, classNames?.closeButton)}\n style={styles?.closeButton}\n onClick={onClickCloseIcon}\n data-testid=\"close-button\"\n >\n {closeIcon ? (\n closeIcon\n ) : (\n <svg\n className={classNames?.closeIcon}\n style={styles?.closeIcon}\n xmlns=\"http://www.w3.org/2000/svg\"\n width={28}\n height={28}\n viewBox=\"0 0 36 36\"\n data-testid=\"close-icon\"\n >\n <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\" />\n </svg>\n )}\n </button>\n);\n\nexport default CloseIcon;\n","const modals: { element: HTMLDivElement; blockScroll: boolean }[] = [];\n\n/**\n * Handle the order of the modals.\n * Inspired by the material-ui implementation.\n */\nexport default {\n /**\n * Return the modals array\n */\n modals: () => modals,\n\n /**\n * Register a new modal\n */\n add: (newModal: HTMLDivElement, blockScroll: boolean) => {\n if (modals.findIndex((modal) => modal.element === newModal) === -1) {\n modals.push({ element: newModal, blockScroll });\n }\n },\n\n /**\n * Remove a modal\n */\n remove: (oldModal: HTMLDivElement) => {\n const index = modals.findIndex((modal) => modal.element === oldModal);\n if (index !== -1) {\n modals.splice(index, 1);\n }\n },\n\n /**\n * Check if the modal is the first one on the screen\n */\n isTopModal: (modal: HTMLDivElement) =>\n !!modals.length && modals[modals.length - 1]?.element === modal,\n};\n","import noScroll from 'no-scroll';\nimport modalManager from './modalManager';\n\nexport const isBrowser = typeof window !== 'undefined';\n\nexport const blockNoScroll = () => {\n noScroll.on();\n};\n\nexport const unblockNoScroll = () => {\n // Restore the scroll only if there is no modal on the screen\n // We filter the modals that are not affecting the scroll\n const modals = modalManager.modals().filter((modal) => modal.blockScroll);\n if (modals.length === 0) {\n noScroll.off();\n }\n};\n","// https://github.com/alexandrzavalii/focus-trap-js/blob/master/src/index.js v1.0.9\n\nexport const candidateSelectors = [\n 'input',\n 'select',\n 'textarea',\n 'a[href]',\n 'button',\n '[tabindex]',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]:not([contenteditable=\"false\"])',\n];\n\nfunction isHidden(node: any) {\n // offsetParent being null will allow detecting cases where an element is invisible or inside an invisible element,\n // as long as the element does not use position: fixed. For them, their visibility has to be checked directly as well.\n return (\n node.offsetParent === null || getComputedStyle(node).visibility === 'hidden'\n );\n}\n\nexport function getAllTabbingElements(parentElem: any) {\n var tabbableNodes = parentElem.querySelectorAll(candidateSelectors.join(','));\n var onlyTabbable = [];\n for (var i = 0; i < tabbableNodes.length; i++) {\n var node = tabbableNodes[i];\n if (!node.disabled && getTabindex(node) > -1 && !isHidden(node)) {\n onlyTabbable.push(node);\n }\n }\n return onlyTabbable;\n}\n\nexport function tabTrappingKey(event: any, parentElem: any) {\n // check if current event keyCode is tab\n if (!event || event.key !== 'Tab') return;\n\n if (!parentElem || !parentElem.contains) {\n if (process && process.env.NODE_ENV === 'development') {\n console.warn('focus-trap-js: parent element is not defined');\n }\n return false;\n }\n\n if (!parentElem.contains(event.target)) {\n return false;\n }\n\n var allTabbingElements = getAllTabbingElements(parentElem);\n var firstFocusableElement = allTabbingElements[0];\n var lastFocusableElement = allTabbingElements[allTabbingElements.length - 1];\n\n if (event.shiftKey && event.target === firstFocusableElement) {\n lastFocusableElement.focus();\n event.preventDefault();\n return true;\n } else if (!event.shiftKey && event.target === lastFocusableElement) {\n firstFocusableElement.focus();\n event.preventDefault();\n return true;\n }\n return false;\n}\n\nfunction getTabindex(node: any) {\n var tabindexAttr = parseInt(node.getAttribute('tabindex'), 10);\n\n if (!isNaN(tabindexAttr)) return tabindexAttr;\n // Browsers do not return tabIndex correctly for contentEditable nodes;\n // so if they don't have a tabindex attribute specifically set, assume it's 0.\n\n if (isContentEditable(node)) return 0;\n return node.tabIndex;\n}\n\nfunction isContentEditable(node: any) {\n return node.getAttribute('contentEditable');\n}\n","import { useEffect, useRef } from 'react';\nimport { isBrowser } from './utils';\nimport {\n tabTrappingKey,\n candidateSelectors,\n getAllTabbingElements,\n} from './lib/focusTrapJs';\n\ninterface FocusTrapProps {\n container?: React.RefObject<HTMLElement> | null;\n}\n\nexport const FocusTrap = ({ container }: FocusTrapProps) => {\n const refLastFocus = useRef<HTMLElement | null>();\n /**\n * Handle focus lock on the modal\n */\n useEffect(() => {\n const handleKeyEvent = (event: KeyboardEvent) => {\n if (container?.current) {\n tabTrappingKey(event, container.current);\n }\n };\n\n if (isBrowser) {\n document.addEventListener('keydown', handleKeyEvent);\n }\n // On mount we focus on the first focusable element in the modal if there is one\n if (isBrowser && container?.current) {\n const allTabbingElements = getAllTabbingElements(container.current);\n if (allTabbingElements[0]) {\n // First we save the last focused element\n // only if it's a focusable element\n if (\n candidateSelectors.findIndex((selector) =>\n document.activeElement?.matches(selector)\n ) !== -1\n ) {\n refLastFocus.current = document.activeElement as HTMLElement;\n }\n allTabbingElements[0].focus();\n }\n }\n return () => {\n if (isBrowser) {\n document.removeEventListener('keydown', handleKeyEvent);\n // On unmount we restore the focus to the last focused element\n refLastFocus.current?.focus();\n }\n };\n }, [container]);\n\n return null;\n};\n","import React, { useEffect, useState, useRef } from 'react';\nimport ReactDom from 'react-dom';\nimport cx from 'classnames';\nimport CloseIcon from './CloseIcon';\nimport { FocusTrap } from './FocusTrap';\nimport modalManager from './modalManager';\nimport { isBrowser, blockNoScroll, unblockNoScroll } from './utils';\n\nconst classes = {\n overlay: 'react-responsive-modal-overlay',\n modal: 'react-responsive-modal-modal',\n modalCenter: 'react-responsive-modal-modalCenter',\n closeButton: 'react-responsive-modal-closeButton',\n animationIn: 'react-responsive-modal-fadeIn',\n animationOut: 'react-responsive-modal-fadeOut',\n};\n\nexport interface ModalProps {\n /**\n * Control if the modal is open or not.\n */\n open: boolean;\n /**\n * Should the dialog be centered.\n *\n * Default to false.\n */\n center?: boolean;\n /**\n * Is the modal closable when user press esc key.\n *\n * Default to true.\n */\n closeOnEsc?: boolean;\n /**\n * Is the modal closable when user click on overlay.\n *\n * Default to true.\n */\n closeOnOverlayClick?: boolean;\n /**\n * Whether to block scrolling when dialog is open.\n *\n * Default to true.\n */\n blockScroll?: boolean;\n /**\n * Show the close icon.\n */\n showCloseIcon?: boolean;\n /**\n * id attribute for the close icon button.\n */\n closeIconId?: string;\n /**\n * Custom icon to render (svg, img, etc...).\n */\n closeIcon?: React.ReactNode;\n /**\n * When the modal is open, trap focus within it.\n *\n * Default to true.\n */\n focusTrapped?: boolean;\n /**\n * You can specify a container prop which should be of type `Element`.\n * The portal will be rendered inside that element.\n * The default behavior will create a div node and render it at the at the end of document.body.\n */\n container?: Element;\n /**\n * An object containing classNames to style the modal.\n */\n classNames?: {\n overlay?: string;\n modal?: string;\n closeButton?: string;\n closeIcon?: string;\n animationIn?: string;\n animationOut?: string;\n };\n /**\n * An object containing the styles objects to style the modal.\n */\n styles?: {\n overlay?: React.CSSProperties;\n modal?: React.CSSProperties;\n closeButton?: React.CSSProperties;\n closeIcon?: React.CSSProperties;\n };\n /**\n * Animation duration in milliseconds.\n *\n * Default to 500.\n */\n animationDuration?: number;\n /**\n * ARIA role for modal\n *\n * Default to 'dialog'.\n */\n role?: string;\n /**\n * ARIA label for modal\n */\n ariaLabelledby?: string;\n /**\n * ARIA description for modal\n */\n ariaDescribedby?: string;\n /**\n * id attribute for modal\n */\n modalId?: string;\n /**\n * Callback fired when the Modal is requested to be closed by a click on the overlay or when user press esc key.\n */\n onClose: () => void;\n /**\n * Callback fired when the escape key is pressed.\n */\n onEscKeyDown?: (event: KeyboardEvent) => void;\n /**\n * Callback fired when the overlay is clicked.\n */\n onOverlayClick?: (\n event: React.MouseEvent<HTMLDivElement, MouseEvent>\n ) => void;\n /**\n * Callback fired when the Modal has exited and the animation is finished.\n */\n onAnimationEnd?: () => void;\n children?: React.ReactNode;\n}\n\nexport const Modal = ({\n open,\n center,\n blockScroll = true,\n closeOnEsc = true,\n closeOnOverlayClick = true,\n container,\n showCloseIcon = true,\n closeIconId,\n closeIcon,\n focusTrapped = true,\n animationDuration = 500,\n classNames,\n styles,\n role = 'dialog',\n ariaDescribedby,\n ariaLabelledby,\n modalId,\n onClose,\n onEscKeyDown,\n onOverlayClick,\n onAnimationEnd,\n children,\n}: ModalProps) => {\n const refModal = useRef<HTMLDivElement>(null);\n const refShouldClose = useRef<boolean | null>(null);\n const refContainer = useRef<HTMLDivElement | null>(null);\n // Lazily create the ref instance\n // https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily\n if (refContainer.current === null && isBrowser) {\n refContainer.current = document.createElement('div');\n }\n\n // The value should be false for srr, that way when the component is hydrated client side,\n // it will match the server rendered content\n const [showPortal, setShowPortal] = useState(false);\n\n const handleOpen = () => {\n modalManager.add(refContainer.current!, blockScroll);\n if (blockScroll) {\n blockNoScroll();\n }\n if (\n refContainer.current &&\n !container &&\n !document.body.contains(refContainer.current)\n ) {\n document.body.appendChild(refContainer.current);\n }\n document.addEventListener('keydown', handleKeydown);\n };\n\n const handleClose = () => {\n modalManager.remove(refContainer.current!);\n if (blockScroll) {\n unblockNoScroll();\n }\n if (\n refContainer.current &&\n !container &&\n document.body.contains(refContainer.current)\n ) {\n document.body.removeChild(refContainer.current);\n }\n document.removeEventListener('keydown', handleKeydown);\n };\n\n const handleKeydown = (event: KeyboardEvent) => {\n // Only the last modal need to be escaped when pressing the esc key\n if (\n event.keyCode !== 27 ||\n !modalManager.isTopModal(refContainer.current!)\n ) {\n return;\n }\n\n onEscKeyDown?.(event);\n\n if (closeOnEsc) {\n onClose();\n }\n };\n\n useEffect(() => {\n return () => {\n // When the component is unmounted directly we want to unblock the scroll\n if (showPortal) {\n handleClose();\n }\n };\n }, [showPortal]);\n\n useEffect(() => {\n // If the open prop is changing, we need to open the modal\n // This is also called on the first render if the open prop is true when the modal is created\n if (open && !showPortal) {\n setShowPortal(true);\n handleOpen();\n }\n }, [open]);\n\n const handleClickOverlay = (\n event: React.MouseEvent<HTMLDivElement, MouseEvent>\n ) => {\n if (refShouldClose.current === null) {\n refShouldClose.current = true;\n }\n\n if (!refShouldClose.current) {\n refShouldClose.current = null;\n return;\n }\n\n onOverlayClick?.(event);\n\n if (closeOnOverlayClick) {\n onClose();\n }\n\n refShouldClose.current = null;\n };\n\n const handleModalEvent = () => {\n refShouldClose.current = false;\n };\n\n const handleClickCloseIcon = () => {\n onClose();\n };\n\n const handleAnimationEnd = () => {\n if (!open) {\n setShowPortal(false);\n }\n\n onAnimationEnd?.();\n };\n\n const containerModal = container || refContainer.current;\n\n return showPortal && containerModal\n ? ReactDom.createPortal(\n <div\n style={{\n animation: `${\n open\n ? classNames?.animationIn ?? classes.animationIn\n : classNames?.animationOut ?? classes.animationOut\n } ${animationDuration}ms`,\n ...styles?.overlay,\n }}\n className={cx(classes.overlay, classNames?.overlay)}\n onClick={handleClickOverlay}\n onAnimationEnd={handleAnimationEnd}\n data-testid=\"overlay\"\n >\n <div\n ref={refModal}\n className={cx(\n classes.modal,\n center && classes.modalCenter,\n classNames?.modal\n )}\n style={styles?.modal}\n onMouseDown={handleModalEvent}\n onMouseUp={handleModalEvent}\n onClick={handleModalEvent}\n id={modalId}\n role={role}\n aria-modal=\"true\"\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n data-testid=\"modal\"\n >\n {focusTrapped && <FocusTrap container={refModal} />}\n {children}\n {showCloseIcon && (\n <CloseIcon\n classes={classes}\n classNames={classNames}\n styles={styles}\n closeIcon={closeIcon}\n onClickCloseIcon={handleClickCloseIcon}\n id={closeIconId}\n />\n )}\n </div>\n </div>,\n containerModal\n )\n : null;\n};\n\nexport default Modal;\n"],"names":["CloseIcon","classes","classNames","styles","id","closeIcon","onClickCloseIcon","React","className","cx","closeButton","style","onClick","xmlns","width","height","viewBox","d","modals","add","newModal","blockScroll","findIndex","modal","element","push","remove","oldModal","index","splice","isTopModal","length","isBrowser","window","blockNoScroll","noScroll","on","unblockNoScroll","modalManager","filter","off","candidateSelectors","isHidden","node","offsetParent","getComputedStyle","visibility","getAllTabbingElements","parentElem","tabbableNodes","querySelectorAll","join","onlyTabbable","i","disabled","getTabindex","tabTrappingKey","event","key","contains","process","env","NODE_ENV","console","warn","target","allTabbingElements","firstFocusableElement","lastFocusableElement","shiftKey","focus","preventDefault","tabindexAttr","parseInt","getAttribute","isNaN","isContentEditable","tabIndex","FocusTrap","container","refLastFocus","useRef","useEffect","handleKeyEvent","current","document","addEventListener","selector","activeElement","matches","removeEventListener","overlay","modalCenter","animationIn","animationOut","Modal","open","center","closeOnEsc","closeOnOverlayClick","showCloseIcon","closeIconId","focusTrapped","animationDuration","role","ariaDescribedby","ariaLabelledby","modalId","onClose","onEscKeyDown","onOverlayClick","onAnimationEnd","children","refModal","refShouldClose","refContainer","createElement","useState","showPortal","setShowPortal","handleOpen","body","appendChild","handleKeydown","handleClose","removeChild","keyCode","handleClickOverlay","handleModalEvent","handleClickCloseIcon","handleAnimationEnd","containerModal","ReactDom","createPortal","animation","ref","onMouseDown","onMouseUp"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAMA,SAAS,GAAG,SAAZA,SAAY;AAAA,MAChBC,OADgB,QAChBA,OADgB;AAAA,MAEhBC,UAFgB,QAEhBA,UAFgB;AAAA,MAGhBC,MAHgB,QAGhBA,MAHgB;AAAA,MAIhBC,EAJgB,QAIhBA,EAJgB;AAAA,MAKhBC,SALgB,QAKhBA,SALgB;AAAA,MAMhBC,gBANgB,QAMhBA,gBANgB;AAAA,SAQhBC,mBAAA,SAAA;AACEH,IAAAA,EAAE,EAAEA;AACJI,IAAAA,SAAS,EAAEC,EAA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;mBACN;GAhBd,EAkBGH,YAAY,IAAI/F,mBAAA,CAACuE,SAAD;AAAWC,IAAAA,SAAS,EAAEkC;GAAtB,CAlBnB,EAmBGD,QAnBH,EAoBGZ,aAAa,IACZ7F,mBAAA,CAACP,SAAD;AACEC,IAAAA,OAAO,EAAEA;AACTC,IAAAA,UAAU,EAAEA;AACZC,IAAAA,MAAM,EAAEA;AACRE,IAAAA,SAAS,EAAEA;AACXC,IAAAA,gBAAgB,EAAE2H;AAClB7H,IAAAA,EAAE,EAAEiG;GANN,CArBJ,CAdF,CADF,EA+CE8B,cA/CF,CADG,GAkDH,IAlDJ;AAmDD,CA/LM;;;;;"}
1
+ {"version":3,"file":"react-responsive-modal.esm.js","sources":["../src/CloseIcon.tsx","../src/utils.ts","../src/lib/focusTrapJs.ts","../src/FocusTrap.tsx","../src/modalManager.ts","../src/useScrollLock.ts","../src/index.tsx"],"sourcesContent":["import React from 'react';\nimport cx from 'classnames';\n\ninterface CloseIconProps {\n id?: string;\n closeIcon?: React.ReactNode;\n styles?: {\n closeButton?: React.CSSProperties;\n closeIcon?: React.CSSProperties;\n };\n classNames?: {\n closeButton?: string;\n closeIcon?: string;\n };\n classes: {\n closeButton?: string;\n };\n onClick: () => void;\n}\n\nconst CloseIcon = ({\n classes,\n classNames,\n styles,\n id,\n closeIcon,\n onClick,\n}: CloseIconProps) => (\n <button\n id={id}\n className={cx(classes.closeButton, classNames?.closeButton)}\n style={styles?.closeButton}\n onClick={onClick}\n data-testid=\"close-button\"\n >\n {closeIcon ? (\n closeIcon\n ) : (\n <svg\n className={classNames?.closeIcon}\n style={styles?.closeIcon}\n width={28}\n height={28}\n viewBox=\"0 0 36 36\"\n data-testid=\"close-icon\"\n >\n <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\" />\n </svg>\n )}\n </button>\n);\n\nexport default CloseIcon;\n","export const isBrowser = typeof window !== 'undefined';\n","// https://github.com/alexandrzavalii/focus-trap-js/blob/master/src/index.js v1.1.0\n\nexport const candidateSelectors = [\n 'input',\n 'select',\n 'textarea',\n 'a[href]',\n 'button',\n '[tabindex]',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]:not([contenteditable=\"false\"])',\n];\n\nfunction isHidden(node: any) {\n // offsetParent being null will allow detecting cases where an element is invisible or inside an invisible element,\n // as long as the element does not use position: fixed. For them, their visibility has to be checked directly as well.\n return (\n node.offsetParent === null || getComputedStyle(node).visibility === 'hidden'\n );\n}\n\nfunction getCheckedRadio(nodes: any, form: any) {\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].checked && nodes[i].form === form) {\n return nodes[i];\n }\n }\n}\n\nfunction isNotRadioOrTabbableRadio(node: any) {\n if (node.tagName !== 'INPUT' || node.type !== 'radio' || !node.name) {\n return true;\n }\n var radioScope = node.form || node.ownerDocument;\n var radioSet = radioScope.querySelectorAll(\n 'input[type=\"radio\"][name=\"' + node.name + '\"]'\n );\n var checked = getCheckedRadio(radioSet, node.form);\n return checked === node || (checked === undefined && radioSet[0] === node);\n}\n\nexport function getAllTabbingElements(parentElem: any) {\n var currentActiveElement = document.activeElement;\n var tabbableNodes = parentElem.querySelectorAll(candidateSelectors.join(','));\n var onlyTabbable = [];\n for (var i = 0; i < tabbableNodes.length; i++) {\n var node = tabbableNodes[i];\n if (\n currentActiveElement === node ||\n (!node.disabled &&\n getTabindex(node) > -1 &&\n !isHidden(node) &&\n isNotRadioOrTabbableRadio(node))\n ) {\n onlyTabbable.push(node);\n }\n }\n return onlyTabbable;\n}\n\nexport function tabTrappingKey(event: any, parentElem: any) {\n // check if current event keyCode is tab\n if (!event || event.key !== 'Tab') return;\n\n if (!parentElem || !parentElem.contains) {\n if (process && process.env.NODE_ENV === 'development') {\n console.warn('focus-trap-js: parent element is not defined');\n }\n return false;\n }\n\n if (!parentElem.contains(event.target)) {\n return false;\n }\n\n var allTabbingElements = getAllTabbingElements(parentElem);\n var firstFocusableElement = allTabbingElements[0];\n var lastFocusableElement = allTabbingElements[allTabbingElements.length - 1];\n\n if (event.shiftKey && event.target === firstFocusableElement) {\n lastFocusableElement.focus();\n event.preventDefault();\n return true;\n } else if (!event.shiftKey && event.target === lastFocusableElement) {\n firstFocusableElement.focus();\n event.preventDefault();\n return true;\n }\n return false;\n}\n\nfunction getTabindex(node: any) {\n var tabindexAttr = parseInt(node.getAttribute('tabindex'), 10);\n\n if (!isNaN(tabindexAttr)) return tabindexAttr;\n // Browsers do not return tabIndex correctly for contentEditable nodes;\n // so if they don't have a tabindex attribute specifically set, assume it's 0.\n\n if (isContentEditable(node)) return 0;\n return node.tabIndex;\n}\n\nfunction isContentEditable(node: any) {\n return node.getAttribute('contentEditable');\n}\n","import { useEffect, useRef } from 'react';\nimport { isBrowser } from './utils';\nimport {\n tabTrappingKey,\n candidateSelectors,\n getAllTabbingElements,\n} from './lib/focusTrapJs';\n\ninterface FocusTrapProps {\n container?: React.RefObject<HTMLElement> | null;\n initialFocusRef?: React.RefObject<HTMLElement>;\n}\n\nexport const FocusTrap = ({ container, initialFocusRef }: FocusTrapProps) => {\n const refLastFocus = useRef<HTMLElement | null>();\n /**\n * Handle focus lock on the modal\n */\n useEffect(() => {\n const handleKeyEvent = (event: KeyboardEvent) => {\n if (container?.current) {\n tabTrappingKey(event, container.current);\n }\n };\n\n if (isBrowser) {\n document.addEventListener('keydown', handleKeyEvent);\n }\n // On mount we focus on the first focusable element in the modal if there is one\n if (isBrowser && container?.current) {\n const savePreviousFocus = () => {\n // First we save the last focused element\n // only if it's a focusable element\n if (\n candidateSelectors.findIndex((selector) =>\n document.activeElement?.matches(selector)\n ) !== -1\n ) {\n refLastFocus.current = document.activeElement as HTMLElement;\n }\n };\n\n if (initialFocusRef) {\n savePreviousFocus();\n // We need to schedule focusing on a next frame - this allows to focus on the modal root\n requestAnimationFrame(() => {\n initialFocusRef.current?.focus();\n });\n } else {\n const allTabbingElements = getAllTabbingElements(container.current);\n if (allTabbingElements[0]) {\n savePreviousFocus();\n allTabbingElements[0].focus();\n }\n }\n }\n return () => {\n if (isBrowser) {\n document.removeEventListener('keydown', handleKeyEvent);\n // On unmount we restore the focus to the last focused element\n refLastFocus.current?.focus();\n }\n };\n }, [container, initialFocusRef]);\n\n return null;\n};\n","import { Ref, useEffect } from 'react';\n\nlet modals: Ref<Element>[] = [];\n\n/**\n * Handle the order of the modals.\n * Inspired by the material-ui implementation.\n */\nexport const modalManager = {\n /**\n * Register a new modal\n */\n add: (newModal: Ref<Element>) => {\n modals.push(newModal);\n },\n\n /**\n * Remove a modal\n */\n remove: (oldModal: Ref<Element>) => {\n modals = modals.filter((modal) => modal !== oldModal);\n },\n\n /**\n * When multiple modals are rendered will return true if current modal is the last one\n */\n isTopModal: (modal: Ref<Element>) =>\n !!modals.length && modals[modals.length - 1] === modal,\n};\n\nexport function useModalManager(ref: Ref<Element>, open: boolean) {\n useEffect(() => {\n if (open) {\n modalManager.add(ref);\n }\n return () => {\n modalManager.remove(ref);\n };\n }, [open, ref]);\n}\n","import { useEffect, useRef } from 'react';\nimport { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';\n\nexport const useScrollLock = (\n refModal: React.RefObject<Element>,\n open: boolean,\n showPortal: boolean,\n blockScroll: boolean,\n reserveScrollBarGap?: boolean\n) => {\n const oldRef = useRef<Element | null>(null);\n\n useEffect(() => {\n if (open && refModal.current && blockScroll) {\n oldRef.current = refModal.current;\n disableBodyScroll(refModal.current, { reserveScrollBarGap });\n }\n return () => {\n if (oldRef.current) {\n enableBodyScroll(oldRef.current);\n oldRef.current = null;\n }\n };\n }, [open, showPortal, refModal, blockScroll, reserveScrollBarGap]);\n};\n","import React, { useEffect, useRef, useState } from 'react';\nimport ReactDom from 'react-dom';\nimport cx from 'classnames';\nimport CloseIcon from './CloseIcon';\nimport { FocusTrap } from './FocusTrap';\nimport { modalManager, useModalManager } from './modalManager';\nimport { useScrollLock } from './useScrollLock';\nimport { isBrowser } from './utils';\nimport useForwardedRef from '@bedrock-layout/use-forwarded-ref';\n\nconst classes = {\n root: 'react-responsive-modal-root',\n overlay: 'react-responsive-modal-overlay',\n overlayAnimationIn: 'react-responsive-modal-overlay-in',\n overlayAnimationOut: 'react-responsive-modal-overlay-out',\n modalContainer: 'react-responsive-modal-container',\n modalContainerCenter: 'react-responsive-modal-containerCenter',\n modal: 'react-responsive-modal-modal',\n modalAnimationIn: 'react-responsive-modal-modal-in',\n modalAnimationOut: 'react-responsive-modal-modal-out',\n closeButton: 'react-responsive-modal-closeButton',\n};\n\nexport interface ModalProps {\n /**\n * Control if the modal is open or not.\n */\n open: boolean;\n /**\n * Should the dialog be centered.\n *\n * Default to false.\n */\n center?: boolean;\n /**\n * Is the modal closable when user press esc key.\n *\n * Default to true.\n */\n closeOnEsc?: boolean;\n /**\n * Is the modal closable when user click on overlay.\n *\n * Default to true.\n */\n closeOnOverlayClick?: boolean;\n /**\n * Whether to block scrolling when dialog is open.\n *\n * Default to true.\n */\n blockScroll?: boolean;\n /**\n * Show the close icon.\n *\n * Default to true.\n */\n showCloseIcon?: boolean;\n /**\n * id attribute for the close icon button.\n */\n closeIconId?: string;\n /**\n * Custom icon to render (svg, img, etc...).\n */\n closeIcon?: React.ReactNode;\n /**\n * When the modal is open, trap focus within it.\n *\n * Default to true.\n */\n focusTrapped?: boolean;\n /**\n * Element to focus when focus trap is used.\n *\n * Default to undefined.\n */\n initialFocusRef?: React.RefObject<HTMLElement>;\n /**\n * You can specify a container prop which should be of type `Element`.\n * The portal will be rendered inside that element.\n * The default behavior will create a div node and render it at the at the end of document.body.\n */\n container?: Element | null;\n /**\n * An object containing classNames to style the modal.\n */\n classNames?: {\n root?: string;\n overlay?: string;\n overlayAnimationIn?: string;\n overlayAnimationOut?: string;\n modalContainer?: string;\n modal?: string;\n modalAnimationIn?: string;\n modalAnimationOut?: string;\n closeButton?: string;\n closeIcon?: string;\n };\n /**\n * An object containing the styles objects to style the modal.\n */\n styles?: {\n root?: React.CSSProperties;\n overlay?: React.CSSProperties;\n modalContainer?: React.CSSProperties;\n modal?: React.CSSProperties;\n closeButton?: React.CSSProperties;\n closeIcon?: React.CSSProperties;\n };\n /**\n * Animation duration in milliseconds.\n *\n * Default to 300.\n */\n animationDuration?: number;\n /**\n * ARIA role for modal\n *\n * Default to 'dialog'.\n */\n role?: string;\n /**\n * ARIA label for modal\n */\n ariaLabelledby?: string;\n /**\n * ARIA description for modal\n */\n ariaDescribedby?: string;\n /**\n * Avoid unpleasant flickering effect when body overflow is hidden. For more information see https://www.npmjs.com/package/body-scroll-lock \n */\n reserveScrollBarGap?: boolean;\n /**\n * id attribute for modal\n */\n modalId?: string;\n /**\n * Callback fired when the Modal is requested to be closed by a click on the overlay or when user press esc key.\n */\n onClose: () => void;\n /**\n * Callback fired when the escape key is pressed.\n */\n onEscKeyDown?: (event: KeyboardEvent) => void;\n /**\n * Callback fired when the overlay is clicked.\n */\n onOverlayClick?: (\n event: React.MouseEvent<HTMLDivElement, MouseEvent>\n ) => void;\n /**\n * Callback fired when the Modal has exited and the animation is finished.\n */\n onAnimationEnd?: () => void;\n children?: React.ReactNode;\n}\n\nexport const Modal = React.forwardRef(\n (\n {\n open,\n center,\n blockScroll = true,\n closeOnEsc = true,\n closeOnOverlayClick = true,\n container,\n showCloseIcon = true,\n closeIconId,\n closeIcon,\n focusTrapped = true,\n initialFocusRef = undefined,\n animationDuration = 300,\n classNames,\n styles,\n role = 'dialog',\n ariaDescribedby,\n ariaLabelledby,\n modalId,\n onClose,\n onEscKeyDown,\n onOverlayClick,\n onAnimationEnd,\n children,\n reserveScrollBarGap,\n }: ModalProps,\n ref: React.ForwardedRef<HTMLDivElement>\n ) => {\n const refDialog = useForwardedRef(ref);\n const refModal = useRef<HTMLDivElement>(null);\n const refShouldClose = useRef<boolean | null>(null);\n const refContainer = useRef<HTMLDivElement | null>(null);\n // Lazily create the ref instance\n // https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily\n if (refContainer.current === null && isBrowser) {\n refContainer.current = document.createElement('div');\n }\n\n // The value should be false for srr, that way when the component is hydrated client side,\n // it will match the server rendered content\n const [showPortal, setShowPortal] = useState(false);\n\n // Hook used to manage multiple modals opened at the same time\n useModalManager(refModal, open);\n\n // Hook used to manage the scroll\n useScrollLock(refModal, open, showPortal, blockScroll, reserveScrollBarGap);\n\n const handleOpen = () => {\n if (\n refContainer.current &&\n !container &&\n !document.body.contains(refContainer.current)\n ) {\n document.body.appendChild(refContainer.current);\n }\n\n document.addEventListener('keydown', handleKeydown);\n };\n\n const handleClose = () => {\n if (\n refContainer.current &&\n !container &&\n document.body.contains(refContainer.current)\n ) {\n document.body.removeChild(refContainer.current);\n }\n document.removeEventListener('keydown', handleKeydown);\n };\n\n const handleKeydown = (event: KeyboardEvent) => {\n // Only the last modal need to be escaped when pressing the esc key\n if (event.keyCode !== 27 || !modalManager.isTopModal(refModal)) {\n return;\n }\n\n onEscKeyDown?.(event);\n\n if (closeOnEsc) {\n onClose();\n }\n };\n\n useEffect(() => {\n return () => {\n if (showPortal) {\n // When the modal is closed or removed directly, cleanup the listeners\n handleClose();\n }\n };\n }, [showPortal]);\n\n useEffect(() => {\n // If the open prop is changing, we need to open the modal\n // This is also called on the first render if the open prop is true when the modal is created\n if (open && !showPortal) {\n setShowPortal(true);\n handleOpen();\n }\n }, [open]);\n\n const handleClickOverlay = (\n event: React.MouseEvent<HTMLDivElement, MouseEvent>\n ) => {\n if (refShouldClose.current === null) {\n refShouldClose.current = true;\n }\n\n if (!refShouldClose.current) {\n refShouldClose.current = null;\n return;\n }\n\n onOverlayClick?.(event);\n\n if (closeOnOverlayClick) {\n onClose();\n }\n\n refShouldClose.current = null;\n };\n\n const handleModalEvent = () => {\n refShouldClose.current = false;\n };\n\n const handleAnimationEnd = () => {\n if (!open) {\n setShowPortal(false);\n }\n\n onAnimationEnd?.();\n };\n\n const containerModal = container || refContainer.current;\n\n const overlayAnimation = open\n ? classNames?.overlayAnimationIn ?? classes.overlayAnimationIn\n : classNames?.overlayAnimationOut ?? classes.overlayAnimationOut;\n\n const modalAnimation = open\n ? classNames?.modalAnimationIn ?? classes.modalAnimationIn\n : classNames?.modalAnimationOut ?? classes.modalAnimationOut;\n\n return showPortal && containerModal\n ? ReactDom.createPortal(\n <div\n className={cx(classes.root, classNames?.root)}\n style={styles?.root}\n data-testid=\"root\"\n >\n <div\n className={cx(classes.overlay, classNames?.overlay)}\n data-testid=\"overlay\"\n aria-hidden={true}\n style={{\n animation: `${overlayAnimation} ${animationDuration}ms`,\n ...styles?.overlay,\n }}\n />\n <div\n ref={refModal}\n className={cx(\n classes.modalContainer,\n center && classes.modalContainerCenter,\n classNames?.modalContainer\n )}\n style={styles?.modalContainer}\n data-testid=\"modal-container\"\n onClick={handleClickOverlay}\n >\n <div\n ref={refDialog}\n className={cx(classes.modal, classNames?.modal)}\n style={{\n animation: `${modalAnimation} ${animationDuration}ms`,\n ...styles?.modal,\n }}\n onMouseDown={handleModalEvent}\n onMouseUp={handleModalEvent}\n onClick={handleModalEvent}\n onAnimationEnd={handleAnimationEnd}\n id={modalId}\n role={role}\n aria-modal=\"true\"\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n data-testid=\"modal\"\n tabIndex={-1}\n >\n {focusTrapped && (\n <FocusTrap\n container={refDialog}\n initialFocusRef={initialFocusRef}\n />\n )}\n {children}\n {showCloseIcon && (\n <CloseIcon\n classes={classes}\n classNames={classNames}\n styles={styles}\n closeIcon={closeIcon}\n onClick={onClose}\n id={closeIconId}\n />\n )}\n </div>\n </div>\n </div>,\n containerModal\n )\n : null;\n }\n);\n\nexport default Modal;\n"],"names":["CloseIcon","classes","classNames","styles","id","closeIcon","onClick","React","className","cx","closeButton","style","width","height","viewBox","d","isBrowser","window","candidateSelectors","isHidden","node","offsetParent","getComputedStyle","visibility","getCheckedRadio","nodes","form","i","length","checked","isNotRadioOrTabbableRadio","tagName","type","name","radioScope","ownerDocument","radioSet","querySelectorAll","undefined","getAllTabbingElements","parentElem","currentActiveElement","document","activeElement","tabbableNodes","join","onlyTabbable","disabled","getTabindex","push","tabTrappingKey","event","key","contains","process","env","NODE_ENV","console","warn","target","allTabbingElements","firstFocusableElement","lastFocusableElement","shiftKey","focus","preventDefault","tabindexAttr","parseInt","getAttribute","isNaN","isContentEditable","tabIndex","FocusTrap","container","initialFocusRef","refLastFocus","useRef","useEffect","handleKeyEvent","current","addEventListener","savePreviousFocus","findIndex","selector","matches","requestAnimationFrame","removeEventListener","modals","modalManager","add","newModal","remove","oldModal","filter","modal","isTopModal","useModalManager","ref","open","useScrollLock","refModal","showPortal","blockScroll","reserveScrollBarGap","oldRef","disableBodyScroll","enableBodyScroll","root","overlay","overlayAnimationIn","overlayAnimationOut","modalContainer","modalContainerCenter","modalAnimationIn","modalAnimationOut","Modal","forwardRef","center","closeOnEsc","closeOnOverlayClick","showCloseIcon","closeIconId","focusTrapped","animationDuration","role","ariaDescribedby","ariaLabelledby","modalId","onClose","onEscKeyDown","onOverlayClick","onAnimationEnd","children","refDialog","useForwardedRef","refShouldClose","refContainer","createElement","useState","setShowPortal","handleOpen","body","appendChild","handleKeydown","handleClose","removeChild","keyCode","handleClickOverlay","handleModalEvent","handleAnimationEnd","containerModal","overlayAnimation","modalAnimation","ReactDom","createPortal","animation","onMouseDown","onMouseUp"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAMA,SAAS,GAAG,SAAZA,SAAY;AAAA,MAChBC,OADgB,QAChBA,OADgB;AAAA,MAEhBC,UAFgB,QAEhBA,UAFgB;AAAA,MAGhBC,MAHgB,QAGhBA,MAHgB;AAAA,MAIhBC,EAJgB,QAIhBA,EAJgB;AAAA,MAKhBC,SALgB,QAKhBA,SALgB;AAAA,MAMhBC,OANgB,QAMhBA,OANgB;AAAA,SAQhBC,mBAAA,SAAA;AACEH,IAAAA,EAAE,EAAEA;AACJI,IAAAA,SAAS,EAAEC,EAAE,CAACR,OAAO,CAACS,WAAT,EAAsBR,UAAtB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CAACP,SAAD;AACEC,IAAAA,OAAO,EAAEA;AACTC,IAAAA,UAAU,EAAEA;AACZC,IAAAA,MAAM,EAAEA;AACRE,IAAAA,SAAS,EAAEA;AACXC,IAAAA,OAAO,EAAE0H;AACT5H,IAAAA,EAAE,EAAEqH;GANN,CA3BJ,CAXF,CAdF,CADF,EAiEE6B,cAjEF,CADG,GAoEH,IApEJ;AAqED,CAxNkB,CAAd;;;;;"}
@@ -0,0 +1 @@
1
+ export declare const useScrollLock: (refModal: React.RefObject<Element>, open: boolean, showPortal: boolean, blockScroll: boolean, reserveScrollBarGap?: boolean | undefined) => void;
package/dist/utils.d.ts CHANGED
@@ -1,3 +1 @@
1
1
  export declare const isBrowser: boolean;
2
- export declare const blockNoScroll: () => void;
3
- export declare const unblockNoScroll: () => void;