updated entry field

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-01-10 16:49:39 -06:00
parent 6283735428
commit c6ffa5736d
2 changed files with 13 additions and 3 deletions

View File

@ -93,7 +93,7 @@ open class EntryField: Control, Accessable {
// MARK: - Configuration Properties // MARK: - Configuration Properties
//-------------------------------------------------- //--------------------------------------------------
// Sizes are from InVision design specs. // Sizes are from InVision design specs.
internal let containerSize = CGSize(width: 45, height: 44) internal var containerSize: CGSize { CGSize(width: 45, height: 44) }
internal let primaryColorConfig = ViewColorConfiguration().with { internal let primaryColorConfig = ViewColorConfiguration().with {
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true) $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)

View File

@ -16,7 +16,7 @@ public enum InputFieldType: String, CaseIterable {
} }
@objc(VDSInputField) @objc(VDSInputField)
public class InputField: EntryField { public class InputField: EntryField, UITextFieldDelegate {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializers // MARK: - Initializers
//-------------------------------------------------- //--------------------------------------------------
@ -102,7 +102,6 @@ public class InputField: EntryField {
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false) $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
}.eraseToAnyColorable() }.eraseToAnyColorable()
internal var minWidthConstraint: NSLayoutConstraint? internal var minWidthConstraint: NSLayoutConstraint?
//-------------------------------------------------- //--------------------------------------------------
@ -117,6 +116,13 @@ public class InputField: EntryField {
controlContainerView.addSubview(textField) controlContainerView.addSubview(textField)
textField.pinToSuperView() textField.pinToSuperView()
textField.heightAnchor.constraint(equalToConstant: 20).isActive = true textField.heightAnchor.constraint(equalToConstant: 20).isActive = true
textField
.textPublisher
.sink { [weak self] text in
self?.value = text
self?.sendActions(for: .valueChanged)
}.store(in: &subscribers)
stackView.addArrangedSubview(successLabel) stackView.addArrangedSubview(successLabel)
stackView.setCustomSpacing(8, after: successLabel) stackView.setCustomSpacing(8, after: successLabel)
@ -130,6 +136,9 @@ public class InputField: EntryField {
public override func reset() { public override func reset() {
super.reset() super.reset()
textField.text = ""
textField.delegate = self
successLabel.reset() successLabel.reset()
successLabel.textPosition = .left successLabel.textPosition = .left
successLabel.typograpicalStyle = .BodySmall successLabel.typograpicalStyle = .BodySmall
@ -204,6 +213,7 @@ public class InputField: EntryField {
} }
} }
} }
} }
extension InputFieldType { extension InputFieldType {