updated controls for reset()
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
9b75fd4edc
commit
00f1418e69
@ -86,7 +86,7 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable {
|
|||||||
open func reset() {
|
open func reset() {
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
surface = .light
|
surface = .light
|
||||||
disabled = false
|
disabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - ViewProtocol
|
// MARK: - ViewProtocol
|
||||||
@ -94,5 +94,5 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable {
|
|||||||
open func setup() {
|
open func setup() {
|
||||||
translatesAutoresizingMaskIntoConstraints = false
|
translatesAutoresizingMaskIntoConstraints = false
|
||||||
insetsLayoutMarginsFromSafeArea = false
|
insetsLayoutMarginsFromSafeArea = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,9 +21,6 @@ public class Badge: View, Accessable {
|
|||||||
private var label = Label().with {
|
private var label = Label().with {
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
$0.adjustsFontSizeToFitWidth = false
|
$0.adjustsFontSizeToFitWidth = false
|
||||||
$0.lineBreakMode = .byTruncatingTail
|
|
||||||
$0.textPosition = .left
|
|
||||||
$0.typograpicalStyle = .BoldBodySmall
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -83,6 +80,21 @@ public class Badge: View, Accessable {
|
|||||||
public override func reset() {
|
public override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
label.reset()
|
label.reset()
|
||||||
|
label.lineBreakMode = .byTruncatingTail
|
||||||
|
label.textPosition = .left
|
||||||
|
label.typograpicalStyle = .BoldBodySmall
|
||||||
|
|
||||||
|
fillColor = .red
|
||||||
|
text = ""
|
||||||
|
maxWidth = nil
|
||||||
|
numberOfLines = 1
|
||||||
|
accessibilityHintEnabled = nil
|
||||||
|
accessibilityHintDisabled = nil
|
||||||
|
accessibilityValueEnabled = nil
|
||||||
|
accessibilityValueDisabled = nil
|
||||||
|
accessibilityLabelEnabled = nil
|
||||||
|
accessibilityLabelDisabled = nil
|
||||||
|
|
||||||
setAccessibilityLabel()
|
setAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -83,8 +83,10 @@ open class TextLink: Control {
|
|||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
size = .large
|
|
||||||
label.reset()
|
label.reset()
|
||||||
|
size = .large
|
||||||
|
text = nil
|
||||||
|
|
||||||
accessibilityCustomActions = []
|
accessibilityCustomActions = []
|
||||||
accessibilityTraits = .staticText
|
accessibilityTraits = .staticText
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,6 +97,11 @@ open class TextLinkCaret: Control {
|
|||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
label.reset()
|
label.reset()
|
||||||
|
|
||||||
|
label.typograpicalStyle = TypographicalStyle.BoldBodyLarge
|
||||||
|
text = nil
|
||||||
|
iconPosition = .right
|
||||||
|
|
||||||
accessibilityCustomActions = []
|
accessibilityCustomActions = []
|
||||||
accessibilityTraits = .staticText
|
accessibilityTraits = .staticText
|
||||||
}
|
}
|
||||||
|
|||||||
@ -258,6 +258,32 @@ open class CheckboxBase: Control, Accessable, DataTrackable, BinaryColorable, Er
|
|||||||
label.reset()
|
label.reset()
|
||||||
childLabel.reset()
|
childLabel.reset()
|
||||||
errorLabel.reset()
|
errorLabel.reset()
|
||||||
|
|
||||||
|
label.typograpicalStyle = .BoldBodyLarge
|
||||||
|
childLabel.typograpicalStyle = .BodyLarge
|
||||||
|
errorLabel.typograpicalStyle = .BodyMedium
|
||||||
|
|
||||||
|
labelText = nil
|
||||||
|
labelTextAttributes = nil
|
||||||
|
labelAttributedText = nil
|
||||||
|
childText = nil
|
||||||
|
childTextAttributes = nil
|
||||||
|
childAttributedText = nil
|
||||||
|
showError = false
|
||||||
|
errorText = nil
|
||||||
|
inputId = nil
|
||||||
|
value = nil
|
||||||
|
dataAnalyticsTrack = nil
|
||||||
|
dataClickStream = nil
|
||||||
|
dataTrack = nil
|
||||||
|
accessibilityHintEnabled = nil
|
||||||
|
accessibilityHintDisabled = nil
|
||||||
|
accessibilityValueEnabled = nil
|
||||||
|
accessibilityValueDisabled = nil
|
||||||
|
accessibilityLabelEnabled = nil
|
||||||
|
accessibilityLabelDisabled = nil
|
||||||
|
isSelected = false
|
||||||
|
|
||||||
updateSelector()
|
updateSelector()
|
||||||
setAccessibilityLabel()
|
setAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -236,6 +236,35 @@ open class RadioBoxBase: Control, BinaryColorable, Accessable, DataTrackable{
|
|||||||
textLabel.reset()
|
textLabel.reset()
|
||||||
subTextLabel.reset()
|
subTextLabel.reset()
|
||||||
subTextRightLabel.reset()
|
subTextRightLabel.reset()
|
||||||
|
|
||||||
|
textLabel.typograpicalStyle = .BoldBodyLarge
|
||||||
|
subTextLabel.typograpicalStyle = .BodyLarge
|
||||||
|
subTextRightLabel.typograpicalStyle = .BodyLarge
|
||||||
|
|
||||||
|
text = "Default Text"
|
||||||
|
textAttributes = nil
|
||||||
|
textAttributedText = nil
|
||||||
|
subText = nil
|
||||||
|
subTextAttributes = nil
|
||||||
|
subTextAttributedText = nil
|
||||||
|
subTextRight = nil
|
||||||
|
subTextRightAttributes = nil
|
||||||
|
subTextRightAttributedText = nil
|
||||||
|
strikethrough = false
|
||||||
|
inputId = nil
|
||||||
|
value = nil
|
||||||
|
dataAnalyticsTrack = nil
|
||||||
|
dataClickStream = nil
|
||||||
|
dataTrack = nil
|
||||||
|
accessibilityHintEnabled = nil
|
||||||
|
accessibilityHintDisabled = nil
|
||||||
|
accessibilityValueEnabled = nil
|
||||||
|
accessibilityValueDisabled = nil
|
||||||
|
accessibilityLabelEnabled = nil
|
||||||
|
accessibilityLabelDisabled = nil
|
||||||
|
|
||||||
|
isSelected = false
|
||||||
|
|
||||||
updateSelector()
|
updateSelector()
|
||||||
setAccessibilityLabel()
|
setAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,14 +82,20 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, BinaryColorable,
|
|||||||
|
|
||||||
private var label = Label().with {
|
private var label = Label().with {
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
|
$0.textPosition = .left
|
||||||
|
$0.typograpicalStyle = .BoldBodyLarge
|
||||||
}
|
}
|
||||||
|
|
||||||
private var childLabel = Label().with {
|
private var childLabel = Label().with {
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
|
$0.textPosition = .left
|
||||||
|
$0.typograpicalStyle = .BodyLarge
|
||||||
}
|
}
|
||||||
|
|
||||||
private var errorLabel = Label().with {
|
private var errorLabel = Label().with {
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
|
$0.textPosition = .left
|
||||||
|
$0.typograpicalStyle = .BodyMedium
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -194,15 +200,6 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, BinaryColorable,
|
|||||||
mainStackView.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true
|
mainStackView.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true
|
||||||
mainStackView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
|
mainStackView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
|
||||||
|
|
||||||
//defaults
|
|
||||||
label.textPosition = .left
|
|
||||||
label.typograpicalStyle = .BoldBodyLarge
|
|
||||||
|
|
||||||
childLabel.textPosition = .left
|
|
||||||
childLabel.typograpicalStyle = .BodyLarge
|
|
||||||
|
|
||||||
errorLabel.textPosition = .left
|
|
||||||
errorLabel.typograpicalStyle = .BodyMedium
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateLabels() {
|
func updateLabels() {
|
||||||
@ -268,6 +265,33 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, BinaryColorable,
|
|||||||
label.reset()
|
label.reset()
|
||||||
childLabel.reset()
|
childLabel.reset()
|
||||||
errorLabel.reset()
|
errorLabel.reset()
|
||||||
|
|
||||||
|
label.typograpicalStyle = .BoldBodyLarge
|
||||||
|
childLabel.typograpicalStyle = .BodyLarge
|
||||||
|
errorLabel.typograpicalStyle = .BodyMedium
|
||||||
|
|
||||||
|
labelText = nil
|
||||||
|
labelTextAttributes = nil
|
||||||
|
labelAttributedText = nil
|
||||||
|
childText = nil
|
||||||
|
childTextAttributes = nil
|
||||||
|
childAttributedText = nil
|
||||||
|
showError = false
|
||||||
|
errorText = nil
|
||||||
|
inputId = nil
|
||||||
|
value = nil
|
||||||
|
dataAnalyticsTrack = nil
|
||||||
|
dataClickStream = nil
|
||||||
|
dataTrack = nil
|
||||||
|
accessibilityHintEnabled = nil
|
||||||
|
accessibilityHintDisabled = nil
|
||||||
|
accessibilityValueEnabled = nil
|
||||||
|
accessibilityValueDisabled = nil
|
||||||
|
accessibilityLabelEnabled = nil
|
||||||
|
accessibilityLabelDisabled = nil
|
||||||
|
|
||||||
|
isSelected = false
|
||||||
|
|
||||||
updateSelector()
|
updateSelector()
|
||||||
setAccessibilityLabel()
|
setAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,6 +122,24 @@ open class RadioSwatchBase: Control, Accessable, DataTrackable, BinaryColorable
|
|||||||
|
|
||||||
public override func reset() {
|
public override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
|
|
||||||
|
fillImage = nil
|
||||||
|
text = ""
|
||||||
|
primaryColor = nil
|
||||||
|
secondaryColor = nil
|
||||||
|
strikethrough = false
|
||||||
|
inputId = nil
|
||||||
|
value = nil
|
||||||
|
dataAnalyticsTrack = nil
|
||||||
|
dataClickStream = nil
|
||||||
|
dataTrack = nil
|
||||||
|
accessibilityHintEnabled = nil
|
||||||
|
accessibilityHintDisabled = nil
|
||||||
|
accessibilityValueEnabled = nil
|
||||||
|
accessibilityValueDisabled = nil
|
||||||
|
accessibilityLabelEnabled = nil
|
||||||
|
accessibilityLabelDisabled = nil
|
||||||
|
|
||||||
setNeedsDisplay()
|
setNeedsDisplay()
|
||||||
setAccessibilityLabel()
|
setAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,14 +46,20 @@ open class EntryField: Control, Accessable {
|
|||||||
internal var titleLabel = Label().with {
|
internal var titleLabel = Label().with {
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
$0.attributes = []
|
$0.attributes = []
|
||||||
|
$0.textPosition = .left
|
||||||
|
$0.typograpicalStyle = .BodySmall
|
||||||
}
|
}
|
||||||
|
|
||||||
internal var errorLabel = Label().with {
|
internal var errorLabel = Label().with {
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
|
$0.textPosition = .left
|
||||||
|
$0.typograpicalStyle = .BodySmall
|
||||||
}
|
}
|
||||||
|
|
||||||
internal var helperLabel = Label().with {
|
internal var helperLabel = Label().with {
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
|
$0.textPosition = .left
|
||||||
|
$0.typograpicalStyle = .BodySmall
|
||||||
}
|
}
|
||||||
|
|
||||||
internal var containerView: UIView = {
|
internal var containerView: UIView = {
|
||||||
@ -256,6 +262,38 @@ open class EntryField: Control, Accessable {
|
|||||||
|
|
||||||
public override func reset() {
|
public override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
|
titleLabel.reset()
|
||||||
|
errorLabel.reset()
|
||||||
|
helperLabel.reset()
|
||||||
|
|
||||||
|
titleLabel.textPosition = .left
|
||||||
|
titleLabel.typograpicalStyle = .BodySmall
|
||||||
|
errorLabel.textPosition = .left
|
||||||
|
errorLabel.typograpicalStyle = .BodySmall
|
||||||
|
helperLabel.textPosition = .left
|
||||||
|
helperLabel.typograpicalStyle = .BodySmall
|
||||||
|
|
||||||
|
labelText = nil
|
||||||
|
helperText = nil
|
||||||
|
showError = false
|
||||||
|
errorText = nil
|
||||||
|
tooltipTitle = nil
|
||||||
|
tooltipContent = nil
|
||||||
|
transparentBackground = false
|
||||||
|
width = nil
|
||||||
|
maxLength = nil
|
||||||
|
inputId = nil
|
||||||
|
value = nil
|
||||||
|
defaultValue = nil
|
||||||
|
required = false
|
||||||
|
readOnly = false
|
||||||
|
accessibilityHintEnabled = nil
|
||||||
|
accessibilityHintDisabled = nil
|
||||||
|
accessibilityValueEnabled = nil
|
||||||
|
accessibilityValueDisabled = nil
|
||||||
|
accessibilityLabelEnabled = nil
|
||||||
|
accessibilityLabelDisabled = nil
|
||||||
|
|
||||||
setAccessibilityLabel()
|
setAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,8 +351,6 @@ open class EntryField: Control, Accessable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//set the titleLabel
|
//set the titleLabel
|
||||||
titleLabel.textPosition = .left
|
|
||||||
titleLabel.typograpicalStyle = .BodySmall
|
|
||||||
titleLabel.text = updatedLabelText
|
titleLabel.text = updatedLabelText
|
||||||
titleLabel.attributes = attributes
|
titleLabel.attributes = attributes
|
||||||
titleLabel.surface = surface
|
titleLabel.surface = surface
|
||||||
@ -324,8 +360,6 @@ open class EntryField: Control, Accessable {
|
|||||||
|
|
||||||
open func updateErrorLabel(){
|
open func updateErrorLabel(){
|
||||||
if showError, let errorText {
|
if showError, let errorText {
|
||||||
errorLabel.textPosition = .left
|
|
||||||
errorLabel.typograpicalStyle = .BodySmall
|
|
||||||
errorLabel.text = errorText
|
errorLabel.text = errorText
|
||||||
errorLabel.surface = surface
|
errorLabel.surface = surface
|
||||||
errorLabel.disabled = disabled
|
errorLabel.disabled = disabled
|
||||||
@ -338,8 +372,6 @@ open class EntryField: Control, Accessable {
|
|||||||
open func updateHelperLabel(){
|
open func updateHelperLabel(){
|
||||||
//set the helper label position
|
//set the helper label position
|
||||||
if let helperText {
|
if let helperText {
|
||||||
helperLabel.textPosition = .left
|
|
||||||
helperLabel.typograpicalStyle = .BodySmall
|
|
||||||
helperLabel.text = helperText
|
helperLabel.text = helperText
|
||||||
helperLabel.surface = surface
|
helperLabel.surface = surface
|
||||||
helperLabel.disabled = disabled
|
helperLabel.disabled = disabled
|
||||||
|
|||||||
@ -60,6 +60,8 @@ open class TextEntryFieldBase: EntryField {
|
|||||||
|
|
||||||
private var successLabel = Label().with {
|
private var successLabel = Label().with {
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
|
$0.textPosition = .left
|
||||||
|
$0.typograpicalStyle = .BodySmall
|
||||||
}
|
}
|
||||||
|
|
||||||
internal var minWidthConstraint: NSLayoutConstraint?
|
internal var minWidthConstraint: NSLayoutConstraint?
|
||||||
@ -80,6 +82,18 @@ open class TextEntryFieldBase: EntryField {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override func reset() {
|
||||||
|
super.reset()
|
||||||
|
successLabel.reset()
|
||||||
|
successLabel.textPosition = .left
|
||||||
|
successLabel.typograpicalStyle = .BodySmall
|
||||||
|
|
||||||
|
type = .text
|
||||||
|
showSuccess = false
|
||||||
|
successText = nil
|
||||||
|
helperTextPlacement = .bottom
|
||||||
|
}
|
||||||
|
|
||||||
open override func getContainer() -> UIView {
|
open override func getContainer() -> UIView {
|
||||||
containerStackView.addArrangedSubview(containerView)
|
containerStackView.addArrangedSubview(containerView)
|
||||||
return containerStackView
|
return containerStackView
|
||||||
@ -126,8 +140,6 @@ open class TextEntryFieldBase: EntryField {
|
|||||||
successLabel.isHidden = true
|
successLabel.isHidden = true
|
||||||
|
|
||||||
} else if showSuccess, let successText {
|
} else if showSuccess, let successText {
|
||||||
successLabel.textPosition = .left
|
|
||||||
successLabel.typograpicalStyle = .BodySmall
|
|
||||||
successLabel.text = successText
|
successLabel.text = successText
|
||||||
successLabel.surface = surface
|
successLabel.surface = surface
|
||||||
successLabel.disabled = disabled
|
successLabel.disabled = disabled
|
||||||
|
|||||||
@ -295,6 +295,19 @@ open class ToggleBase: Control, Accessable, DataTrackable, BinaryColorable {
|
|||||||
public override func reset() {
|
public override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
label.reset()
|
label.reset()
|
||||||
|
isSelected = false
|
||||||
|
isOn = false
|
||||||
|
|
||||||
|
isAnimated = true
|
||||||
|
showText = false
|
||||||
|
onText = "On"
|
||||||
|
offText = "Off"
|
||||||
|
textSize = .small
|
||||||
|
textWeight = .regular
|
||||||
|
textPosition = .left
|
||||||
|
inputId = nil
|
||||||
|
value = nil
|
||||||
|
|
||||||
toggleView.backgroundColor = toggleColorConfiguration.getColor(self)
|
toggleView.backgroundColor = toggleColorConfiguration.getColor(self)
|
||||||
knobView.backgroundColor = knobColorConfiguration.getColor(self)
|
knobView.backgroundColor = knobColorConfiguration.getColor(self)
|
||||||
setAccessibilityLabel()
|
setAccessibilityLabel()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user