updated for enabling
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
44d065da6d
commit
ff0cf0ddbb
@ -11,7 +11,7 @@ import VDSColorTokens
|
|||||||
import VDSFormControlsTokens
|
import VDSFormControlsTokens
|
||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
public protocol Buttonable: UIControl, Surfaceable, Disabling {
|
public protocol Buttonable: UIControl, Surfaceable, Enabling {
|
||||||
var availableSizes: [ButtonSize] { get }
|
var availableSizes: [ButtonSize] { get }
|
||||||
var text: String? { get set }
|
var text: String? { get set }
|
||||||
var intrinsicContentSize: CGSize { get }
|
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.
|
/// Whether the Control is enabled or not.
|
||||||
open override var isEnabled: Bool { didSet { setNeedsUpdate(); isUserInteractionEnabled = isEnabled } }
|
open override var isEnabled: Bool { didSet { setNeedsUpdate(); isUserInteractionEnabled = isEnabled } }
|
||||||
|
|
||||||
@ -144,7 +134,7 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab
|
|||||||
open func reset() {
|
open func reset() {
|
||||||
shouldUpdateView = false
|
shouldUpdateView = false
|
||||||
surface = .light
|
surface = .light
|
||||||
disabled = false
|
isEnabled = true
|
||||||
text = nil
|
text = nil
|
||||||
accessibilityCustomActions = []
|
accessibilityCustomActions = []
|
||||||
shouldUpdateView = true
|
shouldUpdateView = true
|
||||||
|
|||||||
@ -94,21 +94,9 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega
|
|||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Whether this object is disabled or not
|
/// 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 {
|
override open var isEnabled: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
buttons.forEach { button in
|
buttons.forEach { $0.isEnabled = isEnabled }
|
||||||
var b = button
|
|
||||||
b.isEnabled = isEnabled
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user