Merge branch 'mbruce/bugfixes' into 'develop'
fixed bug for borderline in horizontal - top configuration See merge request BPHV_MIPS/vds_ios!78
This commit is contained in:
commit
2c83f0973a
@ -1090,7 +1090,7 @@
|
||||
buildSettings = {
|
||||
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 21;
|
||||
CURRENT_PROJECT_VERSION = 22;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
@ -1123,7 +1123,7 @@
|
||||
buildSettings = {
|
||||
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 21;
|
||||
CURRENT_PROJECT_VERSION = 22;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
|
||||
@ -98,24 +98,24 @@ open class Badge: View {
|
||||
return config.eraseToAnyColorable()
|
||||
}()
|
||||
|
||||
private var textColorConfig = ViewColorConfiguration()
|
||||
private var textColorConfiguration = ViewColorConfiguration()
|
||||
|
||||
public func updateTextColorConfig() {
|
||||
textColorConfig.reset()
|
||||
textColorConfiguration.reset()
|
||||
|
||||
switch fillColor {
|
||||
|
||||
case .red, .black:
|
||||
textColorConfig.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOndark, forDisabled: false)
|
||||
textColorConfig.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOndark, forDisabled: true)
|
||||
textColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOndark, forDisabled: false)
|
||||
textColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOndark, forDisabled: true)
|
||||
|
||||
case .yellow, .white:
|
||||
textColorConfig.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOnlight, forDisabled: false)
|
||||
textColorConfig.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOnlight, forDisabled: true)
|
||||
textColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOnlight, forDisabled: false)
|
||||
textColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOnlight, forDisabled: true)
|
||||
|
||||
case .orange, .green, .blue:
|
||||
textColorConfig.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOnlight, forDisabled: false)
|
||||
textColorConfig.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOnlight, forDisabled: true)
|
||||
textColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOnlight, forDisabled: false)
|
||||
textColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOnlight, forDisabled: true)
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ open class Badge: View {
|
||||
|
||||
backgroundColor = backgroundColorConfiguration.getColor(self)
|
||||
|
||||
label.textColorConfiguration = textColorConfig.eraseToAnyColorable()
|
||||
label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
|
||||
label.numberOfLines = numberOfLines
|
||||
label.text = text
|
||||
label.surface = surface
|
||||
|
||||
@ -75,14 +75,15 @@ open class TextLink: ButtonBase {
|
||||
super.setup()
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = .link
|
||||
|
||||
if let titleLabel {
|
||||
addSubview(line)
|
||||
line.pinLeading(titleLabel.leadingAnchor)
|
||||
line.pinTrailing(titleLabel.trailingAnchor)
|
||||
line.pinTop(titleLabel.bottomAnchor, 1)
|
||||
line.pinTop(titleLabel.bottomAnchor)
|
||||
line.pinBottom(bottomAnchor)
|
||||
lineHeightConstraint = line.heightAnchor.constraint(equalToConstant: 1.0)
|
||||
lineHeightConstraint?.isActive = true
|
||||
titleLabel.debugBorder(show: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -37,10 +37,7 @@ open class Line: View {
|
||||
|
||||
addSubview(lineView)
|
||||
lineView.height(1)
|
||||
|
||||
lineView
|
||||
.pinLeading()
|
||||
.pinTrailing()
|
||||
lineView.pinToSuperView()
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
|
||||
@ -181,7 +181,7 @@ open class Notification: View {
|
||||
return config.eraseToAnyColorable()
|
||||
}()
|
||||
|
||||
private var textColorConfig = ViewColorConfiguration().with {
|
||||
private var textColorConfiguration = ViewColorConfiguration().with {
|
||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
|
||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: true)
|
||||
}
|
||||
@ -224,8 +224,8 @@ open class Notification: View {
|
||||
mainStackView.addArrangedSubview(closeButton)
|
||||
|
||||
//labels
|
||||
titleLabel.textColorConfiguration = textColorConfig.eraseToAnyColorable()
|
||||
subTitleLabel.textColorConfiguration = textColorConfig.eraseToAnyColorable()
|
||||
titleLabel.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
|
||||
subTitleLabel.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
|
||||
@ -66,6 +66,32 @@ extension Tabs {
|
||||
private var indicatorColorConfiguration = SurfaceColorConfiguration(VDSColor.paletteRed, VDSColor.elementsPrimaryOndark)
|
||||
private var indicatorWidth: CGFloat = 4.0
|
||||
|
||||
private var indicatorSide: UIRectEdge {
|
||||
guard orientation == .horizontal else { return .left }
|
||||
return indicatorPosition.value
|
||||
}
|
||||
|
||||
private var leadingSpace: CGFloat {
|
||||
guard orientation == .vertical else { return 0 }
|
||||
return size == .medium ? VDSLayout.Spacing.space4X.value : VDSLayout.Spacing.space6X.value
|
||||
}
|
||||
|
||||
private var otherSpace: CGFloat {
|
||||
if orientation == .horizontal {
|
||||
return size == .medium ? VDSLayout.Spacing.space3X.value : VDSLayout.Spacing.space4X.value
|
||||
} else {
|
||||
return VDSLayout.Spacing.space2X.value
|
||||
}
|
||||
}
|
||||
|
||||
private var widthConstraint: NSLayoutConstraint {
|
||||
if let width, orientation == .vertical {
|
||||
return label.widthAnchor.constraint(equalToConstant: width)
|
||||
} else {
|
||||
return label.widthAnchor.constraint(greaterThanOrEqualToConstant: minWidth)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//--------------------------------------------------
|
||||
@ -87,11 +113,8 @@ extension Tabs {
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
addSubview(label)
|
||||
backgroundColor = .clear
|
||||
accessibilityTraits = .button
|
||||
|
||||
label.backgroundColor = .clear
|
||||
|
||||
|
||||
label.translatesAutoresizingMaskIntoConstraints = false
|
||||
label.pinTrailing()
|
||||
|
||||
@ -125,32 +148,17 @@ extension Tabs {
|
||||
}
|
||||
|
||||
open override func updateView() {
|
||||
//label properties
|
||||
label.text = text
|
||||
label.textPosition = textPosition
|
||||
label.textStyle = size.textStyle
|
||||
label.textColor = textColorConfiguration.getColor(self)
|
||||
labelWidthConstraint?.isActive = false
|
||||
if let width, orientation == .vertical {
|
||||
labelWidthConstraint = label.widthAnchor.constraint(equalToConstant: width)
|
||||
} else {
|
||||
labelWidthConstraint = label.widthAnchor.constraint(greaterThanOrEqualToConstant: minWidth)
|
||||
}
|
||||
labelWidthConstraint?.isActive = true
|
||||
|
||||
var leadingSpace: CGFloat
|
||||
if orientation == .horizontal {
|
||||
leadingSpace = 0
|
||||
} else {
|
||||
leadingSpace = size == .medium ? VDSLayout.Spacing.space4X.value : VDSLayout.Spacing.space6X.value
|
||||
}
|
||||
labelLeadingConstraint?.constant = leadingSpace
|
||||
|
||||
var otherSpace: CGFloat
|
||||
if orientation == .horizontal {
|
||||
otherSpace = size == .medium ? VDSLayout.Spacing.space3X.value : VDSLayout.Spacing.space4X.value
|
||||
} else {
|
||||
otherSpace = VDSLayout.Spacing.space2X.value
|
||||
}
|
||||
//constaints
|
||||
labelWidthConstraint?.isActive = false
|
||||
labelWidthConstraint = widthConstraint
|
||||
labelWidthConstraint?.isActive = true
|
||||
labelLeadingConstraint?.constant = leadingSpace
|
||||
labelTopConstraint?.constant = otherSpace
|
||||
labelBottomConstraint?.constant = -otherSpace
|
||||
|
||||
@ -163,12 +171,10 @@ extension Tabs {
|
||||
removeBorders()
|
||||
|
||||
if selected {
|
||||
var indicator: UIRectEdge = .left
|
||||
if orientation == .horizontal {
|
||||
indicator = indicatorPosition.value
|
||||
}
|
||||
addBorder(side: indicator, width: indicatorWidth, color: indicatorColorConfiguration.getColor(self), offset: 1)
|
||||
addBorder(side: indicatorSide, width: indicatorWidth, color: indicatorColorConfiguration.getColor(self))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -9,17 +9,21 @@ import Foundation
|
||||
import UIKit
|
||||
import VDSColorTokens
|
||||
|
||||
/// Tabs are organizational components that group content and allow customers to navigate its display. Use them to separate content when the content is related but doesn’t need to be compared.
|
||||
@objc(VDSTabs)
|
||||
open class Tabs: View {
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Enums
|
||||
//--------------------------------------------------
|
||||
|
||||
/// Layout Axis of the Tabs
|
||||
public enum Orientation: String, CaseIterable{
|
||||
case vertical
|
||||
case horizontal
|
||||
}
|
||||
|
||||
|
||||
/// Position for the Hover Border Accent for a Tab.
|
||||
public enum IndicatorPosition: String, CaseIterable {
|
||||
case top
|
||||
case bottom
|
||||
@ -33,11 +37,13 @@ open class Tabs: View {
|
||||
}
|
||||
}
|
||||
|
||||
//Type of behavior for Scrolling
|
||||
public enum Overflow: String, CaseIterable {
|
||||
case scroll
|
||||
case none
|
||||
}
|
||||
|
||||
|
||||
/// Available size for tabs
|
||||
public enum Size: String, CaseIterable {
|
||||
case medium
|
||||
case large
|
||||
@ -94,18 +100,60 @@ open class Tabs: View {
|
||||
///Model of the Tabs you are wanting to show.
|
||||
open var tabModels: [TabModel] = [] { didSet { updateTabItems() } }
|
||||
|
||||
open var tabSpacing: CGFloat { tabStackView.spacing }
|
||||
|
||||
open var tabViews: [Tab] = []
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Private Properties
|
||||
//--------------------------------------------------
|
||||
private var tabStackView: UIStackView!
|
||||
private var scrollView: UIScrollView!
|
||||
private var contentView: View!
|
||||
private var borderlineColorConfig = SurfaceColorConfiguration(VDSColor.elementsLowcontrastOnlight, VDSColor.elementsLowcontrastOndark)
|
||||
private var tabStackView = UIStackView()
|
||||
private var scrollView = UIScrollView()
|
||||
private var contentView = View()
|
||||
private var borderlineView = View()
|
||||
private let borderlineSize = 1.0
|
||||
private var borderlineColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsLowcontrastOnlight, VDSColor.elementsLowcontrastOndark)
|
||||
private var borderlineViewLeadingConstraint: NSLayoutConstraint?
|
||||
private var borderlineViewTrailingConstraint: NSLayoutConstraint?
|
||||
private var borderlineViewTopConstraint: NSLayoutConstraint?
|
||||
private var borderlineViewBottomConstraint: NSLayoutConstraint?
|
||||
private var borderlineViewHeightConstraint: NSLayoutConstraint?
|
||||
private var borderlineViewWidthConstraint: NSLayoutConstraint?
|
||||
private var contentViewWidthConstraint: NSLayoutConstraint?
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Configuration Properties
|
||||
//--------------------------------------------------
|
||||
private var stackViewAxis: NSLayoutConstraint.Axis {
|
||||
orientation == .horizontal ? .horizontal : .vertical
|
||||
}
|
||||
|
||||
private var stackViewAlignment: UIStackView.Alignment {
|
||||
orientation == .horizontal ? .fill : .leading
|
||||
}
|
||||
|
||||
private var stackViewDistribution: UIStackView.Distribution{
|
||||
if orientation == .horizontal && fillContainer {
|
||||
return .fillEqually
|
||||
} else {
|
||||
return orientation == .horizontal ? .fillProportionally : .fill
|
||||
}
|
||||
}
|
||||
|
||||
private var stackViewSpacing: CGFloat {
|
||||
switch orientation {
|
||||
case .vertical:
|
||||
return size == .medium ? VDSLayout.Spacing.space4X.value : VDSLayout.Spacing.space6X.value
|
||||
case .horizontal:
|
||||
return size == .medium ? VDSLayout.Spacing.space6X.value : VDSLayout.Spacing.space8X.value
|
||||
}
|
||||
}
|
||||
|
||||
private var scrollIsEnabled: Bool {
|
||||
orientation == .horizontal && overflow == .scroll
|
||||
}
|
||||
|
||||
private var textPosition: TextPosition {
|
||||
orientation == .horizontal && fillContainer ? .center : .left
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
@ -141,12 +189,22 @@ open class Tabs: View {
|
||||
tabStackView.axis = .horizontal
|
||||
tabStackView.distribution = .fill
|
||||
tabStackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(borderlineView)
|
||||
contentView.addSubview(tabStackView)
|
||||
|
||||
|
||||
scrollView.pinToSuperView()
|
||||
contentView.pinToSuperView()
|
||||
tabStackView.pinToSuperView()
|
||||
contentView.heightAnchor.constraint(equalTo: scrollView.heightAnchor).isActive = true
|
||||
|
||||
borderlineViewWidthConstraint = borderlineView.widthAnchor.constraint(equalToConstant: 0)
|
||||
borderlineViewHeightConstraint = borderlineView.heightAnchor.constraint(equalToConstant: 0)
|
||||
|
||||
borderlineViewLeadingConstraint = borderlineView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor)
|
||||
borderlineViewTrailingConstraint = borderlineView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor)
|
||||
borderlineViewTopConstraint = borderlineView.topAnchor.constraint(equalTo: contentView.topAnchor)
|
||||
borderlineViewBottomConstraint = borderlineView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
|
||||
|
||||
}
|
||||
|
||||
private func updateTabItems() {
|
||||
@ -193,15 +251,10 @@ open class Tabs: View {
|
||||
super.updateView()
|
||||
|
||||
// Update the stackview properties
|
||||
if orientation == .horizontal && fillContainer {
|
||||
tabStackView.distribution = .fillEqually
|
||||
} else {
|
||||
tabStackView.distribution = orientation == .horizontal ? .fillProportionally : .fill
|
||||
}
|
||||
|
||||
tabStackView.axis = orientation == .horizontal ? .horizontal : .vertical
|
||||
tabStackView.alignment = orientation == .horizontal ? .fill : .leading
|
||||
tabStackView.spacing = orientation == .horizontal ? VDSLayout.Spacing.space6X.value : VDSLayout.Spacing.space4X.value
|
||||
tabStackView.distribution = stackViewDistribution
|
||||
tabStackView.axis = stackViewAxis
|
||||
tabStackView.alignment = stackViewAlignment
|
||||
tabStackView.spacing = stackViewSpacing
|
||||
|
||||
// Update tab appearance based on properties
|
||||
for (index, tabItem) in tabViews.enumerated() {
|
||||
@ -209,68 +262,86 @@ open class Tabs: View {
|
||||
tabItem.index = index
|
||||
tabItem.minWidth = minWidth
|
||||
tabItem.size = size
|
||||
tabItem.textPosition = orientation == .horizontal && fillContainer ? .center : .left
|
||||
tabItem.textPosition = textPosition
|
||||
tabItem.orientation = orientation
|
||||
tabItem.surface = surface
|
||||
tabItem.indicatorPosition = indicatorPosition
|
||||
tabItem.accessibilityLabel = "\(tabItem.text) \(tabItem.selected ? "selected" : "unselected") \(index+1) of \(tabViews.count)"
|
||||
}
|
||||
|
||||
// Deactivate old constraint
|
||||
contentViewWidthConstraint?.isActive = false
|
||||
|
||||
// Apply width
|
||||
if orientation == .vertical {
|
||||
scrollView.isScrollEnabled = false
|
||||
contentViewWidthConstraint = contentView.widthAnchor.constraint(equalTo: widthAnchor)
|
||||
} else {
|
||||
// Apply overflow
|
||||
if overflow == .scroll && !fillContainer {
|
||||
let contentWidth = tabStackView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).width
|
||||
contentViewWidthConstraint = contentView.widthAnchor.constraint(equalToConstant: contentWidth)
|
||||
//update the width based on rules
|
||||
updateContentView()
|
||||
|
||||
// Enable scrolling if necessary
|
||||
scrollView.contentSize = CGSize(width: contentWidth, height: scrollView.bounds.height)
|
||||
} else {
|
||||
contentViewWidthConstraint = contentView.widthAnchor.constraint(equalTo: widthAnchor)
|
||||
}
|
||||
}
|
||||
scrollView.isScrollEnabled = orientation == .horizontal && overflow == .scroll
|
||||
|
||||
// Activate old constraint
|
||||
contentViewWidthConstraint?.isActive = true
|
||||
|
||||
setNeedsLayout()
|
||||
layoutIfNeeded()
|
||||
}
|
||||
|
||||
open override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
//scrollView Contentsize
|
||||
private func updateContentView() {
|
||||
// Deactivate old constraint
|
||||
contentViewWidthConstraint?.isActive = false
|
||||
|
||||
// Apply overflow
|
||||
if orientation == .horizontal && overflow == .scroll && !fillContainer {
|
||||
let contentWidth = tabStackView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).width
|
||||
contentViewWidthConstraint = contentView.widthAnchor.constraint(equalToConstant: contentWidth)
|
||||
scrollView.contentSize = CGSize(width: contentWidth, height: scrollView.bounds.height)
|
||||
} else {
|
||||
contentViewWidthConstraint = contentView.widthAnchor.constraint(equalTo: widthAnchor)
|
||||
scrollView.contentSize = bounds.size
|
||||
}
|
||||
|
||||
// Apply border line
|
||||
layer.remove(layerName: "borderLineLayer")
|
||||
if borderLine {
|
||||
let borderLineLayer = CALayer()
|
||||
borderLineLayer.name = "borderLineLayer"
|
||||
borderLineLayer.backgroundColor = borderlineColorConfig.getColor(self).cgColor
|
||||
|
||||
if orientation == .horizontal {
|
||||
borderLineLayer.frame = CGRect(x: 0, y: bounds.height - 1, width: bounds.width, height: 1)
|
||||
} else {
|
||||
borderLineLayer.frame = CGRect(x: 0, y: 0, width: 1, height: bounds.height)
|
||||
}
|
||||
|
||||
layer.addSublayer(borderLineLayer)
|
||||
}
|
||||
scrollView.isScrollEnabled = scrollIsEnabled
|
||||
|
||||
// Activate old constraint
|
||||
contentViewWidthConstraint?.isActive = true
|
||||
|
||||
scrollToSelectedIndex(animated: true)
|
||||
}
|
||||
|
||||
open override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
//borderLine
|
||||
if borderLine {
|
||||
var edge: UIRectEdge = .bottom
|
||||
if orientation == .vertical {
|
||||
edge = .left
|
||||
} else if indicatorPosition == .top {
|
||||
edge = .top
|
||||
}
|
||||
|
||||
borderlineViewLeadingConstraint?.isActive = false
|
||||
borderlineViewTrailingConstraint?.isActive = false
|
||||
borderlineViewTopConstraint?.isActive = false
|
||||
borderlineViewBottomConstraint?.isActive = false
|
||||
borderlineViewHeightConstraint?.isActive = false
|
||||
borderlineViewWidthConstraint?.isActive = false
|
||||
|
||||
if edge == .left {
|
||||
borderlineViewWidthConstraint?.constant = borderlineSize
|
||||
borderlineViewWidthConstraint?.isActive = true
|
||||
borderlineViewTopConstraint?.isActive = true
|
||||
borderlineViewLeadingConstraint?.isActive = true
|
||||
borderlineViewBottomConstraint?.isActive = true
|
||||
|
||||
} else if edge == .top {
|
||||
borderlineViewHeightConstraint?.constant = borderlineSize
|
||||
borderlineViewHeightConstraint?.isActive = true
|
||||
borderlineViewTopConstraint?.isActive = true
|
||||
borderlineViewLeadingConstraint?.isActive = true
|
||||
borderlineViewTrailingConstraint?.isActive = true
|
||||
|
||||
} else {
|
||||
borderlineViewHeightConstraint?.constant = borderlineSize
|
||||
borderlineViewHeightConstraint?.isActive = true
|
||||
borderlineViewLeadingConstraint?.isActive = true
|
||||
borderlineViewTrailingConstraint?.isActive = true
|
||||
borderlineViewBottomConstraint?.isActive = true
|
||||
}
|
||||
borderlineView.backgroundColor = borderlineColorConfiguration.getColor(self)
|
||||
borderlineView.isHidden = false
|
||||
} else {
|
||||
borderlineView.isHidden = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,12 +73,12 @@ open class EntryField: Control, Changeable {
|
||||
// Sizes are from InVision design specs.
|
||||
internal var containerSize: CGSize { CGSize(width: 45, height: 44) }
|
||||
|
||||
internal let primaryColorConfig = ViewColorConfiguration().with {
|
||||
internal let primaryColorConfiguration = ViewColorConfiguration().with {
|
||||
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
|
||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
|
||||
}
|
||||
|
||||
internal let secondaryColorConfig = ViewColorConfiguration().with {
|
||||
internal let secondaryColorConfiguration = ViewColorConfiguration().with {
|
||||
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
|
||||
$0.setSurfaceColors(VDSColor.elementsSecondaryOnlight, VDSColor.elementsSecondaryOndark, forDisabled: false)
|
||||
}
|
||||
@ -218,9 +218,9 @@ open class EntryField: Control, Changeable {
|
||||
.pinLeading()
|
||||
.trailingAnchor.constraint(lessThanOrEqualTo: trailingAnchor).isActive = true
|
||||
|
||||
titleLabel.textColorConfiguration = primaryColorConfig.eraseToAnyColorable()
|
||||
errorLabel.textColorConfiguration = primaryColorConfig.eraseToAnyColorable()
|
||||
helperLabel.textColorConfiguration = secondaryColorConfig.eraseToAnyColorable()
|
||||
titleLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
|
||||
errorLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
|
||||
helperLabel.textColorConfiguration = secondaryColorConfiguration.eraseToAnyColorable()
|
||||
}
|
||||
|
||||
open func getContainer() -> UIView {
|
||||
|
||||
@ -133,7 +133,7 @@ open class InputField: EntryField, UITextFieldDelegate {
|
||||
stackView.addArrangedSubview(successLabel)
|
||||
stackView.setCustomSpacing(8, after: successLabel)
|
||||
|
||||
successLabel.textColorConfiguration = primaryColorConfig.eraseToAnyColorable()
|
||||
successLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
|
||||
|
||||
backgroundColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessBackgroundOnlight, VDSColor.feedbackSuccessBackgroundOndark, forState: .success)
|
||||
borderColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessOnlight, VDSColor.feedbackSuccessOndark, forState: .success)
|
||||
|
||||
@ -209,19 +209,19 @@ open class TileContainer: Control {
|
||||
//--------------------------------------------------
|
||||
private let cornerRadius = VDSFormControls.borderradius * 2
|
||||
|
||||
private var backgroundColorConfig = BackgroundColorConfiguration()
|
||||
private var backgroundColorConfiguration = BackgroundColorConfiguration()
|
||||
|
||||
private var borderColorConfig = SurfaceColorConfiguration().with {
|
||||
private var borderColorConfiguration = SurfaceColorConfiguration().with {
|
||||
$0.lightColor = VDSColor.elementsLowcontrastOnlight
|
||||
$0.darkColor = VDSColor.elementsLowcontrastOndark
|
||||
}
|
||||
|
||||
private var imageFallbackColorConfig = SurfaceColorConfiguration().with {
|
||||
private var imageFallbackColorConfiguration = SurfaceColorConfiguration().with {
|
||||
$0.lightColor = VDSColor.backgroundPrimaryLight
|
||||
$0.darkColor = VDSColor.backgroundPrimaryDark
|
||||
}
|
||||
|
||||
private var hightLightViewColorConfig = SurfaceColorConfiguration().with {
|
||||
private var hightLightViewColorConfiguration = SurfaceColorConfiguration().with {
|
||||
$0.lightColor = VDSColor.paletteWhite.withAlphaComponent(0.3)
|
||||
$0.darkColor = VDSColor.paletteBlack.withAlphaComponent(0.3)
|
||||
}
|
||||
@ -265,19 +265,19 @@ open class TileContainer: Control {
|
||||
open override func updateView() {
|
||||
super.updateView()
|
||||
|
||||
highlightView.backgroundColor = hightLightViewColorConfig.getColor(self)
|
||||
highlightView.backgroundColor = hightLightViewColorConfiguration.getColor(self)
|
||||
highlightView.isHidden = !isHighlighted
|
||||
|
||||
if let backgroundImage {
|
||||
backgroundImageView.image = backgroundImage
|
||||
backgroundImageView.isHidden = false
|
||||
backgroundColor = imageFallbackColorConfig.getColor(self)
|
||||
backgroundColor = imageFallbackColorConfiguration.getColor(self)
|
||||
} else {
|
||||
backgroundImageView.isHidden = true
|
||||
backgroundColor = backgroundColorConfig.getColor(self)
|
||||
backgroundColor = backgroundColorConfiguration.getColor(self)
|
||||
}
|
||||
|
||||
layer.borderColor = borderColorConfig.getColor(self).cgColor
|
||||
layer.borderColor = borderColorConfiguration.getColor(self).cgColor
|
||||
layer.borderWidth = showBorder ? VDSFormControls.widthBorder : 0
|
||||
|
||||
containerTopConstraint?.constant = padding.value
|
||||
|
||||
@ -61,27 +61,27 @@ open class Tooltip: Control, TooltipLaunchable {
|
||||
switch fillColor {
|
||||
|
||||
case .primary:
|
||||
return primaryColorConfig.eraseToAnyColorable()
|
||||
return primaryColorConfiguration.eraseToAnyColorable()
|
||||
case .secondary:
|
||||
return secondaryColorConfig.eraseToAnyColorable()
|
||||
return secondaryColorConfiguration.eraseToAnyColorable()
|
||||
case .brandHighlight:
|
||||
return brandHighlightColorConfig.eraseToAnyColorable()
|
||||
return brandHighlightColorConfiguration.eraseToAnyColorable()
|
||||
}
|
||||
}
|
||||
|
||||
private var primaryColorConfig = ControlColorConfiguration().with {
|
||||
private var primaryColorConfiguration = ControlColorConfiguration().with {
|
||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .normal)
|
||||
$0.setSurfaceColors(VDSColor.interactiveActiveOnlight, VDSColor.interactiveActiveOndark, forState: .highlighted)
|
||||
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled)
|
||||
}
|
||||
|
||||
private var secondaryColorConfig = ControlColorConfiguration().with {
|
||||
private var secondaryColorConfiguration = ControlColorConfiguration().with {
|
||||
$0.setSurfaceColors(VDSColor.elementsSecondaryOnlight, VDSColor.elementsSecondaryOndark, forState: .normal)
|
||||
$0.setSurfaceColors(VDSColor.paletteGray65, VDSColor.paletteGray65, forState: .highlighted)
|
||||
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled)
|
||||
}
|
||||
|
||||
private var brandHighlightColorConfig = ControlColorConfiguration().with {
|
||||
private var brandHighlightColorConfiguration = ControlColorConfiguration().with {
|
||||
$0.setSurfaceColors(VDSColor.elementsBrandhighlight, VDSColor.elementsBrandhighlight, forState: .normal)
|
||||
$0.setSurfaceColors(VDSColor.elementsBrandhighlight, VDSColor.elementsBrandhighlight, forState: .highlighted)
|
||||
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled)
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
1.0.22
|
||||
=======
|
||||
- CXTDT-423133 - Tabs - Indicator should overlap Border
|
||||
- CXTDT-423092 - Tabs - Top-aligned version should have line top also
|
||||
- CXTDT-423141 - Tabs - Incorrect spacing on top-aligned Fill containe
|
||||
- CXTDT-422872 - Text Link - spacing issue between text and underline
|
||||
|
||||
1.0.21
|
||||
=======
|
||||
- CXTDT-412383 - Label - Disabled Font color
|
||||
|
||||
Loading…
Reference in New Issue
Block a user