Making further improvements from design specs.

This commit is contained in:
Kevin G Christiano 2019-12-12 16:47:07 -05:00
parent 420a874711
commit 59008f87d0
5 changed files with 28 additions and 17 deletions

View File

@ -69,9 +69,6 @@ import UIKit
container.trailingAnchor.constraint(equalTo: dropDownCaretView.trailingAnchor, constant: 16).isActive = true
container.bottomAnchor.constraint(greaterThanOrEqualTo: dropDownCaretView.bottomAnchor, constant: 13).isActive = true
dropDownCaretView.centerYAnchor.constraint(equalTo: container.centerYAnchor).isActive = true
let caretTap = UITapGestureRecognizer(target: self, action: #selector(startEditing))
dropDownCaretView.addGestureRecognizer(caretTap)
}
}

View File

@ -50,9 +50,7 @@ import UIKit
public var fieldKey: String?
public var errorMessage: String?
/// Determines whther the feedback label will clear itself after user interaction or display update.
public var affixFeedback: Bool = false
public var standardMessage: String?
//--------------------------------------------------
// MARK: - Computed Properties
@ -67,7 +65,6 @@ import UIKit
self.entryFieldContainer.isEnabled = enabled
self.feedbackLabel.textColor = enabled ? .black : .mfSilver()
self.titleLabel.textColor = enabled ? .mfBattleshipGrey() : .mfSilver()
}
}
}
@ -245,11 +242,10 @@ import UIKit
titleLabel.reset()
feedbackLabel.reset()
entryFieldContainer.reset()
titleLabel.textColor = .mfBattleshipGrey()
}
}
// MARK: - Molecular
// MARK: - MVMCoreUIMoleculeViewProtocol
extension EntryField {
@objc override open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {

View File

@ -215,7 +215,7 @@ import UIKit
/// Executes on UITextField.textDidChangeNotification
@objc func valueChanged() {
if !showError && !affixFeedback {
if !showError {
feedback = ""
}

View File

@ -53,6 +53,7 @@ public protocol TextFieldDidDeleteProtocol: class {
public func initialSetup() {
if !initialSetupPerformed {
tintColor = .black
initialSetupPerformed = true
setupView()
}
@ -64,7 +65,8 @@ public protocol TextFieldDidDeleteProtocol: class {
return .zero
}
return super.caretRect(for: position)
let caretRect = super.caretRect(for: position)
return CGRect(origin: caretRect.origin, size: CGSize(width: 1, height: caretRect.height))
}
open override func deleteBackward() {

View File

@ -23,7 +23,7 @@ import UIKit
return layer
}()
/// Total control overthe drawn top,bottom, left and right borders.
/// Total control over the drawn top, bottom, left and right borders.
public var disableAllBorders = false {
didSet {
bottomBar?.isHidden = disableAllBorders
@ -33,9 +33,8 @@ import UIKit
private(set) var fieldState: FieldState = .original {
didSet (oldState) {
// Will not update if new state is the same as old.
if fieldState != oldState {
fieldState.setStateUI(for: self)
}
guard fieldState != oldState else { return }
fieldState.setStateUI(for: self)
}
}
@ -100,9 +99,12 @@ import UIKit
_isSelected = selected
_isLocked = false
_isEnabled = true
_showError = false
fieldState = selected ? .selected : .original
if selected && showError {
fieldState = .selectedError
} else {
fieldState = selected ? .selected : .original
}
}
}
@ -181,11 +183,13 @@ import UIKit
public enum FieldState {
case original
case error
case selectedError
case selected
case locked
case disabled
public func setStateUI(for formField: EntryFieldContainer) {
switch self {
case .original:
formField.originalUI()
@ -193,6 +197,9 @@ import UIKit
case .error:
formField.errorUI()
case .selectedError:
formField.selectedErrorUI()
case .selected:
formField.selectedUI()
@ -223,6 +230,15 @@ import UIKit
refreshUI(bottomBarSize: 4)
}
open func selectedErrorUI() {
isUserInteractionEnabled = true
hideBorders = false
borderStrokeColor = .black
bottomBar?.backgroundColor = UIColor.mfPumpkin().cgColor
refreshUI(bottomBarSize: 4)
}
open func selectedUI() {
isUserInteractionEnabled = true