refactored naming

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-30 14:17:55 -05:00
parent 99340c616e
commit d9dc8e9b4f
13 changed files with 22 additions and 37 deletions

View File

@ -73,21 +73,18 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
/// Label used to render labelText. /// Label used to render labelText.
open var label = Label().with { open var label = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .boldBodyLarge $0.textStyle = .boldBodyLarge
} }
/// Label used to render childText. /// Label used to render childText.
open var childLabel = Label().with { open var childLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodyLarge $0.textStyle = .bodyLarge
} }
/// Label used to render errorText. /// Label used to render errorText.
open var errorLabel = Label().with { open var errorLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodyMedium $0.textStyle = .bodyMedium
} }

View File

@ -52,7 +52,6 @@ open class Badge: View {
$0.setContentHuggingPriority(.defaultHigh, for: .vertical) $0.setContentHuggingPriority(.defaultHigh, for: .vertical)
$0.setContentCompressionResistancePriority(.required, for: .horizontal) $0.setContentCompressionResistancePriority(.required, for: .horizontal)
$0.setContentHuggingPriority(.defaultHigh, for: .horizontal) $0.setContentHuggingPriority(.defaultHigh, for: .horizontal)
$0.textPosition = .left
$0.textStyle = .boldBodySmall $0.textStyle = .boldBodySmall
} }
@ -154,7 +153,6 @@ open class Badge: View {
shouldUpdateView = false shouldUpdateView = false
label.reset() label.reset()
label.lineBreakMode = .byTruncatingTail label.lineBreakMode = .byTruncatingTail
label.textPosition = .left
label.textStyle = .boldBodySmall label.textStyle = .boldBodySmall
fillColor = .red fillColor = .red
text = "" text = ""

View File

@ -139,7 +139,7 @@ open class BadgeIndicator: View {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.adjustsFontSizeToFitWidth = false $0.adjustsFontSizeToFitWidth = false
$0.lineBreakMode = .byTruncatingTail $0.lineBreakMode = .byTruncatingTail
$0.textPosition = .center $0.textAlignment = .center
$0.numberOfLines = 1 $0.numberOfLines = 1
} }
@ -294,7 +294,7 @@ open class BadgeIndicator: View {
shouldUpdateView = false shouldUpdateView = false
label.reset() label.reset()
label.lineBreakMode = .byTruncatingTail label.lineBreakMode = .byTruncatingTail
label.textPosition = .center label.textAlignment = .center
fillColor = .red fillColor = .red
number = nil number = nil
shouldUpdateView = true shouldUpdateView = true

View File

@ -119,7 +119,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
open var textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }} open var textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }}
/// The alignment of the text within the label. /// The alignment of the text within the label.
open var textPosition: TextAlignment = .left { didSet { setNeedsUpdate() }} open override var textAlignment: NSTextAlignment { didSet { setNeedsUpdate() }}
open var userInfo = [String: Primitive]() open var userInfo = [String: Primitive]()
@ -169,6 +169,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
translatesAutoresizingMaskIntoConstraints = false translatesAutoresizingMaskIntoConstraints = false
accessibilityCustomActions = [] accessibilityCustomActions = []
accessibilityTraits = .staticText accessibilityTraits = .staticText
textAlignment = .left
setup() setup()
setNeedsUpdate() setNeedsUpdate()
} }
@ -182,7 +183,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
isEnabled = true isEnabled = true
attributes = nil attributes = nil
textStyle = .defaultStyle textStyle = .defaultStyle
textPosition = .left textAlignment = .left
text = nil text = nil
attributedText = nil attributedText = nil
numberOfLines = 0 numberOfLines = 0
@ -201,7 +202,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
textStyle: textStyle, textStyle: textStyle,
useScaledFont: useScaledFont, useScaledFont: useScaledFont,
textColor: textColorConfiguration.getColor(self), textColor: textColorConfiguration.getColor(self),
alignment: textPosition.value, alignment: textAlignment,
lineBreakMode: lineBreakMode) lineBreakMode: lineBreakMode)
applyAttributes(mutableText) applyAttributes(mutableText)

View File

@ -70,21 +70,19 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
/// Label used to render the text. /// Label used to render the text.
open var textLabel = Label().with { open var textLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .boldBodyLarge $0.textStyle = .boldBodyLarge
} }
/// Label used to render the subText. /// Label used to render the subText.
open var subTextLabel = Label().with { open var subTextLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodyLarge $0.textStyle = .bodyLarge
} }
/// Label used to render the subTextRight. /// Label used to render the subTextRight.
open var subTextRightLabel = Label().with { open var subTextRightLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .right $0.textAlignment = .right
$0.textStyle = .bodyLarge $0.textStyle = .bodyLarge
} }

View File

@ -69,7 +69,7 @@ extension Tabs {
open var size: Tabs.Size = .medium { didSet { setNeedsUpdate() } } open var size: Tabs.Size = .medium { didSet { setNeedsUpdate() } }
///Text position left or center ///Text position left or center
open var textPosition: TextAlignment = .left { didSet { setNeedsUpdate() } } open var textAlignment: TextAlignment = .left { didSet { setNeedsUpdate() } }
///Sets the Position of the Selected/Hover Border Accent for All Tabs. ///Sets the Position of the Selected/Hover Border Accent for All Tabs.
open var indicatorPosition: Tabs.IndicatorPosition = .bottom { didSet { setNeedsUpdate() } } open var indicatorPosition: Tabs.IndicatorPosition = .bottom { didSet { setNeedsUpdate() } }
@ -165,7 +165,7 @@ extension Tabs {
label.text = text label.text = text
label.surface = surface label.surface = surface
label.textStyle = textStyle label.textStyle = textStyle
label.textPosition = textPosition label.textAlignment = textAlignment.value
label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable() label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
setNeedsLayout() setNeedsLayout()
layoutIfNeeded() layoutIfNeeded()

View File

@ -154,7 +154,7 @@ open class Tabs: View {
orientation == .horizontal && overflow == .scroll orientation == .horizontal && overflow == .scroll
} }
private var textPosition: TextAlignment { private var textAlignment: TextAlignment {
orientation == .horizontal && fillContainer ? .center : .left orientation == .horizontal && fillContainer ? .center : .left
} }
@ -274,7 +274,7 @@ open class Tabs: View {
tabItem.isSelected = selectedIndex == index tabItem.isSelected = selectedIndex == index
tabItem.index = index tabItem.index = index
tabItem.minWidth = minWidth tabItem.minWidth = minWidth
tabItem.textPosition = textPosition tabItem.textAlignment = textAlignment
tabItem.orientation = orientation tabItem.orientation = orientation
tabItem.surface = surface tabItem.surface = surface
tabItem.indicatorPosition = indicatorPosition tabItem.indicatorPosition = indicatorPosition

View File

@ -111,19 +111,16 @@ open class EntryFieldBase: Control, Changeable {
open var titleLabel = Label().with { open var titleLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodySmall $0.textStyle = .bodySmall
} }
open var errorLabel = Label().with { open var errorLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodySmall $0.textStyle = .bodySmall
} }
open var helperLabel = Label().with { open var helperLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodySmall $0.textStyle = .bodySmall
} }
@ -237,11 +234,8 @@ open class EntryFieldBase: Control, Changeable {
errorLabel.reset() errorLabel.reset()
helperLabel.reset() helperLabel.reset()
titleLabel.textPosition = .left
titleLabel.textStyle = .bodySmall titleLabel.textStyle = .bodySmall
errorLabel.textPosition = .left
errorLabel.textStyle = .bodySmall errorLabel.textStyle = .bodySmall
helperLabel.textPosition = .left
helperLabel.textStyle = .bodySmall helperLabel.textStyle = .bodySmall
labelText = nil labelText = nil

View File

@ -60,7 +60,6 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
/// Label to render the successText. /// Label to render the successText.
open var successLabel = Label().with { open var successLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left
$0.textStyle = .bodySmall $0.textStyle = .bodySmall
} }
@ -157,7 +156,6 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
textField.delegate = self textField.delegate = self
successLabel.reset() successLabel.reset()
successLabel.textPosition = .left
successLabel.textStyle = .bodySmall successLabel.textStyle = .bodySmall
fieldType = .text fieldType = .text

View File

@ -34,7 +34,7 @@ open class TitleLockup: View {
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Enum used to describe the alignment of the text. /// Enum used to describe the alignment of the text.
public enum TextPosition: String, EnumSubset { public enum TextAlignment: String, EnumSubset {
case left, center case left, center
public var defaultValue: VDS.TextAlignment { .left } public var defaultValue: VDS.TextAlignment { .left }
@ -68,7 +68,7 @@ open class TitleLockup: View {
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
/// Aligns TitleLockup's subcomponent's text /// Aligns TitleLockup's subcomponent's text
open var textPosition: TextPosition = .left { didSet { setNeedsUpdate() }} open var textAlignment: TextAlignment = .left { didSet { setNeedsUpdate() }}
//first row //first row
/// Label used to render the eyebrow model. /// Label used to render the eyebrow model.
@ -295,7 +295,6 @@ open class TitleLockup: View {
open override func reset() { open override func reset() {
super.reset() super.reset()
shouldUpdateView = false shouldUpdateView = false
textPosition = .left
eyebrowModel = nil eyebrowModel = nil
titleModel = nil titleModel = nil
subTitleModel = nil subTitleModel = nil
@ -307,7 +306,7 @@ open class TitleLockup: View {
open override func updateView() { open override func updateView() {
super.updateView() super.updateView()
let allLabelsTextPosition = textPosition.value let allLabelsTextAlignment = textAlignment.value.value
var eyebrowTextIsEmpty = true var eyebrowTextIsEmpty = true
var titleTextIsEmpty = true var titleTextIsEmpty = true
var subTitleTextIsEmpty = true var subTitleTextIsEmpty = true
@ -324,7 +323,7 @@ open class TitleLockup: View {
if let eyebrowModel, !eyebrowModel.text.isEmpty { if let eyebrowModel, !eyebrowModel.text.isEmpty {
eyebrowTextIsEmpty = false eyebrowTextIsEmpty = false
eyebrowLabel.textPosition = allLabelsTextPosition eyebrowLabel.textAlignment = allLabelsTextAlignment
eyebrowLabel.text = eyebrowModel.text eyebrowLabel.text = eyebrowModel.text
eyebrowLabel.attributes = eyebrowModel.textAttributes eyebrowLabel.attributes = eyebrowModel.textAttributes
eyebrowLabel.numberOfLines = eyebrowModel.numberOfLines eyebrowLabel.numberOfLines = eyebrowModel.numberOfLines
@ -350,7 +349,7 @@ open class TitleLockup: View {
if let titleModel, !titleModel.text.isEmpty { if let titleModel, !titleModel.text.isEmpty {
titleTextIsEmpty = false titleTextIsEmpty = false
titleLabel.textPosition = allLabelsTextPosition titleLabel.textAlignment = allLabelsTextAlignment
titleLabel.textStyle = titleModel.textStyle titleLabel.textStyle = titleModel.textStyle
titleLabel.text = titleModel.text titleLabel.text = titleModel.text
titleLabel.attributes = titleModel.textAttributes titleLabel.attributes = titleModel.textAttributes
@ -360,7 +359,7 @@ open class TitleLockup: View {
if let subTitleModel, !subTitleModel.text.isEmpty { if let subTitleModel, !subTitleModel.text.isEmpty {
subTitleTextIsEmpty = false subTitleTextIsEmpty = false
subTitleLabel.textPosition = allLabelsTextPosition subTitleLabel.textAlignment = allLabelsTextAlignment
subTitleLabel.textStyle = otherStandardStyle.value.regular subTitleLabel.textStyle = otherStandardStyle.value.regular
subTitleLabel.textColorConfiguration = subTitleModel.textColor == .secondary ? textColorSecondaryConfiguration : textColorPrimaryConfiguration subTitleLabel.textColorConfiguration = subTitleModel.textColor == .secondary ? textColorSecondaryConfiguration : textColorPrimaryConfiguration
subTitleLabel.text = subTitleModel.text subTitleLabel.text = subTitleModel.text

View File

@ -267,7 +267,7 @@ open class Toggle: Control, Changeable, FormFieldable {
label.isHidden = !showLabel label.isHidden = !showLabel
if showLabel { if showLabel {
label.textPosition = textPosition == .left ? .right : .left label.textAlignment = textPosition == .left ? .right : .left
label.textStyle = textStyle label.textStyle = textStyle
label.text = statusText label.text = statusText
label.surface = surface label.surface = surface

View File

@ -50,7 +50,7 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
open var labelTextStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() } } open var labelTextStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() } }
/// Text position used to render the label. /// Text position used to render the label.
open var labelTextPosition: TextAlignment = .left { didSet { setNeedsUpdate() } } open var labelTextAlignment: TextAlignment = .left { didSet { setNeedsUpdate() } }
/// Color configuration set for the label. /// Color configuration set for the label.
public lazy var textColorConfiguration: AnyColorable = { public lazy var textColorConfiguration: AnyColorable = {
@ -96,7 +96,7 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
label.text = labelText label.text = labelText
label.textStyle = labelTextStyle label.textStyle = labelTextStyle
label.textPosition = labelTextPosition label.textAlignment = labelTextAlignment.value
label.attributes = labelAttributes label.attributes = labelAttributes
label.surface = surface label.surface = surface
label.isEnabled = isEnabled label.isEnabled = isEnabled
@ -114,7 +114,7 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
labelText = nil labelText = nil
labelAttributes = nil labelAttributes = nil
labelTextStyle = .defaultStyle labelTextStyle = .defaultStyle
labelTextPosition = .left labelTextAlignment = .left
tooltipCloseButtonText = "Close" tooltipCloseButtonText = "Close"
tooltipTitle = "" tooltipTitle = ""
tooltipContent = "" tooltipContent = ""

View File

@ -80,7 +80,7 @@ extension TextStyle {
public enum TextAlignment: String, CaseIterable { public enum TextAlignment: String, CaseIterable {
case left, right, center case left, right, center
var value: NSTextAlignment { public var value: NSTextAlignment {
switch self { switch self {
case .left: case .left:
return NSTextAlignment.left return NSTextAlignment.left