Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/vds_ios.git into feature/inputField

This commit is contained in:
Matt Bruce 2024-04-25 15:00:43 -05:00
commit cea37eeb77
18 changed files with 105 additions and 93 deletions

View File

@ -35,13 +35,7 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable {
//-------------------------------------------------- //--------------------------------------------------
open var subscribers = Set<AnyCancellable>() open var subscribers = Set<AnyCancellable>()
open var onClickSubscriber: AnyCancellable? { open var onClickSubscriber: AnyCancellable?
willSet {
if let onClickSubscriber {
onClickSubscriber.cancel()
}
}
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Private Properties // MARK: - Private Properties
@ -118,6 +112,8 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable {
backgroundColor = .clear backgroundColor = .clear
surface = .light surface = .light
isEnabled = true isEnabled = true
onClick = nil
userInfo.removeAll()
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -47,13 +47,7 @@ open class SelectorBase: Control, SelectorControlable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
open var onChangeSubscriber: AnyCancellable? { open var onChangeSubscriber: AnyCancellable?
willSet {
if let onChangeSubscriber {
onChangeSubscriber.cancel()
}
}
}
open var size = CGSize(width: 20, height: 20) { didSet { setNeedsUpdate() } } open var size = CGSize(width: 20, height: 20) { didSet { setNeedsUpdate() } }
@ -135,4 +129,8 @@ open class SelectorBase: Control, SelectorControlable {
/// This will change the state of the Selector and execute the actionBlock if provided. /// This will change the state of the Selector and execute the actionBlock if provided.
open func toggle() { } open func toggle() { }
open override func reset() {
super.reset()
onChange = nil
}
} }

View File

@ -75,13 +75,7 @@ open class SelectorGroupBase<SelectorItemType: Control>: Control, SelectorGroup,
} }
} }
open var onChangeSubscriber: AnyCancellable? { open var onChangeSubscriber: AnyCancellable?
willSet {
if let onChangeSubscriber {
onChangeSubscriber.cancel()
}
}
}
/// Whether the Control is enabled or not. /// Whether the Control is enabled or not.
override open var isEnabled: Bool { override open var isEnabled: Bool {
@ -130,6 +124,7 @@ open class SelectorGroupBase<SelectorItemType: Control>: Control, SelectorGroup,
/// Resets to default settings. /// Resets to default settings.
open override func reset() { open override func reset() {
super.reset() super.reset()
onChange = nil
items.forEach{ $0.reset() } items.forEach{ $0.reset() }
} }
} }

View File

@ -61,13 +61,7 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
open var onChangeSubscriber: AnyCancellable? { open var onChangeSubscriber: AnyCancellable?
willSet {
if let onChangeSubscriber {
onChangeSubscriber.cancel()
}
}
}
/// Label used to render labelText. /// Label used to render labelText.
open var label = Label().with { open var label = Label().with {
@ -223,6 +217,7 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
value = nil value = nil
isSelected = false isSelected = false
onChange = nil
shouldUpdateView = true shouldUpdateView = true
setNeedsUpdate() setNeedsUpdate()
} }

View File

