CXTDT-542341 - disabled state color/borderWidth
CXTDT-542333 - padding fix Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
b56e45d41b
commit
f3f71b4b10
@ -34,16 +34,10 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private var mainStackView = UIStackView().with {
|
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
$0.alignment = .top
|
|
||||||
$0.axis = .vertical
|
|
||||||
$0.spacing = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
private var selectorStackView = UIStackView().with {
|
private var selectorStackView = UIStackView().with {
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
$0.alignment = .top
|
$0.alignment = .top
|
||||||
|
$0.distribution = .fill
|
||||||
$0.axis = .horizontal
|
$0.axis = .horizontal
|
||||||
$0.spacing = 12
|
$0.spacing = 12
|
||||||
}
|
}
|
||||||
@ -160,6 +154,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
|
|||||||
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled)
|
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled)
|
||||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .selected)
|
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .selected)
|
||||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .highlighted)
|
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .highlighted)
|
||||||
|
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: [.selected, .disabled])
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -182,10 +177,8 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
|
|||||||
addSubview(selectorView)
|
addSubview(selectorView)
|
||||||
selectorView.isUserInteractionEnabled = false
|
selectorView.isUserInteractionEnabled = false
|
||||||
|
|
||||||
selectorView.addSubview(mainStackView)
|
selectorView.addSubview(selectorStackView)
|
||||||
|
|
||||||
mainStackView.addArrangedSubview(selectorStackView)
|
|
||||||
|
|
||||||
selectorStackView.addArrangedSubview(selectorLeftLabelStackView)
|
selectorStackView.addArrangedSubview(selectorLeftLabelStackView)
|
||||||
selectorStackView.addArrangedSubview(subTextRightLabel)
|
selectorStackView.addArrangedSubview(subTextRightLabel)
|
||||||
selectorLeftLabelStackView.addArrangedSubview(textLabel)
|
selectorLeftLabelStackView.addArrangedSubview(textLabel)
|
||||||
@ -197,7 +190,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
|
|||||||
.pinTrailing(0, .defaultHigh)
|
.pinTrailing(0, .defaultHigh)
|
||||||
.pinBottom(0, .defaultHigh)
|
.pinBottom(0, .defaultHigh)
|
||||||
|
|
||||||
mainStackView.pinToSuperView(.uniform(16))
|
selectorStackView.pinToSuperView(.uniform(16))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
/// Resets to default settings.
|
||||||
@ -323,7 +316,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
|
|||||||
//get the colors
|
//get the colors
|
||||||
let backgroundColor = backgroundColorConfiguration.getColor(self)
|
let backgroundColor = backgroundColorConfiguration.getColor(self)
|
||||||
let borderColor = borderColorConfiguration.getColor(self)
|
let borderColor = borderColorConfiguration.getColor(self)
|
||||||
let borderWidth = isSelected || isHighlighted ? selectorBorderWidthSelected : selectorBorderWidth
|
let borderWidth = (isSelected || isHighlighted) && isEnabled ? selectorBorderWidthSelected : selectorBorderWidth
|
||||||
|
|
||||||
selectorView.backgroundColor = backgroundColor
|
selectorView.backgroundColor = backgroundColor
|
||||||
selectorView.layer.borderColor = borderColor.cgColor
|
selectorView.layer.borderColor = borderColor.cgColor
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user