update naming conventions

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-06-08 08:56:31 -05:00
parent 439c66fb97
commit 55885c80ba
7 changed files with 35 additions and 34 deletions

View File

@ -98,24 +98,24 @@ open class Badge: View {
return config.eraseToAnyColorable() return config.eraseToAnyColorable()
}() }()
private var textColorConfig = ViewColorConfiguration() private var textColorConfiguration = ViewColorConfiguration()
public func updateTextColorConfig() { public func updateTextColorConfig() {
textColorConfig.reset() textColorConfiguration.reset()
switch fillColor { switch fillColor {
case .red, .black: case .red, .black:
textColorConfig.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOndark, forDisabled: false) textColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOndark, forDisabled: false)
textColorConfig.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOndark, forDisabled: true) textColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOndark, forDisabled: true)
case .yellow, .white: case .yellow, .white:
textColorConfig.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOnlight, forDisabled: false) textColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOnlight, forDisabled: false)
textColorConfig.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOnlight, forDisabled: true) textColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOnlight, forDisabled: true)
case .orange, .green, .blue: case .orange, .green, .blue:
textColorConfig.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOnlight, forDisabled: false) textColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOnlight, forDisabled: false)
textColorConfig.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOnlight, forDisabled: true) textColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOnlight, forDisabled: true)
} }
} }
@ -127,7 +127,7 @@ open class Badge: View {
backgroundColor = backgroundColorConfiguration.getColor(self) backgroundColor = backgroundColorConfiguration.getColor(self)
label.textColorConfiguration = textColorConfig.eraseToAnyColorable() label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
label.numberOfLines = numberOfLines label.numberOfLines = numberOfLines
label.text = text label.text = text
label.surface = surface label.surface = surface

View File

@ -75,14 +75,15 @@ open class TextLink: ButtonBase {
super.setup() super.setup()
isAccessibilityElement = true isAccessibilityElement = true
accessibilityTraits = .link accessibilityTraits = .link
//titleEdgeInsets = .init(top: 0, left: 0, bottom: 2, right: 0)
if let titleLabel { if let titleLabel {
addSubview(line) addSubview(line)
line.pinLeading(titleLabel.leadingAnchor) line.pinLeading(titleLabel.leadingAnchor)
line.pinTrailing(titleLabel.trailingAnchor) line.pinTrailing(titleLabel.trailingAnchor)
line.pinTop(titleLabel.bottomAnchor, 1) line.pinTop(titleLabel.bottomAnchor)
lineHeightConstraint = line.heightAnchor.constraint(equalToConstant: 1.0) lineHeightConstraint = line.heightAnchor.constraint(equalToConstant: 1.0)
lineHeightConstraint?.isActive = true lineHeightConstraint?.isActive = true
titleLabel.debugBorder(show: true)
} }
} }

View File

@ -181,7 +181,7 @@ open class Notification: View {
return config.eraseToAnyColorable() 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: false)
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: true) $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: true)
} }
@ -224,8 +224,8 @@ open class Notification: View {
mainStackView.addArrangedSubview(closeButton) mainStackView.addArrangedSubview(closeButton)
//labels //labels
titleLabel.textColorConfiguration = textColorConfig.eraseToAnyColorable() titleLabel.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
subTitleLabel.textColorConfiguration = textColorConfig.eraseToAnyColorable() subTitleLabel.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
} }
open override func reset() { open override func reset() {

View File

@ -73,12 +73,12 @@ open class EntryField: Control, Changeable {
// Sizes are from InVision design specs. // Sizes are from InVision design specs.
internal var containerSize: CGSize { CGSize(width: 45, height: 44) } 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.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false) $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.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
$0.setSurfaceColors(VDSColor.elementsSecondaryOnlight, VDSColor.elementsSecondaryOndark, forDisabled: false) $0.setSurfaceColors(VDSColor.elementsSecondaryOnlight, VDSColor.elementsSecondaryOndark, forDisabled: false)
} }
@ -218,9 +218,9 @@ open class EntryField: Control, Changeable {
.pinLeading() .pinLeading()
.trailingAnchor.constraint(lessThanOrEqualTo: trailingAnchor).isActive = true .trailingAnchor.constraint(lessThanOrEqualTo: trailingAnchor).isActive = true
titleLabel.textColorConfiguration = primaryColorConfig.eraseToAnyColorable() titleLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
errorLabel.textColorConfiguration = primaryColorConfig.eraseToAnyColorable() errorLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
helperLabel.textColorConfiguration = secondaryColorConfig.eraseToAnyColorable() helperLabel.textColorConfiguration = secondaryColorConfiguration.eraseToAnyColorable()
} }
open func getContainer() -> UIView { open func getContainer() -> UIView {

View File

@ -133,7 +133,7 @@ open class InputField: EntryField, UITextFieldDelegate {
stackView.addArrangedSubview(successLabel) stackView.addArrangedSubview(successLabel)
stackView.setCustomSpacing(8, after: successLabel) stackView.setCustomSpacing(8, after: successLabel)
successLabel.textColorConfiguration = primaryColorConfig.eraseToAnyColorable() successLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
backgroundColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessBackgroundOnlight, VDSColor.feedbackSuccessBackgroundOndark, forState: .success) backgroundColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessBackgroundOnlight, VDSColor.feedbackSuccessBackgroundOndark, forState: .success)
borderColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessOnlight, VDSColor.feedbackSuccessOndark, forState: .success) borderColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessOnlight, VDSColor.feedbackSuccessOndark, forState: .success)

