diff --git a/VDS/BaseClasses/Selector/SelectorItemBase.swift b/VDS/BaseClasses/Selector/SelectorItemBase.swift index ee63d2e1..611f15d0 100644 --- a/VDS/BaseClasses/Selector/SelectorItemBase.swift +++ b/VDS/BaseClasses/Selector/SelectorItemBase.swift @@ -73,21 +73,18 @@ open class SelectorItemBase: 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 } diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index d151516e..67bbae67 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -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 = "" diff --git a/VDS/Components/BadgeIndicator/BadgeIndicator.swift b/VDS/Components/BadgeIndicator/BadgeIndicator.swift index 4a7fb4a3..922f774d 100644 --- a/VDS/Components/BadgeIndicator/BadgeIndicator.swift +++ b/VDS/Components/BadgeIndicator/BadgeIndicator.swift @@ -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 diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index 0a1fa776..59640545 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -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) diff --git a/VDS/Components/RadioBox/RadioBoxItem.swift b/VDS/Components/RadioBox/RadioBoxItem.swift index 97bafe6d..13743343 100644 --- a/VDS/Components/RadioBox/RadioBoxItem.swift +++ b/VDS/Components/RadioBox/RadioBoxItem.swift @@ -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 } diff --git a/VDS/Components/Tabs/Tab.swift b/VDS/Components/Tabs/Tab.swift index 1e1f6d1b..079b01d5 100644 --- a/VDS/Components/Tabs/Tab.swift +++ b/VDS/Components/Tabs/Tab.swift @@ -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() diff --git a/VDS/Components/Tabs/Tabs.swift b/VDS/Components/Tabs/Tabs.swift index 200f0d96..dc73bc62 100644 --- a/VDS/Components/Tabs/Tabs.swift +++ b/VDS/Components/Tabs/Tabs.swift @@ -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 diff --git a/VDS/Components/TextFields/EntryFieldBase.swift b/VDS/Components/TextFields/EntryFieldBase.swift index 6051ce2b..a80d875f 100644 --- a/VDS/Components/TextFields/EntryFieldBase.swift +++ b/VDS/Components/TextFields/EntryFieldBase.swift @@ -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 diff --git a/VDS/Components/TextFields/InputField/InputField.swift b/VDS/Components/TextFields/InputField/InputField.swift index 27886b55..1e1c985e 100644 --- a/VDS/Components/TextFields/InputField/InputField.swift +++ b/VDS/Components/TextFields/InputField/InputField.swift @@ -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 diff --git a/VDS/Components/TitleLockup/TitleLockup.swift b/VDS/Components/TitleLockup/TitleLockup.swift index 358f63ca..391674ae 100644 --- a/VDS/Components/TitleLockup/TitleLockup.swift +++ b/VDS/Components/TitleLockup/TitleLockup.swift @@ -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 diff --git a/VDS/Components/Toggle/Toggle.swift b/VDS/Components/Toggle/Toggle.swift index 06d58954..6125cac5 100644 --- a/VDS/Components/Toggle/Toggle.swift +++ b/VDS/Components/Toggle/Toggle.swift @@ -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 diff --git a/VDS/Components/Tooltip/TrailingTooltipLabel.swift b/VDS/Components/Tooltip/TrailingTooltipLabel.swift index 6545f9ba..dc4f1f3e 100644 --- a/VDS/Components/Tooltip/TrailingTooltipLabel.swift +++ b/VDS/Components/Tooltip/TrailingTooltipLabel.swift @@ -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 = "" diff --git a/VDS/Typography/Typography+Enums.swift b/VDS/Typography/Typography+Enums.swift index 8c2b03e2..5e828882 100644 --- a/VDS/Typography/Typography+Enums.swift +++ b/VDS/Typography/Typography+Enums.swift @@ -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