@7shifts/sous-chef 3.44.10 → 3.44.12
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.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +15 -2
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6347,7 +6347,7 @@ var DropdownPane = function DropdownPane(props) {
|
|
|
6347
6347
|
var PaneOverlay = function PaneOverlay(_ref) {
|
|
6348
6348
|
var _classNames;
|
|
6349
6349
|
var width = _ref.width,
|
|
6350
|
-
|
|
6350
|
+
customMaxHeight = _ref.maxHeight,
|
|
6351
6351
|
alignment = _ref.alignment,
|
|
6352
6352
|
onMouseEnter = _ref.onMouseEnter,
|
|
6353
6353
|
onMouseLeave = _ref.onMouseLeave,
|
|
@@ -6362,6 +6362,19 @@ var PaneOverlay = function PaneOverlay(_ref) {
|
|
|
6362
6362
|
var _useState = React.useState({}),
|
|
6363
6363
|
position = _useState[0],
|
|
6364
6364
|
setPosition = _useState[1];
|
|
6365
|
+
var _useState2 = React.useState(function () {
|
|
6366
|
+
if (!triggerRef || !('current' in triggerRef) || !(triggerRef !== null && triggerRef !== void 0 && triggerRef.current)) {
|
|
6367
|
+
return customMaxHeight;
|
|
6368
|
+
}
|
|
6369
|
+
var triggerPosition = triggerRef.current.getBoundingClientRect();
|
|
6370
|
+
var MIN_HEIGHT_FIT = 200;
|
|
6371
|
+
var triggerDistanceFromTheBottom = window.innerHeight - triggerPosition.top + triggerPosition.height;
|
|
6372
|
+
if (triggerDistanceFromTheBottom > MIN_HEIGHT_FIT) {
|
|
6373
|
+
return triggerDistanceFromTheBottom - 14;
|
|
6374
|
+
}
|
|
6375
|
+
return triggerPosition.top - 14;
|
|
6376
|
+
}),
|
|
6377
|
+
maxHeight = _useState2[0];
|
|
6365
6378
|
React.useEffect(function () {
|
|
6366
6379
|
var handleScroll = function handleScroll(e) {
|
|
6367
6380
|
var _paneRef$current;
|
|
@@ -6385,7 +6398,7 @@ var PaneOverlay = function PaneOverlay(_ref) {
|
|
|
6385
6398
|
setPosition(pos);
|
|
6386
6399
|
}, [triggerRef, alignment, paneRef]);
|
|
6387
6400
|
useKeyPress(['Escape'], onToggleDropdown);
|
|
6388
|
-
var overflow = maxHeight ? '
|
|
6401
|
+
var overflow = maxHeight ? 'auto' : undefined;
|
|
6389
6402
|
return React__default.createElement("div", {
|
|
6390
6403
|
className: classnames(styles$f['dropdown-pane'], (_classNames = {}, _classNames[styles$f['dropdown-pane--with-padding']] = true, _classNames)),
|
|
6391
6404
|
style: _extends({}, position, {
|