refactored naming
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
99340c616e
commit
d9dc8e9b4f
@ -73,21 +73,18 @@ open class SelectorItemBase<Selector: SelectorControlable>: Control, Errorable,
|
||||
/// Label used to render labelText.
|
||||
open var label = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
$0.textPosition = .left
|
||||
$0.textStyle = .boldBodyLarge
|
||||
}
|
||||
|
||||
/// Label used to render childText.
|
||||
open var childLabel = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
$0.textPosition = .left
|
||||
$0.textStyle = .bodyLarge
|
||||
}
|
||||
|
||||
/// Label used to render errorText.
|
||||
open var errorLabel = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
$0.textPosition = .left
|
||||
$0.textStyle = .bodyMedium
|
||||
}
|
||||
|
||||
|
||||
@ -52,7 +52,6 @@ open class Badge: View {
|
||||
$0.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
||||
$0.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||
$0.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||
$0.textPosition = .left
|
||||
$0.textStyle = .boldBodySmall
|
||||
}
|
||||
|
||||
@ -154,7 +153,6 @@ open class Badge: View {
|
||||
shouldUpdateView = false
|
||||
label.reset()
|
||||
label.lineBreakMode = .byTruncatingTail
|
||||
label.textPosition = .left
|
||||
label.textStyle = .boldBodySmall
|
||||
fillColor = .red
|
||||
text = ""
|
||||
|
||||
@ -139,7 +139,7 @@ open class BadgeIndicator: View {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
$0.adjustsFontSizeToFitWidth = false
|
||||
$0.lineBreakMode = .byTruncatingTail
|
||||
$0.textPosition = .center
|
||||
$0.textAlignment = .center
|
||||
$0.numberOfLines = 1
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ open class BadgeIndicator: View {
|
||||
shouldUpdateView = false
|
||||
label.reset()
|
||||
label.lineBreakMode = .byTruncatingTail
|
||||
label.textPosition = .center
|
||||
label.textAlignment = .center
|
||||
fillColor = .red
|
||||
number = nil
|
||||
shouldUpdateView = true
|
||||
|
||||
@ -119,7 +119,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
||||
open var textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }}
|
||||
|
||||
/// 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]()
|
||||
|
||||
@ -169,6 +169,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
||||
translatesAutoresizingMaskIntoConstraints = false
|
||||
accessibilityCustomActions = []
|
||||
accessibilityTraits = .staticText
|
||||
textAlignment = .left
|
||||
setup()
|
||||
setNeedsUpdate()
|
||||
}
|
||||
@ -182,7 +183,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
||||
isEnabled = true
|
||||
attributes = nil
|
||||
textStyle = .defaultStyle
|
||||
textPosition = .left
|
||||
textAlignment = .left
|
||||
text = nil
|
||||
attributedText = nil
|
||||
numberOfLines = 0
|
||||
@ -201,7 +202,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
||||
textStyle: textStyle,
|
||||
useScaledFont: useScaledFont,
|
||||
textColor: textColorConfiguration.getColor(self),
|
||||
alignment: textPosition.value,
|
||||
alignment: textAlignment,
|
||||
lineBreakMode: lineBreakMode)
|
||||
|
||||
applyAttributes(mutableText)
|
||||
|
||||
@ -70,21 +70,19 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
|
||||
/// Label used to render the text.
|
||||
open var textLabel = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
$0.textPosition = .left
|
||||
$0.textStyle = .boldBodyLarge
|
||||
}
|
||||
|
||||
/// Label used to render the subText.
|
||||
open var subTextLabel = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
$0.textPosition = .left
|
||||
$0.textStyle = .bodyLarge
|
||||
}
|
||||
|
||||
/// Label used to render the subTextRight.
|
||||
open var subTextRightLabel = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
$0.textPosition = .right
|
||||
$0.textAlignment = .right
|
||||
$0.textStyle = .bodyLarge
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ extension Tabs {
|
||||
open var size: Tabs.Size = .medium { didSet { setNeedsUpdate() } }
|
||||
|
||||
///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.
|
||||
open var indicatorPosition: Tabs.IndicatorPosition = .bottom { didSet { setNeedsUpdate() } }
|
||||
@ -165,7 +165,7 @@ extension Tabs {
|
||||
label.text = text
|
||||
label.surface = surface
|
||||
label.textStyle = textStyle
|
||||
label.textPosition = textPosition
|
||||
label.textAlignment = textAlignment.value
|
||||
label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
|
||||
setNeedsLayout()
|
||||
layoutIfNeeded()
|
||||
|
||||
@ -154,7 +154,7 @@ open class Tabs: View {
|
||||
orientation == .horizontal && overflow == .scroll
|
||||
}
|
||||
|
||||
private var textPosition: TextAlignment {
|
||||
private var textAlignment: TextAlignment {
|
||||
orientation == .horizontal && fillContainer ? .center : .left
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ open class Tabs: View {
|
||||
tabItem.isSelected = selectedIndex == index
|
||||
tabItem.index = index
|
||||
tabItem.minWidth = minWidth
|
||||
tabItem.textPosition = textPosition
|
||||
tabItem.textAlignment = textAlignment
|
||||
tabItem.orientation = orientation
|
||||
tabItem.surface = surface
|
||||
tabItem.indicatorPosition = indicatorPosition
|
||||
|
||||
@ -111,19 +111,16 @@ open class EntryFieldBase: Control, Changeable {
|
||||
|
||||
open var titleLabel = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
$0.textPosition = .left
|
||||
$0.textStyle = .bodySmall
|
||||
}
|
||||
|
||||
open var errorLabel = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
$0.textPosition = .left
|
||||
$0.textStyle = .bodySmall
|
||||
}
|
||||
|
||||
open var helperLabel = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
$0.textPosition = .left
|
||||
$0.textStyle = .bodySmall
|
||||
}
|
||||
|
||||
@ -237,11 +234,8 @@ open class EntryFieldBase: Control, Changeable {
|
||||
errorLabel.reset()
|
||||
helperLabel.reset()
|
||||
|
||||
titleLabel.textPosition = .left
|
||||
titleLabel.textStyle = .bodySmall
|
||||
errorLabel.textPosition = .left
|
||||
errorLabel.textStyle = .bodySmall
|
||||
helperLabel.textPosition = .left
|
||||
helperLabel.textStyle = .bodySmall
|
||||
|
||||
labelText = nil
|
||||
|
||||
@ -60,7 +60,6 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
|
||||
/// Label to render the successText.
|
||||
open var successLabel = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
$0.textPosition = .left
|
||||
$0.textStyle = .bodySmall
|
||||
}
|
||||
|
||||
@ -157,7 +156,6 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
|
||||
textField.delegate = self
|
||||
|
||||
successLabel.reset()
|
||||
successLabel.textPosition = .left
|
||||
successLabel.textStyle = .bodySmall
|
||||
|
||||
fieldType = .text
|
||||
|
||||
@ -34,7 +34,7 @@ open class TitleLockup: View {
|
||||
// MARK: - Enums
|
||||
//--------------------------------------------------
|
||||
/// Enum used to describe the alignment of the text.
|
||||
public enum TextPosition: String, EnumSubset {
|
||||
public enum TextAlignment: String, EnumSubset {
|
||||
case left, center
|
||||
|
||||
public var defaultValue: VDS.TextAlignment { .left }
|
||||
@ -68,7 +68,7 @@ open class TitleLockup: View {
|
||||
// MARK: - Public Properties
|
||||
//--------------------------------------------------
|
||||
/// Aligns TitleLockup's subcomponent's text
|
||||
open var textPosition: TextPosition = .left { didSet { setNeedsUpdate() }}
|
||||
open var textAlignment: TextAlignment = .left { didSet { setNeedsUpdate() }}
|
||||
|
||||
//first row
|
||||
/// Label used to render the eyebrow model.
|
||||
@ -295,7 +295,6 @@ open class TitleLockup: View {
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
shouldUpdateView = false
|
||||
textPosition = .left
|
||||
eyebrowModel = nil
|
||||
titleModel = nil
|
||||
subTitleModel = nil
|
||||
@ -307,7 +306,7 @@ open class TitleLockup: View {
|
||||
open override func updateView() {
|
||||
super.updateView()
|
||||
|
||||
let allLabelsTextPosition = textPosition.value
|
||||
let allLabelsTextAlignment = textAlignment.value.value
|
||||
var eyebrowTextIsEmpty = true
|
||||
var titleTextIsEmpty = true
|
||||
var subTitleTextIsEmpty = true
|
||||
@ -324,7 +323,7 @@ open class TitleLockup: View {
|
||||
|
||||
if let eyebrowModel, !eyebrowModel.text.isEmpty {
|
||||
eyebrowTextIsEmpty = false
|
||||
eyebrowLabel.textPosition = allLabelsTextPosition
|
||||
eyebrowLabel.textAlignment = allLabelsTextAlignment
|
||||
eyebrowLabel.text = eyebrowModel.text
|
||||
eyebrowLabel.attributes = eyebrowModel.textAttributes
|
||||
eyebrowLabel.numberOfLines = eyebrowModel.numberOfLines
|
||||
@ -350,7 +349,7 @@ open class TitleLockup: View {
|
||||
|
||||
if let titleModel, !titleModel.text.isEmpty {
|
||||
titleTextIsEmpty = false
|
||||
titleLabel.textPosition = allLabelsTextPosition
|
||||
titleLabel.textAlignment = allLabelsTextAlignment
|
||||
titleLabel.textStyle = titleModel.textStyle
|
||||
titleLabel.text = titleModel.text
|
||||
titleLabel.attributes = titleModel.textAttributes
|
||||
@ -360,7 +359,7 @@ open class TitleLockup: View {
|
||||
|
||||
if let subTitleModel, !subTitleModel.text.isEmpty {
|
||||
subTitleTextIsEmpty = false
|
||||
subTitleLabel.textPosition = allLabelsTextPosition
|
||||
subTitleLabel.textAlignment = allLabelsTextAlignment
|
||||
subTitleLabel.textStyle = otherStandardStyle.value.regular
|
||||
subTitleLabel.textColorConfiguration = subTitleModel.textColor == .secondary ? textColorSecondaryConfiguration : textColorPrimaryConfiguration
|
||||
subTitleLabel.text = subTitleModel.text
|
||||
|
||||
@ -267,7 +267,7 @@ open class Toggle: Control, Changeable, FormFieldable {
|
||||
label.isHidden = !showLabel
|
||||
|
||||
if showLabel {
|
||||
label.textPosition = textPosition == .left ? .right : .left
|
||||
label.textAlignment = textPosition == .left ? .right : .left
|
||||
label.textStyle = textStyle
|
||||
label.text = statusText
|
||||
label.surface = surface
|
||||
|
||||
@ -50,7 +50,7 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
|
||||
open var labelTextStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() } }
|
||||
|
||||
/// 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.
|
||||
public lazy var textColorConfiguration: AnyColorable = {
|
||||
@ -96,7 +96,7 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
|
||||
|
||||
label.text = labelText
|
||||
label.textStyle = labelTextStyle
|
||||
label.textPosition = labelTextPosition
|
||||
label.textAlignment = labelTextAlignment.value
|
||||
label.attributes = labelAttributes
|
||||
label.surface = surface
|
||||
label.isEnabled = isEnabled
|
||||
@ -114,7 +114,7 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
|
||||
labelText = nil
|
||||
labelAttributes = nil
|
||||
labelTextStyle = .defaultStyle
|
||||
labelTextPosition = .left
|
||||
labelTextAlignment = .left
|
||||
tooltipCloseButtonText = "Close"
|
||||
tooltipTitle = ""
|
||||
tooltipContent = ""
|
||||
|
||||
@ -80,7 +80,7 @@ extension TextStyle {
|
||||
public enum TextAlignment: String, CaseIterable {
|
||||
case left, right, center
|
||||
|
||||
var value: NSTextAlignment {
|
||||
public var value: NSTextAlignment {
|
||||
switch self {
|
||||
case .left:
|
||||
return NSTextAlignment.left
|
||||
|
||||
Loading…
Reference in New Issue
Block a user