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.js
CHANGED
|
@@ -9933,7 +9933,8 @@ var ButtonDropdown = function ButtonDropdown(_ref) {
|
|
|
9933
9933
|
placeholder = _ref$placeholder === void 0 ? 'Select Option' : _ref$placeholder,
|
|
9934
9934
|
_ref$disabled = _ref.disabled,
|
|
9935
9935
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
9936
|
-
width = _ref.width
|
|
9936
|
+
width = _ref.width,
|
|
9937
|
+
dropDownPosition = _ref.dropDownPosition;
|
|
9937
9938
|
var _useState = React.useState(false),
|
|
9938
9939
|
isOpen = _useState[0],
|
|
9939
9940
|
setIsOpen = _useState[1];
|
|
@@ -9963,15 +9964,17 @@ var ButtonDropdown = function ButtonDropdown(_ref) {
|
|
|
9963
9964
|
} else {
|
|
9964
9965
|
setDropUp(false);
|
|
9965
9966
|
}
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
9967
|
+
if (!dropDownPosition) {
|
|
9968
|
+
var dropdownWidth = rect.width;
|
|
9969
|
+
var spaceRight = windowWidth - rect.left;
|
|
9970
|
+
var spaceLeft = rect.right;
|
|
9971
|
+
if (spaceRight < dropdownWidth && spaceLeft > dropdownWidth) {
|
|
9972
|
+
setDropdownPosition('right');
|
|
9973
|
+
} else if (rect.left < dropdownWidth / 2 && windowWidth - rect.right < dropdownWidth / 2) {
|
|
9974
|
+
setDropdownPosition('center');
|
|
9975
|
+
} else {
|
|
9976
|
+
setDropdownPosition('left');
|
|
9977
|
+
}
|
|
9975
9978
|
}
|
|
9976
9979
|
}
|
|
9977
9980
|
setIsOpen(function (prev) {
|
|
@@ -10003,7 +10006,7 @@ var ButtonDropdown = function ButtonDropdown(_ref) {
|
|
|
10003
10006
|
"$top": dropUp ? 'auto' : '126%',
|
|
10004
10007
|
"$bottom": dropUp ? '126%' : 'auto',
|
|
10005
10008
|
"$optionsAvailable": options.length > 0,
|
|
10006
|
-
"$dropDownPosition": dropdownPosition
|
|
10009
|
+
"$dropDownPosition": dropDownPosition || dropdownPosition
|
|
10007
10010
|
}, options.map(function (option) {
|
|
10008
10011
|
return React__default.createElement(Options, {
|
|
10009
10012
|
key: option.value,
|