Merge branch 'mbruce/bugfix' into feature/inputField

This commit is contained in:
Matt Bruce 2024-04-30 13:19:34 -05:00
commit 2241f6d131
4 changed files with 40 additions and 8 deletions

View File

@ -37,17 +37,19 @@ public class TooltipLabelAttribute: ActionLabelAttributeModel, TooltipLaunchable
} }
var frame = CGRect.zero var frame = CGRect.zero
let ratio: Double = 1.0 //0.80
let yPosition: Double = -3
if let font = attributedString.attribute(.font, at: 0, effectiveRange: &originalRange) as? UIFont { if let font = attributedString.attribute(.font, at: 0, effectiveRange: &originalRange) as? UIFont {
switch font.pointSize { switch font.pointSize {
case 15..<25: case 15..<25:
size = .medium size = .medium
frame = CGRect(x: 0, y: -1, width: size.value.dimensions.width * 0.80, height: size.value.dimensions.height * 0.80) frame = CGRect(x: 0, y: yPosition, width: size.value.dimensions.width * ratio, height: size.value.dimensions.height * ratio)
case 0..<14: case 0..<14:
size = .small size = .small
frame = CGRect(x: 0, y: -1, width: size.value.dimensions.width * 0.80 , height: size.value.dimensions.height * 0.80) frame = CGRect(x: 0, y: yPosition, width: size.value.dimensions.width * ratio , height: size.value.dimensions.height * ratio)
default: default:
size = .medium size = .medium
frame = CGRect(x: 0, y: -1, width: size.value.dimensions.width, height: size.value.dimensions.height) frame = CGRect(x: 0, y: yPosition, width: size.value.dimensions.width, height: size.value.dimensions.height)
} }
} }

View File

@ -107,6 +107,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
internal var borderColorConfiguration = ControlColorConfiguration().with { internal var borderColorConfiguration = ControlColorConfiguration().with {
$0.setSurfaceColors(VDSFormControlsColor.borderOnlight, VDSFormControlsColor.borderOndark, forState: .normal) $0.setSurfaceColors(VDSFormControlsColor.borderOnlight, VDSFormControlsColor.borderOndark, forState: .normal)
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOnlight, forState: .focused)
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled) $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled)
$0.setSurfaceColors(VDSColor.feedbackErrorOnlight, VDSColor.feedbackErrorOndark, forState: .error) $0.setSurfaceColors(VDSColor.feedbackErrorOnlight, VDSColor.feedbackErrorOndark, forState: .error)
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: [.disabled,.error]) $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: [.disabled,.error])
@ -238,7 +239,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
//this is the horizontal stack that contains //this is the horizontal stack that contains
//the left, InputContainer, Icons, Buttons //the left, InputContainer, Icons, Buttons
container.addSubview(containerStackView) container.addSubview(containerStackView)
containerStackView.pinToSuperView(.uniform(12)) containerStackView.pinToSuperView(.uniform(VDSLayout.space3X))
//add the view to add input fields //add the view to add input fields
containerStackView.addArrangedSubview(controlContainerView) containerStackView.addArrangedSubview(controlContainerView)

View File

@ -79,22 +79,34 @@ open class TextArea: EntryFieldBase {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
override var containerSize: CGSize { CGSize(width: 182, height: 88) } /// Override UIControl state to add the .error state if showSuccess is true and if showError is true.
open override var state: UIControl.State {
get {
var state = super.state
if textView.isFirstResponder && !showError && !hasInternalError {
state.insert(.focused)
}
return state
}
}
override var containerSize: CGSize { CGSize(width: 182, height: Height.twoX.value) }
/// Enum used to describe the the height of TextArea. /// Enum used to describe the the height of TextArea.
public enum Height: String, CaseIterable { public enum Height: String, CaseIterable {
case twoX = "2X" case twoX = "2X"
case fourX = "4X" case fourX = "4X"
case eightX = "8X" case eightX = "8X"
var containerVerticalPadding: CGFloat { VDSLayout.space3X * 2 }
var value: CGFloat { var value: CGFloat {
switch self { switch self {
case .twoX: case .twoX:
88 88 - containerVerticalPadding
case .fourX: case .fourX:
176 176 - containerVerticalPadding
case .eightX: case .eightX:
352 352 - containerVerticalPadding
} }
} }
} }
@ -119,6 +131,8 @@ open class TextArea: EntryFieldBase {
$0.translatesAutoresizingMaskIntoConstraints = false $0.translatesAutoresizingMaskIntoConstraints = false
$0.sizeToFit() $0.sizeToFit()
$0.isScrollEnabled = false $0.isScrollEnabled = false
$0.textContainerInset = .zero
$0.textContainer.lineFragmentPadding = 0
} }
open var maxLength: Int? { open var maxLength: Int? {
@ -292,6 +306,14 @@ open class TextArea: EntryFieldBase {
} }
extension TextArea: UITextViewDelegate { extension TextArea: UITextViewDelegate {
public func textViewDidBeginEditing(_ textView: UITextView) {
setNeedsUpdate()
}
public func textViewDidEndEditing(_ textView: UITextView) {
setNeedsUpdate()
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - UITextViewDelegate // MARK: - UITextViewDelegate
//-------------------------------------------------- //--------------------------------------------------

View File

@ -1,3 +1,10 @@
1.0.61
----------------
- CXTDT-552068 - Text Area - Text padding
- CXTDT-552074 - Text Area - Tooltip
- CXTDT-552070 - Text Area - Container heights
- CXTDT-552071 - Text Area - Entering text
1.0.60 1.0.60
---------------- ----------------
- CXTDT-544442 - Button Icon - Selected state needs to allow custom color - CXTDT-544442 - Button Icon - Selected state needs to allow custom color