View File

@ -209,19 +209,19 @@ open class TileContainer: Control {
//-------------------------------------------------- //--------------------------------------------------
private let cornerRadius = VDSFormControls.borderradius * 2 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.lightColor = VDSColor.elementsLowcontrastOnlight
$0.darkColor = VDSColor.elementsLowcontrastOndark $0.darkColor = VDSColor.elementsLowcontrastOndark
} }
private var imageFallbackColorConfig = SurfaceColorConfiguration().with { private var imageFallbackColorConfiguration = SurfaceColorConfiguration().with {
$0.lightColor = VDSColor.backgroundPrimaryLight $0.lightColor = VDSColor.backgroundPrimaryLight
$0.darkColor = VDSColor.backgroundPrimaryDark $0.darkColor = VDSColor.backgroundPrimaryDark
} }
private var hightLightViewColorConfig = SurfaceColorConfiguration().with { private var hightLightViewColorConfiguration = SurfaceColorConfiguration().with {
$0.lightColor = VDSColor.paletteWhite.withAlphaComponent(0.3) $0.lightColor = VDSColor.paletteWhite.withAlphaComponent(0.3)
$0.darkColor = VDSColor.paletteBlack.withAlphaComponent(0.3) $0.darkColor = VDSColor.paletteBlack.withAlphaComponent(0.3)
} }
@ -265,19 +265,19 @@ open class TileContainer: Control {
open override func updateView() { open override func updateView() {
super.updateView() super.updateView()
highlightView.backgroundColor = hightLightViewColorConfig.getColor(self) highlightView.backgroundColor = hightLightViewColorConfiguration.getColor(self)
highlightView.isHidden = !isHighlighted highlightView.isHidden = !isHighlighted
if let backgroundImage { if let backgroundImage {
backgroundImageView.image = backgroundImage backgroundImageView.image = backgroundImage
backgroundImageView.isHidden = false backgroundImageView.isHidden = false
backgroundColor = imageFallbackColorConfig.getColor(self) backgroundColor = imageFallbackColorConfiguration.getColor(self)
} else { } else {
backgroundImageView.isHidden = true 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 layer.borderWidth = showBorder ? VDSFormControls.widthBorder : 0
containerTopConstraint?.constant = padding.value containerTopConstraint?.constant = padding.value

View File

@ -61,27 +61,27 @@ open class Tooltip: Control, TooltipLaunchable {
switch fillColor { switch fillColor {
case .primary: case .primary:
return primaryColorConfig.eraseToAnyColorable() return primaryColorConfiguration.eraseToAnyColorable()
case .secondary: case .secondary:
return secondaryColorConfig.eraseToAnyColorable() return secondaryColorConfiguration.eraseToAnyColorable()
case .brandHighlight: 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.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .normal)
$0.setSurfaceColors(VDSColor.interactiveActiveOnlight, VDSColor.interactiveActiveOndark, forState: .highlighted) $0.setSurfaceColors(VDSColor.interactiveActiveOnlight, VDSColor.interactiveActiveOndark, forState: .highlighted)
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled) $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.elementsSecondaryOnlight, VDSColor.elementsSecondaryOndark, forState: .normal)
$0.setSurfaceColors(VDSColor.paletteGray65, VDSColor.paletteGray65, forState: .highlighted) $0.setSurfaceColors(VDSColor.paletteGray65, VDSColor.paletteGray65, forState: .highlighted)
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled) $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: .normal)
$0.setSurfaceColors(VDSColor.elementsBrandhighlight, VDSColor.elementsBrandhighlight, forState: .highlighted) $0.setSurfaceColors(VDSColor.elementsBrandhighlight, VDSColor.elementsBrandhighlight, forState: .highlighted)
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled) $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled)