From 443636b723ae660cdd3808c22bfea93cad4ee0df Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 13 Jan 2023 13:36:53 -0600 Subject: [PATCH] refactored typograpicalStyle to textStyle Signed-off-by: Matt Bruce --- VDS/Components/Badge/Badge.swift | 4 ++-- VDS/Components/Buttons/Button/Button.swift | 2 +- VDS/Components/Buttons/Button/ButtonBase.swift | 12 ++++++------ VDS/Components/Buttons/TextLink/TextLink.swift | 2 +- .../Buttons/TextLinkCaret/TextLinkCaret.swift | 2 +- VDS/Components/Checkbox/Checkbox.swift | 12 ++++++------ VDS/Components/Label/Label.swift | 14 +++++++------- VDS/Components/RadioBox/RadioBox.swift | 12 ++++++------ VDS/Components/RadioButton/RadioButton.swift | 12 ++++++------ .../RadioSwatch/RadioSwatchGroup.swift | 2 +- .../TextFields/EntryField/EntryField.swift | 16 ++++++++-------- .../TextFields/InputField/InputField.swift | 4 ++-- VDS/Components/TitleLockup/TitleLockup.swift | 6 +++--- VDS/Components/Toggle/Toggle.swift | 4 ++-- 14 files changed, 52 insertions(+), 52 deletions(-) diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index 16a5370c..777c8168 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -29,7 +29,7 @@ public class Badge: View, Accessable { $0.adjustsFontSizeToFitWidth = false $0.lineBreakMode = .byTruncatingTail $0.textPosition = .left - $0.typograpicalStyle = .BoldBodySmall + $0.textStyle = .BoldBodySmall } //-------------------------------------------------- @@ -86,7 +86,7 @@ public class Badge: View, Accessable { label.reset() label.lineBreakMode = .byTruncatingTail label.textPosition = .left - label.typograpicalStyle = .BoldBodySmall + label.textStyle = .BoldBodySmall fillColor = .red text = "" diff --git a/VDS/Components/Buttons/Button/Button.swift b/VDS/Components/Buttons/Button/Button.swift index 43682d96..3fbd9bfd 100644 --- a/VDS/Components/Buttons/Button/Button.swift +++ b/VDS/Components/Buttons/Button/Button.swift @@ -42,7 +42,7 @@ open class Button: ButtonBase, Useable { textColorConfiguration.getColor(self) } - open override var typograpicalStyle: TypographicalStyle { + open override var textStyle: TypographicalStyle { size == .large ? TypographicalStyle.BoldBodyLarge : TypographicalStyle.BoldBodySmall } diff --git a/VDS/Components/Buttons/Button/ButtonBase.swift b/VDS/Components/Buttons/Button/ButtonBase.swift index cb69771f..1d753bc7 100644 --- a/VDS/Components/Buttons/Button/ButtonBase.swift +++ b/VDS/Components/Buttons/Button/ButtonBase.swift @@ -66,7 +66,7 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab } } - open var typograpicalStyle: TypographicalStyle { .defaultStyle } + open var textStyle: TypographicalStyle { .defaultStyle } open var textColor: UIColor { .black } @@ -149,7 +149,7 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab // MARK: - PRIVATE //-------------------------------------------------- private func updateLabel() { - let font = typograpicalStyle.font + let font = textStyle.font //clear the arrays holding actions accessibilityCustomActions = [] @@ -163,8 +163,8 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab let entireRange = NSRange(location: 0, length: mutableText.length) //set letterSpacing - if typograpicalStyle.letterSpacing > 0.0 { - mutableText.addAttribute(.kern, value: typograpicalStyle.letterSpacing, range: entireRange) + if textStyle.letterSpacing > 0.0 { + mutableText.addAttribute(.kern, value: textStyle.letterSpacing, range: entireRange) } let paragraph = NSMutableParagraphStyle().with { @@ -173,8 +173,8 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab } //set lineHeight - if typograpicalStyle.lineHeight > 0.0 { - let lineHeight = typograpicalStyle.lineHeight + if textStyle.lineHeight > 0.0 { + let lineHeight = textStyle.lineHeight let adjustment = lineHeight > font.lineHeight ? 2.0 : 1.0 let baselineOffset = (lineHeight - font.lineHeight) / 2.0 / adjustment paragraph.maximumLineHeight = lineHeight diff --git a/VDS/Components/Buttons/TextLink/TextLink.swift b/VDS/Components/Buttons/TextLink/TextLink.swift index ec03610c..64494eb6 100644 --- a/VDS/Components/Buttons/TextLink/TextLink.swift +++ b/VDS/Components/Buttons/TextLink/TextLink.swift @@ -26,7 +26,7 @@ open class TextLink: ButtonBase { open override var availableSizes: [ButtonSize] { [.large, .small] } - open override var typograpicalStyle: TypographicalStyle { + open override var textStyle: TypographicalStyle { size == .large ? TypographicalStyle.BodyLarge : TypographicalStyle.BodySmall } diff --git a/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift b/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift index af95b24e..d7db31a8 100644 --- a/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift +++ b/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift @@ -24,7 +24,7 @@ open class TextLinkCaret: ButtonBase { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- - open override var typograpicalStyle: TypographicalStyle { + open override var textStyle: TypographicalStyle { TypographicalStyle.BoldBodyLarge } diff --git a/VDS/Components/Checkbox/Checkbox.swift b/VDS/Components/Checkbox/Checkbox.swift index 5048f4e5..28512835 100644 --- a/VDS/Components/Checkbox/Checkbox.swift +++ b/VDS/Components/Checkbox/Checkbox.swift @@ -76,19 +76,19 @@ open class CheckboxBase: Control, Accessable, DataTrackable, Errorable { private var label = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left - $0.typograpicalStyle = .BoldBodyLarge + $0.textStyle = .BoldBodyLarge } private var childLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left - $0.typograpicalStyle = .BodyLarge + $0.textStyle = .BodyLarge } private var errorLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left - $0.typograpicalStyle = .BodyMedium + $0.textStyle = .BodyMedium } //-------------------------------------------------- @@ -272,9 +272,9 @@ open class CheckboxBase: Control, Accessable, DataTrackable, Errorable { childLabel.reset() errorLabel.reset() - label.typograpicalStyle = .BoldBodyLarge - childLabel.typograpicalStyle = .BodyLarge - errorLabel.typograpicalStyle = .BodyMedium + label.textStyle = .BoldBodyLarge + childLabel.textStyle = .BodyLarge + errorLabel.textStyle = .BodyMedium labelText = nil labelTextAttributes = nil diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index 25b5c18a..274ca71b 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -33,7 +33,7 @@ public class Label: UILabel, Handlerable, ViewProtocol, Resettable { open var attributes: [any LabelAttributeModel]? { didSet { didChange() }} - open var typograpicalStyle: TypographicalStyle = .defaultStyle { didSet { didChange() }} + open var textStyle: TypographicalStyle = .defaultStyle { didSet { didChange() }} open var textPosition: TextPosition = .left { didSet { didChange() }} @@ -103,7 +103,7 @@ public class Label: UILabel, Handlerable, ViewProtocol, Resettable { surface = .light disabled = false attributes = nil - typograpicalStyle = .defaultStyle + textStyle = .defaultStyle textPosition = .left text = nil attributedText = nil @@ -120,7 +120,7 @@ public class Label: UILabel, Handlerable, ViewProtocol, Resettable { if !useAttributedText { textAlignment = textPosition.textAlignment textColor = textColorConfiguration.getColor(self) - font = typograpicalStyle.font + font = textStyle.font if let text = text, let font = font, let textColor = textColor { //clear the arrays holding actions @@ -169,13 +169,13 @@ public class Label: UILabel, Handlerable, ViewProtocol, Resettable { let entireRange = NSRange(location: 0, length: attributedString.length) //set letterSpacing - if typograpicalStyle.letterSpacing > 0.0 { - attributedString.addAttribute(.kern, value: typograpicalStyle.letterSpacing, range: entireRange) + if textStyle.letterSpacing > 0.0 { + attributedString.addAttribute(.kern, value: textStyle.letterSpacing, range: entireRange) } //set lineHeight - if typograpicalStyle.lineHeight > 0.0 { - let lineHeight = typograpicalStyle.lineHeight + if textStyle.lineHeight > 0.0 { + let lineHeight = textStyle.lineHeight let adjustment = lineHeight > font.lineHeight ? 2.0 : 1.0 let baselineOffset = (lineHeight - font.lineHeight) / 2.0 / adjustment let paragraph = NSMutableParagraphStyle().with { diff --git a/VDS/Components/RadioBox/RadioBox.swift b/VDS/Components/RadioBox/RadioBox.swift index d9398259..3b9e6bbe 100644 --- a/VDS/Components/RadioBox/RadioBox.swift +++ b/VDS/Components/RadioBox/RadioBox.swift @@ -70,19 +70,19 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{ private var textLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left - $0.typograpicalStyle = .BoldBodyLarge + $0.textStyle = .BoldBodyLarge } private var subTextLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left - $0.typograpicalStyle = .BodyLarge + $0.textStyle = .BodyLarge } private var subTextRightLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .right - $0.typograpicalStyle = .BodyLarge + $0.textStyle = .BodyLarge } //-------------------------------------------------- @@ -226,9 +226,9 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{ subTextLabel.reset() subTextRightLabel.reset() - textLabel.typograpicalStyle = .BoldBodyLarge - subTextLabel.typograpicalStyle = .BodyLarge - subTextRightLabel.typograpicalStyle = .BodyLarge + textLabel.textStyle = .BoldBodyLarge + subTextLabel.textStyle = .BodyLarge + subTextRightLabel.textStyle = .BodyLarge text = "Default Text" textAttributes = nil diff --git a/VDS/Components/RadioButton/RadioButton.swift b/VDS/Components/RadioButton/RadioButton.swift index 3972fcf7..881546e4 100644 --- a/VDS/Components/RadioButton/RadioButton.swift +++ b/VDS/Components/RadioButton/RadioButton.swift @@ -83,19 +83,19 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable { private var label = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left - $0.typograpicalStyle = .BoldBodyLarge + $0.textStyle = .BoldBodyLarge } private var childLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left - $0.typograpicalStyle = .BodyLarge + $0.textStyle = .BodyLarge } private var errorLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left - $0.typograpicalStyle = .BodyMedium + $0.textStyle = .BodyMedium } //-------------------------------------------------- @@ -269,9 +269,9 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable { childLabel.reset() errorLabel.reset() - label.typograpicalStyle = .BoldBodyLarge - childLabel.typograpicalStyle = .BodyLarge - errorLabel.typograpicalStyle = .BodyMedium + label.textStyle = .BoldBodyLarge + childLabel.textStyle = .BodyLarge + errorLabel.textStyle = .BodyMedium labelText = nil labelTextAttributes = nil diff --git a/VDS/Components/RadioSwatch/RadioSwatchGroup.swift b/VDS/Components/RadioSwatch/RadioSwatchGroup.swift index 420302e9..71c1be72 100644 --- a/VDS/Components/RadioSwatch/RadioSwatchGroup.swift +++ b/VDS/Components/RadioSwatch/RadioSwatchGroup.swift @@ -117,7 +117,7 @@ public class RadioSwatchGroupBase: SelectorGroupSe open override func updateView() { label.textPosition = .left - label.typograpicalStyle = .BodySmall + label.textStyle = .BodySmall label.text = selectedHandler?.text ?? " " label.surface = surface label.disabled = disabled diff --git a/VDS/Components/TextFields/EntryField/EntryField.swift b/VDS/Components/TextFields/EntryField/EntryField.swift index 5a425837..2e66860d 100644 --- a/VDS/Components/TextFields/EntryField/EntryField.swift +++ b/VDS/Components/TextFields/EntryField/EntryField.swift @@ -50,19 +50,19 @@ open class EntryField: Control, Accessable { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.attributes = [] $0.textPosition = .left - $0.typograpicalStyle = .BodySmall + $0.textStyle = .BodySmall } internal var errorLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left - $0.typograpicalStyle = .BodySmall + $0.textStyle = .BodySmall } internal var helperLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left - $0.typograpicalStyle = .BodySmall + $0.textStyle = .BodySmall } internal var containerView: UIView = { @@ -249,7 +249,7 @@ open class EntryField: Control, Accessable { let title = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left - $0.typograpicalStyle = .BoldBodySmall + $0.textStyle = .BoldBodySmall $0.text = tooltipTitle $0.surface = surface $0.disabled = disabled @@ -258,7 +258,7 @@ open class EntryField: Control, Accessable { let content = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left - $0.typograpicalStyle = .BoldBodySmall + $0.textStyle = .BoldBodySmall $0.text = tooltipContent $0.surface = surface $0.disabled = disabled @@ -283,11 +283,11 @@ open class EntryField: Control, Accessable { helperLabel.reset() titleLabel.textPosition = .left - titleLabel.typograpicalStyle = .BodySmall + titleLabel.textStyle = .BodySmall errorLabel.textPosition = .left - errorLabel.typograpicalStyle = .BodySmall + errorLabel.textStyle = .BodySmall helperLabel.textPosition = .left - helperLabel.typograpicalStyle = .BodySmall + helperLabel.textStyle = .BodySmall labelText = nil helperText = nil diff --git a/VDS/Components/TextFields/InputField/InputField.swift b/VDS/Components/TextFields/InputField/InputField.swift index f6e0e72e..47174b56 100644 --- a/VDS/Components/TextFields/InputField/InputField.swift +++ b/VDS/Components/TextFields/InputField/InputField.swift @@ -95,7 +95,7 @@ public class InputField: EntryField, UITextFieldDelegate { private var successLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left - $0.typograpicalStyle = .BodySmall + $0.textStyle = .BodySmall } private var textField = UITextField().with { @@ -147,7 +147,7 @@ public class InputField: EntryField, UITextFieldDelegate { successLabel.reset() successLabel.textPosition = .left - successLabel.typograpicalStyle = .BodySmall + successLabel.textStyle = .BodySmall type = .text showSuccess = false diff --git a/VDS/Components/TitleLockup/TitleLockup.swift b/VDS/Components/TitleLockup/TitleLockup.swift index 10d8306d..0f9fba53 100644 --- a/VDS/Components/TitleLockup/TitleLockup.swift +++ b/VDS/Components/TitleLockup/TitleLockup.swift @@ -245,7 +245,7 @@ open class TitleLockup: View { if let eyebrowModel, !eyebrowModel.text.isEmpty { eyebrowTextIsEmpty = false eyebrowLabel.textPosition = allLabelsTextPosition - eyebrowLabel.typograpicalStyle = otherTextStyle.value + eyebrowLabel.textStyle = otherTextStyle.value eyebrowLabel.text = eyebrowModel.text eyebrowLabel.attributes = eyebrowModel.textAttributes eyebrowLabel.numberOfLines = eyebrowModel.numberOfLines @@ -257,7 +257,7 @@ open class TitleLockup: View { if let titleModel, !titleModel.text.isEmpty { titleTextIsEmpty = false titleLabel.textPosition = allLabelsTextPosition - titleLabel.typograpicalStyle = titleModel.textStyle.value + titleLabel.textStyle = titleModel.textStyle.value titleLabel.text = titleModel.text titleLabel.attributes = titleModel.textAttributes titleLabel.numberOfLines = titleModel.numberOfLines @@ -269,7 +269,7 @@ open class TitleLockup: View { if let subTitleModel, !subTitleModel.text.isEmpty { subTitleTextIsEmpty = false subTitleLabel.textPosition = allLabelsTextPosition - subTitleLabel.typograpicalStyle = otherTextStyle.value + subTitleLabel.textStyle = otherTextStyle.value subTitleLabel.text = subTitleModel.text subTitleLabel.attributes = subTitleModel.textAttributes subTitleLabel.numberOfLines = subTitleModel.numberOfLines diff --git a/VDS/Components/Toggle/Toggle.swift b/VDS/Components/Toggle/Toggle.swift index 894516d1..c01cceb9 100644 --- a/VDS/Components/Toggle/Toggle.swift +++ b/VDS/Components/Toggle/Toggle.swift @@ -102,7 +102,7 @@ open class ToggleBase: Control, Accessable, DataTrackable { $0.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOndark, forState: .selected) } - private var typograpicalStyle: TypographicalStyle { + private var textStyle: TypographicalStyle { if textSize == .small { if textWeight == .bold { return .BoldBodySmall @@ -225,7 +225,7 @@ open class ToggleBase: Control, Accessable, DataTrackable { if showText { label.textPosition = textPosition == .left ? .left : .right - label.typograpicalStyle = typograpicalStyle + label.textStyle = textStyle label.text = isOn ? onText : offText label.surface = surface label.disabled = disabled