@7shifts/sous-chef 2.14.0 → 2.15.1
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/dist/index.modern.js
CHANGED
|
@@ -6459,7 +6459,9 @@ var Modal = function Modal(_ref) {
|
|
|
6459
6459
|
_ref$width = _ref.width,
|
|
6460
6460
|
width = _ref$width === void 0 ? 500 : _ref$width,
|
|
6461
6461
|
height = _ref.height,
|
|
6462
|
-
maxWidth = _ref.maxWidth
|
|
6462
|
+
maxWidth = _ref.maxWidth,
|
|
6463
|
+
_ref$shouldReturnFocu = _ref.shouldReturnFocusAfterClose,
|
|
6464
|
+
shouldReturnFocusAfterClose = _ref$shouldReturnFocu === void 0 ? true : _ref$shouldReturnFocu;
|
|
6463
6465
|
var style = {
|
|
6464
6466
|
content: {
|
|
6465
6467
|
width: width,
|
|
@@ -6474,6 +6476,7 @@ var Modal = function Modal(_ref) {
|
|
|
6474
6476
|
isOpen: true,
|
|
6475
6477
|
shouldCloseOnEsc: true,
|
|
6476
6478
|
shouldCloseOnOverlayClick: false,
|
|
6479
|
+
shouldReturnFocusAfterClose: shouldReturnFocusAfterClose,
|
|
6477
6480
|
onRequestClose: onClose,
|
|
6478
6481
|
style: style,
|
|
6479
6482
|
closeTimeoutMS: 200,
|
|
@@ -6500,12 +6503,45 @@ Modal.setAppElement = function (rootElement) {
|
|
|
6500
6503
|
ReactModal.setAppElement(rootElement);
|
|
6501
6504
|
};
|
|
6502
6505
|
|
|
6503
|
-
var
|
|
6506
|
+
var THRESHOLD = 20;
|
|
6507
|
+
var useScrollShadow = function useScrollShadow() {
|
|
6508
|
+
var ref = useRef(null);
|
|
6509
|
+
|
|
6510
|
+
var _useState = useState(false),
|
|
6511
|
+
showScrollShadow = _useState[0],
|
|
6512
|
+
setShowScrollShadow = _useState[1];
|
|
6513
|
+
|
|
6514
|
+
useEffect(function () {
|
|
6515
|
+
if (!ref.current) {
|
|
6516
|
+
return;
|
|
6517
|
+
}
|
|
6518
|
+
|
|
6519
|
+
var modalBody = ref.current;
|
|
6520
|
+
|
|
6521
|
+
if (modalBody.offsetHeight > THRESHOLD) {
|
|
6522
|
+
setShowScrollShadow(true);
|
|
6523
|
+
}
|
|
6524
|
+
}, []);
|
|
6525
|
+
return {
|
|
6526
|
+
ref: ref,
|
|
6527
|
+
showScrollShadow: showScrollShadow
|
|
6528
|
+
};
|
|
6529
|
+
};
|
|
6530
|
+
|
|
6531
|
+
var styles$y = {"modal-body":"_2J-ku","modal-body--with-scroll-shadow":"_2ErCP"};
|
|
6504
6532
|
|
|
6505
6533
|
var ModalBody = function ModalBody(_ref) {
|
|
6534
|
+
var _classNames;
|
|
6535
|
+
|
|
6506
6536
|
var children = _ref.children;
|
|
6537
|
+
|
|
6538
|
+
var _useScrollShadow = useScrollShadow(),
|
|
6539
|
+
ref = _useScrollShadow.ref,
|
|
6540
|
+
showScrollShadow = _useScrollShadow.showScrollShadow;
|
|
6541
|
+
|
|
6507
6542
|
return React__default.createElement("div", {
|
|
6508
|
-
className: styles$y['modal-body']
|
|
6543
|
+
className: classnames(styles$y['modal-body'], (_classNames = {}, _classNames[styles$y['modal-body--with-scroll-shadow']] = showScrollShadow, _classNames)),
|
|
6544
|
+
ref: ref
|
|
6509
6545
|
}, children);
|
|
6510
6546
|
};
|
|
6511
6547
|
|