@ -38,13 +38,7 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable {
/// Set of Subscribers for any Publishers for this Control. /// Set of Subscribers for any Publishers for this Control.
open var subscribers = Set<AnyCancellable>() open var subscribers = Set<AnyCancellable>()
open var onClickSubscriber: AnyCancellable? { open var onClickSubscriber: AnyCancellable?
willSet {
if let onClickSubscriber {
onClickSubscriber.cancel()
}
}
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Private Properties // MARK: - Private Properties
@ -140,6 +134,8 @@ open class ButtonBase: UIButton, ViewProtocol, UserInfoable, Clickable {
isEnabled = true isEnabled = true
text = nil text = nil
accessibilityCustomActions = [] accessibilityCustomActions = []
onClick = nil
userInfo.removeAll()
shouldUpdateView = true shouldUpdateView = true
setNeedsUpdate() setNeedsUpdate()
} }

View File

@ -240,8 +240,7 @@ open class CarouselScrollbar: View {
open override func setup() { open override func setup() {
super.setup() super.setup()
isAccessibilityElement = true isAccessibilityElement = false
accessibilityLabel = "Carousel Scrollbar"
addSubview(containerView) addSubview(containerView)
containerView containerView
@ -304,10 +303,6 @@ open class CarouselScrollbar: View {
thumbViewLayer.backgroundColor = thumbColorConfiguration.getColor(surface).cgColor thumbViewLayer.backgroundColor = thumbColorConfiguration.getColor(surface).cgColor
} }
open override func updateAccessibility() {
super.updateAccessibility()
}
open override func reset() { open override func reset() {
for subview in subviews { for subview in subviews {
for recognizer in subview.gestureRecognizers ?? [] { for recognizer in subview.gestureRecognizers ?? [] {

View File

@ -109,6 +109,7 @@ open class ButtonIcon: Control, Changeable, FormFieldable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
public var onChangeSubscriber: AnyCancellable?
///Badge Indicator object used to render for the ButtonIcon. ///Badge Indicator object used to render for the ButtonIcon.
open var badgeIndicator = BadgeIndicator().with { open var badgeIndicator = BadgeIndicator().with {
@ -172,8 +173,6 @@ open class ButtonIcon: Control, Changeable, FormFieldable {
/// Used to move the icon inside the button in both x and y axis. /// Used to move the icon inside the button in both x and y axis.
open var iconOffset: CGPoint = .init(x: 0, y: 0) { didSet { setNeedsUpdate() } } open var iconOffset: CGPoint = .init(x: 0, y: 0) { didSet { setNeedsUpdate() } }
open var onChangeSubscriber: AnyCancellable?
open var inputId: String? { didSet { setNeedsUpdate() } } open var inputId: String? { didSet { setNeedsUpdate() } }
open var value: AnyHashable? { didSet { setNeedsUpdate() } } open var value: AnyHashable? { didSet { setNeedsUpdate() } }
@ -365,7 +364,6 @@ open class ButtonIcon: Control, Changeable, FormFieldable {
open override func setup() { open override func setup() {
super.setup() super.setup()
isAccessibilityElement = false isAccessibilityElement = false
accessibilityElements = [icon, badgeIndicator]
//create a layoutGuide for the icon to key off of //create a layoutGuide for the icon to key off of
let iconLayoutGuide = UILayoutGuide() let iconLayoutGuide = UILayoutGuide()
@ -436,6 +434,7 @@ open class ButtonIcon: Control, Changeable, FormFieldable {
showBadgeIndicator = false showBadgeIndicator = false
selectable = false selectable = false
badgeIndicatorModel = nil badgeIndicatorModel = nil
onChange = nil
shouldUpdateView = true shouldUpdateView = true
setNeedsUpdate() setNeedsUpdate()
} }
@ -459,6 +458,18 @@ open class ButtonIcon: Control, Changeable, FormFieldable {
setNeedsLayout() setNeedsLayout()
} }
open override func updateAccessibility() {
super.updateAccessibility()
var elements = [Any]()
if iconName != nil {
elements.append(icon)
}
if badgeIndicatorModel != nil && showBadgeIndicator {
elements.append(badgeIndicator)
}
accessibilityElements = elements.count > 0 ? elements : nil
}
open override func layoutSubviews() { open override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()

View File

@ -31,12 +31,13 @@ public struct ColorLabelAttribute: LabelAttributeModel {
} }
public func setAttribute(on attributedString: NSMutableAttributedString) { public func setAttribute(on attributedString: NSMutableAttributedString) {
guard isValidRange(on: attributedString) else { return }
var colorRange = range var colorRange = range
if length == 0 && location == 0 { if length == 0 && location == 0 {
colorRange = .init(location: location, length: attributedString.length) colorRange = .init(location: location, length: attributedString.length)
} }
if !attributedString.isValid(range: colorRange) { return }
let attributeKey = isForegroundColor ? NSAttributedString.Key.foregroundColor : NSAttributedString.Key.backgroundColor let attributeKey = isForegroundColor ? NSAttributedString.Key.foregroundColor : NSAttributedString.Key.backgroundColor
attributedString.removeAttribute(attributeKey, range: colorRange) attributedString.removeAttribute(attributeKey, range: colorRange)
attributedString.addAttribute(attributeKey, value: color, range: colorRange) attributedString.addAttribute(attributeKey, value: color, range: colorRange)

View File

@ -52,13 +52,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
open var onChangeSubscriber: AnyCancellable? { open var onChangeSubscriber: AnyCancellable?
willSet {
if let onChangeSubscriber {
onChangeSubscriber.cancel()
}
}
}
/// Label used to render the text. /// Label used to render the text.
open var textLabel = Label().with { open var textLabel = Label().with {
@ -218,6 +212,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
value = nil value = nil
isSelected = false isSelected = false
onChange = nil
shouldUpdateView = true shouldUpdateView = true
setNeedsUpdate() setNeedsUpdate()

View File

@ -125,13 +125,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
open var onChangeSubscriber: AnyCancellable? { open var onChangeSubscriber: AnyCancellable?
willSet {
if let onChangeSubscriber {
onChangeSubscriber.cancel()
}
}
}
open var titleLabel = Label().with { open var titleLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
@ -302,6 +296,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
defaultValue = nil defaultValue = nil
required = false required = false
readOnly = false readOnly = false
onChange = nil
} }
/// Used to make changes to the View based off a change events or from local properties. /// Used to make changes to the View based off a change events or from local properties.

View File

@ -8,6 +8,7 @@
import Foundation import Foundation
import VDSTokens import VDSTokens
import UIKit import UIKit
import Combine
@objc(VDSTileContainer) @objc(VDSTileContainer)
open class TileContainer: TileContainerBase<TileContainer.Padding> { open class TileContainer: TileContainerBase<TileContainer.Padding> {
@ -43,7 +44,6 @@ open class TileContainer: TileContainerBase<TileContainer.Padding> {
} }
open class TileContainerBase<PaddingType: DefaultValuing>: Control where PaddingType.ValueType == CGFloat { open class TileContainerBase<PaddingType: DefaultValuing>: Control where PaddingType.ValueType == CGFloat {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializers // MARK: - Initializers
//-------------------------------------------------- //--------------------------------------------------
@ -111,6 +111,19 @@ open class TileContainerBase<PaddingType: DefaultValuing>: Control where Padding
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
public override var onClickSubscriber: AnyCancellable? {
didSet {
if onClickSubscriber != nil {
isAccessibilityElement = true
accessibilityTraits = .link
accessibilityHint = "Double tap to open."
} else {
isAccessibilityElement = false
accessibilityTraits.remove(.link)
}
}
}
/// This takes an image source url and applies it as a background image. /// This takes an image source url and applies it as a background image.
open var backgroundImage: UIImage? { didSet { setNeedsUpdate() } } open var backgroundImage: UIImage? { didSet { setNeedsUpdate() } }
@ -171,7 +184,7 @@ open class TileContainerBase<PaddingType: DefaultValuing>: Control where Padding
open var showBorder: Bool = false { didSet { setNeedsUpdate() } } open var showBorder: Bool = false { didSet { setNeedsUpdate() } }
/// Determines if there is a drop shadow or not. /// Determines if there is a drop shadow or not.
open var showDropShadows: Bool = false { didSet { setNeedsUpdate() } } open var showDropShadow: Bool = false { didSet { setNeedsUpdate() } }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Constraints // MARK: - Constraints
@ -274,7 +287,7 @@ open class TileContainerBase<PaddingType: DefaultValuing>: Control where Padding
width = nil width = nil
height = nil height = nil
showBorder = false showBorder = false
showDropShadows = false showDropShadow = false
shouldUpdateView = true shouldUpdateView = true
setNeedsUpdate() setNeedsUpdate()
} }
@ -316,7 +329,7 @@ open class TileContainerBase<PaddingType: DefaultValuing>: Control where Padding
widthConstraint?.isActive = false widthConstraint?.isActive = false
heightConstraint?.isActive = false heightConstraint?.isActive = false
} }
if showDropShadows, surface == .light { if showDropShadow, surface == .light {
addDropShadow(dropShadowConfiguration) addDropShadow(dropShadowConfiguration)
} else { } else {
removeDropShadows() removeDropShadows()
@ -337,6 +350,7 @@ open class TileContainerBase<PaddingType: DefaultValuing>: Control where Padding
/// This will place a view within the contentView of this component. /// This will place a view within the contentView of this component.
public func addContentView(_ view: UIView, shouldPin: Bool = true) { public func addContentView(_ view: UIView, shouldPin: Bool = true) {
view.removeFromSuperview()
containerView.addSubview(view) containerView.addSubview(view)
if shouldPin { if shouldPin {
view.pinToSuperView() view.pinToSuperView()

View File

@ -105,12 +105,6 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
public override var onClickSubscriber: AnyCancellable? {
didSet {
isAccessibilityElement = onClickSubscriber != nil
}
}
/// Title lockup positioned in the contentView. /// Title lockup positioned in the contentView.
open var titleLockup = TitleLockup().with { open var titleLockup = TitleLockup().with {
$0.standardStyleConfiguration = .init(styleConfigurations: [ $0.standardStyleConfiguration = .init(styleConfigurations: [
@ -305,9 +299,6 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
color = .black color = .black
addContentView(stackView) addContentView(stackView)
accessibilityTraits = .link
accessibilityElements = [badge, titleLockup, descriptiveIcon, directionalIcon]
//badge //badge
badgeContainerView.addSubview(badge) badgeContainerView.addSubview(badge)
badge badge
@ -418,6 +409,20 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
/// Used to update any Accessibility properties. /// Used to update any Accessibility properties.
open override func updateAccessibility() { open override func updateAccessibility() {
super.updateAccessibility() super.updateAccessibility()
var elements = [Any]()
if badgeModel != nil {
elements.append(badge)
}
if titleModel != nil || subTitleModel != nil || eyebrowModel != nil {
elements.append(titleLockup)
}
if descriptiveIconModel != nil {
elements.append(descriptiveIcon)
}
if directionalIconModel != nil {
elements.append(directionalIcon)
}
accessibilityElements = elements.count > 0 ? elements : nil
setAccessibilityLabel(for: [badge.label, titleLockup.eyebrowLabel, titleLockup.titleLabel, titleLockup.subTitleLabel]) setAccessibilityLabel(for: [badge.label, titleLockup.eyebrowLabel, titleLockup.titleLabel, titleLockup.subTitleLabel])
} }

View File

@ -272,7 +272,21 @@ open class TitleLockup: View {
titleLabel.textColorConfiguration = textColorPrimaryConfiguration titleLabel.textColorConfiguration = textColorPrimaryConfiguration
accessibilityElements = [eyebrowLabel, titleLabel, subTitleLabel] }
open override func updateAccessibility() {
super.updateAccessibility()
var elements = [Any]()
if eyebrowModel != nil {
elements.append(eyebrowLabel)
}
if titleModel != nil {
elements.append(titleLabel)
}
if subTitleModel != nil {
elements.append(subTitleLabel)
}
accessibilityElements = elements.count > 0 ? elements : nil
} }
/// Resets to default settings. /// Resets to default settings.

View File

@ -88,13 +88,7 @@ open class Toggle: Control, Changeable, FormFieldable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
open var onChangeSubscriber: AnyCancellable? { open var onChangeSubscriber: AnyCancellable?
willSet {
if let onChangeSubscriber {
onChangeSubscriber.cancel()
}
}
}
/// Actual toggle used in this component. /// Actual toggle used in this component.
open var toggleView = ToggleView().with { open var toggleView = ToggleView().with {
@ -231,6 +225,7 @@ open class Toggle: Control, Changeable, FormFieldable {
textPosition = .left textPosition = .left
inputId = nil inputId = nil
value = nil value = nil
onChange = nil
shouldUpdateView = true shouldUpdateView = true
setNeedsUpdate() setNeedsUpdate()
} }

View File

@ -166,6 +166,7 @@ open class ToggleView: Control, Changeable, FormFieldable {
value = nil value = nil
toggleView.backgroundColor = toggleColorConfiguration.getColor(self) toggleView.backgroundColor = toggleColorConfiguration.getColor(self)
knobView.backgroundColor = knobColorConfiguration.getColor(self) knobView.backgroundColor = knobColorConfiguration.getColor(self)
onChange = nil
shouldUpdateView = true shouldUpdateView = true
setNeedsUpdate() setNeedsUpdate()
} }

View File

@ -26,6 +26,8 @@ extension Changeable {
.sink { c in .sink { c in
newValue(c) newValue(c)
} }
} else {
onChangeSubscriber = nil
} }
} }
} }

View File

@ -20,6 +20,7 @@ extension Clickable {
public var onClick: ((Self) -> ())? { public var onClick: ((Self) -> ())? {
get { return nil } get { return nil }
set { set {
onClickSubscriber?.cancel()
if let newValue { if let newValue {
onClickSubscriber = publisher(for: .touchUpInside) onClickSubscriber = publisher(for: .touchUpInside)
.sink { [weak self] c in .sink { [weak self] c in
@ -27,7 +28,6 @@ extension Clickable {
newValue(c) newValue(c)
} }
} else { } else {
onClickSubscriber?.cancel()
onClickSubscriber = nil onClickSubscriber = nil
} }
} }

View File

@ -1,6 +1,8 @@
1.0.60 1.0.60
---------------- ----------------
CXTDT-544442- Button Icon - Selected state needs to allow custom color - CXTDT-544442 - Button Icon - Selected state needs to allow custom color
- CXTDT-546821 - TextArea - Accessibility - input field is not receiving swipe focus
- CXTDT-547200 - Carousel scrollbar Accessibility - The scrollbar is receiving right/ left swipe focus
1.0.59 1.0.59
---------------- ----------------
@ -9,6 +11,8 @@ CXTDT-544442- Button Icon - Selected state needs to allow custom color
- CXTDT-544383 - TileContainer - Removed spacing2x and replaced with spacing3x - CXTDT-544383 - TileContainer - Removed spacing2x and replaced with spacing3x
- CXTDT-544384 - TileContainer - BackgroundImage strecthing screen - CXTDT-544384 - TileContainer - BackgroundImage strecthing screen
- CXTDT-546824 - Notification - Accessibility - Improper label for close notification button & icon - CXTDT-546824 - Notification - Accessibility - Improper label for close notification button & icon
- CXTDT-544460 - Button Icon - Incorrect Icon Sizes
- CXTDT-544441 - Button Icon - Small version showing incorrect size
1.0.58 1.0.58
---------------- ----------------