labsense-ui-kit 1.4.24 → 1.4.25
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/Dropdown/ButtonDropdown.d.ts +1 -0
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +14 -11
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -9928,7 +9928,8 @@ var ButtonDropdown = function ButtonDropdown(_ref) {
|
|
|
9928
9928
|
placeholder = _ref$placeholder === void 0 ? 'Select Option' : _ref$placeholder,
|
|
9929
9929
|
_ref$disabled = _ref.disabled,
|
|
9930
9930
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
9931
|
-
width = _ref.width
|
|
9931
|
+
width = _ref.width,
|
|
9932
|
+
dropDownPosition = _ref.dropDownPosition;
|
|
9932
9933
|
var _useState = useState(false),
|
|
9933
9934
|
isOpen = _useState[0],
|
|
9934
9935
|
setIsOpen = _useState[1];
|
|
@@ -9958,15 +9959,17 @@ var ButtonDropdown = function ButtonDropdown(_ref) {
|
|
|
9958
9959
|
} else {
|
|
9959
9960
|
setDropUp(false);
|
|
9960
9961
|
}
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9962
|
+
if (!dropDownPosition) {
|
|
9963
|
+
var dropdownWidth = rect.width;
|
|
9964
|
+
var spaceRight = windowWidth - rect.left;
|
|
9965
|
+
var spaceLeft = rect.right;
|
|
9966
|
+
if (spaceRight < dropdownWidth && spaceLeft > dropdownWidth) {
|
|
9967
|
+
setDropdownPosition('right');
|
|
9968
|
+
} else if (rect.left < dropdownWidth / 2 && windowWidth - rect.right < dropdownWidth / 2) {
|
|
9969
|
+
setDropdownPosition('center');
|
|
9970
|
+
} else {
|
|
9971
|
+
setDropdownPosition('left');
|
|
9972
|
+
}
|
|
9970
9973
|
}
|
|
9971
9974
|
}
|
|
9972
9975
|
setIsOpen(function (prev) {
|
|
@@ -9998,7 +10001,7 @@ var ButtonDropdown = function ButtonDropdown(_ref) {
|
|
|
9998
10001
|
"$top": dropUp ? 'auto' : '126%',
|
|
9999
10002
|
"$bottom": dropUp ? '126%' : 'auto',
|
|
10000
10003
|
"$optionsAvailable": options.length > 0,
|
|
10001
|
-
"$dropDownPosition": dropdownPosition
|
|
10004
|
+
"$dropDownPosition": dropDownPosition || dropdownPosition
|
|
10002
10005
|
}, options.map(function (option) {
|
|
10003
10006
|
return React.createElement(Options, {
|
|
10004
10007
|
key: option.value,
|