updated for enabling

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-25 15:37:53 -05:00
parent 44d065da6d
commit ff0cf0ddbb
2 changed files with 4 additions and 26 deletions

View File

@ -11,7 +11,7 @@ import VDSColorTokens
import VDSFormControlsTokens
import Combine
public protocol Buttonable: UIControl, Surfaceable, Disabling {
public protocol Buttonable: UIControl, Surfaceable, Enabling {
var availableSizes: [ButtonSize] { get }
var text: String? { get set }
var intrinsicContentSize: CGSize { get }
@ -83,17 +83,7 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab
}
}
}
/// Whether this object is disabled or not
open var disabled: Bool {
get { !isEnabled }
set {
if !isEnabled != newValue {
isEnabled = !newValue
}
}
}
/// Whether the Control is enabled or not.
open override var isEnabled: Bool { didSet { setNeedsUpdate(); isUserInteractionEnabled = isEnabled } }
@ -144,7 +134,7 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab
open func reset() {
shouldUpdateView = false
surface = .light
disabled = false
isEnabled = true
text = nil
accessibilityCustomActions = []
shouldUpdateView = true

View File

@ -94,21 +94,9 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
// MARK: - Overrides
//--------------------------------------------------
/// Whether this object is disabled or not
override open var disabled: Bool {
didSet {
buttons.forEach { button in
var b = button
b.disabled = disabled
}
}
}
override open var isEnabled: Bool {
didSet {
buttons.forEach { button in
var b = button
b.isEnabled = isEnabled
}
buttons.forEach { $0.isEnabled = isEnabled }
}
}