diff --git a/VDS/Components/RadioBox/RadioBoxItem.swift b/VDS/Components/RadioBox/RadioBoxItem.swift index cfeb54e6..ef9ee4fa 100644 --- a/VDS/Components/RadioBox/RadioBoxItem.swift +++ b/VDS/Components/RadioBox/RadioBoxItem.swift @@ -34,16 +34,10 @@ open class RadioBoxItem: Control, Changeable, FormFieldable { //-------------------------------------------------- // 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 { $0.translatesAutoresizingMaskIntoConstraints = false $0.alignment = .top + $0.distribution = .fill $0.axis = .horizontal $0.spacing = 12 } @@ -160,6 +154,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable { $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled) $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .selected) $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) selectorView.isUserInteractionEnabled = false - selectorView.addSubview(mainStackView) - - mainStackView.addArrangedSubview(selectorStackView) - + selectorView.addSubview(selectorStackView) + selectorStackView.addArrangedSubview(selectorLeftLabelStackView) selectorStackView.addArrangedSubview(subTextRightLabel) selectorLeftLabelStackView.addArrangedSubview(textLabel) @@ -197,7 +190,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable { .pinTrailing(0, .defaultHigh) .pinBottom(0, .defaultHigh) - mainStackView.pinToSuperView(.uniform(16)) + selectorStackView.pinToSuperView(.uniform(16)) } /// Resets to default settings. @@ -323,7 +316,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable { //get the colors let backgroundColor = backgroundColorConfiguration.getColor(self) let borderColor = borderColorConfiguration.getColor(self) - let borderWidth = isSelected || isHighlighted ? selectorBorderWidthSelected : selectorBorderWidth + let borderWidth = (isSelected || isHighlighted) && isEnabled ? selectorBorderWidthSelected : selectorBorderWidth selectorView.backgroundColor = backgroundColor selectorView.layer.borderColor = borderColor.cgColor