diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift b/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift index 1854f943..1f82a63c 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/RadioButton.swift @@ -7,14 +7,15 @@ // import UIKit - +import VDSColorTokens +import VDSFormControlsTokens @objcMembers open class RadioButton: Control, MFButtonProtocol { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- - public var diameter: CGFloat = 30 { + public var diameter: CGFloat = 20 { didSet { widthConstraint?.constant = diameter } } @@ -24,9 +25,12 @@ import UIKit updateAccessibilityLabel() } } - - public var enabledColor: UIColor = .mvmBlack - public var disabledColor: UIColor = .mvmCoolGray3 + public var enabledColor: UIColor { + return radioModel?.inverted ?? false ? VDSFormControlsColor.borderOndark : VDSFormControlsColor.borderOnlight + } + public var disabledColor: UIColor { + return radioModel?.inverted ?? false ? VDSColor.interactiveDisabledOndark : VDSColor.interactiveDisabledOnlight + } public var delegateObject: MVMCoreUIDelegateObject? var additionalData: [AnyHashable: Any]? @@ -141,9 +145,9 @@ import UIKit open override func setupView() { super.setupView() - backgroundColor = .mvmWhite + backgroundColor = .clear clipsToBounds = true - widthConstraint = widthAnchor.constraint(equalToConstant: 30) + widthConstraint = widthAnchor.constraint(equalToConstant: 20) widthConstraint?.isActive = true heightConstraint = heightAnchor.constraint(equalTo: widthAnchor, multiplier: 1) heightConstraint?.isActive = true @@ -169,6 +173,6 @@ import UIKit public override func reset() { super.reset() - backgroundColor = .mvmWhite + backgroundColor = .clear } } diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/RadioButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Selectors/RadioButtonModel.swift index 8db46032..86eb36e9 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/RadioButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/RadioButtonModel.swift @@ -28,6 +28,7 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol { public var groupName: String = FormValidator.defaultGroupName public var fieldKey: String? public var action: ActionModelProtocol? + public var inverted: Bool = false //-------------------------------------------------- // MARK: - Keys @@ -44,6 +45,7 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol { case groupName case action case readOnly + case inverted } //-------------------------------------------------- @@ -94,6 +96,9 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol { } fieldValue = try typeContainer.decodeIfPresent(String.self, forKey: .fieldValue) action = try typeContainer.decodeModelIfPresent(codingKey: .action) + if let inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) { + self.inverted = inverted + } } public func encode(to encoder: Encoder) throws { @@ -108,5 +113,6 @@ open class RadioButtonModel: MoleculeModelProtocol, FormFieldProtocol { try container.encodeIfPresent(groupName, forKey: .groupName) try container.encodeIfPresent(fieldValue, forKey: .fieldValue) try container.encodeModelIfPresent(action, forKey: .action) + try container.encodeIfPresent(inverted, forKey: .inverted) } } diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift index 7c5485be..f8e00ae6 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift @@ -261,6 +261,9 @@ extension Tabs: UICollectionViewDelegateFlowLayout { } else if let action = tabsModel.tabs[selectedIndex].action { MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: [KeySourceModel: tabsModel], delegateObject:delegateObject) } + if UIAccessibility.isVoiceOverRunning { + UIAccessibility.post(notification: .layoutChanged, argument: tabCell) + } } }