more comments

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-29 14:00:23 -05:00
parent 26854bf317
commit 2a589b1e22
6 changed files with 28 additions and 12 deletions

View File

@ -58,6 +58,7 @@ open class SelectorBase: Control, SelectorControlable {
open var size = CGSize(width: 20, height: 20) { didSet { setNeedsUpdate() }}
var _showError: Bool = false
/// Whether not to show the error.
open var showError: Bool {
get { _showError }
set {

View File

@ -107,6 +107,7 @@ extension CheckboxGroup {
/// Array of LabelAttributeModel objects used in rendering the childText.
public var childTextAttributes: [any LabelAttributeModel]?
public var selected: Bool
/// Whether not to show the error.
public var showError: Bool
public var errorText: String?

View File

@ -121,6 +121,7 @@ extension RadioButtonGroup {
/// Array of LabelAttributeModel objects used in rendering the childText.
public var childTextAttributes: [any LabelAttributeModel]?
public var selected: Bool
/// Whether not to show the error.
public var showError: Bool
public var errorText: String?

View File

@ -135,6 +135,7 @@ open class EntryFieldBase: Control, Changeable {
open var helperText: String? { didSet { setNeedsUpdate() }}
/// Whether not to show the error.
open var showError: Bool = false { didSet { setNeedsUpdate() }}
/// Override UIControl state to add the .error state if showError is true.
@ -277,6 +278,7 @@ open class EntryFieldBase: Control, Changeable {
//--------------------------------------------------
// MARK: - Public Methods
//--------------------------------------------------
/// Container for the area in which the user interacts.
open func getContainer() -> UIView {
return containerView
}

View File

@ -51,30 +51,35 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
}
}()
open var textFieldTextColorConfiguration: AnyColorable = ViewColorConfiguration().with {
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
}.eraseToAnyColorable()
internal var minWidthConstraint: NSLayoutConstraint?
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
/// Label to render the successText.
open var successLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodySmall
}
/// UITextField shown in the InputField.
open var textField = UITextField().with {
$0.translatesAutoresizingMaskIntoConstraints = false
$0.font = TextStyle.bodyLarge.font
}
/// Color configuration for the textField.
open var textFieldTextColorConfiguration: AnyColorable = ViewColorConfiguration().with {
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
}.eraseToAnyColorable()
/// Representing the type of input.
open var type: FieldType = .text { didSet { setNeedsUpdate() }}
var _showError: Bool = false
/// Whether not to show the error.
open override var showError: Bool {
get { _showError }
set {
@ -86,6 +91,7 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
}
var _showSuccess: Bool = false
/// Whether not to show the success.
open var showSuccess: Bool {
get { _showSuccess }
set {
@ -106,9 +112,10 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
return state
}
}
/// If given, this will be shown if showSuccess if true.
open var successText: String? { didSet { setNeedsUpdate() }}
/// Determines the placement of the helper text.
open var helperTextPlacement: HelperTextPlacement = .bottom { didSet { setNeedsUpdate() }}
//--------------------------------------------------
@ -158,6 +165,7 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
helperTextPlacement = .bottom
}
/// Container for the area in which the user interacts.
open override func getContainer() -> UIView {
inputFieldStackView.addArrangedSubview(containerView)
return inputFieldStackView

View File

@ -34,6 +34,9 @@ open class TextArea: EntryFieldBase {
//--------------------------------------------------
// MARK: - Private Properties
//--------------------------------------------------
internal var minWidthConstraint: NSLayoutConstraint?
internal var textViewHeightConstraint: NSLayoutConstraint?
internal var inputFieldStackView: UIStackView = {
return UIStackView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
@ -47,22 +50,21 @@ open class TextArea: EntryFieldBase {
// MARK: - Public Properties
//--------------------------------------------------
override var containerSize: CGSize { CGSize(width: 45, height: 88) }
private var textView = UITextView().with {
/// UITextView shown in the TextArea.
open var textView = UITextView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
$0.font = TextStyle.bodyLarge.font
$0.sizeToFit()
$0.isScrollEnabled = false
}
/// Color configuration for the textView.
open var textViewTextColorConfiguration: AnyColorable = ViewColorConfiguration().with {
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
}.eraseToAnyColorable() { didSet { setNeedsUpdate() }}
internal var minWidthConstraint: NSLayoutConstraint?
internal var textViewHeightConstraint: NSLayoutConstraint?
//--------------------------------------------------
// MARK: - Overrides
//--------------------------------------------------
@ -89,6 +91,7 @@ open class TextArea: EntryFieldBase {
textView.text = ""
}
/// Container for the area in which the user interacts.
open override func getContainer() -> UIView {
inputFieldStackView.addArrangedSubview(containerView)
return inputFieldStackView