more comments
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
26854bf317
commit
2a589b1e22
@ -58,6 +58,7 @@ open class SelectorBase: Control, SelectorControlable {
|
|||||||
open var size = CGSize(width: 20, height: 20) { didSet { setNeedsUpdate() }}
|
open var size = CGSize(width: 20, height: 20) { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
var _showError: Bool = false
|
var _showError: Bool = false
|
||||||
|
/// Whether not to show the error.
|
||||||
open var showError: Bool {
|
open var showError: Bool {
|
||||||
get { _showError }
|
get { _showError }
|
||||||
set {
|
set {
|
||||||
|
|||||||
@ -107,6 +107,7 @@ extension CheckboxGroup {
|
|||||||
/// Array of LabelAttributeModel objects used in rendering the childText.
|
/// Array of LabelAttributeModel objects used in rendering the childText.
|
||||||
public var childTextAttributes: [any LabelAttributeModel]?
|
public var childTextAttributes: [any LabelAttributeModel]?
|
||||||
public var selected: Bool
|
public var selected: Bool
|
||||||
|
/// Whether not to show the error.
|
||||||
public var showError: Bool
|
public var showError: Bool
|
||||||
public var errorText: String?
|
public var errorText: String?
|
||||||
|
|
||||||
|
|||||||
@ -121,6 +121,7 @@ extension RadioButtonGroup {
|
|||||||
/// Array of LabelAttributeModel objects used in rendering the childText.
|
/// Array of LabelAttributeModel objects used in rendering the childText.
|
||||||
public var childTextAttributes: [any LabelAttributeModel]?
|
public var childTextAttributes: [any LabelAttributeModel]?
|
||||||
public var selected: Bool
|
public var selected: Bool
|
||||||
|
/// Whether not to show the error.
|
||||||
public var showError: Bool
|
public var showError: Bool
|
||||||
public var errorText: String?
|
public var errorText: String?
|
||||||
|
|
||||||
|
|||||||
@ -135,6 +135,7 @@ open class EntryFieldBase: Control, Changeable {
|
|||||||
|
|
||||||
open var helperText: String? { didSet { setNeedsUpdate() }}
|
open var helperText: String? { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
|
/// Whether not to show the error.
|
||||||
open var showError: Bool = false { didSet { setNeedsUpdate() }}
|
open var showError: Bool = false { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
/// Override UIControl state to add the .error state if showError is true.
|
/// Override UIControl state to add the .error state if showError is true.
|
||||||
@ -277,6 +278,7 @@ open class EntryFieldBase: Control, Changeable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Methods
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
/// Container for the area in which the user interacts.
|
||||||
open func getContainer() -> UIView {
|
open func getContainer() -> UIView {
|
||||||
return containerView
|
return containerView
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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?
|
internal var minWidthConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
/// Label to render the successText.
|
||||||
open var successLabel = Label().with {
|
open var successLabel = Label().with {
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
$0.textPosition = .left
|
$0.textPosition = .left
|
||||||
$0.textStyle = .bodySmall
|
$0.textStyle = .bodySmall
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// UITextField shown in the InputField.
|
||||||
open var textField = UITextField().with {
|
open var textField = UITextField().with {
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
$0.font = TextStyle.bodyLarge.font
|
$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() }}
|
open var type: FieldType = .text { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
var _showError: Bool = false
|
var _showError: Bool = false
|
||||||
|
/// Whether not to show the error.
|
||||||
open override var showError: Bool {
|
open override var showError: Bool {
|
||||||
get { _showError }
|
get { _showError }
|
||||||
set {
|
set {
|
||||||
@ -86,6 +91,7 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var _showSuccess: Bool = false
|
var _showSuccess: Bool = false
|
||||||
|
/// Whether not to show the success.
|
||||||
open var showSuccess: Bool {
|
open var showSuccess: Bool {
|
||||||
get { _showSuccess }
|
get { _showSuccess }
|
||||||
set {
|
set {
|
||||||
@ -106,9 +112,10 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
|
|||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// If given, this will be shown if showSuccess if true.
|
||||||
open var successText: String? { didSet { setNeedsUpdate() }}
|
open var successText: String? { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
|
/// Determines the placement of the helper text.
|
||||||
open var helperTextPlacement: HelperTextPlacement = .bottom { didSet { setNeedsUpdate() }}
|
open var helperTextPlacement: HelperTextPlacement = .bottom { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -158,6 +165,7 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
|
|||||||
helperTextPlacement = .bottom
|
helperTextPlacement = .bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Container for the area in which the user interacts.
|
||||||
open override func getContainer() -> UIView {
|
open override func getContainer() -> UIView {
|
||||||
inputFieldStackView.addArrangedSubview(containerView)
|
inputFieldStackView.addArrangedSubview(containerView)
|
||||||
return inputFieldStackView
|
return inputFieldStackView
|
||||||
|
|||||||
@ -34,6 +34,9 @@ open class TextArea: EntryFieldBase {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
internal var minWidthConstraint: NSLayoutConstraint?
|
||||||
|
internal var textViewHeightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
internal var inputFieldStackView: UIStackView = {
|
internal var inputFieldStackView: UIStackView = {
|
||||||
return UIStackView().with {
|
return UIStackView().with {
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
@ -47,22 +50,21 @@ open class TextArea: EntryFieldBase {
|
|||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
override var containerSize: CGSize { CGSize(width: 45, height: 88) }
|
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.translatesAutoresizingMaskIntoConstraints = false
|
||||||
$0.font = TextStyle.bodyLarge.font
|
$0.font = TextStyle.bodyLarge.font
|
||||||
$0.sizeToFit()
|
$0.sizeToFit()
|
||||||
$0.isScrollEnabled = false
|
$0.isScrollEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Color configuration for the textView.
|
||||||
open var textViewTextColorConfiguration: AnyColorable = ViewColorConfiguration().with {
|
open var textViewTextColorConfiguration: AnyColorable = ViewColorConfiguration().with {
|
||||||
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
|
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
|
||||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
|
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
|
||||||
}.eraseToAnyColorable() { didSet { setNeedsUpdate() }}
|
}.eraseToAnyColorable() { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
internal var minWidthConstraint: NSLayoutConstraint?
|
|
||||||
internal var textViewHeightConstraint: NSLayoutConstraint?
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -89,6 +91,7 @@ open class TextArea: EntryFieldBase {
|
|||||||
textView.text = ""
|
textView.text = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Container for the area in which the user interacts.
|
||||||
open override func getContainer() -> UIView {
|
open override func getContainer() -> UIView {
|
||||||
inputFieldStackView.addArrangedSubview(containerView)
|
inputFieldStackView.addArrangedSubview(containerView)
|
||||||
return inputFieldStackView
|
return inputFieldStackView
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user