From ef1ca0f6ab0ab4d98574ae1aff35dbef71dcc073 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 23 Jan 2023 09:27:36 -0600 Subject: [PATCH] marked private/internal subcomponents to open Signed-off-by: Matt Bruce --- VDS/Components/Badge/Badge.swift | 7 +-- VDS/Components/Checkbox/Checkbox.swift | 14 ++--- VDS/Components/Icon/Icon.swift | 8 +-- VDS/Components/RadioBox/RadioBox.swift | 12 ++--- VDS/Components/RadioButton/RadioButton.swift | 12 ++--- .../TextFields/EntryField/EntryField.swift | 53 +++++++++---------- VDS/Components/Tilelet/Tilelet.swift | 34 ++++++------ VDS/Components/Toggle/Toggle.swift | 10 ++-- 8 files changed, 73 insertions(+), 77 deletions(-) diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index d2759c52..b8d919c4 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -22,9 +22,9 @@ public class Badge: View, Accessable { } //-------------------------------------------------- - // MARK: - Private Properties + // MARK: - Public Properties //-------------------------------------------------- - private var label = Label().with { + open var label = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.adjustsFontSizeToFitWidth = false $0.lineBreakMode = .byTruncatingTail @@ -32,9 +32,6 @@ public class Badge: View, Accessable { $0.textStyle = .boldBodySmall } - //-------------------------------------------------- - // MARK: - Public Properties - //-------------------------------------------------- open var fillColor: FillColor = .red { didSet { didChange() }} open var text: String = "" { didSet { didChange() }} diff --git a/VDS/Components/Checkbox/Checkbox.swift b/VDS/Components/Checkbox/Checkbox.swift index 12ab59c3..a1a6a0fd 100644 --- a/VDS/Components/Checkbox/Checkbox.swift +++ b/VDS/Components/Checkbox/Checkbox.swift @@ -73,28 +73,28 @@ open class CheckboxBase: Control, Accessable, DataTrackable, Errorable { $0.axis = .vertical } - private var label = Label().with { + //-------------------------------------------------- + // MARK: - Public Properties + //-------------------------------------------------- + open var label = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left $0.textStyle = .boldBodyLarge } - private var childLabel = Label().with { + open var childLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left $0.textStyle = .bodyLarge } - private var errorLabel = Label().with { + open var errorLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left $0.textStyle = .bodyMedium } - //-------------------------------------------------- - // MARK: - Public Properties - //-------------------------------------------------- - public var selectorView = UIView().with { + open var selectorView = UIView().with { $0.translatesAutoresizingMaskIntoConstraints = false } diff --git a/VDS/Components/Icon/Icon.swift b/VDS/Components/Icon/Icon.swift index 6105b633..184ccf6f 100644 --- a/VDS/Components/Icon/Icon.swift +++ b/VDS/Components/Icon/Icon.swift @@ -19,15 +19,15 @@ public class Icon: View { private var widthConstraint: NSLayoutConstraint? private var heightConstraint: NSLayoutConstraint? - private var imageView = UIImageView().with { + //-------------------------------------------------- + // MARK: - Public Properties + //-------------------------------------------------- + open var imageView = UIImageView().with { $0.translatesAutoresizingMaskIntoConstraints = false $0.contentMode = .scaleAspectFill $0.clipsToBounds = true } - //-------------------------------------------------- - // MARK: - Public Properties - //-------------------------------------------------- open var color: Color = .black { didSet { didChange() }} open var size: Size = .medium { didSet { didChange() }} open var name: Name? { didSet { didChange() }} diff --git a/VDS/Components/RadioBox/RadioBox.swift b/VDS/Components/RadioBox/RadioBox.swift index 975199af..bacd5278 100644 --- a/VDS/Components/RadioBox/RadioBox.swift +++ b/VDS/Components/RadioBox/RadioBox.swift @@ -67,27 +67,27 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{ $0.isHidden = false } - private var textLabel = Label().with { + //-------------------------------------------------- + // MARK: - Public Properties + //-------------------------------------------------- + open var textLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left $0.textStyle = .boldBodyLarge } - private var subTextLabel = Label().with { + open var subTextLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left $0.textStyle = .bodyLarge } - private var subTextRightLabel = Label().with { + open var subTextRightLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .right $0.textStyle = .bodyLarge } - //-------------------------------------------------- - // MARK: - Public Properties - //-------------------------------------------------- public var selectorView = UIView().with { $0.translatesAutoresizingMaskIntoConstraints = false } diff --git a/VDS/Components/RadioButton/RadioButton.swift b/VDS/Components/RadioButton/RadioButton.swift index 1f01e85b..08b46faf 100644 --- a/VDS/Components/RadioButton/RadioButton.swift +++ b/VDS/Components/RadioButton/RadioButton.swift @@ -80,27 +80,27 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable { $0.axis = .vertical } - private var label = Label().with { + //-------------------------------------------------- + // MARK: - Public Properties + //-------------------------------------------------- + open var label = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left $0.textStyle = .boldBodyLarge } - private var childLabel = Label().with { + open var childLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left $0.textStyle = .bodyLarge } - private var errorLabel = Label().with { + open var errorLabel = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.textPosition = .left $0.textStyle = .bodyMedium } - //-------------------------------------------------- - // MARK: - Public Properties - //-------------------------------------------------- public var selectorView = UIView().with { $0.translatesAutoresizingMaskIntoConstraints = false } diff --git a/VDS/Components/TextFields/EntryField/EntryField.swift b/VDS/Components/TextFields/EntryField/EntryField.swift index e4d4b9fd..5e500b9a 100644 --- a/VDS/Components/TextFields/EntryField/EntryField.swift +++ b/VDS/Components/TextFields/EntryField/EntryField.swift @@ -45,26 +45,7 @@ open class EntryField: Control, Accessable { $0.distribution = .fill } }() - - internal var titleLabel = Label().with { - $0.setContentCompressionResistancePriority(.required, for: .vertical) - $0.attributes = [] - $0.textPosition = .left - $0.textStyle = .bodySmall - } - - internal var errorLabel = Label().with { - $0.setContentCompressionResistancePriority(.required, for: .vertical) - $0.textPosition = .left - $0.textStyle = .bodySmall - } - - internal var helperLabel = Label().with { - $0.setContentCompressionResistancePriority(.required, for: .vertical) - $0.textPosition = .left - $0.textStyle = .bodySmall - } - + internal var containerView: UIView = { return UIView().with { $0.translatesAutoresizingMaskIntoConstraints = false @@ -85,13 +66,7 @@ open class EntryField: Control, Accessable { $0.translatesAutoresizingMaskIntoConstraints = false } }() - - - internal var tooltipView: UIView? - internal var icon: Icon = Icon().with { - $0.size = .small - } - + //-------------------------------------------------- // MARK: - Configuration Properties //-------------------------------------------------- @@ -123,6 +98,30 @@ open class EntryField: Control, Accessable { //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- + open var titleLabel = Label().with { + $0.setContentCompressionResistancePriority(.required, for: .vertical) + $0.attributes = [] + $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 + } + + open var tooltipView: UIView? + open var icon: Icon = Icon().with { + $0.size = .small + } + open var labelText: String? { didSet { didChange() }} open var helperText: String? { didSet { didChange() }} diff --git a/VDS/Components/Tilelet/Tilelet.swift b/VDS/Components/Tilelet/Tilelet.swift index 8ad347e8..dd35a951 100644 --- a/VDS/Components/Tilelet/Tilelet.swift +++ b/VDS/Components/Tilelet/Tilelet.swift @@ -50,8 +50,20 @@ open class Tilelet: TileContainer { private var titleLockupContainerView = UIView().with { $0.translatesAutoresizingMaskIntoConstraints = false } - - private var titleLockup = TitleLockup().with { + + private var badgeContainerView = UIView().with { + $0.translatesAutoresizingMaskIntoConstraints = false + } + + private let iconContainerView = UIView().with { + $0.translatesAutoresizingMaskIntoConstraints = false + $0.backgroundColor = .clear + } + + //-------------------------------------------------- + // MARK: - Public Properties + //-------------------------------------------------- + open var titleLockup = TitleLockup().with { let configs = [ TextStyle.DeviceSpacingConfig([.titleSmall, .boldTitleSmall], neighboring: [ @@ -113,28 +125,16 @@ open class Tilelet: TileContainer { $0.bottomTextStyleSpacingConfig = TextStyle.SpacingConfig(configs: configs) } - private var badgeContainerView = UIView().with { - $0.translatesAutoresizingMaskIntoConstraints = false - } - - private var badge = Badge().with { + open var badge = Badge().with { $0.fillColor = .red } - private let iconContainerView = UIView().with { - $0.translatesAutoresizingMaskIntoConstraints = false - $0.backgroundColor = .clear - } + open var descriptiveIcon = Icon() - private var descriptiveIcon = Icon() - private var directionalIcon = Icon().with { + open var directionalIcon = Icon().with { $0.name = .rightArrow } - //-------------------------------------------------- - // MARK: - Public Properties - //-------------------------------------------------- - //style private var _textWidth: CGFloat? open var textWidth: CGFloat? { get { _textWidth } diff --git a/VDS/Components/Toggle/Toggle.swift b/VDS/Components/Toggle/Toggle.swift index e490d456..6af7354d 100644 --- a/VDS/Components/Toggle/Toggle.swift +++ b/VDS/Components/Toggle/Toggle.swift @@ -68,11 +68,7 @@ open class ToggleBase: Control, Accessable, DataTrackable { $0.axis = .horizontal $0.distribution = .fill } - - private var label = Label().with { - $0.setContentCompressionResistancePriority(.required, for: .vertical) - } - + private var toggleView = UIView().with { $0.translatesAutoresizingMaskIntoConstraints = false } @@ -121,6 +117,10 @@ open class ToggleBase: Control, Accessable, DataTrackable { //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- + open var label = Label().with { + $0.setContentCompressionResistancePriority(.required, for: .vertical) + } + open var isOn: Bool { get { isSelected } set {