refactored label to remove disabled.

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-25 15:46:00 -05:00
parent 1b9a2799b2
commit a6a0003c3b
10 changed files with 16 additions and 26 deletions

View File

@ -237,7 +237,7 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
//top label
if let labelText {
label.surface = surface
label.disabled = disabled
label.isEnabled = isEnabled
label.attributes = labelTextAttributes
label.text = labelText
label.isHidden = false
@ -252,7 +252,7 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
if let childText {
childLabel.text = childText
childLabel.surface = surface
childLabel.disabled = disabled
childLabel.isEnabled = isEnabled
childLabel.attributes = childTextAttributes
childLabel.isHidden = false
@ -276,7 +276,7 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
if let errorText, shouldShowError {
errorLabel.text = errorText
errorLabel.surface = surface
errorLabel.disabled = disabled
errorLabel.isEnabled = isEnabled
mainStackView.spacing = 8
errorLabel.isHidden = false
} else {

View File

@ -157,6 +157,6 @@ open class Badge: View {
label.numberOfLines = numberOfLines
label.text = text
label.surface = surface
label.disabled = disabled
label.isEnabled = isEnabled
}
}

View File

@ -341,7 +341,7 @@ open class BadgeIndicator: View {
label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
label.text = getText()
label.surface = surface
label.disabled = disabled
label.isEnabled = isEnabled
label.sizeToFit()
setNeedsLayout()
layoutIfNeeded()

View File

@ -55,16 +55,6 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
}
}
/// Whether this object is disabled or not
open var disabled: Bool {
get { !isEnabled }
set {
if !isEnabled != newValue {
isEnabled = !newValue
}
}
}
/// Whether the View is enabled or not.
open override var isEnabled: Bool { didSet { setNeedsUpdate(); isUserInteractionEnabled = isEnabled } }
@ -123,7 +113,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
open func reset() {
shouldUpdateView = false
surface = .light
disabled = false
isEnabled = true
attributes = nil
textStyle = .defaultStyle
textPosition = .left

View File

@ -187,14 +187,14 @@ open class RadioBoxItem: Control, Changeable {
//text label
textLabel.text = text
textLabel.surface = surface
textLabel.disabled = disabled
textLabel.isEnabled = isEnabled
textLabel.attributes = textAttributes
//subText label
if let subText {
subTextLabel.text = subText
subTextLabel.surface = surface
subTextLabel.disabled = disabled
subTextLabel.isEnabled = isEnabled
subTextLabel.attributes = subTextAttributes
subTextLabel.isHidden = false
@ -209,7 +209,7 @@ open class RadioBoxItem: Control, Changeable {
if let subTextRight {
subTextRightLabel.text = subTextRight
subTextRightLabel.surface = surface
subTextRightLabel.disabled = disabled
subTextRightLabel.isEnabled = isEnabled
subTextRightLabel.attributes = subTextRightAttributes
subTextRightLabel.isHidden = false

View File

@ -132,7 +132,7 @@ open class RadioSwatchGroup: SelectorGroupSelectedHandlerBase<RadioSwatch>, UICo
label.textStyle = .bodySmall
label.text = selectedHandler?.text ?? " "
label.surface = surface
label.disabled = disabled
label.isEnabled = isEnabled
collectionView.reloadData()
}

View File

@ -301,7 +301,7 @@ open class EntryField: Control, Changeable {
titleLabel.text = updatedLabelText
titleLabel.attributes = attributes
titleLabel.surface = surface
titleLabel.disabled = disabled
titleLabel.isEnabled = isEnabled
}
@ -309,7 +309,7 @@ open class EntryField: Control, Changeable {
if showError, let errorText {
errorLabel.text = errorText
errorLabel.surface = surface
errorLabel.disabled = disabled
errorLabel.isEnabled = isEnabled
errorLabel.isHidden = false
icon.name = .error
icon.color = VDSColor.paletteBlack
@ -326,7 +326,7 @@ open class EntryField: Control, Changeable {
if let helperText {
helperLabel.text = helperText
helperLabel.surface = surface
helperLabel.disabled = disabled
helperLabel.isEnabled = isEnabled
helperLabel.isHidden = false
} else {
helperLabel.isHidden = true

View File

@ -175,7 +175,7 @@ open class InputField: EntryField, UITextFieldDelegate {
} else if showSuccess, let successText {
successLabel.text = successText
successLabel.surface = surface
successLabel.disabled = disabled
successLabel.isEnabled = isEnabled
successLabel.isHidden = false
errorLabel.isHidden = true
icon.name = .checkmarkAlt

View File

@ -234,7 +234,7 @@ open class Toggle: Control, Changeable {
label.textStyle = textStyle
label.text = statusText
label.surface = surface
label.disabled = disabled
label.isEnabled = isEnabled
switch textPosition {
case .left:
NSLayoutConstraint.deactivate(rightConstraints)

View File

@ -71,7 +71,7 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
label.textPosition = labelTextPosition
label.attributes = labelAttributes
label.surface = surface
label.disabled = disabled
label.isEnabled = isEnabled
//add tooltip
if let labelText, !labelText.isEmpty {