react-magma-dom 4.15.1-next.1 → 4.15.1-next.2

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/esm/index.js CHANGED
@@ -18980,17 +18980,44 @@ var PasswordInput = /*#__PURE__*/forwardRef(function (props, ref) {
18980
18980
  var _React$useState2 = useState(0),
18981
18981
  buttonWidth = _React$useState2[0],
18982
18982
  setButtonWidth = _React$useState2[1];
18983
+ var _React$useState3 = useState(0),
18984
+ maxButtonWidth = _React$useState3[0],
18985
+ setMaxButtonWidth = _React$useState3[1];
18983
18986
  useLayoutEffect(function () {
18984
- if (buttonRef.current && !usesDefaultText) {
18985
- setButtonWidth(buttonRef.current.offsetWidth);
18987
+ var button = buttonRef.current;
18988
+ if (!button || usesDefaultText) {
18989
+ return;
18990
+ }
18991
+ var container = button.closest('div');
18992
+ var updateWidths = function updateWidths() {
18993
+ if (container) {
18994
+ setMaxButtonWidth(Math.floor(container.offsetWidth / 2));
18995
+ }
18996
+ setButtonWidth(button.offsetWidth);
18997
+ };
18998
+ updateWidths();
18999
+ if (typeof window !== 'undefined' && 'ResizeObserver' in window) {
19000
+ var resizeObserver = new window.ResizeObserver(updateWidths);
19001
+ resizeObserver.observe(button);
19002
+ if (container) {
19003
+ resizeObserver.observe(container);
19004
+ }
19005
+ return function () {
19006
+ return resizeObserver.disconnect();
19007
+ };
18986
19008
  }
18987
19009
  }, [usesDefaultText, passwordShown, SHOW_PASSWORD_BUTTON_TEXT, HIDE_PASSWORD_BUTTON_TEXT]);
18988
19010
  var getButtonWidth = function getButtonWidth() {
18989
19011
  if (usesDefaultText) {
18990
19012
  return inputSize === InputSize.large ? '64px' : '54px';
18991
- } else if (buttonWidth !== 0) {
18992
- return buttonWidth + "px";
18993
19013
  }
19014
+ return undefined;
19015
+ };
19016
+ var getButtonMaxWidth = function getButtonMaxWidth() {
19017
+ if (usesDefaultText) {
19018
+ return getButtonWidth();
19019
+ }
19020
+ return maxButtonWidth > 0 ? maxButtonWidth + "px" : undefined;
18994
19021
  };
18995
19022
  var getInputStyle = function getInputStyle() {
18996
19023
  if (isPasswordMaskButtonHidden) {
@@ -19049,7 +19076,10 @@ var PasswordInput = /*#__PURE__*/forwardRef(function (props, ref) {
19049
19076
  margin: '0 3px 0 0',
19050
19077
  width: getButtonWidth(),
19051
19078
  minWidth: 0,
19052
- maxWidth: getButtonWidth()
19079
+ maxWidth: getButtonMaxWidth(),
19080
+ overflow: 'hidden',
19081
+ textOverflow: 'ellipsis',
19082
+ whiteSpace: 'nowrap'
19053
19083
  },
19054
19084
  type: ButtonType.button,
19055
19085
  variant: ButtonVariant.link,