From 5a0018319fb20cef51f117f09d26250971899ea2 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 30 Apr 2024 11:54:12 -0500 Subject: [PATCH 1/4] CXTDT-552068 - Text Area - Text padding Signed-off-by: Matt Bruce --- VDS/Components/TextFields/TextArea/TextArea.swift | 2 ++ VDS/SupportingFiles/ReleaseNotes.txt | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/VDS/Components/TextFields/TextArea/TextArea.swift b/VDS/Components/TextFields/TextArea/TextArea.swift index d057333b..732ac7ac 100644 --- a/VDS/Components/TextFields/TextArea/TextArea.swift +++ b/VDS/Components/TextFields/TextArea/TextArea.swift @@ -127,6 +127,8 @@ open class TextArea: EntryFieldBase { $0.translatesAutoresizingMaskIntoConstraints = false $0.sizeToFit() $0.isScrollEnabled = false + $0.textContainerInset = .zero + $0.textContainer.lineFragmentPadding = 0 } open var maxLength: Int? { diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index 855ef058..3e3f0258 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,3 +1,7 @@ +1.0.61 +---------------- +- CXTDT-552068 - Text Area - Text padding + 1.0.60 ---------------- - CXTDT-544442 - Button Icon - Selected state needs to allow custom color From 000e4cdefae703a5e03df87975788b188f8f0357 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 30 Apr 2024 12:15:43 -0500 Subject: [PATCH 2/4] CXTDT-552074 - Text Area - Tooltip Signed-off-by: Matt Bruce --- .../Label/Attributes/TooltipLabelAttribute.swift | 8 +++++--- VDS/SupportingFiles/ReleaseNotes.txt | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/VDS/Components/Label/Attributes/TooltipLabelAttribute.swift b/VDS/Components/Label/Attributes/TooltipLabelAttribute.swift index 187d4eda..20666b10 100644 --- a/VDS/Components/Label/Attributes/TooltipLabelAttribute.swift +++ b/VDS/Components/Label/Attributes/TooltipLabelAttribute.swift @@ -37,17 +37,19 @@ public class TooltipLabelAttribute: ActionLabelAttributeModel, TooltipLaunchable } 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 { switch font.pointSize { case 15..<25: 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: 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: 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) } } diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index 3e3f0258..e09e37c0 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -1,6 +1,7 @@ 1.0.61 ---------------- - CXTDT-552068 - Text Area - Text padding +- CXTDT-552074 - Text Area - Tooltip 1.0.60 ---------------- From b80dcda680264d0b71f5c4c2e109d2e6975ca70e Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 30 Apr 2024 12:31:55 -0500 Subject: [PATCH 3/4] CXTDT-552070 - Text Area - Container heights Signed-off-by: Matt Bruce --- VDS/Components/TextFields/EntryFieldBase.swift | 2 +- VDS/Components/TextFields/TextArea/TextArea.swift | 9 +++++---- VDS/SupportingFiles/ReleaseNotes.txt | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/VDS/Components/TextFields/EntryFieldBase.swift b/VDS/Components/TextFields/EntryFieldBase.swift index a8ad917a..2fae06c0 100644 --- a/VDS/Components/TextFields/EntryFieldBase.swift +++ b/VDS/Components/TextFields/EntryFieldBase.swift @@ -239,7 +239,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable { //this is the horizontal stack that contains //the left, InputContainer, Icons, Buttons container.addSubview(containerStackView) - containerStackView.pinToSuperView(.uniform(12)) + containerStackView.pinToSuperView(.uniform(VDSLayout.space3X)) //add the view to add input fields containerStackView.addArrangedSubview(controlContainerView) diff --git a/VDS/Components/TextFields/TextArea/TextArea.swift b/VDS/Components/TextFields/TextArea/TextArea.swift index 732ac7ac..83f940bb 100644 --- a/VDS/Components/TextFields/TextArea/TextArea.swift +++ b/VDS/Components/TextFields/TextArea/TextArea.swift @@ -86,15 +86,16 @@ open class TextArea: EntryFieldBase { case twoX = "2X" case fourX = "4X" case eightX = "8X" + var containerVerticalPadding: CGFloat { VDSLayout.space3X * 2 } var value: CGFloat { switch self { case .twoX: - 88 + 88 - containerVerticalPadding case .fourX: - 176 + 176 - containerVerticalPadding case .eightX: - 352 + 352 - containerVerticalPadding } } } @@ -176,7 +177,7 @@ open class TextArea: EntryFieldBase { .pinBottom(0, .defaultHigh) textView.isScrollEnabled = true textView.autocorrectionType = .no - textViewHeightConstraint = textView.heightAnchor.constraint(greaterThanOrEqualToConstant: containerSize.height) + textViewHeightConstraint = textView.heightAnchor.constraint(greaterThanOrEqualToConstant: Height.twoX.value) textViewHeightConstraint?.isActive = true backgroundColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessBackgroundOnlight, VDSColor.feedbackSuccessBackgroundOndark, forState: .success) borderColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessOnlight, VDSColor.feedbackSuccessOndark, forState: .success) diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index e09e37c0..1df8f3a6 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -2,7 +2,7 @@ ---------------- - CXTDT-552068 - Text Area - Text padding - CXTDT-552074 - Text Area - Tooltip - +- CXTDT-552070 - Text Area - Container heights 1.0.60 ---------------- - CXTDT-544442 - Button Icon - Selected state needs to allow custom color From 83e0c4ab53fe249ea7e0a8cb28ea23cc9f562c82 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 30 Apr 2024 13:15:31 -0500 Subject: [PATCH 4/4] CXTDT-552071 - Text Area - Entering text Signed-off-by: Matt Bruce --- .../TextFields/EntryFieldBase.swift | 1 + .../TextFields/TextArea/TextArea.swift | 23 +++++++++++++++++-- VDS/SupportingFiles/ReleaseNotes.txt | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/VDS/Components/TextFields/EntryFieldBase.swift b/VDS/Components/TextFields/EntryFieldBase.swift index 2fae06c0..2f776ab8 100644 --- a/VDS/Components/TextFields/EntryFieldBase.swift +++ b/VDS/Components/TextFields/EntryFieldBase.swift @@ -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]) diff --git a/VDS/Components/TextFields/TextArea/TextArea.swift b/VDS/Components/TextFields/TextArea/TextArea.swift index 83f940bb..ad76b0f2 100644 --- a/VDS/Components/TextFields/TextArea/TextArea.swift +++ b/VDS/Components/TextFields/TextArea/TextArea.swift @@ -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 //-------------------------------------------------- diff --git a/VDS/SupportingFiles/ReleaseNotes.txt b/VDS/SupportingFiles/ReleaseNotes.txt index 1df8f3a6..8ffb31cb 100644 --- a/VDS/SupportingFiles/ReleaseNotes.txt +++ b/VDS/SupportingFiles/ReleaseNotes.txt @@ -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