documentation update

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-30 13:29:52 -05:00
parent d78a87273e
commit e3f791960a
24 changed files with 62 additions and 21 deletions

View File

@ -37,6 +37,7 @@ open class Badge: View {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Enum used to describe the primary color for the view.
public enum FillColor: String, CaseIterable { public enum FillColor: String, CaseIterable {
case red, yellow, green, orange, blue, black, white case red, yellow, green, orange, blue, black, white
} }

View File

@ -34,17 +34,17 @@ open class BadgeIndicator: View {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Enum type for fill color. /// Enum used to describe the primary color for the view.
public enum FillColor: String, CaseIterable { public enum FillColor: String, CaseIterable {
case red, yellow, green, orange, blue, gray, grayLowContrast, black, white case red, yellow, green, orange, blue, gray, grayLowContrast, black, white
} }
/// Enum type for kind of BadgeIndicator. /// Enum used to describe the kind of BadgeIndicator.
public enum Kind: String, CaseIterable { public enum Kind: String, CaseIterable {
case simple, numbered case simple, numbered
} }
/// Enum type for maximum number of digits. /// Enum used to describe the maximum number of digits.
public enum MaximumDigits: String, CaseIterable { public enum MaximumDigits: String, CaseIterable {
case one case one
case two case two

View File

@ -11,6 +11,7 @@ import VDSColorTokens
import VDSFormControlsTokens import VDSFormControlsTokens
import Combine import Combine
/// Enum used to describe the size of a buttonable.
public enum ButtonSize: String, CaseIterable { public enum ButtonSize: String, CaseIterable {
case large case large
case small case small

View File

@ -33,10 +33,12 @@ open class ButtonGroup: View {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Enum used to describe the alignment of the buttons.
public enum Alignment: String, CaseIterable { public enum Alignment: String, CaseIterable {
case left, center, right case left, center, right
} }
/// Enum used to describe the width of any buttons.
public enum ChildWidth { public enum ChildWidth {
case percentage(CGFloat) case percentage(CGFloat)
case value(CGFloat) case value(CGFloat)

View File

@ -37,6 +37,7 @@ open class TextLinkCaret: ButtonBase, Buttonable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Enum used to describe the position of the icon in relation to the title label.
public enum IconPosition: String, CaseIterable { public enum IconPosition: String, CaseIterable {
case left, right case left, right
} }

View File

@ -33,17 +33,17 @@ open class ButtonIcon: Control {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Enum for the type of button based on the contrast. /// Enum used to describe the type of button based on the contrast.
public enum Kind: String, CaseIterable { public enum Kind: String, CaseIterable {
case ghost, lowContrast, highContrast case ghost, lowContrast, highContrast
} }
/// Enum for the background inside icon button determining the surface type. /// Enum used to describe the background inside icon button determining the surface type.
public enum SurfaceType: String, CaseIterable { public enum SurfaceType: String, CaseIterable {
case colorFill, media case colorFill, media
} }
/// Enum for the size of button icon and icon /// Enum used to describe the size of button icon.
public enum Size: String, EnumSubset { public enum Size: String, EnumSubset {
case large case large
case small case small

View File

@ -8,7 +8,7 @@
import Foundation import Foundation
extension Icon { extension Icon {
/// Enum for a preset height and width for the icon. /// Enum used to describe the height and width for the icon.
public enum Size: String, CaseIterable { public enum Size: String, CaseIterable {
case xsmall case xsmall
case small case small

View File

@ -12,6 +12,7 @@ public struct ImageLabelAttribute: AttachmentLabelAttributeModel {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Enum used to describe the type of error that can occur.
public enum Error: Swift.Error { public enum Error: Swift.Error {
case bundleNotFound case bundleNotFound
case imageNotFound(String) case imageNotFound(String)

View File

@ -31,12 +31,12 @@ open class Line: View {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Style of the line that will be displayed. /// Enum used to describe the style the line that will be displayed.
public enum Style: String, CaseIterable { public enum Style: String, CaseIterable {
case primary, secondary case primary, secondary
} }
/// Orientation that will be displayed. /// Enum used to describe the orientation that will be displayed.
public enum Orientation: String, CaseIterable { public enum Orientation: String, CaseIterable {
case horizontal, vertical case horizontal, vertical
} }

View File

@ -35,7 +35,7 @@ open class Notification: View {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Type of Notification. /// Enum used to describe the type of Notification.
public enum Style: String, CaseIterable { public enum Style: String, CaseIterable {
case info, success, warning, error case info, success, warning, error
@ -53,7 +53,7 @@ open class Notification: View {
} }
} }
/// Orientation of Notification. /// Enum used to describe the orientation of Notification.
public enum Layout: String, CaseIterable { public enum Layout: String, CaseIterable {
case vertical, horizontal case vertical, horizontal
} }

View File

@ -31,13 +31,13 @@ open class Tabs: View {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Layout Axis of the Tabs /// Enum used to describe the layout axis of the tabs
public enum Orientation: String, CaseIterable{ public enum Orientation: String, CaseIterable{
case vertical case vertical
case horizontal case horizontal
} }
/// Position for the Hover Border Accent for a Tab. /// Enum used to describe the position for the Hover Border Accent for a Tab.
public enum IndicatorPosition: String, CaseIterable { public enum IndicatorPosition: String, CaseIterable {
case top case top
case bottom case bottom
@ -51,13 +51,13 @@ open class Tabs: View {
} }
} }
/// Type of behavior for Scrolling /// Enum used to describe the type of behavior for Scrolling
public enum Overflow: String, CaseIterable { public enum Overflow: String, CaseIterable {
case scroll case scroll
case none case none
} }
/// Available size for tabs /// Enum used to describe the available size for tabs
public enum Size: String, CaseIterable { public enum Size: String, CaseIterable {
case medium case medium
case large case large

View File

@ -29,6 +29,7 @@ open class TabsContainer: View {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Enum used to describe the width of each tab
public enum TabsWidth { public enum TabsWidth {
case percentage(CGFloat) case percentage(CGFloat)
case value(CGFloat) case value(CGFloat)

View File

@ -33,6 +33,7 @@ open class EntryFieldBase: Control, Changeable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Enum used to describe the position of the helper text.
public enum HelperTextPlacement: String, CaseIterable { public enum HelperTextPlacement: String, CaseIterable {
case bottom, right case bottom, right
} }

View File

@ -35,6 +35,7 @@ open class InputField: EntryFieldBase, UITextFieldDelegate {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Enum used to describe the input type.
public enum FieldType: String, CaseIterable { public enum FieldType: String, CaseIterable {
case text, number, calendar, inlineAction, password, creditCard, tel, date, securityCode case text, number, calendar, inlineAction, password, creditCard, tel, date, securityCode
} }

View File

@ -31,7 +31,7 @@ open class TileContainer: Control {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Background color choices used for this component. /// Enum used to describe the background color choices used for this component.
public enum BackgroundColor: String, CaseIterable { public enum BackgroundColor: String, CaseIterable {
case white case white
case black case black
@ -39,7 +39,7 @@ open class TileContainer: Control {
case transparent case transparent
} }
/// Padding choices used for this component. /// Enum used to describe the padding choices used for this component.
public enum Padding: String, CaseIterable { public enum Padding: String, CaseIterable {
case padding2X case padding2X
case padding4X case padding4X
@ -63,7 +63,7 @@ open class TileContainer: Control {
} }
} }
/// Aspect ratios used for this component. /// Enum used to describe the aspect ratios used for this component.
public enum AspectRatio: String, CaseIterable { public enum AspectRatio: String, CaseIterable {
case ratio1x1 = "1:1" case ratio1x1 = "1:1"
case ratio3x4 = "3:4" case ratio3x4 = "3:4"

View File

@ -13,7 +13,7 @@ extension Tilelet {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Enum for the textStyle of the subTitle label. /// Enum used to describe the textStyle of the subTitle label.
public enum StandardStyle: String, EnumSubset { public enum StandardStyle: String, EnumSubset {
case bodyLarge case bodyLarge
case bodyMedium case bodyMedium

View File

@ -33,6 +33,7 @@ open class TitleLockup: View {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Enum used to describe the alignment of the text.
public enum TextPosition: String, EnumSubset { public enum TextPosition: String, EnumSubset {
case left, center case left, center

View File

@ -35,10 +35,12 @@ open class Tooltip: Control, TooltipLaunchable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Enums // MARK: - Enums
//-------------------------------------------------- //--------------------------------------------------
/// Enum used to describe the color of the tooltip.
public enum FillColor: String, CaseIterable { public enum FillColor: String, CaseIterable {
case primary, secondary, brandHighlight case primary, secondary, brandHighlight
} }
/// Enum used to describe the size of the icon.
public enum Size: String, EnumSubset { public enum Size: String, EnumSubset {
case small case small
case medium case medium
@ -56,22 +58,29 @@ open class Tooltip: Control, TooltipLaunchable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
/// Icon used to render the tooltip image.
open var icon = Icon().with { open var icon = Icon().with {
$0.name = .info $0.name = .info
$0.size = .small $0.size = .small
$0.isUserInteractionEnabled = false $0.isUserInteractionEnabled = false
} }
/// Will render the text for Close button for tooltip dialog when on mobile devices
open var closeButtonText: String = "Close" { didSet { setNeedsUpdate() }} open var closeButtonText: String = "Close" { didSet { setNeedsUpdate() }}
/// Will render icon in brand colors.
open var fillColor: FillColor = .primary { didSet { setNeedsUpdate() }} open var fillColor: FillColor = .primary { didSet { setNeedsUpdate() }}
/// Size of the icon
open var size: Size = .medium { didSet { setNeedsUpdate() }} open var size: Size = .medium { didSet { setNeedsUpdate() }}
/// Text rendered for the title of the tooltip
open var title: String? { didSet { setNeedsUpdate() }} open var title: String? { didSet { setNeedsUpdate() }}
/// Text rendered for the content of the tooltip
open var content: String? { didSet { setNeedsUpdate() }} open var content: String? { didSet { setNeedsUpdate() }}
/// UIView rendered for the content area of the tooltip
open var contentView: UIView? { didSet { setNeedsUpdate() }} open var contentView: UIView? { didSet { setNeedsUpdate() }}
//-------------------------------------------------- //--------------------------------------------------

View File

@ -37,26 +37,36 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
/// Label used to render the label text.
open var label = Label() open var label = Label()
/// Text used to render the label.
open var labelText: String? { didSet { setNeedsUpdate() }} open var labelText: String? { didSet { setNeedsUpdate() }}
/// Attributes used to render the label.
open var labelAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() } } open var labelAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() } }
/// Text style used to render the label.
open var labelTextStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() } } open var labelTextStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() } }
/// Text position used to render the label.
open var labelTextPosition: TextPosition = .left { didSet { setNeedsUpdate() } } open var labelTextPosition: TextPosition = .left { didSet { setNeedsUpdate() } }
/// Color configuration set for the label.
public lazy var textColorConfiguration: AnyColorable = { public lazy var textColorConfiguration: AnyColorable = {
label.textColorConfiguration label.textColorConfiguration
}() { didSet { setNeedsUpdate() }} }() { didSet { setNeedsUpdate() }}
/// Will render the text for Close button for tooltip dialog when on mobile devices
open var tooltipCloseButtonText: String = "Close" { didSet { setNeedsUpdate() } } open var tooltipCloseButtonText: String = "Close" { didSet { setNeedsUpdate() } }
/// Text rendered for the title of the tooltip
open var tooltipTitle: String? { didSet { setNeedsUpdate() } } open var tooltipTitle: String? { didSet { setNeedsUpdate() } }
/// Text rendered for the content of the tooltip
open var tooltipContent: String? { didSet { setNeedsUpdate() } } open var tooltipContent: String? { didSet { setNeedsUpdate() } }
/// UIView rendered for the content area of the tooltip
open var tooltipContentView: UIView? { didSet { setNeedsUpdate() } } open var tooltipContentView: UIView? { didSet { setNeedsUpdate() } }
//-------------------------------------------------- //--------------------------------------------------
@ -115,6 +125,7 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
extension Label { extension Label {
/// Model used to represent the tooltip.
public struct TooltipModel { public struct TooltipModel {
/// Current Surface and this is used to pass down to child objects that implement Surfacable /// Current Surface and this is used to pass down to child objects that implement Surfacable
public var surface: Surface public var surface: Surface
@ -131,6 +142,7 @@ extension Label {
} }
} }
/// Helper to add a tool tip attribute to an existing label.
public func addTooltip(model: TooltipModel) { public func addTooltip(model: TooltipModel) {
var newAttributes: [any LabelAttributeModel] = [] var newAttributes: [any LabelAttributeModel] = []

View File

@ -7,7 +7,9 @@
import Foundation import Foundation
/// Represents constants used that deal with layout.
public struct VDSLayout { public struct VDSLayout {
/// Enum used to describe the spacing constants.
public enum Spacing: String, CaseIterable { public enum Spacing: String, CaseIterable {
case space1X case space1X
case space2X case space2X

View File

@ -9,10 +9,12 @@ import Foundation
import UIKit import UIKit
import VDSColorTokens import VDSColorTokens
/// Enum to describe types of use.
public enum Use: String, Equatable { public enum Use: String, Equatable {
case primary, secondary case primary, secondary
} }
public protocol Useable { public protocol Useable {
/// Selection for the type of use.
var use: Use { get set } var use: Use { get set }
} }

View File

@ -218,6 +218,7 @@ extension UIEdgeInsets {
} }
extension TextStyle { extension TextStyle {
/// Enum used to describe the naming convention for the Typography.
public enum StandardStyle: String, CaseIterable { public enum StandardStyle: String, CaseIterable {
case featureXLarge, case featureXLarge,
featureLarge, featureLarge,
@ -234,15 +235,18 @@ extension TextStyle {
bodySmall, bodySmall,
micro micro
/// The bold version for this Standard Style.
public var bold: TextStyle { public var bold: TextStyle {
return TextStyle(rawValue: "bold\(rawValue.prefix(1).uppercased())\(rawValue.dropFirst())")! return TextStyle(rawValue: "bold\(rawValue.prefix(1).uppercased())\(rawValue.dropFirst())")!
} }
/// The regular version for this Standard Style.
public var regular: TextStyle { public var regular: TextStyle {
TextStyle(rawValue: rawValue)! TextStyle(rawValue: rawValue)!
} }
} }
/// The converting a TextStyle to a StandardStyle.
public func toStandardStyle() -> StandardStyle { public func toStandardStyle() -> StandardStyle {
var rawName = rawValue var rawName = rawValue
if rawName.hasPrefix("bold") { if rawName.hasPrefix("bold") {

View File

@ -65,6 +65,7 @@ extension TextStyle {
//MARK: FontSize //MARK: FontSize
extension TextStyle { extension TextStyle {
/// Enum used to describe the size of font.
public enum FontSize: String, CaseIterable { public enum FontSize: String, CaseIterable {
case xxlarge = "2XLarge" case xxlarge = "2XLarge"
case xlarge = "XLarge" case xlarge = "XLarge"
@ -75,7 +76,7 @@ extension TextStyle {
} }
} }
/// Enum used to describe the alignment of text.
public enum TextPosition: String, CaseIterable { public enum TextPosition: String, CaseIterable {
case left, right, center case left, right, center

View File

@ -26,6 +26,7 @@ extension TextStyle {
} }
public struct DeviceSpacingConfig { public struct DeviceSpacingConfig {
/// Enum used to describe the type of device for this configuration.
public enum DeviceType { public enum DeviceType {
case iPhone, iPad, all case iPhone, iPad, all
} }