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.
@@ -12,6 +12,7 @@ interface ButtonDropdownProps {
12
12
  placeholder?: string;
13
13
  disabled?: boolean;
14
14
  width?: string;
15
+ dropDownPosition?: 'left' | 'center' | 'right';
15
16
  }
16
17
  declare const ButtonDropdown: React.FC<ButtonDropdownProps>;
17
18
  export default ButtonDropdown;
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
- var dropdownWidth = rect.width;
9967
- var spaceRight = windowWidth - rect.left;
9968
- var spaceLeft = rect.right;
9969
- if (spaceRight < dropdownWidth && spaceLeft > dropdownWidth) {
9970
- setDropdownPosition('right');
9971
- } else if (rect.left < dropdownWidth / 2 && windowWidth - rect.right < dropdownWidth / 2) {
9972
- setDropdownPosition('center');
9973
- } else {
9974
- setDropdownPosition('left');
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,