diff --git a/VDS/Components/DropdownSelect/DropdownSelect.swift b/VDS/Components/DropdownSelect/DropdownSelect.swift index 98a5a61f..f8a74aea 100644 --- a/VDS/Components/DropdownSelect/DropdownSelect.swift +++ b/VDS/Components/DropdownSelect/DropdownSelect.swift @@ -61,8 +61,9 @@ open class DropdownSelect: EntryFieldBase { internal var minWidthInlineLabel = 102.0 internal override var minWidth: CGFloat { showInlineLabel ? minWidthInlineLabel : minWidthDefault } internal override var maxWidth: CGFloat { - let frameWidth = frame.size.width - return helperTextPlacement == .right ? (frameWidth - horizontalStackView.spacing) / 2 : frameWidth + let frameWidth = constrainedWidth + let halfWidth = (frameWidth - horizontalStackView.spacing) / 2 + return helperTextPlacement == .right && halfWidth > minWidth * 2 ? halfWidth : frameWidth } /// The is used for the for adding the helperLabel to the right of the containerView. diff --git a/VDS/Components/TextFields/InputField/InputField.swift b/VDS/Components/TextFields/InputField/InputField.swift index 165d4dc5..227d515d 100644 --- a/VDS/Components/TextFields/InputField/InputField.swift +++ b/VDS/Components/TextFields/InputField/InputField.swift @@ -47,8 +47,9 @@ open class InputField: EntryFieldBase { internal override var minWidth: CGFloat { fieldType.handler().minWidth } internal override var maxWidth: CGFloat { - let frameWidth = frame.size.width - return helperTextPlacement == .right ? (frameWidth - horizontalStackView.spacing) / 2 : frameWidth + let frameWidth = constrainedWidth + let halfWidth = (frameWidth - horizontalStackView.spacing) / 2 + return helperTextPlacement == .right && halfWidth > minWidth * 2 ? halfWidth : frameWidth } /// The is used for the for adding the helperLabel to the right of the containerView. @@ -320,15 +321,12 @@ open class InputField: EntryFieldBase { internal override func updateContainerWidth() { widthConstraint?.deactivate() - trailingLessThanEqualsConstraint?.deactivate() - trailingEqualsConstraint?.deactivate() //see if there is a widthPercentage and follow the same pattern as done for "width" let currentWidth = (horizontalPinnedWidth() ?? 0) * (widthPercentage ?? 0) if currentWidth >= minWidth, currentWidth <= maxWidth { widthConstraint?.constant = currentWidth widthConstraint?.activate() - trailingLessThanEqualsConstraint?.activate() } else { super.updateContainerWidth() }