CXTDT-552071 - Text Area - Entering text

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-04-30 13:15:31 -05:00
parent b80dcda680
commit 83e0c4ab53
3 changed files with 24 additions and 2 deletions

View File

@ -107,6 +107,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
internal var borderColorConfiguration = ControlColorConfiguration().with {
$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.feedbackErrorOnlight, VDSColor.feedbackErrorOndark, forState: .error)
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: [.disabled,.error])

View File

@ -79,7 +79,18 @@ open class TextArea: EntryFieldBase {
//--------------------------------------------------
// 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.
public enum Height: String, CaseIterable {
@ -177,7 +188,7 @@ open class TextArea: EntryFieldBase {
.pinBottom(0, .defaultHigh)
textView.isScrollEnabled = true
textView.autocorrectionType = .no
textViewHeightConstraint = textView.heightAnchor.constraint(greaterThanOrEqualToConstant: Height.twoX.value)
textViewHeightConstraint = textView.heightAnchor.constraint(greaterThanOrEqualToConstant: containerSize.height)
textViewHeightConstraint?.isActive = true
backgroundColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessBackgroundOnlight, VDSColor.feedbackSuccessBackgroundOndark, forState: .success)
borderColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessOnlight, VDSColor.feedbackSuccessOndark, forState: .success)
@ -309,6 +320,14 @@ open class TextArea: EntryFieldBase {
}
extension TextArea: UITextViewDelegate {
public func textViewDidBeginEditing(_ textView: UITextView) {
setNeedsUpdate()
}
public func textViewDidEndEditing(_ textView: UITextView) {
setNeedsUpdate()
}
//--------------------------------------------------
// MARK: - UITextViewDelegate
//--------------------------------------------------

View File

@ -3,6 +3,8 @@
- 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
----------------
- CXTDT-544442 - Button Icon - Selected state needs to allow custom color