Merge branch 'feature/tilet' into 'develop'

refactored TextStyle enums to camelCase

See merge request BPHV_MIPS/vds_ios!32
This commit is contained in:
Bruce, Matt R 2023-01-13 21:38:46 +00:00
commit 0d05c1354e
19 changed files with 254 additions and 262 deletions

View File

@ -29,7 +29,7 @@ public class Badge: View, Accessable {
$0.adjustsFontSizeToFitWidth = false $0.adjustsFontSizeToFitWidth = false
$0.lineBreakMode = .byTruncatingTail $0.lineBreakMode = .byTruncatingTail
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BoldBodySmall $0.textStyle = .boldBodySmall
} }
//-------------------------------------------------- //--------------------------------------------------
@ -86,7 +86,7 @@ public class Badge: View, Accessable {
label.reset() label.reset()
label.lineBreakMode = .byTruncatingTail label.lineBreakMode = .byTruncatingTail
label.textPosition = .left label.textPosition = .left
label.textStyle = .BoldBodySmall label.textStyle = .boldBodySmall
fillColor = .red fillColor = .red
text = "" text = ""

View File

@ -43,7 +43,7 @@ open class Button: ButtonBase, Useable {
} }
open override var textStyle: TextStyle { open override var textStyle: TextStyle {
size == .large ? TextStyle.BoldBodyLarge : TextStyle.BoldBodySmall size == .large ? TextStyle.boldBodyLarge : TextStyle.boldBodySmall
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -27,7 +27,7 @@ open class TextLink: ButtonBase {
open override var availableSizes: [ButtonSize] { [.large, .small] } open override var availableSizes: [ButtonSize] { [.large, .small] }
open override var textStyle: TextStyle { open override var textStyle: TextStyle {
size == .large ? TextStyle.BodyLarge : TextStyle.BodySmall size == .large ? TextStyle.bodyLarge : TextStyle.bodySmall
} }
open override var textColor: UIColor { open override var textColor: UIColor {

View File

@ -25,7 +25,7 @@ open class TextLinkCaret: ButtonBase {
// MARK: - Private Properties // MARK: - Private Properties
//-------------------------------------------------- //--------------------------------------------------
open override var textStyle: TextStyle { open override var textStyle: TextStyle {
TextStyle.BoldBodyLarge TextStyle.boldBodyLarge
} }
private var caretView = CaretView().with { private var caretView = CaretView().with {

View File

@ -76,19 +76,19 @@ open class CheckboxBase: Control, Accessable, DataTrackable, Errorable {
private var label = Label().with { private var label = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BoldBodyLarge $0.textStyle = .boldBodyLarge
} }
private var childLabel = Label().with { private var childLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BodyLarge $0.textStyle = .bodyLarge
} }
private var errorLabel = Label().with { private var errorLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BodyMedium $0.textStyle = .bodyMedium
} }
//-------------------------------------------------- //--------------------------------------------------
@ -272,9 +272,9 @@ open class CheckboxBase: Control, Accessable, DataTrackable, Errorable {
childLabel.reset() childLabel.reset()
errorLabel.reset() errorLabel.reset()
label.textStyle = .BoldBodyLarge label.textStyle = .boldBodyLarge
childLabel.textStyle = .BodyLarge childLabel.textStyle = .bodyLarge
errorLabel.textStyle = .BodyMedium errorLabel.textStyle = .bodyMedium
labelText = nil labelText = nil
labelTextAttributes = nil labelTextAttributes = nil

View File

@ -70,19 +70,19 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{
private var textLabel = Label().with { private var textLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BoldBodyLarge $0.textStyle = .boldBodyLarge
} }
private var subTextLabel = Label().with { private var subTextLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BodyLarge $0.textStyle = .bodyLarge
} }
private var subTextRightLabel = Label().with { private var subTextRightLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .right $0.textPosition = .right
$0.textStyle = .BodyLarge $0.textStyle = .bodyLarge
} }
//-------------------------------------------------- //--------------------------------------------------
@ -226,9 +226,9 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{
subTextLabel.reset() subTextLabel.reset()
subTextRightLabel.reset() subTextRightLabel.reset()
textLabel.textStyle = .BoldBodyLarge textLabel.textStyle = .boldBodyLarge
subTextLabel.textStyle = .BodyLarge subTextLabel.textStyle = .bodyLarge
subTextRightLabel.textStyle = .BodyLarge subTextRightLabel.textStyle = .bodyLarge
text = "Default Text" text = "Default Text"
textAttributes = nil textAttributes = nil

View File

@ -83,19 +83,19 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable {
private var label = Label().with { private var label = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BoldBodyLarge $0.textStyle = .boldBodyLarge
} }
private var childLabel = Label().with { private var childLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BodyLarge $0.textStyle = .bodyLarge
} }
private var errorLabel = Label().with { private var errorLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BodyMedium $0.textStyle = .bodyMedium
} }
//-------------------------------------------------- //--------------------------------------------------
@ -269,9 +269,9 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable {
childLabel.reset() childLabel.reset()
errorLabel.reset() errorLabel.reset()
label.textStyle = .BoldBodyLarge label.textStyle = .boldBodyLarge
childLabel.textStyle = .BodyLarge childLabel.textStyle = .bodyLarge
errorLabel.textStyle = .BodyMedium errorLabel.textStyle = .bodyMedium
labelText = nil labelText = nil
labelTextAttributes = nil labelTextAttributes = nil

View File

@ -117,7 +117,7 @@ public class RadioSwatchGroupBase<HandlerType: RadioSwatchBase>: SelectorGroupSe
open override func updateView() { open override func updateView() {
label.textPosition = .left label.textPosition = .left
label.textStyle = .BodySmall label.textStyle = .bodySmall
label.text = selectedHandler?.text ?? " " label.text = selectedHandler?.text ?? " "
label.surface = surface label.surface = surface
label.disabled = disabled label.disabled = disabled

View File

@ -50,19 +50,19 @@ open class EntryField: Control, Accessable {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.attributes = [] $0.attributes = []
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BodySmall $0.textStyle = .bodySmall
} }
internal var errorLabel = Label().with { internal var errorLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BodySmall $0.textStyle = .bodySmall
} }
internal var helperLabel = Label().with { internal var helperLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BodySmall $0.textStyle = .bodySmall
} }
internal var containerView: UIView = { internal var containerView: UIView = {
@ -249,7 +249,7 @@ open class EntryField: Control, Accessable {
let title = Label().with { let title = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BoldBodySmall $0.textStyle = .boldBodySmall
$0.text = tooltipTitle $0.text = tooltipTitle
$0.surface = surface $0.surface = surface
$0.disabled = disabled $0.disabled = disabled
@ -258,7 +258,7 @@ open class EntryField: Control, Accessable {
let content = Label().with { let content = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BoldBodySmall $0.textStyle = .boldBodySmall
$0.text = tooltipContent $0.text = tooltipContent
$0.surface = surface $0.surface = surface
$0.disabled = disabled $0.disabled = disabled
@ -283,11 +283,11 @@ open class EntryField: Control, Accessable {
helperLabel.reset() helperLabel.reset()
titleLabel.textPosition = .left titleLabel.textPosition = .left
titleLabel.textStyle = .BodySmall titleLabel.textStyle = .bodySmall
errorLabel.textPosition = .left errorLabel.textPosition = .left
errorLabel.textStyle = .BodySmall errorLabel.textStyle = .bodySmall
helperLabel.textPosition = .left helperLabel.textPosition = .left
helperLabel.textStyle = .BodySmall helperLabel.textStyle = .bodySmall
labelText = nil labelText = nil
helperText = nil helperText = nil

View File

@ -95,12 +95,12 @@ public class InputField: EntryField, UITextFieldDelegate {
private var successLabel = Label().with { private var successLabel = Label().with {
$0.setContentCompressionResistancePriority(.required, for: .vertical) $0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.textPosition = .left $0.textPosition = .left
$0.textStyle = .BodySmall $0.textStyle = .bodySmall
} }
private var textField = UITextField().with { private var textField = UITextField().with {
$0.translatesAutoresizingMaskIntoConstraints = false $0.translatesAutoresizingMaskIntoConstraints = false
$0.font = TextStyle.BodyLarge.font $0.font = TextStyle.bodyLarge.font
} }
public var textFieldTextColorConfiguration: AnyColorable = ViewColorConfiguration().with { public var textFieldTextColorConfiguration: AnyColorable = ViewColorConfiguration().with {
@ -147,7 +147,7 @@ public class InputField: EntryField, UITextFieldDelegate {
successLabel.reset() successLabel.reset()
successLabel.textPosition = .left successLabel.textPosition = .left
successLabel.textStyle = .BodySmall successLabel.textStyle = .bodySmall
type = .text type = .text
showSuccess = false showSuccess = false

View File

@ -48,7 +48,7 @@ public class TextArea: EntryField {
private var textView = UITextView().with { private var textView = UITextView().with {
$0.translatesAutoresizingMaskIntoConstraints = false $0.translatesAutoresizingMaskIntoConstraints = false
$0.font = TextStyle.BodyLarge.font $0.font = TextStyle.bodyLarge.font
$0.sizeToFit() $0.sizeToFit()
$0.isScrollEnabled = false $0.isScrollEnabled = false
} }

View File

@ -53,57 +53,57 @@ open class Tilet: TileContainer {
private var titleLockup = TitleLockup().with { private var titleLockup = TitleLockup().with {
let configs = [ let configs = [
TextStyle.DeviceSpacingConfig([.TitleSmall, .BoldTitleSmall], TextStyle.DeviceSpacingConfig([.titleSmall, .boldTitleSmall],
neighboring: [ neighboring: [
.BodySmall, .BoldBodySmall, .bodySmall, .boldBodySmall,
.BodyMedium, .BoldBodyMedium .bodyMedium, .boldBodyMedium
], ],
spacing: 8.0, spacing: 8.0,
deviceType: .iPhone), deviceType: .iPhone),
TextStyle.DeviceSpacingConfig([.TitleMedium, .BoldTitleMedium, TextStyle.DeviceSpacingConfig([.titleMedium, .boldTitleMedium,
.TitleLarge, .BoldTitleLarge], .titleLarge, .boldTitleLarge],
neighboring: [ neighboring: [
.BodySmall, .BoldBodySmall, .bodySmall, .boldBodySmall,
.BodyMedium, .BoldBodyMedium, .bodyMedium, .boldBodyMedium,
.BodyLarge, .BoldBodyLarge], .bodyLarge, .boldBodyLarge],
spacing: 8.0, spacing: 8.0,
deviceType: .iPhone), deviceType: .iPhone),
TextStyle.DeviceSpacingConfig([.TitleXLarge, .BoldTitleXLarge], TextStyle.DeviceSpacingConfig([.titleXLarge, .boldTitleXLarge],
neighboring: [ neighboring: [
.BodySmall, .BoldBodySmall, .bodySmall, .boldBodySmall,
.BodyMedium, .BoldBodyMedium, .bodyMedium, .boldBodyMedium,
.BodyLarge, .BoldBodyLarge, .bodyLarge, .boldBodyLarge,
.TitleMedium, .BoldTitleMedium .titleMedium, .boldTitleMedium
], ],
spacing: 12.0, spacing: 12.0,
deviceType: .iPhone), deviceType: .iPhone),
TextStyle.DeviceSpacingConfig([.TitleSmall, .BoldTitleSmall, TextStyle.DeviceSpacingConfig([.titleSmall, .boldTitleSmall,
.TitleMedium, .BoldTitleMedium], .titleMedium, .boldTitleMedium],
neighboring: [ neighboring: [
.BodySmall, .BoldBodySmall, .bodySmall, .boldBodySmall,
.BodyMedium, .BoldBodyMedium, .bodyMedium, .boldBodyMedium,
.BodyLarge, .BoldBodyLarge .bodyLarge, .boldBodyLarge
], ],
spacing: 8.0, spacing: 8.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.TitleLarge, .BoldTitleLarge], TextStyle.DeviceSpacingConfig([.titleLarge, .boldTitleLarge],
neighboring: [ neighboring: [
.BodySmall, .BoldBodySmall, .bodySmall, .boldBodySmall,
.BodyMedium, .BoldBodyMedium, .bodyMedium, .boldBodyMedium,
.BodyLarge, .BoldBodyLarge, .bodyLarge, .boldBodyLarge,
.TitleSmall, .BoldTitleSmall .titleSmall, .boldTitleSmall
], ],
spacing: 12.0, spacing: 12.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.TitleXLarge, .BoldTitleXLarge], TextStyle.DeviceSpacingConfig([.titleXLarge, .boldTitleXLarge],
neighboring: [ neighboring: [
.BodyLarge, .BoldBodyLarge, .bodyLarge, .boldBodyLarge,
.TitleMedium, .BoldTitleMedium .titleMedium, .boldTitleMedium
], ],
spacing: 16.0, spacing: 16.0,
deviceType: .iPad) deviceType: .iPad)
@ -213,15 +213,7 @@ open class Tilet: TileContainer {
width = 100 width = 100
aspectRatio = .none aspectRatio = .none
color = .black color = .black
let view = UIView().with { addContentView(stackView)
$0.translatesAutoresizingMaskIntoConstraints = false
}
view.addSubview(stackView)
stackView.pinTop()
stackView.pinLeading()
stackView.pinTrailing()
stackView.bottomAnchor.constraint(lessThanOrEqualTo: view.bottomAnchor).isActive = true
addContentView(view)
//badge //badge
badgeContainerView.addSubview(badge) badgeContainerView.addSubview(badge)

View File

@ -13,21 +13,21 @@ extension Tilet {
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum TextStyle: String, Codable, EnumSubset { public enum TextStyle: String, Codable, EnumSubset {
case BodyLarge case bodyLarge
case BoldBodyLarge case boldBodyLarge
case BodyMedium case bodyMedium
case BoldBodyMedium case boldBodyMedium
case BodySmall case bodySmall
case BoldBodySmall case boldBodySmall
public var defaultValue: TitleLockup.OtherTextStyle { .BodySmall } public var defaultValue: TitleLockup.OtherTextStyle { .bodySmall }
} }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
public var text: String = "" public var text: String = ""
public var textStyle: TextStyle = .BodySmall public var textStyle: TextStyle = .bodySmall
public var textColor: Use = .primary public var textColor: Use = .primary
//-------------------------------------------------- //--------------------------------------------------
@ -36,7 +36,7 @@ extension Tilet {
public init(text: String, public init(text: String,
textColor: Use = .primary, textColor: Use = .primary,
textAttributes: [any LabelAttributeModel]? = nil, textAttributes: [any LabelAttributeModel]? = nil,
textStyle: TextStyle = .BodySmall) { textStyle: TextStyle = .bodySmall) {
self.text = text self.text = text
self.textColor = textColor self.textColor = textColor
self.textStyle = textStyle self.textStyle = textStyle

View File

@ -13,29 +13,29 @@ extension Tilet {
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
public enum TextStyle: String, EnumSubset, Codable { public enum TextStyle: String, EnumSubset, Codable {
case TitleXLarge case titleXLarge
case BoldTitleXLarge case boldTitleXLarge
case TitleLarge case titleLarge
case BoldTitleLarge case boldTitleLarge
case TitleMedium case titleMedium
case BoldTitleMedium case boldTitleMedium
case TitleSmall case titleSmall
case BoldTitleSmall case boldTitleSmall
public var defaultValue: TitleLockup.TitleTextStyle { .BoldTitleSmall } public var defaultValue: TitleLockup.TitleTextStyle { .boldTitleSmall }
} }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
public var text: String = "" public var text: String = ""
public var textStyle: TextStyle = .BoldTitleSmall public var textStyle: TextStyle = .boldTitleSmall
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializers // MARK: - Initializers
//-------------------------------------------------- //--------------------------------------------------
public init(text: String, public init(text: String,
textStyle: TextStyle = .BoldTitleSmall) { textStyle: TextStyle = .boldTitleSmall) {
self.text = text self.text = text
self.textStyle = textStyle self.textStyle = textStyle
} }

View File

@ -52,58 +52,58 @@ open class TitleLockup: View {
// Sizes are from InVision design specs. // Sizes are from InVision design specs.
open var topTextStyleSpacingConfig: TextStyle.SpacingConfig = { open var topTextStyleSpacingConfig: TextStyle.SpacingConfig = {
let configs = [ let configs = [
TextStyle.DeviceSpacingConfig([.BoldTitleLarge, .TitleLarge], TextStyle.DeviceSpacingConfig([.boldTitleLarge, .titleLarge],
neighboring: [.BodySmall, .BodyMedium, .BodyLarge], neighboring: [.bodySmall, .bodyMedium, .bodyLarge],
spacing: 12.0, spacing: 12.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.BoldTitleXLarge, .TitleXLarge], TextStyle.DeviceSpacingConfig([.boldTitleXLarge, .titleXLarge],
neighboring: [.TitleMedium, .BodyLarge], neighboring: [.titleMedium, .bodyLarge],
spacing: 12.0, spacing: 12.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.BoldTitle2XLarge, .Title2XLarge, .BoldFeatureXSmall, .FeatureXSmall], TextStyle.DeviceSpacingConfig([.boldTitle2XLarge, .title2XLarge, .boldFeatureXSmall, .featureXSmall],
neighboring: [.TitleMedium, .TitleLarge], neighboring: [.titleMedium, .titleLarge],
spacing: 16.0, spacing: 16.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.BoldTitle2XLarge, .Title2XLarge, .BoldFeatureXSmall, .FeatureXSmall], TextStyle.DeviceSpacingConfig([.boldTitle2XLarge, .title2XLarge, .boldFeatureXSmall, .featureXSmall],
neighboring: [.BodyLarge], neighboring: [.bodyLarge],
spacing: 12.0, spacing: 12.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.BoldFeatureSmall, .FeatureSmall, .BoldFeatureMedium, .FeatureMedium], TextStyle.DeviceSpacingConfig([.boldFeatureSmall, .featureSmall, .boldFeatureMedium, .featureMedium],
neighboring: [.TitleMedium, .TitleLarge], neighboring: [.titleMedium, .titleLarge],
spacing: 16.0, spacing: 16.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.BoldFeatureSmall, .FeatureSmall, .BoldFeatureMedium, .FeatureMedium], TextStyle.DeviceSpacingConfig([.boldFeatureSmall, .featureSmall, .boldFeatureMedium, .featureMedium],
neighboring: [.BodyLarge], neighboring: [.bodyLarge],
spacing: 12.0, spacing: 12.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.BoldTitleXLarge, .TitleXLarge], TextStyle.DeviceSpacingConfig([.boldTitleXLarge, .titleXLarge],
neighboring: [.BodyLarge, .BodyMedium, .BodySmall, .TitleMedium], neighboring: [.bodyLarge, .bodyMedium, .bodySmall, .titleMedium],
spacing: 12.0, spacing: 12.0,
deviceType: .iPhone), deviceType: .iPhone),
TextStyle.DeviceSpacingConfig([.BoldTitle2XLarge, .Title2XLarge, .BoldFeatureXSmall, .FeatureXSmall], TextStyle.DeviceSpacingConfig([.boldTitle2XLarge, .title2XLarge, .boldFeatureXSmall, .featureXSmall],
neighboring: [.BodyLarge, .BodyMedium, .TitleMedium], neighboring: [.bodyLarge, .bodyMedium, .titleMedium],
spacing: 12.0, spacing: 12.0,
deviceType: .iPhone), deviceType: .iPhone),
TextStyle.DeviceSpacingConfig([.BoldFeatureSmall, .FeatureSmall], TextStyle.DeviceSpacingConfig([.boldFeatureSmall, .featureSmall],
neighboring: [.TitleLarge, .BodyLarge], neighboring: [.titleLarge, .bodyLarge],
spacing: 12.0, spacing: 12.0,
deviceType: .iPhone), deviceType: .iPhone),
TextStyle.DeviceSpacingConfig([.BoldFeatureMedium, .FeatureMedium], TextStyle.DeviceSpacingConfig([.boldFeatureMedium, .featureMedium],
neighboring: [.TitleLarge, .TitleXLarge], neighboring: [.titleLarge, .titleXLarge],
spacing: 16.0, spacing: 16.0,
deviceType: .iPhone), deviceType: .iPhone),
TextStyle.DeviceSpacingConfig([.BoldFeatureMedium, .FeatureMedium], TextStyle.DeviceSpacingConfig([.boldFeatureMedium, .featureMedium],
neighboring: [.BodyLarge], neighboring: [.bodyLarge],
spacing: 12.0, spacing: 12.0,
deviceType: .iPhone) deviceType: .iPhone)
] ]
@ -112,58 +112,58 @@ open class TitleLockup: View {
open var bottomTextStyleSpacingConfig: TextStyle.SpacingConfig = { open var bottomTextStyleSpacingConfig: TextStyle.SpacingConfig = {
let configs = [ let configs = [
TextStyle.DeviceSpacingConfig([.BoldTitleLarge, .TitleLarge], TextStyle.DeviceSpacingConfig([.boldTitleLarge, .titleLarge],
neighboring: [.BodySmall, .BodyMedium, .BodyLarge], neighboring: [.bodySmall, .bodyMedium, .bodyLarge],
spacing: 12.0, spacing: 12.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.BoldTitleXLarge, .TitleXLarge], TextStyle.DeviceSpacingConfig([.boldTitleXLarge, .titleXLarge],
neighboring: [.TitleMedium, .BodyLarge], neighboring: [.titleMedium, .bodyLarge],
spacing: 16.0, spacing: 16.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.BoldTitle2XLarge, .Title2XLarge, .BoldFeatureXSmall, .FeatureXSmall], TextStyle.DeviceSpacingConfig([.boldTitle2XLarge, .title2XLarge, .boldFeatureXSmall, .featureXSmall],
neighboring: [.TitleMedium, .TitleLarge], neighboring: [.titleMedium, .titleLarge],
spacing: 24.0, spacing: 24.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.BoldTitle2XLarge, .Title2XLarge, .BoldFeatureXSmall, .FeatureXSmall], TextStyle.DeviceSpacingConfig([.boldTitle2XLarge, .title2XLarge, .boldFeatureXSmall, .featureXSmall],
neighboring: [.BodyLarge], neighboring: [.bodyLarge],
spacing: 24.0, spacing: 24.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.BoldFeatureSmall, .FeatureSmall, .BoldFeatureMedium, .FeatureMedium], TextStyle.DeviceSpacingConfig([.boldFeatureSmall, .featureSmall, .boldFeatureMedium, .featureMedium],
neighboring: [.TitleMedium, .TitleLarge], neighboring: [.titleMedium, .titleLarge],
spacing: 24.0, spacing: 24.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.BoldFeatureSmall, .FeatureSmall, .BoldFeatureMedium, .FeatureMedium], TextStyle.DeviceSpacingConfig([.boldFeatureSmall, .featureSmall, .boldFeatureMedium, .featureMedium],
neighboring: [.BodyLarge], neighboring: [.bodyLarge],
spacing: 24.0, spacing: 24.0,
deviceType: .iPad), deviceType: .iPad),
TextStyle.DeviceSpacingConfig([.BoldTitleXLarge, .TitleXLarge], TextStyle.DeviceSpacingConfig([.boldTitleXLarge, .titleXLarge],
neighboring: [.BodyLarge, .BodyMedium, .BodySmall, .TitleMedium], neighboring: [.bodyLarge, .bodyMedium, .bodySmall, .titleMedium],
spacing: 12.0, spacing: 12.0,
deviceType: .iPhone), deviceType: .iPhone),
TextStyle.DeviceSpacingConfig([.BoldTitle2XLarge, .Title2XLarge, .BoldFeatureXSmall, .FeatureXSmall], TextStyle.DeviceSpacingConfig([.boldTitle2XLarge, .title2XLarge, .boldFeatureXSmall, .featureXSmall],
neighboring: [.BodyLarge, .BodyMedium, .TitleMedium], neighboring: [.bodyLarge, .bodyMedium, .titleMedium],
spacing: 16, spacing: 16,
deviceType: .iPhone), deviceType: .iPhone),
TextStyle.DeviceSpacingConfig([.BoldFeatureSmall, .FeatureSmall], TextStyle.DeviceSpacingConfig([.boldFeatureSmall, .featureSmall],
neighboring: [.TitleLarge, .BodyLarge], neighboring: [.titleLarge, .bodyLarge],
spacing: 16.0, spacing: 16.0,
deviceType: .iPhone), deviceType: .iPhone),
TextStyle.DeviceSpacingConfig([.BoldFeatureMedium, .FeatureMedium], TextStyle.DeviceSpacingConfig([.boldFeatureMedium, .featureMedium],
neighboring: [.TitleLarge, .TitleXLarge], neighboring: [.titleLarge, .titleXLarge],
spacing: 24.0, spacing: 24.0,
deviceType: .iPhone), deviceType: .iPhone),
TextStyle.DeviceSpacingConfig([.BoldFeatureMedium, .FeatureMedium], TextStyle.DeviceSpacingConfig([.boldFeatureMedium, .featureMedium],
neighboring: [.BodyLarge], neighboring: [.bodyLarge],
spacing: 24.0, spacing: 24.0,
deviceType: .iPhone) deviceType: .iPhone)
] ]
@ -176,7 +176,7 @@ open class TitleLockup: View {
open var textPosition: TextPosition = .left { didSet { didChange() }} open var textPosition: TextPosition = .left { didSet { didChange() }}
//style //style
open var otherTextStyle: OtherTextStyle = UIDevice.isIPad ? .BodyLarge : .BodyMedium { didSet { didChange() }} open var otherTextStyle: OtherTextStyle = UIDevice.isIPad ? .bodyLarge : .bodyMedium { didSet { didChange() }}
//first row //first row
open var eyebrowLabel = Label().with { open var eyebrowLabel = Label().with {
@ -227,7 +227,7 @@ open class TitleLockup: View {
eyebrowModel = nil eyebrowModel = nil
titleModel = nil titleModel = nil
subTitleModel = nil subTitleModel = nil
otherTextStyle = .BodyLarge otherTextStyle = .bodyLarge
} }

View File

@ -13,36 +13,36 @@ extension TitleLockup {
//-------------------------------------------------- //--------------------------------------------------
public enum TitleTextStyle: String, Codable, EnumSubset { public enum TitleTextStyle: String, Codable, EnumSubset {
case FeatureMedium case featureMedium
case BoldFeatureMedium case boldFeatureMedium
case FeatureSmall case featureSmall
case BoldFeatureSmall case boldFeatureSmall
case FeatureXSmall case featureXSmall
case BoldFeatureXSmall case boldFeatureXSmall
case Title2XLarge case title2XLarge
case BoldTitle2XLarge case boldTitle2XLarge
case TitleXLarge case titleXLarge
case BoldTitleXLarge case boldTitleXLarge
case TitleLarge case titleLarge
case BoldTitleLarge case boldTitleLarge
case TitleMedium case titleMedium
case BoldTitleMedium case boldTitleMedium
case TitleSmall case titleSmall
case BoldTitleSmall case boldTitleSmall
public var defaultValue: TextStyle {.BoldFeatureXSmall } public var defaultValue: TextStyle {.boldFeatureXSmall }
} }
public enum OtherTextStyle: String, Codable, EnumSubset { public enum OtherTextStyle: String, Codable, EnumSubset {
case BodyLarge case bodyLarge
case BoldBodyLarge case boldBodyLarge
case BodyMedium case bodyMedium
case BoldBodyMedium case boldBodyMedium
case BodySmall case bodySmall
case BoldBodySmall case boldBodySmall
public var defaultValue: TextStyle {.BodyLarge } public var defaultValue: TextStyle {.bodyLarge }
} }
} }

View File

@ -16,7 +16,7 @@ extension TitleLockup {
public init(text: String, public init(text: String,
textAttributes: [any LabelAttributeModel]? = nil, textAttributes: [any LabelAttributeModel]? = nil,
textStyle: TitleTextStyle = .BoldFeatureXSmall, textStyle: TitleTextStyle = .boldFeatureXSmall,
numberOfLines: Int = 0) { numberOfLines: Int = 0) {
self.text = text self.text = text
self.textAttributes = textAttributes self.textAttributes = textAttributes

View File

@ -105,15 +105,15 @@ open class ToggleBase: Control, Accessable, DataTrackable {
private var textStyle: TextStyle { private var textStyle: TextStyle {
if textSize == .small { if textSize == .small {
if textWeight == .bold { if textWeight == .bold {
return .BoldBodySmall return .boldBodySmall
} else { } else {
return .BodySmall return .bodySmall
} }
} else { } else {
if textWeight == .bold { if textWeight == .bold {
return .BoldBodyLarge return .boldBodyLarge
} else { } else {
return .BodyLarge return .bodyLarge
} }
} }
} }

View File

@ -25,40 +25,40 @@ public enum TextPosition: String, Codable, CaseIterable {
public enum TextStyle: String, Codable, CaseIterable { public enum TextStyle: String, Codable, CaseIterable {
case FeatureXLarge case featureXLarge
case BoldFeatureXLarge case boldFeatureXLarge
case FeatureLarge case featureLarge
case BoldFeatureLarge case boldFeatureLarge
case FeatureMedium case featureMedium
case BoldFeatureMedium case boldFeatureMedium
case FeatureSmall case featureSmall
case BoldFeatureSmall case boldFeatureSmall
case FeatureXSmall case featureXSmall
case BoldFeatureXSmall case boldFeatureXSmall
case Title2XLarge case title2XLarge
case BoldTitle2XLarge case boldTitle2XLarge
case TitleXLarge case titleXLarge
case BoldTitleXLarge case boldTitleXLarge
case TitleLarge case titleLarge
case BoldTitleLarge case boldTitleLarge
case TitleMedium case titleMedium
case BoldTitleMedium case boldTitleMedium
case TitleSmall case titleSmall
case BoldTitleSmall case boldTitleSmall
case BodyLarge case bodyLarge
case BoldBodyLarge case boldBodyLarge
case BodyMedium case bodyMedium
case BoldBodyMedium case boldBodyMedium
case BodySmall case bodySmall
case BoldBodySmall case boldBodySmall
case Micro case micro
case BoldMicro case boldMicro
public static var defaultStyle: TextStyle { public static var defaultStyle: TextStyle {
return .BodyLarge return .bodyLarge
} }
} }
@ -68,7 +68,7 @@ extension TextStyle {
case feature = "Feature" case feature = "Feature"
case title = "Title" case title = "Title"
case body = "Body" case body = "Body"
case micro = "Micro" case micro = "micro"
public var sizes: [FontSize] { public var sizes: [FontSize] {
switch self { switch self {
@ -109,33 +109,33 @@ extension TextStyle {
extension TextStyle { extension TextStyle {
public var pointSize: CGFloat { public var pointSize: CGFloat {
switch self { switch self {
case .FeatureXLarge, .BoldFeatureXLarge: case .featureXLarge, .boldFeatureXLarge:
return UIDevice.isIPad ? VDSTypography.fontSizeFeature144 : VDSTypography.fontSizeFeature96 return UIDevice.isIPad ? VDSTypography.fontSizeFeature144 : VDSTypography.fontSizeFeature96
case .FeatureLarge, .BoldFeatureLarge: case .featureLarge, .boldFeatureLarge:
return UIDevice.isIPad ? VDSTypography.fontSizeFeature128 : VDSTypography.fontSizeFeature80 return UIDevice.isIPad ? VDSTypography.fontSizeFeature128 : VDSTypography.fontSizeFeature80
case .FeatureMedium, .BoldFeatureMedium: case .featureMedium, .boldFeatureMedium:
return UIDevice.isIPad ? VDSTypography.fontSizeFeature96 : VDSTypography.fontSizeFeature64 return UIDevice.isIPad ? VDSTypography.fontSizeFeature96 : VDSTypography.fontSizeFeature64
case .FeatureSmall, .BoldFeatureSmall: case .featureSmall, .boldFeatureSmall:
return UIDevice.isIPad ? VDSTypography.fontSizeFeature80 : VDSTypography.fontSizeFeature48 return UIDevice.isIPad ? VDSTypography.fontSizeFeature80 : VDSTypography.fontSizeFeature48
case .FeatureXSmall, .BoldFeatureXSmall: case .featureXSmall, .boldFeatureXSmall:
return UIDevice.isIPad ? VDSTypography.fontSizeFeature64 : VDSTypography.fontSizeFeature40 return UIDevice.isIPad ? VDSTypography.fontSizeFeature64 : VDSTypography.fontSizeFeature40
case .Title2XLarge, .BoldTitle2XLarge: case .title2XLarge, .boldTitle2XLarge:
return UIDevice.isIPad ? VDSTypography.fontSizeTitle64 : VDSTypography.fontSizeTitle40 return UIDevice.isIPad ? VDSTypography.fontSizeTitle64 : VDSTypography.fontSizeTitle40
case .TitleXLarge, .BoldTitleXLarge: case .titleXLarge, .boldTitleXLarge:
return UIDevice.isIPad ? VDSTypography.fontSizeTitle48 : VDSTypography.fontSizeTitle32 return UIDevice.isIPad ? VDSTypography.fontSizeTitle48 : VDSTypography.fontSizeTitle32
case .TitleLarge, .BoldTitleLarge: case .titleLarge, .boldTitleLarge:
return UIDevice.isIPad ? VDSTypography.fontSizeTitle32 : VDSTypography.fontSizeTitle24 return UIDevice.isIPad ? VDSTypography.fontSizeTitle32 : VDSTypography.fontSizeTitle24
case .TitleMedium, .BoldTitleMedium: case .titleMedium, .boldTitleMedium:
return UIDevice.isIPad ? VDSTypography.fontSizeTitle24 : VDSTypography.fontSizeTitle20 return UIDevice.isIPad ? VDSTypography.fontSizeTitle24 : VDSTypography.fontSizeTitle20
case .TitleSmall, .BoldTitleSmall: case .titleSmall, .boldTitleSmall:
return UIDevice.isIPad ? VDSTypography.fontSizeTitle20 : VDSTypography.fontSizeTitle16 return UIDevice.isIPad ? VDSTypography.fontSizeTitle20 : VDSTypography.fontSizeTitle16
case .BodyLarge, .BoldBodyLarge: case .bodyLarge, .boldBodyLarge:
return VDSTypography.fontSizeBody16 return VDSTypography.fontSizeBody16
case .BodyMedium, .BoldBodyMedium: case .bodyMedium, .boldBodyMedium:
return VDSTypography.fontSizeBody14 return VDSTypography.fontSizeBody14
case .BodySmall, .BoldBodySmall: case .bodySmall, .boldBodySmall:
return VDSTypography.fontSizeBody12 return VDSTypography.fontSizeBody12
case .Micro, .BoldMicro: case .micro, .boldMicro:
return VDSTypography.fontSizeMicro11 return VDSTypography.fontSizeMicro11
} }
} }
@ -145,33 +145,33 @@ extension TextStyle {
extension TextStyle { extension TextStyle {
public var lineHeight: CGFloat { public var lineHeight: CGFloat {
switch self { switch self {
case .FeatureXLarge, .BoldFeatureXLarge: case .featureXLarge, .boldFeatureXLarge:
return UIDevice.isIPad ? VDSTypography.lineHeightFeature136 : VDSTypography.lineHeightFeature88 return UIDevice.isIPad ? VDSTypography.lineHeightFeature136 : VDSTypography.lineHeightFeature88
case .FeatureLarge, .BoldFeatureLarge: case .featureLarge, .boldFeatureLarge:
return UIDevice.isIPad ? VDSTypography.lineHeightFeature120 : VDSTypography.lineHeightFeature76 return UIDevice.isIPad ? VDSTypography.lineHeightFeature120 : VDSTypography.lineHeightFeature76
case .FeatureMedium, .BoldFeatureMedium: case .featureMedium, .boldFeatureMedium:
return UIDevice.isIPad ? VDSTypography.lineHeightFeature88 : VDSTypography.lineHeightFeature64 return UIDevice.isIPad ? VDSTypography.lineHeightFeature88 : VDSTypography.lineHeightFeature64
case .FeatureSmall, .BoldFeatureSmall: case .featureSmall, .boldFeatureSmall:
return UIDevice.isIPad ? VDSTypography.lineHeightFeature76 : VDSTypography.lineHeightFeature48 return UIDevice.isIPad ? VDSTypography.lineHeightFeature76 : VDSTypography.lineHeightFeature48
case .FeatureXSmall, .BoldFeatureXSmall: case .featureXSmall, .boldFeatureXSmall:
return UIDevice.isIPad ? VDSTypography.lineHeightFeature64 : VDSTypography.lineHeightFeature40 return UIDevice.isIPad ? VDSTypography.lineHeightFeature64 : VDSTypography.lineHeightFeature40
case .Title2XLarge, .BoldTitle2XLarge: case .title2XLarge, .boldTitle2XLarge:
return UIDevice.isIPad ? VDSTypography.lineHeightTitle64 : VDSTypography.lineHeightTitle40 return UIDevice.isIPad ? VDSTypography.lineHeightTitle64 : VDSTypography.lineHeightTitle40
case .TitleXLarge, .BoldTitleXLarge: case .titleXLarge, .boldTitleXLarge:
return UIDevice.isIPad ? VDSTypography.lineHeightTitle48 : VDSTypography.lineHeightTitle36 return UIDevice.isIPad ? VDSTypography.lineHeightTitle48 : VDSTypography.lineHeightTitle36
case .TitleLarge, .BoldTitleLarge: case .titleLarge, .boldTitleLarge:
return UIDevice.isIPad ? VDSTypography.lineHeightTitle36 : VDSTypography.lineHeightTitle28 return UIDevice.isIPad ? VDSTypography.lineHeightTitle36 : VDSTypography.lineHeightTitle28
case .TitleMedium, .BoldTitleMedium: case .titleMedium, .boldTitleMedium:
return UIDevice.isIPad ? VDSTypography.lineHeightTitle28 : VDSTypography.lineHeightTitle24 return UIDevice.isIPad ? VDSTypography.lineHeightTitle28 : VDSTypography.lineHeightTitle24
case .TitleSmall, .BoldTitleSmall: case .titleSmall, .boldTitleSmall:
return UIDevice.isIPad ? VDSTypography.lineHeightTitle24 : VDSTypography.lineHeightTitle20 return UIDevice.isIPad ? VDSTypography.lineHeightTitle24 : VDSTypography.lineHeightTitle20
case .BodyLarge, .BoldBodyLarge: case .bodyLarge, .boldBodyLarge:
return VDSTypography.lineHeightBody20 return VDSTypography.lineHeightBody20
case .BodyMedium, .BoldBodyMedium: case .bodyMedium, .boldBodyMedium:
return VDSTypography.lineHeightBody18 return VDSTypography.lineHeightBody18
case .BodySmall, .BoldBodySmall: case .bodySmall, .boldBodySmall:
return VDSTypography.lineHeightBody16 return VDSTypography.lineHeightBody16
case .Micro, .BoldMicro: case .micro, .boldMicro:
return VDSTypography.lineHeightMicro16 return VDSTypography.lineHeightMicro16
} }
} }
@ -181,18 +181,18 @@ extension TextStyle {
extension TextStyle { extension TextStyle {
public var letterSpacing: CGFloat { public var letterSpacing: CGFloat {
switch self { switch self {
case .FeatureXLarge, case .featureXLarge,
.FeatureLarge, .featureLarge,
.FeatureMedium, .featureMedium,
.FeatureSmall, .featureSmall,
.FeatureXSmall, .featureXSmall,
.Title2XLarge, .title2XLarge,
.TitleXLarge, .titleXLarge,
.TitleLarge: .titleLarge:
return 0.25 return 0.25
case .BoldBodyLarge, .BodyLarge, case .boldBodyLarge, .bodyLarge,
.BoldBodyMedium, .BodyMedium: .boldBodyMedium, .bodyMedium:
return 0.5 return 0.5
default: default:
@ -212,42 +212,42 @@ extension TextStyle {
extension TextStyle { extension TextStyle {
public var fontFace: Fonts { public var fontFace: Fonts {
switch self { switch self {
case .BoldFeatureXLarge, case .boldFeatureXLarge,
.BoldFeatureLarge, .boldFeatureLarge,
.BoldFeatureMedium, .boldFeatureMedium,
.BoldFeatureSmall, .boldFeatureSmall,
.BoldFeatureXSmall, .boldFeatureXSmall,
.BoldTitle2XLarge, .boldTitle2XLarge,
.BoldTitleXLarge, .boldTitleXLarge,
.BoldTitleLarge, .boldTitleLarge,
.BoldTitleMedium, .boldTitleMedium,
.BoldTitleSmall, .boldTitleSmall,
.BoldBodyLarge, .boldBodyLarge,
.BoldBodyMedium: .boldBodyMedium:
return .dsBold return .dsBold
case .FeatureXLarge, case .featureXLarge,
.FeatureLarge, .featureLarge,
.FeatureMedium, .featureMedium,
.FeatureSmall, .featureSmall,
.FeatureXSmall, .featureXSmall,
.Title2XLarge, .title2XLarge,
.TitleXLarge: .titleXLarge:
return .dsLight return .dsLight
case .TitleLarge, case .titleLarge,
.TitleMedium, .titleMedium,
.TitleSmall, .titleSmall,
.BodyLarge, .bodyLarge,
.BodyMedium: .bodyMedium:
return .dsRegular return .dsRegular
case .BoldBodySmall, case .boldBodySmall,
.BoldMicro: .boldMicro:
return .txBold return .txBold
case .BodySmall, case .bodySmall,
.Micro: .micro:
return .txRegular return .txRegular
} }
} }