Merge branch 'feature/accessibilityUpdate' into 'develop'
removed accessibility protocols See merge request BPHV_MIPS/vds_ios!46
This commit is contained in:
commit
12a1d3cde4
@ -18,14 +18,12 @@
|
|||||||
EA33617D288B19210071C351 /* VDS.h in Headers */ = {isa = PBXBuildFile; fileRef = EA33616F288B19200071C351 /* VDS.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
EA33617D288B19210071C351 /* VDS.h in Headers */ = {isa = PBXBuildFile; fileRef = EA33616F288B19200071C351 /* VDS.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
EA3361A8288B23300071C351 /* UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361A7288B23300071C351 /* UIColor.swift */; };
|
EA3361A8288B23300071C351 /* UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361A7288B23300071C351 /* UIColor.swift */; };
|
||||||
EA3361AA288B25E40071C351 /* Disabling.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361A9288B25E40071C351 /* Disabling.swift */; };
|
EA3361AA288B25E40071C351 /* Disabling.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361A9288B25E40071C351 /* Disabling.swift */; };
|
||||||
EA3361AD288B26190071C351 /* DataTrackable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361AC288B26190071C351 /* DataTrackable.swift */; };
|
|
||||||
EA3361AF288B26310071C351 /* FormFieldable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361AE288B26310071C351 /* FormFieldable.swift */; };
|
EA3361AF288B26310071C351 /* FormFieldable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361AE288B26310071C351 /* FormFieldable.swift */; };
|
||||||
EA3361B6288B2A410071C351 /* Control.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361B5288B2A410071C351 /* Control.swift */; };
|
EA3361B6288B2A410071C351 /* Control.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361B5288B2A410071C351 /* Control.swift */; };
|
||||||
EA3361B8288B2AAA0071C351 /* ViewProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361B7288B2AAA0071C351 /* ViewProtocol.swift */; };
|
EA3361B8288B2AAA0071C351 /* ViewProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361B7288B2AAA0071C351 /* ViewProtocol.swift */; };
|
||||||
EA3361BD288B2C760071C351 /* TypeAlias.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361BC288B2C760071C351 /* TypeAlias.swift */; };
|
EA3361BD288B2C760071C351 /* TypeAlias.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361BC288B2C760071C351 /* TypeAlias.swift */; };
|
||||||
EA3361BF288B2EA60071C351 /* Handlerable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361BE288B2EA60071C351 /* Handlerable.swift */; };
|
EA3361BF288B2EA60071C351 /* Handlerable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361BE288B2EA60071C351 /* Handlerable.swift */; };
|
||||||
EA3361C328902D960071C351 /* Toggle.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361C228902D960071C351 /* Toggle.swift */; };
|
EA3361C328902D960071C351 /* Toggle.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361C228902D960071C351 /* Toggle.swift */; };
|
||||||
EA3361C5289030FC0071C351 /* Accessable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361C4289030FC0071C351 /* Accessable.swift */; };
|
|
||||||
EA3361C9289054C50071C351 /* Surfaceable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361C8289054C50071C351 /* Surfaceable.swift */; };
|
EA3361C9289054C50071C351 /* Surfaceable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361C8289054C50071C351 /* Surfaceable.swift */; };
|
||||||
EA3362042891E14D0071C351 /* VerizonNHGeTX-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = EA3362002891E14C0071C351 /* VerizonNHGeTX-Bold.otf */; };
|
EA3362042891E14D0071C351 /* VerizonNHGeTX-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = EA3362002891E14C0071C351 /* VerizonNHGeTX-Bold.otf */; };
|
||||||
EA3362052891E14D0071C351 /* VerizonNHGeDS-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = EA3362012891E14D0071C351 /* VerizonNHGeDS-Bold.otf */; };
|
EA3362052891E14D0071C351 /* VerizonNHGeDS-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = EA3362012891E14D0071C351 /* VerizonNHGeDS-Bold.otf */; };
|
||||||
@ -134,14 +132,12 @@
|
|||||||
EA33617B288B19210071C351 /* VDSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VDSTests.swift; sourceTree = "<group>"; };
|
EA33617B288B19210071C351 /* VDSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VDSTests.swift; sourceTree = "<group>"; };
|
||||||
EA3361A7288B23300071C351 /* UIColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = "<group>"; };
|
EA3361A7288B23300071C351 /* UIColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = "<group>"; };
|
||||||
EA3361A9288B25E40071C351 /* Disabling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Disabling.swift; sourceTree = "<group>"; };
|
EA3361A9288B25E40071C351 /* Disabling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Disabling.swift; sourceTree = "<group>"; };
|
||||||
EA3361AC288B26190071C351 /* DataTrackable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataTrackable.swift; sourceTree = "<group>"; };
|
|
||||||
EA3361AE288B26310071C351 /* FormFieldable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormFieldable.swift; sourceTree = "<group>"; };
|
EA3361AE288B26310071C351 /* FormFieldable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormFieldable.swift; sourceTree = "<group>"; };
|
||||||
EA3361B5288B2A410071C351 /* Control.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Control.swift; sourceTree = "<group>"; };
|
EA3361B5288B2A410071C351 /* Control.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Control.swift; sourceTree = "<group>"; };
|
||||||
EA3361B7288B2AAA0071C351 /* ViewProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewProtocol.swift; sourceTree = "<group>"; };
|
EA3361B7288B2AAA0071C351 /* ViewProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewProtocol.swift; sourceTree = "<group>"; };
|
||||||
EA3361BC288B2C760071C351 /* TypeAlias.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeAlias.swift; sourceTree = "<group>"; };
|
EA3361BC288B2C760071C351 /* TypeAlias.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeAlias.swift; sourceTree = "<group>"; };
|
||||||
EA3361BE288B2EA60071C351 /* Handlerable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Handlerable.swift; sourceTree = "<group>"; };
|
EA3361BE288B2EA60071C351 /* Handlerable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Handlerable.swift; sourceTree = "<group>"; };
|
||||||
EA3361C228902D960071C351 /* Toggle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toggle.swift; sourceTree = "<group>"; };
|
EA3361C228902D960071C351 /* Toggle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toggle.swift; sourceTree = "<group>"; };
|
||||||
EA3361C4289030FC0071C351 /* Accessable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Accessable.swift; sourceTree = "<group>"; };
|
|
||||||
EA3361C8289054C50071C351 /* Surfaceable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Surfaceable.swift; sourceTree = "<group>"; };
|
EA3361C8289054C50071C351 /* Surfaceable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Surfaceable.swift; sourceTree = "<group>"; };
|
||||||
EA3362002891E14C0071C351 /* VerizonNHGeTX-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "VerizonNHGeTX-Bold.otf"; sourceTree = "<group>"; };
|
EA3362002891E14C0071C351 /* VerizonNHGeTX-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "VerizonNHGeTX-Bold.otf"; sourceTree = "<group>"; };
|
||||||
EA3362012891E14D0071C351 /* VerizonNHGeDS-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "VerizonNHGeDS-Bold.otf"; sourceTree = "<group>"; };
|
EA3362012891E14D0071C351 /* VerizonNHGeDS-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "VerizonNHGeDS-Bold.otf"; sourceTree = "<group>"; };
|
||||||
@ -392,10 +388,8 @@
|
|||||||
EA3361AB288B25EC0071C351 /* Protocols */ = {
|
EA3361AB288B25EC0071C351 /* Protocols */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
EA3361C4289030FC0071C351 /* Accessable.swift */,
|
|
||||||
EA4DB2FC28D3D0CA00103EE3 /* AnyEquatable.swift */,
|
EA4DB2FC28D3D0CA00103EE3 /* AnyEquatable.swift */,
|
||||||
EAA5EEDF28F49DB3003B3210 /* Colorable.swift */,
|
EAA5EEDF28F49DB3003B3210 /* Colorable.swift */,
|
||||||
EA3361AC288B26190071C351 /* DataTrackable.swift */,
|
|
||||||
EA3361A9288B25E40071C351 /* Disabling.swift */,
|
EA3361A9288B25E40071C351 /* Disabling.swift */,
|
||||||
EA5E305929510F8B0082B959 /* EnumSubset.swift */,
|
EA5E305929510F8B0082B959 /* EnumSubset.swift */,
|
||||||
EAF7F0A1289AFB3900B287F5 /* Errorable.swift */,
|
EAF7F0A1289AFB3900B287F5 /* Errorable.swift */,
|
||||||
@ -773,7 +767,6 @@
|
|||||||
EA985BF7296C665E00F2FF2E /* IconName.swift in Sources */,
|
EA985BF7296C665E00F2FF2E /* IconName.swift in Sources */,
|
||||||
EAF7F0AF289B144C00B287F5 /* UnderlineLabelAttribute.swift in Sources */,
|
EAF7F0AF289B144C00B287F5 /* UnderlineLabelAttribute.swift in Sources */,
|
||||||
EAC925842911C63100091998 /* Colorable.swift in Sources */,
|
EAC925842911C63100091998 /* Colorable.swift in Sources */,
|
||||||
EA3361C5289030FC0071C351 /* Accessable.swift in Sources */,
|
|
||||||
EAB5FEF5292D371F00998C17 /* ButtonBase.swift in Sources */,
|
EAB5FEF5292D371F00998C17 /* ButtonBase.swift in Sources */,
|
||||||
EA978EC5291D6AFE00ACC883 /* AnyLabelAttribute.swift in Sources */,
|
EA978EC5291D6AFE00ACC883 /* AnyLabelAttribute.swift in Sources */,
|
||||||
EA33622C2891E73B0071C351 /* FontProtocol.swift in Sources */,
|
EA33622C2891E73B0071C351 /* FontProtocol.swift in Sources */,
|
||||||
@ -829,7 +822,6 @@
|
|||||||
EAF7F0B7289C12A600B287F5 /* UITapGestureRecognizer.swift in Sources */,
|
EAF7F0B7289C12A600B287F5 /* UITapGestureRecognizer.swift in Sources */,
|
||||||
EA985BF9296C710100F2FF2E /* IconColor.swift in Sources */,
|
EA985BF9296C710100F2FF2E /* IconColor.swift in Sources */,
|
||||||
EAB5FED429267EB300998C17 /* UIView.swift in Sources */,
|
EAB5FED429267EB300998C17 /* UIView.swift in Sources */,
|
||||||
EA3361AD288B26190071C351 /* DataTrackable.swift in Sources */,
|
|
||||||
EA33623E2892EE950071C351 /* UIDevice.swift in Sources */,
|
EA33623E2892EE950071C351 /* UIDevice.swift in Sources */,
|
||||||
EA985C692971B90B00F2FF2E /* IconSize.swift in Sources */,
|
EA985C692971B90B00F2FF2E /* IconSize.swift in Sources */,
|
||||||
EA985C672970C21600F2FF2E /* VDSLayout.swift in Sources */,
|
EA985C672970C21600F2FF2E /* VDSLayout.swift in Sources */,
|
||||||
|
|||||||
@ -17,6 +17,16 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable, UserInfoab
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public var subject = PassthroughSubject<Void, Never>()
|
public var subject = PassthroughSubject<Void, Never>()
|
||||||
public var subscribers = Set<AnyCancellable>()
|
public var subscribers = Set<AnyCancellable>()
|
||||||
|
open var onClickSubscriber: AnyCancellable? {
|
||||||
|
willSet {
|
||||||
|
if let onClickSubscriber {
|
||||||
|
onClickSubscriber.cancel()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
didSet {
|
||||||
|
enabledHighlight = onClickSubscriber != nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
@ -103,7 +113,13 @@ open class Control: UIControl, Handlerable, ViewProtocol, Resettable, UserInfoab
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open func updateView() {}
|
open func updateView() {
|
||||||
|
updateAccessibilityLabel()
|
||||||
|
}
|
||||||
|
|
||||||
|
open func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
open func reset() {
|
open func reset() {
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
|
|||||||
@ -75,7 +75,13 @@ open class View: UIView, Handlerable, ViewProtocol, Resettable, UserInfoable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open func updateView() {}
|
open func updateView() {
|
||||||
|
updateAccessibilityLabel()
|
||||||
|
}
|
||||||
|
|
||||||
|
open func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
open func reset() {
|
open func reset() {
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import Combine
|
|||||||
|
|
||||||
/// Badges are visual labels used to convey status or highlight supplemental information.
|
/// Badges are visual labels used to convey status or highlight supplemental information.
|
||||||
@objc(VDSBadge)
|
@objc(VDSBadge)
|
||||||
public class Badge: View, Accessable {
|
public class Badge: View {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Enums
|
// MARK: - Enums
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -40,18 +40,6 @@ public class Badge: View, Accessable {
|
|||||||
|
|
||||||
open var numberOfLines: Int = 1 { didSet { didChange() }}
|
open var numberOfLines: Int = 1 { didSet { didChange() }}
|
||||||
|
|
||||||
open var accessibilityHintEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityHintDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Constraints
|
// MARK: - Constraints
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -65,8 +53,7 @@ public class Badge: View, Accessable {
|
|||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
|
||||||
isAccessibilityElement = true
|
accessibilityElements = [label]
|
||||||
accessibilityTraits = .staticText
|
|
||||||
layer.cornerRadius = VDSFormControls.borderradius
|
layer.cornerRadius = VDSFormControls.borderradius
|
||||||
|
|
||||||
addSubview(label)
|
addSubview(label)
|
||||||
@ -89,14 +76,6 @@ public class Badge: View, Accessable {
|
|||||||
text = ""
|
text = ""
|
||||||
maxWidth = nil
|
maxWidth = nil
|
||||||
numberOfLines = 1
|
numberOfLines = 1
|
||||||
accessibilityHintEnabled = nil
|
|
||||||
accessibilityHintDisabled = nil
|
|
||||||
accessibilityValueEnabled = nil
|
|
||||||
accessibilityValueDisabled = nil
|
|
||||||
accessibilityLabelEnabled = nil
|
|
||||||
accessibilityLabelDisabled = nil
|
|
||||||
|
|
||||||
setAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -155,9 +134,6 @@ public class Badge: View, Accessable {
|
|||||||
} else {
|
} else {
|
||||||
maxWidthConstraint?.isActive = false
|
maxWidthConstraint?.isActive = false
|
||||||
}
|
}
|
||||||
|
|
||||||
setAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -143,6 +143,11 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
|
|||||||
|
|
||||||
open func updateView() {
|
open func updateView() {
|
||||||
updateLabel()
|
updateLabel()
|
||||||
|
updateAccessibilityLabel()
|
||||||
|
}
|
||||||
|
|
||||||
|
open func updateAccessibilityLabel() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -19,15 +19,15 @@ public class Checkbox: CheckboxBase{}
|
|||||||
public class SoloCheckbox: CheckboxBase{
|
public class SoloCheckbox: CheckboxBase{
|
||||||
public override func initialSetup() {
|
public override func initialSetup() {
|
||||||
super.initialSetup()
|
super.initialSetup()
|
||||||
publisher(for: .touchUpInside)
|
onClickSubscriber = publisher(for: .touchUpInside)
|
||||||
.sink { control in
|
.sink { control in
|
||||||
control.toggle()
|
control.toggle()
|
||||||
}.store(in: &subscribers)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc(VDSCheckboxBase)
|
@objc(VDSCheckboxBase)
|
||||||
open class CheckboxBase: Control, Accessable, DataTrackable, Errorable {
|
open class CheckboxBase: Control, Errorable {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -153,24 +153,6 @@ open class CheckboxBase: Control, Accessable, DataTrackable, Errorable {
|
|||||||
|
|
||||||
open var value: AnyHashable? { didSet { didChange() }}
|
open var value: AnyHashable? { didSet { didChange() }}
|
||||||
|
|
||||||
open var dataAnalyticsTrack: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var dataClickStream: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var dataTrack: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityHintEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityHintDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Constraints
|
// MARK: - Constraints
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -286,19 +268,9 @@ open class CheckboxBase: Control, Accessable, DataTrackable, Errorable {
|
|||||||
errorText = nil
|
errorText = nil
|
||||||
inputId = nil
|
inputId = nil
|
||||||
value = nil
|
value = nil
|
||||||
dataAnalyticsTrack = nil
|
|
||||||
dataClickStream = nil
|
|
||||||
dataTrack = nil
|
|
||||||
accessibilityHintEnabled = nil
|
|
||||||
accessibilityHintDisabled = nil
|
|
||||||
accessibilityValueEnabled = nil
|
|
||||||
accessibilityValueDisabled = nil
|
|
||||||
accessibilityLabelEnabled = nil
|
|
||||||
accessibilityLabelDisabled = nil
|
|
||||||
isSelected = false
|
isSelected = false
|
||||||
|
|
||||||
updateSelector()
|
updateSelector()
|
||||||
setAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This will checkbox the state of the Selector and execute the actionBlock if provided.
|
/// This will checkbox the state of the Selector and execute the actionBlock if provided.
|
||||||
@ -317,11 +289,12 @@ open class CheckboxBase: Control, Accessable, DataTrackable, Errorable {
|
|||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
updateLabels()
|
updateLabels()
|
||||||
updateSelector()
|
updateSelector()
|
||||||
setAccessibilityHint()
|
updateAccessibilityLabel()
|
||||||
setAccessibilityValue(isSelected)
|
|
||||||
setAccessibilityLabel(isSelected)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func updateAccessibilityLabel() {
|
||||||
|
setAccessibilityLabel(for: [label, childLabel, errorLabel])
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Configuration Properties
|
// MARK: - Configuration Properties
|
||||||
|
|||||||
@ -89,6 +89,10 @@ public class Icon: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private func getImage(for imageName: String) -> UIImage? {
|
private func getImage(for imageName: String) -> UIImage? {
|
||||||
|
|
||||||
return BundleManager.shared.image(for: imageName)
|
return BundleManager.shared.image(for: imageName)
|
||||||
|
|||||||
@ -137,11 +137,15 @@ public class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable
|
|||||||
|
|
||||||
//set the attributed text
|
//set the attributed text
|
||||||
attributedText = mutableText
|
attributedText = mutableText
|
||||||
accessibilityLabel = text
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func updateAccessibilityLabel() {
|
||||||
|
accessibilityLabel = text
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Private Attributes
|
// MARK: - Private Attributes
|
||||||
private func applyAttributes(_ mutableAttributedString: NSMutableAttributedString) {
|
private func applyAttributes(_ mutableAttributedString: NSMutableAttributedString) {
|
||||||
actions = []
|
actions = []
|
||||||
|
|||||||
@ -19,15 +19,15 @@ public class SoloRadioBox: RadioBoxBase{
|
|||||||
|
|
||||||
public override func initialSetup() {
|
public override func initialSetup() {
|
||||||
super.initialSetup()
|
super.initialSetup()
|
||||||
publisher(for: .touchUpInside)
|
onClickSubscriber = publisher(for: .touchUpInside)
|
||||||
.sink { control in
|
.sink { control in
|
||||||
control.toggle()
|
control.toggle()
|
||||||
}.store(in: &subscribers)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc(VDSRadioBoxBase)
|
@objc(VDSRadioBoxBase)
|
||||||
open class RadioBoxBase: Control, Accessable, DataTrackable{
|
open class RadioBoxBase: Control{
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -134,24 +134,6 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{
|
|||||||
|
|
||||||
open var value: AnyHashable? { didSet { didChange() }}
|
open var value: AnyHashable? { didSet { didChange() }}
|
||||||
|
|
||||||
open var dataAnalyticsTrack: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var dataClickStream: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var dataTrack: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityHintEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityHintDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
//functions
|
//functions
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
@ -242,20 +224,10 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{
|
|||||||
strikethrough = false
|
strikethrough = false
|
||||||
inputId = nil
|
inputId = nil
|
||||||
value = nil
|
value = nil
|
||||||
dataAnalyticsTrack = nil
|
|
||||||
dataClickStream = nil
|
|
||||||
dataTrack = nil
|
|
||||||
accessibilityHintEnabled = nil
|
|
||||||
accessibilityHintDisabled = nil
|
|
||||||
accessibilityValueEnabled = nil
|
|
||||||
accessibilityValueDisabled = nil
|
|
||||||
accessibilityLabelEnabled = nil
|
|
||||||
accessibilityLabelDisabled = nil
|
|
||||||
|
|
||||||
isSelected = false
|
isSelected = false
|
||||||
|
|
||||||
updateSelector()
|
updateSelector()
|
||||||
setAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This will radioBox the state of the Selector and execute the actionBlock if provided.
|
/// This will radioBox the state of the Selector and execute the actionBlock if provided.
|
||||||
@ -271,12 +243,13 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{
|
|||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
updateLabels()
|
updateLabels()
|
||||||
updateSelector()
|
updateSelector()
|
||||||
setAccessibilityHint()
|
updateAccessibilityLabel()
|
||||||
setAccessibilityValue(isSelected)
|
|
||||||
setAccessibilityLabel(isSelected)
|
|
||||||
setNeedsDisplay()
|
setNeedsDisplay()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func updateAccessibilityLabel() {
|
||||||
|
setAccessibilityLabel(for: [textLabel, subTextLabel, subTextRightLabel])
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Configuration Properties
|
// MARK: - Configuration Properties
|
||||||
|
|||||||
@ -26,15 +26,15 @@ public class RadioButton: RadioButtonBase {
|
|||||||
public class SoloRadioButton: RadioButtonBase {
|
public class SoloRadioButton: RadioButtonBase {
|
||||||
public override func initialSetup() {
|
public override func initialSetup() {
|
||||||
super.initialSetup()
|
super.initialSetup()
|
||||||
publisher(for: .touchUpInside)
|
onClickSubscriber = publisher(for: .touchUpInside)
|
||||||
.sink { control in
|
.sink { control in
|
||||||
control.toggle()
|
control.toggle()
|
||||||
}.store(in: &subscribers)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc(VDSRadioButtonBase)
|
@objc(VDSRadioButtonBase)
|
||||||
open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable {
|
open class RadioButtonBase: Control, Errorable {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -147,24 +147,6 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable {
|
|||||||
|
|
||||||
open var value: AnyHashable? { didSet { didChange() }}
|
open var value: AnyHashable? { didSet { didChange() }}
|
||||||
|
|
||||||
open var dataAnalyticsTrack: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var dataClickStream: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var dataTrack: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityHintEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityHintDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Constraints
|
// MARK: - Constraints
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -283,20 +265,10 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable {
|
|||||||
errorText = nil
|
errorText = nil
|
||||||
inputId = nil
|
inputId = nil
|
||||||
value = nil
|
value = nil
|
||||||
dataAnalyticsTrack = nil
|
|
||||||
dataClickStream = nil
|
|
||||||
dataTrack = nil
|
|
||||||
accessibilityHintEnabled = nil
|
|
||||||
accessibilityHintDisabled = nil
|
|
||||||
accessibilityValueEnabled = nil
|
|
||||||
accessibilityValueDisabled = nil
|
|
||||||
accessibilityLabelEnabled = nil
|
|
||||||
accessibilityLabelDisabled = nil
|
|
||||||
|
|
||||||
isSelected = false
|
isSelected = false
|
||||||
|
|
||||||
updateSelector()
|
updateSelector()
|
||||||
setAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This will checkbox the state of the Selector and execute the actionBlock if provided.
|
/// This will checkbox the state of the Selector and execute the actionBlock if provided.
|
||||||
@ -317,9 +289,11 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable {
|
|||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
updateLabels()
|
updateLabels()
|
||||||
updateSelector()
|
updateSelector()
|
||||||
setAccessibilityHint()
|
updateAccessibilityLabel()
|
||||||
setAccessibilityValue(isSelected)
|
}
|
||||||
setAccessibilityLabel(isSelected)
|
|
||||||
|
open override func updateAccessibilityLabel() {
|
||||||
|
setAccessibilityLabel(for: [label, childLabel])
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -23,15 +23,15 @@ public class RadioSwatch: RadioSwatchBase{
|
|||||||
public class SolorRadioSwatch: RadioSwatchBase{
|
public class SolorRadioSwatch: RadioSwatchBase{
|
||||||
public override func initialSetup() {
|
public override func initialSetup() {
|
||||||
super.initialSetup()
|
super.initialSetup()
|
||||||
publisher(for: .touchUpInside)
|
onClickSubscriber = publisher(for: .touchUpInside)
|
||||||
.sink { control in
|
.sink { control in
|
||||||
control.toggle()
|
control.toggle()
|
||||||
}.store(in: &subscribers)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc(VDSRadioSwatchBase)
|
@objc(VDSRadioSwatchBase)
|
||||||
open class RadioSwatchBase: Control, Accessable, DataTrackable {
|
open class RadioSwatchBase: Control {
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
@ -74,24 +74,6 @@ open class RadioSwatchBase: Control, Accessable, DataTrackable {
|
|||||||
|
|
||||||
open var value: AnyHashable? { didSet { didChange() }}
|
open var value: AnyHashable? { didSet { didChange() }}
|
||||||
|
|
||||||
open var dataAnalyticsTrack: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var dataClickStream: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var dataTrack: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityHintEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityHintDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
//functions
|
//functions
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
@ -130,18 +112,8 @@ open class RadioSwatchBase: Control, Accessable, DataTrackable {
|
|||||||
strikethrough = false
|
strikethrough = false
|
||||||
inputId = nil
|
inputId = nil
|
||||||
value = nil
|
value = nil
|
||||||
dataAnalyticsTrack = nil
|
|
||||||
dataClickStream = nil
|
|
||||||
dataTrack = nil
|
|
||||||
accessibilityHintEnabled = nil
|
|
||||||
accessibilityHintDisabled = nil
|
|
||||||
accessibilityValueEnabled = nil
|
|
||||||
accessibilityValueDisabled = nil
|
|
||||||
accessibilityLabelEnabled = nil
|
|
||||||
accessibilityLabelDisabled = nil
|
|
||||||
|
|
||||||
setNeedsDisplay()
|
setNeedsDisplay()
|
||||||
setAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open func toggle() {
|
open func toggle() {
|
||||||
@ -153,12 +125,13 @@ open class RadioSwatchBase: Control, Accessable, DataTrackable {
|
|||||||
// MARK: - State
|
// MARK: - State
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
setAccessibilityHint()
|
|
||||||
setAccessibilityValue(isSelected)
|
|
||||||
setAccessibilityLabel(isSelected)
|
|
||||||
layer.setNeedsDisplay()
|
layer.setNeedsDisplay()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override func updateAccessibilityLabel() {
|
||||||
|
accessibilityLabel = text
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Configuration Properties
|
// MARK: - Configuration Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import VDSFormControlsTokens
|
|||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
@objc(VDSEntryField)
|
@objc(VDSEntryField)
|
||||||
open class EntryField: Control, Accessable {
|
open class EntryField: Control {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Enums
|
// MARK: - Enums
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -160,18 +160,6 @@ open class EntryField: Control, Accessable {
|
|||||||
|
|
||||||
open var readOnly: Bool = false { didSet { didChange() }}
|
open var readOnly: Bool = false { didSet { didChange() }}
|
||||||
|
|
||||||
open var accessibilityHintEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityHintDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Constraints
|
// MARK: - Constraints
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -302,14 +290,6 @@ open class EntryField: Control, Accessable {
|
|||||||
defaultValue = nil
|
defaultValue = nil
|
||||||
required = false
|
required = false
|
||||||
readOnly = false
|
readOnly = false
|
||||||
accessibilityHintEnabled = nil
|
|
||||||
accessibilityHintDisabled = nil
|
|
||||||
accessibilityValueEnabled = nil
|
|
||||||
accessibilityValueDisabled = nil
|
|
||||||
accessibilityLabelEnabled = nil
|
|
||||||
accessibilityLabelDisabled = nil
|
|
||||||
|
|
||||||
setAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -326,7 +306,6 @@ open class EntryField: Control, Accessable {
|
|||||||
updateErrorLabel()
|
updateErrorLabel()
|
||||||
updateHelperLabel()
|
updateHelperLabel()
|
||||||
|
|
||||||
setAccessibilityHint()
|
|
||||||
backgroundColor = surface.color
|
backgroundColor = surface.color
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -197,6 +197,10 @@ public class InputField: EntryField, UITextFieldDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
open override func updateHelperLabel(){
|
open override func updateHelperLabel(){
|
||||||
//remove first
|
//remove first
|
||||||
helperLabel.removeFromSuperview()
|
helperLabel.removeFromSuperview()
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import Foundation
|
|||||||
import Foundation
|
import Foundation
|
||||||
import VDSColorTokens
|
import VDSColorTokens
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import Combine
|
||||||
|
|
||||||
@objc(VDSTilelet)
|
@objc(VDSTilelet)
|
||||||
open class Tilelet: TileContainer {
|
open class Tilelet: TileContainer {
|
||||||
@ -61,6 +62,13 @@ open class Tilelet: TileContainer {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
open override var onClickSubscriber: AnyCancellable? {
|
||||||
|
didSet {
|
||||||
|
isAccessibilityElement = onClickSubscriber != nil
|
||||||
|
//updateAccessibilityLabel()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
open var titleLockup = TitleLockup().with {
|
open var titleLockup = TitleLockup().with {
|
||||||
let configs = [
|
let configs = [
|
||||||
TextStyle.DeviceSpacingConfig([.titleSmall, .boldTitleSmall],
|
TextStyle.DeviceSpacingConfig([.titleSmall, .boldTitleSmall],
|
||||||
@ -213,8 +221,8 @@ open class Tilelet: TileContainer {
|
|||||||
color = .black
|
color = .black
|
||||||
addContentView(stackView)
|
addContentView(stackView)
|
||||||
|
|
||||||
isAccessibilityElement = true
|
accessibilityTraits = .link
|
||||||
accessibilityTraits = .staticText
|
accessibilityElements = [badge, titleLockup, descriptiveIcon, directionalIcon]
|
||||||
|
|
||||||
//badge
|
//badge
|
||||||
badgeContainerView.addSubview(badge)
|
badgeContainerView.addSubview(badge)
|
||||||
@ -333,9 +341,6 @@ open class Tilelet: TileContainer {
|
|||||||
} else {
|
} else {
|
||||||
removeFromSuperview(titleLockupContainerView)
|
removeFromSuperview(titleLockupContainerView)
|
||||||
}
|
}
|
||||||
|
|
||||||
accessibilityTraits = enabledHighlight ? .link : .staticText
|
|
||||||
accessibilityLabel = [titleModel?.text, subTitleModel?.text].compactMap({$0}).joined(separator: ", ")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func updateIcons() {
|
fileprivate func updateIcons() {
|
||||||
@ -387,6 +392,11 @@ open class Tilelet: TileContainer {
|
|||||||
updateIcons()
|
updateIcons()
|
||||||
|
|
||||||
layoutIfNeeded()
|
layoutIfNeeded()
|
||||||
|
updateAccessibilityLabel()
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func updateAccessibilityLabel() {
|
||||||
|
setAccessibilityLabel(for: [badge.label, titleLockup.eyebrowLabel, titleLockup.titleLabel, titleLockup.subTitleLabel])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -202,8 +202,7 @@ open class TitleLockup: View {
|
|||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
|
||||||
isAccessibilityElement = true
|
accessibilityElements = [eyebrowLabel, titleLabel, subTitleLabel]
|
||||||
accessibilityTraits = .staticText
|
|
||||||
addSubview(stackView)
|
addSubview(stackView)
|
||||||
|
|
||||||
stackView.spacing = 0.0
|
stackView.spacing = 0.0
|
||||||
@ -299,8 +298,6 @@ open class TitleLockup: View {
|
|||||||
eyebrowLabel.isHidden = eyebrowTextIsEmpty
|
eyebrowLabel.isHidden = eyebrowTextIsEmpty
|
||||||
titleLabel.isHidden = titleTextIsEmpty
|
titleLabel.isHidden = titleTextIsEmpty
|
||||||
subTitleLabel.isHidden = subTitleTextIsEmpty
|
subTitleLabel.isHidden = subTitleTextIsEmpty
|
||||||
|
|
||||||
accessibilityLabel = [eyebrowModel?.text, titleModel?.text, subTitleModel?.text].compactMap({$0}).joined(separator: ", ")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ public class Toggle: ToggleBase{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc(VDSToggleBase)
|
@objc(VDSToggleBase)
|
||||||
open class ToggleBase: Control, Accessable, DataTrackable {
|
open class ToggleBase: Control {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Enums
|
// MARK: - Enums
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -149,24 +149,6 @@ open class ToggleBase: Control, Accessable, DataTrackable {
|
|||||||
|
|
||||||
open var value: AnyHashable? { didSet { didChange() }}
|
open var value: AnyHashable? { didSet { didChange() }}
|
||||||
|
|
||||||
open var dataAnalyticsTrack: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var dataClickStream: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var dataTrack: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityHintEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityHintDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityValueDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelEnabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
open var accessibilityLabelDisabled: String? { didSet { didChange() }}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Constraints
|
// MARK: - Constraints
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -305,7 +287,6 @@ open class ToggleBase: Control, Accessable, DataTrackable {
|
|||||||
|
|
||||||
toggleView.backgroundColor = toggleColorConfiguration.getColor(self)
|
toggleView.backgroundColor = toggleColorConfiguration.getColor(self)
|
||||||
knobView.backgroundColor = knobColorConfiguration.getColor(self)
|
knobView.backgroundColor = knobColorConfiguration.getColor(self)
|
||||||
setAccessibilityLabel()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This will toggle the state of the Toggle and execute the actionBlock if provided.
|
/// This will toggle the state of the Toggle and execute the actionBlock if provided.
|
||||||
@ -320,8 +301,10 @@ open class ToggleBase: Control, Accessable, DataTrackable {
|
|||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
updateLabel()
|
updateLabel()
|
||||||
updateToggle()
|
updateToggle()
|
||||||
setAccessibilityHint()
|
updateAccessibilityLabel()
|
||||||
setAccessibilityValue(isOn)
|
}
|
||||||
setAccessibilityLabel(isOn)
|
|
||||||
|
open override func updateAccessibilityLabel() {
|
||||||
|
setAccessibilityLabel(for: [label])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,49 +0,0 @@
|
|||||||
//
|
|
||||||
// Accessable.swift
|
|
||||||
// VDS
|
|
||||||
//
|
|
||||||
// Created by Matt Bruce on 7/26/22.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
public protocol Accessable {
|
|
||||||
var accessibilityHintEnabled: String? { get set }
|
|
||||||
var accessibilityHintDisabled: String? { get set }
|
|
||||||
var accessibilityValueEnabled: String? { get set }
|
|
||||||
var accessibilityValueDisabled: String? { get set }
|
|
||||||
var accessibilityLabelEnabled: String? { get set }
|
|
||||||
var accessibilityLabelDisabled: String? { get set }
|
|
||||||
}
|
|
||||||
|
|
||||||
//Configurations to set within the UIControl
|
|
||||||
extension Handlerable where Self: UIView, Self: Accessable {
|
|
||||||
|
|
||||||
public func setAccessibilityHint(_ override: Bool? = nil) {
|
|
||||||
let check = override ?? !disabled
|
|
||||||
if let value = accessibilityHintEnabled, check {
|
|
||||||
accessibilityHint = value
|
|
||||||
} else if let value = accessibilityHintDisabled, !check {
|
|
||||||
accessibilityHint = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func setAccessibilityValue(_ override: Bool? = nil) {
|
|
||||||
let check = override ?? !disabled
|
|
||||||
if let value = accessibilityValueEnabled, check {
|
|
||||||
accessibilityValue = value
|
|
||||||
} else if let value = accessibilityValueDisabled, !check {
|
|
||||||
accessibilityValue = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func setAccessibilityLabel(_ override: Bool? = nil) {
|
|
||||||
let check = override ?? !disabled
|
|
||||||
if let value = accessibilityLabelEnabled, check {
|
|
||||||
accessibilityLabel = value
|
|
||||||
} else if let value = accessibilityLabelDisabled, !check {
|
|
||||||
accessibilityLabel = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
//
|
|
||||||
// DataTrackable.swift
|
|
||||||
// VDS
|
|
||||||
//
|
|
||||||
// Created by Matt Bruce on 7/22/22.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
public protocol DataTrackable {
|
|
||||||
var dataAnalyticsTrack: String? { get set }
|
|
||||||
var dataClickStream: String? { get set }
|
|
||||||
var dataTrack: String? { get set }
|
|
||||||
}
|
|
||||||
@ -25,7 +25,6 @@ extension Handlerable {
|
|||||||
|
|
||||||
public func handlerPublisher() -> AnyPublisher<Void, Never> {
|
public func handlerPublisher() -> AnyPublisher<Void, Never> {
|
||||||
subject
|
subject
|
||||||
.debounce(for: .seconds(Constants.StateDebounce), scheduler: RunLoop.main)
|
|
||||||
.eraseToAnyPublisher()
|
.eraseToAnyPublisher()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ public protocol ViewProtocol {
|
|||||||
|
|
||||||
// Can setup ui here. Should be called in the initialization functions.
|
// Can setup ui here. Should be called in the initialization functions.
|
||||||
func setup()
|
func setup()
|
||||||
|
func updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ViewProtocol where Self: UIView {
|
extension ViewProtocol where Self: UIView {
|
||||||
@ -21,4 +22,13 @@ extension ViewProtocol where Self: UIView {
|
|||||||
setNeedsDisplay()
|
setNeedsDisplay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func combineAccessibilityLabel(for views: [UIView]) -> String? {
|
||||||
|
let labels = views.map({($0.accessibilityLabel?.isEmpty ?? true) ? nil : $0.accessibilityLabel}).compactMap({$0})
|
||||||
|
return labels.joined(separator: ", ")
|
||||||
|
}
|
||||||
|
|
||||||
|
public func setAccessibilityLabel(for views: [UIView]) {
|
||||||
|
accessibilityLabel = combineAccessibilityLabel(for: views)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user