ewnsure comments marks are in the correct order and naming convention
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
fe54617a07
commit
f398dcf9a8
@ -41,7 +41,6 @@ open class Line: View {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open var style: Style = .primary { didSet { setNeedsUpdate() } }
|
open var style: Style = .primary { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
open var orientation: Orientation = .horizontal { didSet { setNeedsUpdate() } }
|
open var orientation: Orientation = .horizontal { didSet { setNeedsUpdate() } }
|
||||||
|
|||||||
@ -54,7 +54,7 @@ open class Loader: View {
|
|||||||
open override var intrinsicContentSize: CGSize { .init(width: size, height: size) }
|
open override var intrinsicContentSize: CGSize { .init(width: size, height: size) }
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
@ -86,10 +86,10 @@ open class Loader: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Animation
|
// MARK: - Private Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private let rotationLayerName = "rotationAnimation"
|
private let rotationLayerName = "rotationAnimation"
|
||||||
func startAnimating() {
|
private func startAnimating() {
|
||||||
icon.layer.remove(layerName: rotationLayerName)
|
icon.layer.remove(layerName: rotationLayerName)
|
||||||
let rotation : CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
|
let rotation : CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
|
||||||
rotation.toValue = NSNumber(value: Double.pi * 2)
|
rotation.toValue = NSNumber(value: Double.pi * 2)
|
||||||
@ -99,7 +99,7 @@ open class Loader: View {
|
|||||||
icon.layer.add(rotation, forKey: rotationLayerName)
|
icon.layer.add(rotation, forKey: rotationLayerName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func stopAnimating() {
|
private func stopAnimating() {
|
||||||
icon.layer.removeAnimation(forKey: rotationLayerName)
|
icon.layer.removeAnimation(forKey: rotationLayerName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,6 @@ open class Notification: View {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Enums
|
// MARK: - Enums
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public enum Style: String, CaseIterable {
|
public enum Style: String, CaseIterable {
|
||||||
case info, success, warning, error
|
case info, success, warning, error
|
||||||
|
|
||||||
@ -57,7 +56,6 @@ open class Notification: View {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private var mainStackView = UIStackView().with {
|
private var mainStackView = UIStackView().with {
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
$0.alignment = .top
|
$0.alignment = .top
|
||||||
@ -100,11 +98,13 @@ open class Notification: View {
|
|||||||
return fullBleed ? 1272 : 1232
|
return fullBleed ? 1272 : 1232
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal var onCloseSubscriber: AnyCancellable?
|
||||||
|
|
||||||
private var maxWidthConstraint: NSLayoutConstraint?
|
private var maxWidthConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
open var leadingConstraint: NSLayoutConstraint?
|
private var leadingConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
open var trailingConstraint: NSLayoutConstraint?
|
private var trailingConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
@ -163,11 +163,7 @@ open class Notification: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal var onCloseSubscriber: AnyCancellable?
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Properties
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
open var hideCloseButton: Bool = false { didSet{setNeedsUpdate()}}
|
open var hideCloseButton: Bool = false { didSet{setNeedsUpdate()}}
|
||||||
|
|
||||||
open var type: Style = .info { didSet{setNeedsUpdate()}}
|
open var type: Style = .info { didSet{setNeedsUpdate()}}
|
||||||
@ -203,9 +199,8 @@ open class Notification: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
@ -276,6 +271,9 @@ open class Notification: View {
|
|||||||
setConstraints()
|
setConstraints()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Private Methods
|
||||||
|
//--------------------------------------------------
|
||||||
private func updateIcons() {
|
private func updateIcons() {
|
||||||
let iconColor = surface == .dark ? VDSColor.paletteWhite : VDSColor.paletteBlack
|
let iconColor = surface == .dark ? VDSColor.paletteWhite : VDSColor.paletteBlack
|
||||||
typeIcon.name = type.styleIconName()
|
typeIcon.name = type.styleIconName()
|
||||||
|
|||||||
@ -26,6 +26,16 @@ open class RadioBoxGroup: SelectorGroupSelectedHandlerBase<RadioBoxItem> {
|
|||||||
super.init(coder: coder)
|
super.init(coder: coder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Private Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
private var mainStackView: UIStackView = {
|
||||||
|
return UIStackView().with {
|
||||||
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
$0.spacing = VDSLayout.Spacing.space3X.value
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -67,16 +77,6 @@ open class RadioBoxGroup: SelectorGroupSelectedHandlerBase<RadioBoxItem> {
|
|||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Private Properties
|
|
||||||
//--------------------------------------------------
|
|
||||||
private var mainStackView: UIStackView = {
|
|
||||||
return UIStackView().with {
|
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
$0.spacing = VDSLayout.Spacing.space3X.value
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
|
|||||||
@ -154,7 +154,7 @@ open class RadioBoxItem: Control, Changeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Executed on initialization for this View.
|
/// Executed on initialization for this View.
|
||||||
open override func initialSetup() {
|
open override func initialSetup() {
|
||||||
@ -185,47 +185,7 @@ open class RadioBoxItem: Control, Changeable {
|
|||||||
selectorView.pinToSuperView()
|
selectorView.pinToSuperView()
|
||||||
mainStackView.pinToSuperView(.init(top: 16, left: 16, bottom: 16, right: 16))
|
mainStackView.pinToSuperView(.init(top: 16, left: 16, bottom: 16, right: 16))
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateLabels() {
|
|
||||||
|
|
||||||
//add the stackview to hold the 2 labels
|
|
||||||
//text label
|
|
||||||
textLabel.text = text
|
|
||||||
textLabel.surface = surface
|
|
||||||
textLabel.isEnabled = isEnabled
|
|
||||||
textLabel.attributes = textAttributes
|
|
||||||
|
|
||||||
//subText label
|
|
||||||
if let subText {
|
|
||||||
subTextLabel.text = subText
|
|
||||||
subTextLabel.surface = surface
|
|
||||||
subTextLabel.isEnabled = isEnabled
|
|
||||||
subTextLabel.attributes = subTextAttributes
|
|
||||||
subTextLabel.isHidden = false
|
|
||||||
|
|
||||||
} else if subTextAttributedText != nil {
|
|
||||||
subTextLabel.isHidden = false
|
|
||||||
|
|
||||||
} else {
|
|
||||||
subTextLabel.isHidden = true
|
|
||||||
}
|
|
||||||
|
|
||||||
//subTextRight label
|
|
||||||
if let subTextRight {
|
|
||||||
subTextRightLabel.text = subTextRight
|
|
||||||
subTextRightLabel.surface = surface
|
|
||||||
subTextRightLabel.isEnabled = isEnabled
|
|
||||||
subTextRightLabel.attributes = subTextRightAttributes
|
|
||||||
subTextRightLabel.isHidden = false
|
|
||||||
|
|
||||||
} else if subTextAttributedText != nil {
|
|
||||||
subTextRightLabel.isHidden = false
|
|
||||||
|
|
||||||
} else {
|
|
||||||
subTextRightLabel.isHidden = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Resets to default settings.
|
/// Resets to default settings.
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
@ -281,6 +241,49 @@ open class RadioBoxItem: Control, Changeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Private Methods
|
||||||
|
//--------------------------------------------------
|
||||||
|
func updateLabels() {
|
||||||
|
|
||||||
|
//add the stackview to hold the 2 labels
|
||||||
|
//text label
|
||||||
|
textLabel.text = text
|
||||||
|
textLabel.surface = surface
|
||||||
|
textLabel.isEnabled = isEnabled
|
||||||
|
textLabel.attributes = textAttributes
|
||||||
|
|
||||||
|
//subText label
|
||||||
|
if let subText {
|
||||||
|
subTextLabel.text = subText
|
||||||
|
subTextLabel.surface = surface
|
||||||
|
subTextLabel.isEnabled = isEnabled
|
||||||
|
subTextLabel.attributes = subTextAttributes
|
||||||
|
subTextLabel.isHidden = false
|
||||||
|
|
||||||
|
} else if subTextAttributedText != nil {
|
||||||
|
subTextLabel.isHidden = false
|
||||||
|
|
||||||
|
} else {
|
||||||
|
subTextLabel.isHidden = true
|
||||||
|
}
|
||||||
|
|
||||||
|
//subTextRight label
|
||||||
|
if let subTextRight {
|
||||||
|
subTextRightLabel.text = subTextRight
|
||||||
|
subTextRightLabel.surface = surface
|
||||||
|
subTextRightLabel.isEnabled = isEnabled
|
||||||
|
subTextRightLabel.attributes = subTextRightAttributes
|
||||||
|
subTextRightLabel.isHidden = false
|
||||||
|
|
||||||
|
} else if subTextAttributedText != nil {
|
||||||
|
subTextRightLabel.isHidden = false
|
||||||
|
|
||||||
|
} else {
|
||||||
|
subTextRightLabel.isHidden = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - RadioBox View Updates
|
// MARK: - RadioBox View Updates
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -26,6 +26,19 @@ open class RadioButtonGroup: SelectorGroupSelectedHandlerBase<RadioButtonItem> {
|
|||||||
super.init(coder: coder)
|
super.init(coder: coder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Private Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
private var mainStackView: UIStackView = {
|
||||||
|
return UIStackView().with {
|
||||||
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
$0.alignment = .fill
|
||||||
|
$0.distribution = .fill
|
||||||
|
$0.axis = .vertical
|
||||||
|
$0.spacing = VDSLayout.Spacing.space6X.value
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -85,19 +98,6 @@ open class RadioButtonGroup: SelectorGroupSelectedHandlerBase<RadioButtonItem> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Private Properties
|
|
||||||
//--------------------------------------------------
|
|
||||||
private var mainStackView: UIStackView = {
|
|
||||||
return UIStackView().with {
|
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
$0.alignment = .fill
|
|
||||||
$0.distribution = .fill
|
|
||||||
$0.axis = .vertical
|
|
||||||
$0.spacing = VDSLayout.Spacing.space6X.value
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -72,7 +72,7 @@ open class RadioSwatch: Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Executed on initialization for this View.
|
/// Executed on initialization for this View.
|
||||||
open override func initialSetup() {
|
open override func initialSetup() {
|
||||||
@ -140,21 +140,6 @@ open class RadioSwatch: Control {
|
|||||||
accessibilityLabel = text
|
accessibilityLabel = text
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - RadioBox View Updates
|
|
||||||
//--------------------------------------------------
|
|
||||||
/// Manages the appearance of the radioSwatch.
|
|
||||||
|
|
||||||
private var shapeLayer: CAShapeLayer?
|
|
||||||
private var gradientLayer: CAGradientLayer?
|
|
||||||
|
|
||||||
open func getSelectorSize() -> CGSize {
|
|
||||||
return swatchSize
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Overrides
|
|
||||||
//--------------------------------------------------
|
|
||||||
open override func layoutSubviews() {
|
open override func layoutSubviews() {
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
// Accounts for any size changes
|
// Accounts for any size changes
|
||||||
@ -228,6 +213,18 @@ open class RadioSwatch: Control {
|
|||||||
selectorView.layer.addSublayer(strikeThrough)
|
selectorView.layer.addSublayer(strikeThrough)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - RadioBox View Updates
|
||||||
|
//--------------------------------------------------
|
||||||
|
/// Manages the appearance of the radioSwatch.
|
||||||
|
|
||||||
|
private var shapeLayer: CAShapeLayer?
|
||||||
|
private var gradientLayer: CAGradientLayer?
|
||||||
|
|
||||||
|
open func getSelectorSize() -> CGSize {
|
||||||
|
return swatchSize
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension UIImage {
|
extension UIImage {
|
||||||
|
|||||||
@ -27,6 +27,31 @@ open class RadioSwatchGroup: SelectorGroupSelectedHandlerBase<RadioSwatch>, UICo
|
|||||||
super.init(coder: coder)
|
super.init(coder: coder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Private Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
open var label = Label()
|
||||||
|
private let cellSize: CGFloat = 48.0
|
||||||
|
private let labelSpacing: CGFloat = 24.0
|
||||||
|
private let labelHeight: CGFloat = 16.0
|
||||||
|
private let lineSpacing: CGFloat = 12.0
|
||||||
|
private let itemSpacing: CGFloat = 16.0
|
||||||
|
|
||||||
|
fileprivate lazy var collectionView: SelfSizingCollectionView = {
|
||||||
|
let layout = UICollectionViewFlowLayout().with {
|
||||||
|
$0.minimumLineSpacing = lineSpacing
|
||||||
|
$0.minimumInteritemSpacing = itemSpacing
|
||||||
|
}
|
||||||
|
return SelfSizingCollectionView(frame: .zero, collectionViewLayout: layout).with {
|
||||||
|
$0.backgroundColor = .clear
|
||||||
|
$0.showsHorizontalScrollIndicator = false
|
||||||
|
$0.showsVerticalScrollIndicator = false
|
||||||
|
$0.isScrollEnabled = false
|
||||||
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
$0.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "collectionViewCell")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -57,31 +82,6 @@ open class RadioSwatchGroup: SelectorGroupSelectedHandlerBase<RadioSwatch>, UICo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Private Properties
|
|
||||||
//--------------------------------------------------
|
|
||||||
open var label = Label()
|
|
||||||
private let cellSize: CGFloat = 48.0
|
|
||||||
private let labelSpacing: CGFloat = 24.0
|
|
||||||
private let labelHeight: CGFloat = 16.0
|
|
||||||
private let lineSpacing: CGFloat = 12.0
|
|
||||||
private let itemSpacing: CGFloat = 16.0
|
|
||||||
|
|
||||||
fileprivate lazy var collectionView: SelfSizingCollectionView = {
|
|
||||||
let layout = UICollectionViewFlowLayout().with {
|
|
||||||
$0.minimumLineSpacing = lineSpacing
|
|
||||||
$0.minimumInteritemSpacing = itemSpacing
|
|
||||||
}
|
|
||||||
return SelfSizingCollectionView(frame: .zero, collectionViewLayout: layout).with {
|
|
||||||
$0.backgroundColor = .clear
|
|
||||||
$0.showsHorizontalScrollIndicator = false
|
|
||||||
$0.showsVerticalScrollIndicator = false
|
|
||||||
$0.isScrollEnabled = false
|
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
$0.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "collectionViewCell")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
|
|||||||
@ -28,7 +28,27 @@ extension Tabs {
|
|||||||
public required init?(coder: NSCoder) {
|
public required init?(coder: NSCoder) {
|
||||||
super.init(coder: coder)
|
super.init(coder: coder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Private Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
/// TextStyle used on the label.
|
||||||
|
private var textStyle: TextStyle {
|
||||||
|
if size == .medium {
|
||||||
|
return .boldBodyLarge
|
||||||
|
} else {
|
||||||
|
//specs show that the font size shouldn't change however boldTitleSmall does
|
||||||
|
//change point size between iPad/iPhone. This is a "fix" so each device will
|
||||||
|
//load the correct pointSize
|
||||||
|
return UIDevice.isIPad ? .boldTitleSmall : .boldTitleMedium
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var labelWidthConstraint: NSLayoutConstraint?
|
||||||
|
private var labelLeadingConstraint: NSLayoutConstraint?
|
||||||
|
private var labelTopConstraint: NSLayoutConstraint?
|
||||||
|
private var labelBottomConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -53,36 +73,16 @@ extension Tabs {
|
|||||||
|
|
||||||
///Sets the Position of the Selected/Hover Border Accent for All Tabs.
|
///Sets the Position of the Selected/Hover Border Accent for All Tabs.
|
||||||
open var indicatorPosition: Tabs.IndicatorPosition = .bottom { didSet { setNeedsUpdate() } }
|
open var indicatorPosition: Tabs.IndicatorPosition = .bottom { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
///If provided, it will set fixed width for this Tab.
|
///If provided, it will set fixed width for this Tab.
|
||||||
open var width: CGFloat? { didSet { setNeedsUpdate() } }
|
open var width: CGFloat? { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
///The text label of the tab.
|
///The text label of the tab.
|
||||||
open var text: String = "Tab" { didSet { setNeedsUpdate() } }
|
open var text: String = "Tab" { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
///Minimum width for the tab
|
///Minimum width for the tab
|
||||||
open var minWidth: CGFloat = 44.0 { didSet { setNeedsUpdate() } }
|
open var minWidth: CGFloat = 44.0 { didSet { setNeedsUpdate() } }
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Private Properties
|
|
||||||
//--------------------------------------------------
|
|
||||||
/// TextStyle used on the label.
|
|
||||||
private var textStyle: TextStyle {
|
|
||||||
if size == .medium {
|
|
||||||
return .boldBodyLarge
|
|
||||||
} else {
|
|
||||||
//specs show that the font size shouldn't change however boldTitleSmall does
|
|
||||||
//change point size between iPad/iPhone. This is a "fix" so each device will
|
|
||||||
//load the correct pointSize
|
|
||||||
return UIDevice.isIPad ? .boldTitleSmall : .boldTitleMedium
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var labelWidthConstraint: NSLayoutConstraint?
|
|
||||||
private var labelLeadingConstraint: NSLayoutConstraint?
|
|
||||||
private var labelTopConstraint: NSLayoutConstraint?
|
|
||||||
private var labelBottomConstraint: NSLayoutConstraint?
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Configuration
|
// MARK: - Configuration
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -111,7 +111,7 @@ extension Tabs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private let layoutGuide = UILayoutGuide()
|
private let layoutGuide = UILayoutGuide()
|
||||||
|
|
||||||
private func updateWidth() {
|
private func updateWidth() {
|
||||||
labelWidthConstraint?.isActive = false
|
labelWidthConstraint?.isActive = false
|
||||||
guard let width, width > minWidth else { return }
|
guard let width, width > minWidth else { return }
|
||||||
@ -122,13 +122,12 @@ extension Tabs {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
|
||||||
canHighlight = false
|
canHighlight = false
|
||||||
|
|
||||||
addLayoutGuide(layoutGuide)
|
addLayoutGuide(layoutGuide)
|
||||||
addSubview(label)
|
addSubview(label)
|
||||||
accessibilityTraits = .button
|
accessibilityTraits = .button
|
||||||
@ -136,10 +135,10 @@ extension Tabs {
|
|||||||
|
|
||||||
//pin layoutguide
|
//pin layoutguide
|
||||||
layoutGuide.pinToSuperView()
|
layoutGuide.pinToSuperView()
|
||||||
|
|
||||||
//pin trailing
|
//pin trailing
|
||||||
label.pinTrailing(layoutGuide.trailingAnchor)
|
label.pinTrailing(layoutGuide.trailingAnchor)
|
||||||
|
|
||||||
//setup constraints
|
//setup constraints
|
||||||
labelWidthConstraint = layoutGuide.width(constant: 0).with { $0.isActive = false }
|
labelWidthConstraint = layoutGuide.width(constant: 0).with { $0.isActive = false }
|
||||||
layoutGuide.widthGreaterThanEqualTo(minWidth)
|
layoutGuide.widthGreaterThanEqualTo(minWidth)
|
||||||
@ -153,7 +152,7 @@ extension Tabs {
|
|||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
guard !text.isEmpty else { return }
|
guard !text.isEmpty else { return }
|
||||||
|
|
||||||
accessibilityIdentifier = "VDSTab:\(text)"
|
accessibilityIdentifier = "VDSTab:\(text)"
|
||||||
|
|
||||||
//constaints
|
//constaints
|
||||||
@ -161,7 +160,7 @@ extension Tabs {
|
|||||||
labelLeadingConstraint?.constant = leadingSpace
|
labelLeadingConstraint?.constant = leadingSpace
|
||||||
labelTopConstraint?.constant = otherSpace
|
labelTopConstraint?.constant = otherSpace
|
||||||
labelBottomConstraint?.constant = -otherSpace
|
labelBottomConstraint?.constant = -otherSpace
|
||||||
|
|
||||||
//label properties
|
//label properties
|
||||||
label.text = text
|
label.text = text
|
||||||
label.surface = surface
|
label.surface = surface
|
||||||
@ -181,7 +180,7 @@ extension Tabs {
|
|||||||
|
|
||||||
open override func layoutSubviews() {
|
open override func layoutSubviews() {
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
|
|
||||||
removeBorders()
|
removeBorders()
|
||||||
|
|
||||||
if isSelected {
|
if isSelected {
|
||||||
|
|||||||
@ -31,7 +31,6 @@ open class Tabs: View {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Enums
|
// MARK: - Enums
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
/// Layout Axis of the Tabs
|
/// Layout Axis of the Tabs
|
||||||
public enum Orientation: String, CaseIterable{
|
public enum Orientation: String, CaseIterable{
|
||||||
case vertical
|
case vertical
|
||||||
@ -64,11 +63,27 @@ open class Tabs: View {
|
|||||||
case large
|
case large
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Private Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
private var tabStackView = UIStackView()
|
||||||
|
private var scrollView = UIScrollView()
|
||||||
|
private var contentView = View()
|
||||||
|
private var borderlineView = View()
|
||||||
|
private let borderlineSize = 1.0
|
||||||
|
private var borderlineColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsLowcontrastOnlight, VDSColor.elementsLowcontrastOndark)
|
||||||
|
private var borderlineViewLeadingConstraint: NSLayoutConstraint?
|
||||||
|
private var borderlineViewTrailingConstraint: NSLayoutConstraint?
|
||||||
|
private var borderlineViewTopConstraint: NSLayoutConstraint?
|
||||||
|
private var borderlineViewBottomConstraint: NSLayoutConstraint?
|
||||||
|
private var borderlineViewHeightConstraint: NSLayoutConstraint?
|
||||||
|
private var borderlineViewWidthConstraint: NSLayoutConstraint?
|
||||||
|
private var contentViewWidthConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
///An
|
/// A callback when the selectedIndex changes. Passes parameters (event, tabIndex).
|
||||||
/// callback that is called when the selectedIndex changes. Passes parameters (event, tabIndex).
|
|
||||||
open var onTabChange: ((Int) -> Void)?
|
open var onTabChange: ((Int) -> Void)?
|
||||||
|
|
||||||
//Determines the layout of the Tabs, defaults to horizontal
|
//Determines the layout of the Tabs, defaults to horizontal
|
||||||
@ -106,23 +121,6 @@ open class Tabs: View {
|
|||||||
|
|
||||||
open var tabViews: [Tab] = []
|
open var tabViews: [Tab] = []
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Private Properties
|
|
||||||
//--------------------------------------------------
|
|
||||||
private var tabStackView = UIStackView()
|
|
||||||
private var scrollView = UIScrollView()
|
|
||||||
private var contentView = View()
|
|
||||||
private var borderlineView = View()
|
|
||||||
private let borderlineSize = 1.0
|
|
||||||
private var borderlineColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsLowcontrastOnlight, VDSColor.elementsLowcontrastOndark)
|
|
||||||
private var borderlineViewLeadingConstraint: NSLayoutConstraint?
|
|
||||||
private var borderlineViewTrailingConstraint: NSLayoutConstraint?
|
|
||||||
private var borderlineViewTopConstraint: NSLayoutConstraint?
|
|
||||||
private var borderlineViewBottomConstraint: NSLayoutConstraint?
|
|
||||||
private var borderlineViewHeightConstraint: NSLayoutConstraint?
|
|
||||||
private var borderlineViewWidthConstraint: NSLayoutConstraint?
|
|
||||||
private var contentViewWidthConstraint: NSLayoutConstraint?
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Configuration Properties
|
// MARK: - Configuration Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -212,6 +210,11 @@ open class Tabs: View {
|
|||||||
updateBorderline()
|
updateBorderline()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func layoutSubviews() {
|
||||||
|
super.layoutSubviews()
|
||||||
|
updateContentView()
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Methods
|
// MARK: - Private Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -301,11 +304,6 @@ open class Tabs: View {
|
|||||||
scrollToSelectedIndex(animated: true)
|
scrollToSelectedIndex(animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func layoutSubviews() {
|
|
||||||
super.layoutSubviews()
|
|
||||||
updateContentView()
|
|
||||||
}
|
|
||||||
|
|
||||||
//update layout for borderline
|
//update layout for borderline
|
||||||
private func updateBorderline() {
|
private func updateBorderline() {
|
||||||
//borderLine
|
//borderLine
|
||||||
|
|||||||
@ -33,6 +33,28 @@ open class TabsContainer: View {
|
|||||||
case percentage(CGFloat)
|
case percentage(CGFloat)
|
||||||
case value(CGFloat)
|
case value(CGFloat)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Private Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
private var contentViewWidthConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
|
private var stackView = UIStackView().with {
|
||||||
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
$0.axis = .vertical
|
||||||
|
$0.alignment = .fill
|
||||||
|
$0.distribution = .fill
|
||||||
|
}
|
||||||
|
|
||||||
|
private var contentView = UIStackView().with {
|
||||||
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
$0.alignment = .fill
|
||||||
|
$0.distribution = .fillProportionally
|
||||||
|
$0.axis = .vertical
|
||||||
|
$0.spacing = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
private var tabMenuLayoutGuide = UILayoutGuide()
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
@ -118,27 +140,8 @@ open class TabsContainer: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private var contentViewWidthConstraint: NSLayoutConstraint?
|
|
||||||
|
|
||||||
private var stackView = UIStackView().with {
|
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
$0.axis = .vertical
|
|
||||||
$0.alignment = .fill
|
|
||||||
$0.distribution = .fill
|
|
||||||
}
|
|
||||||
|
|
||||||
private var contentView = UIStackView().with {
|
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
$0.alignment = .fill
|
|
||||||
$0.distribution = .fillProportionally
|
|
||||||
$0.axis = .vertical
|
|
||||||
$0.spacing = 10
|
|
||||||
}
|
|
||||||
|
|
||||||
private var tabMenuLayoutGuide = UILayoutGuide()
|
|
||||||
|
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
|||||||
@ -178,7 +178,7 @@ open class EntryField: Control, Changeable {
|
|||||||
internal var widthConstraint: NSLayoutConstraint?
|
internal var widthConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
@ -226,11 +226,7 @@ open class EntryField: Control, Changeable {
|
|||||||
errorLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
|
errorLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
|
||||||
helperLabel.textColorConfiguration = secondaryColorConfiguration.eraseToAnyColorable()
|
helperLabel.textColorConfiguration = secondaryColorConfiguration.eraseToAnyColorable()
|
||||||
}
|
}
|
||||||
|
|
||||||
open func getContainer() -> UIView {
|
|
||||||
return containerView
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Resets to default settings.
|
/// Resets to default settings.
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
@ -277,6 +273,13 @@ open class EntryField: Control, Changeable {
|
|||||||
backgroundColor = surface.color
|
backgroundColor = surface.color
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Public Methods
|
||||||
|
//--------------------------------------------------
|
||||||
|
open func getContainer() -> UIView {
|
||||||
|
return containerView
|
||||||
|
}
|
||||||
|
|
||||||
open func updateTitleLabel() {
|
open func updateTitleLabel() {
|
||||||
|
|
||||||
//update the local vars for the label since we no
|
//update the local vars for the label since we no
|
||||||
|
|||||||
@ -47,11 +47,28 @@ open class InputField: EntryField, UITextFieldDelegate {
|
|||||||
$0.spacing = 12
|
$0.spacing = 12
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
open var textFieldTextColorConfiguration: AnyColorable = ViewColorConfiguration().with {
|
||||||
|
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
|
||||||
|
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
|
||||||
|
}.eraseToAnyColorable()
|
||||||
|
|
||||||
|
internal var minWidthConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
open var successLabel = Label().with {
|
||||||
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
|
$0.textPosition = .left
|
||||||
|
$0.textStyle = .bodySmall
|
||||||
|
}
|
||||||
|
|
||||||
|
open var textField = UITextField().with {
|
||||||
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
$0.font = TextStyle.bodyLarge.font
|
||||||
|
}
|
||||||
|
|
||||||
open var type: FieldType = .text { didSet { setNeedsUpdate() }}
|
open var type: FieldType = .text { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
var _showError: Bool = false
|
var _showError: Bool = false
|
||||||
@ -91,27 +108,6 @@ open class InputField: EntryField, UITextFieldDelegate {
|
|||||||
|
|
||||||
open var helperTextPlacement: HelperTextPlacement = .bottom { didSet { setNeedsUpdate() }}
|
open var helperTextPlacement: HelperTextPlacement = .bottom { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Private Properties
|
|
||||||
//--------------------------------------------------
|
|
||||||
private var successLabel = Label().with {
|
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
|
||||||
$0.textPosition = .left
|
|
||||||
$0.textStyle = .bodySmall
|
|
||||||
}
|
|
||||||
|
|
||||||
private var textField = UITextField().with {
|
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
$0.font = TextStyle.bodyLarge.font
|
|
||||||
}
|
|
||||||
|
|
||||||
open var textFieldTextColorConfiguration: AnyColorable = ViewColorConfiguration().with {
|
|
||||||
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true)
|
|
||||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false)
|
|
||||||
}.eraseToAnyColorable()
|
|
||||||
|
|
||||||
internal var minWidthConstraint: NSLayoutConstraint?
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -62,7 +62,7 @@ open class TextArea: EntryField {
|
|||||||
internal var textViewHeightConstraint: NSLayoutConstraint?
|
internal var textViewHeightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
|
|||||||
@ -74,6 +74,15 @@ open class TileContainer: Control {
|
|||||||
case none
|
case none
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Private Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
private var backgroundImageView = UIImageView().with {
|
||||||
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
$0.contentMode = .scaleAspectFill
|
||||||
|
$0.clipsToBounds = true
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -124,16 +133,7 @@ open class TileContainer: Control {
|
|||||||
open var showBorder: Bool = false { didSet{ setNeedsUpdate() } }
|
open var showBorder: Bool = false { didSet{ setNeedsUpdate() } }
|
||||||
|
|
||||||
open var showDropShadows: Bool = false { didSet{ setNeedsUpdate() } }
|
open var showDropShadows: Bool = false { didSet{ setNeedsUpdate() } }
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Private Properties
|
|
||||||
//--------------------------------------------------
|
|
||||||
private var backgroundImageView = UIImageView().with {
|
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
$0.contentMode = .scaleAspectFill
|
|
||||||
$0.clipsToBounds = true
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Constraints
|
// MARK: - Constraints
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -146,9 +146,30 @@ open class TileContainer: Control {
|
|||||||
internal var containerTrailingConstraint: NSLayoutConstraint?
|
internal var containerTrailingConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Configuration
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
private let cornerRadius = VDSFormControls.borderradius * 2
|
||||||
|
|
||||||
|
private var backgroundColorConfiguration = BackgroundColorConfiguration()
|
||||||
|
|
||||||
|
private var borderColorConfiguration = SurfaceColorConfiguration().with {
|
||||||
|
$0.lightColor = VDSColor.elementsLowcontrastOnlight
|
||||||
|
$0.darkColor = VDSColor.elementsLowcontrastOndark
|
||||||
|
}
|
||||||
|
|
||||||
|
private var imageFallbackColorConfiguration = SurfaceColorConfiguration().with {
|
||||||
|
$0.lightColor = VDSColor.backgroundPrimaryLight
|
||||||
|
$0.darkColor = VDSColor.backgroundPrimaryDark
|
||||||
|
}
|
||||||
|
|
||||||
|
private var hightLightViewColorConfiguration = SurfaceColorConfiguration().with {
|
||||||
|
$0.lightColor = VDSColor.paletteWhite.withAlphaComponent(0.3)
|
||||||
|
$0.darkColor = VDSColor.paletteBlack.withAlphaComponent(0.3)
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Overrides
|
||||||
|
//--------------------------------------------------
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
@ -248,7 +269,7 @@ open class TileContainer: Control {
|
|||||||
heightConstraint?.isActive = false
|
heightConstraint?.isActive = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Methods
|
// MARK: - Public Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -258,28 +279,6 @@ open class TileContainer: Control {
|
|||||||
view.pinToSuperView()
|
view.pinToSuperView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Configuration
|
|
||||||
//--------------------------------------------------
|
|
||||||
private let cornerRadius = VDSFormControls.borderradius * 2
|
|
||||||
|
|
||||||
private var backgroundColorConfiguration = BackgroundColorConfiguration()
|
|
||||||
|
|
||||||
private var borderColorConfiguration = SurfaceColorConfiguration().with {
|
|
||||||
$0.lightColor = VDSColor.elementsLowcontrastOnlight
|
|
||||||
$0.darkColor = VDSColor.elementsLowcontrastOndark
|
|
||||||
}
|
|
||||||
|
|
||||||
private var imageFallbackColorConfiguration = SurfaceColorConfiguration().with {
|
|
||||||
$0.lightColor = VDSColor.backgroundPrimaryLight
|
|
||||||
$0.darkColor = VDSColor.backgroundPrimaryDark
|
|
||||||
}
|
|
||||||
|
|
||||||
private var hightLightViewColorConfiguration = SurfaceColorConfiguration().with {
|
|
||||||
$0.lightColor = VDSColor.paletteWhite.withAlphaComponent(0.3)
|
|
||||||
$0.darkColor = VDSColor.paletteBlack.withAlphaComponent(0.3)
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Methods
|
// MARK: - Private Methods
|
||||||
|
|||||||
@ -196,9 +196,8 @@ open class Tilelet: TileContainer {
|
|||||||
internal var titleLockupTrailingConstraint: NSLayoutConstraint?
|
internal var titleLockupTrailingConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
@ -256,7 +255,28 @@ open class Tilelet: TileContainer {
|
|||||||
setNeedsUpdate()
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func updateBadge() {
|
/// Used to make changes to the View based off a change events or from local properties.
|
||||||
|
open override func updateView() {
|
||||||
|
super.updateView()
|
||||||
|
|
||||||
|
updateBadge()
|
||||||
|
updateTitleLockup()
|
||||||
|
updateIcons()
|
||||||
|
|
||||||
|
layoutIfNeeded()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Used to update any Accessibility properties.
|
||||||
|
open override func updateAccessibility() {
|
||||||
|
super.updateAccessibility()
|
||||||
|
|
||||||
|
setAccessibilityLabel(for: [badge.label, titleLockup.eyebrowLabel, titleLockup.titleLabel, titleLockup.subTitleLabel])
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Private Methods
|
||||||
|
//--------------------------------------------------
|
||||||
|
private func updateBadge() {
|
||||||
if let badgeModel {
|
if let badgeModel {
|
||||||
badge.text = badgeModel.text
|
badge.text = badgeModel.text
|
||||||
badge.fillColor = badgeModel.fillColor
|
badge.fillColor = badgeModel.fillColor
|
||||||
@ -272,7 +292,7 @@ open class Tilelet: TileContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func updateTitleLockup() {
|
private func updateTitleLockup() {
|
||||||
|
|
||||||
var showTitleLockup = false
|
var showTitleLockup = false
|
||||||
|
|
||||||
@ -325,7 +345,7 @@ open class Tilelet: TileContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func updateIcons() {
|
private func updateIcons() {
|
||||||
//icons
|
//icons
|
||||||
var showIconContainerView = false
|
var showIconContainerView = false
|
||||||
if let descriptiveIconModel {
|
if let descriptiveIconModel {
|
||||||
@ -365,24 +385,6 @@ open class Tilelet: TileContainer {
|
|||||||
removeFromSuperview(iconContainerView)
|
removeFromSuperview(iconContainerView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used to make changes to the View based off a change events or from local properties.
|
|
||||||
open override func updateView() {
|
|
||||||
super.updateView()
|
|
||||||
|
|
||||||
updateBadge()
|
|
||||||
updateTitleLockup()
|
|
||||||
updateIcons()
|
|
||||||
|
|
||||||
layoutIfNeeded()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Used to update any Accessibility properties.
|
|
||||||
open override func updateAccessibility() {
|
|
||||||
super.updateAccessibility()
|
|
||||||
|
|
||||||
setAccessibilityLabel(for: [badge.label, titleLockup.eyebrowLabel, titleLockup.titleLabel, titleLockup.subTitleLabel])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TileContainer.Padding {
|
extension TileContainer.Padding {
|
||||||
|
|||||||
@ -252,7 +252,7 @@ open class TitleLockup: View {
|
|||||||
private var textColorPrimaryConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark).eraseToAnyColorable()
|
private var textColorPrimaryConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark).eraseToAnyColorable()
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
|
|||||||
@ -51,7 +51,7 @@ open class Toggle: Control, Changeable {
|
|||||||
private var labelConstraints: [NSLayoutConstraint] = []
|
private var labelConstraints: [NSLayoutConstraint] = []
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Configuration Properties
|
// MARK: - Configuration
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private let toggleContainerSize = CGSize(width: 52, height: 44)
|
private let toggleContainerSize = CGSize(width: 52, height: 44)
|
||||||
private let spacingBetween = VDSLayout.Spacing.space3X.value
|
private let spacingBetween = VDSLayout.Spacing.space3X.value
|
||||||
@ -74,6 +74,13 @@ open class Toggle: Control, Changeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Private Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
private var showLabel: Bool {
|
||||||
|
showText && !statusText.isEmpty
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -238,12 +245,8 @@ open class Toggle: Control, Changeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Labels
|
// MARK: - Private Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private var showLabel: Bool {
|
|
||||||
showText && !statusText.isEmpty
|
|
||||||
}
|
|
||||||
|
|
||||||
private func updateLabel() {
|
private func updateLabel() {
|
||||||
label.isHidden = !showLabel
|
label.isHidden = !showLabel
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,6 @@ open class ToggleView: Control, Changeable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private var toggleView = UIView().with {
|
private var toggleView = UIView().with {
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
$0.isUserInteractionEnabled = false
|
$0.isUserInteractionEnabled = false
|
||||||
@ -189,6 +188,27 @@ open class ToggleView: Control, Changeable {
|
|||||||
isOn.toggle()
|
isOn.toggle()
|
||||||
sendActions(for: .valueChanged)
|
sendActions(for: .valueChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func layoutSubviews() {
|
||||||
|
super.layoutSubviews()
|
||||||
|
|
||||||
|
shadowLayer1.frame = knobView.bounds
|
||||||
|
shadowLayer2.frame = knobView.bounds
|
||||||
|
|
||||||
|
let shadowColor = isEnabled ? VDSColor.paletteBlack.cgColor : VDSColor.paletteGray95.cgColor
|
||||||
|
shadowLayer1.cornerRadius = knobView.layer.cornerRadius
|
||||||
|
shadowLayer1.shadowColor = shadowColor
|
||||||
|
shadowLayer1.shadowOpacity = isEnabled ? 0.24 : 0.1
|
||||||
|
shadowLayer1.shadowOffset = .init(width: 0, height: 1)
|
||||||
|
shadowLayer1.shadowRadius = isEnabled ? 5.0 : 10.0
|
||||||
|
|
||||||
|
shadowLayer2.cornerRadius = knobView.layer.cornerRadius
|
||||||
|
shadowLayer2.shadowColor = shadowColor
|
||||||
|
shadowLayer2.shadowOpacity = isEnabled ? 0.08 : 0.04
|
||||||
|
shadowLayer2.shadowOffset = .init(width: 0, height: 2)
|
||||||
|
shadowLayer2.shadowRadius = 2.0
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Functions
|
// MARK: - Private Functions
|
||||||
@ -231,27 +251,6 @@ open class ToggleView: Control, Changeable {
|
|||||||
}, completion: nil)
|
}, completion: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func layoutSubviews() {
|
|
||||||
super.layoutSubviews()
|
|
||||||
|
|
||||||
shadowLayer1.frame = knobView.bounds
|
|
||||||
shadowLayer2.frame = knobView.bounds
|
|
||||||
|
|
||||||
let shadowColor = isEnabled ? VDSColor.paletteBlack.cgColor : VDSColor.paletteGray95.cgColor
|
|
||||||
shadowLayer1.cornerRadius = knobView.layer.cornerRadius
|
|
||||||
shadowLayer1.shadowColor = shadowColor
|
|
||||||
shadowLayer1.shadowOpacity = isEnabled ? 0.24 : 0.1
|
|
||||||
shadowLayer1.shadowOffset = .init(width: 0, height: 1)
|
|
||||||
shadowLayer1.shadowRadius = isEnabled ? 5.0 : 10.0
|
|
||||||
|
|
||||||
shadowLayer2.cornerRadius = knobView.layer.cornerRadius
|
|
||||||
shadowLayer2.shadowColor = shadowColor
|
|
||||||
shadowLayer2.shadowOpacity = isEnabled ? 0.08 : 0.04
|
|
||||||
shadowLayer2.shadowOffset = .init(width: 0, height: 2)
|
|
||||||
shadowLayer2.shadowRadius = 2.0
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: AppleGuidlinesTouchable
|
// MARK: AppleGuidlinesTouchable
|
||||||
|
|||||||
@ -105,9 +105,8 @@ open class Tooltip: Control, TooltipLaunchable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
|||||||
@ -64,9 +64,6 @@ open class TooltipAlertViewController: UIViewController, Surfaceable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Lifecycle
|
|
||||||
//--------------------------------------------------
|
|
||||||
open func setup() {
|
open func setup() {
|
||||||
view.accessibilityElements = [tooltipDialog]
|
view.accessibilityElements = [tooltipDialog]
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,6 @@ open class TooltipDialog: View, UIScrollViewDelegate {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private var scrollView = UIScrollView().with {
|
private var scrollView = UIScrollView().with {
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
$0.backgroundColor = .clear
|
$0.backgroundColor = .clear
|
||||||
@ -46,6 +45,12 @@ open class TooltipDialog: View, UIScrollViewDelegate {
|
|||||||
instance.lineViewColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsLowcontrastOnlight, VDSColor.elementsLowcontrastOndark).eraseToAnyColorable()
|
instance.lineViewColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsLowcontrastOnlight, VDSColor.elementsLowcontrastOndark).eraseToAnyColorable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lazy var primaryAccessibilityElement = UIAccessibilityElement(accessibilityContainer: self).with {
|
||||||
|
$0.accessibilityLabel = "Tooltip"
|
||||||
|
$0.accessibilityValue = "expanded"
|
||||||
|
$0.accessibilityFrameInContainerSpace = .init(origin: .zero, size: .init(width: fullWidth, height: VDSLayout.Spacing.space1X.value))
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -91,7 +96,7 @@ open class TooltipDialog: View, UIScrollViewDelegate {
|
|||||||
private var heightConstraint: NSLayoutConstraint?
|
private var heightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
@ -222,13 +227,7 @@ open class TooltipDialog: View, UIScrollViewDelegate {
|
|||||||
|
|
||||||
heightConstraint?.constant = contentHeight
|
heightConstraint?.constant = contentHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy var primaryAccessibilityElement = UIAccessibilityElement(accessibilityContainer: self).with {
|
|
||||||
$0.accessibilityLabel = "Tooltip"
|
|
||||||
$0.accessibilityValue = "expanded"
|
|
||||||
$0.accessibilityFrameInContainerSpace = .init(origin: .zero, size: .init(width: fullWidth, height: VDSLayout.Spacing.space1X.value))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Used to update any Accessibility properties.
|
/// Used to update any Accessibility properties.
|
||||||
open override func updateAccessibility() {
|
open override func updateAccessibility() {
|
||||||
super.updateAccessibility()
|
super.updateAccessibility()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user