Merge branch 'develop' into feature/monarch
This commit is contained in:
commit
1fe2d061a6
@ -540,7 +540,9 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
|
|||||||
var showIconContainerView = false
|
var showIconContainerView = false
|
||||||
if let descriptiveIconModel {
|
if let descriptiveIconModel {
|
||||||
descriptiveIcon.name = descriptiveIconModel.name
|
descriptiveIcon.name = descriptiveIconModel.name
|
||||||
descriptiveIcon.colorConfiguration = descriptiveIconModel.colorConfiguration
|
if let color = descriptiveIconModel.iconColor?.uiColor {
|
||||||
|
descriptiveIcon.color = color
|
||||||
|
}
|
||||||
descriptiveIcon.size = descriptiveIconModel.size
|
descriptiveIcon.size = descriptiveIconModel.size
|
||||||
descriptiveIcon.surface = backgroundColorSurface
|
descriptiveIcon.surface = backgroundColorSurface
|
||||||
showIconContainerView = true
|
showIconContainerView = true
|
||||||
@ -548,7 +550,9 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
|
|||||||
|
|
||||||
if let directionalIconModel {
|
if let directionalIconModel {
|
||||||
directionalIcon.name = directionalIconModel.iconType.iconName
|
directionalIcon.name = directionalIconModel.iconType.iconName
|
||||||
directionalIcon.colorConfiguration = directionalIconModel.colorConfiguration
|
if let color = directionalIconModel.iconColor?.uiColor {
|
||||||
|
directionalIcon.color = color
|
||||||
|
}
|
||||||
directionalIcon.size = directionalIconModel.size.value
|
directionalIcon.size = directionalIconModel.size.value
|
||||||
directionalIcon.surface = backgroundColorSurface
|
directionalIcon.surface = backgroundColorSurface
|
||||||
showIconContainerView = true
|
showIconContainerView = true
|
||||||
|
|||||||
@ -11,13 +11,33 @@ import VDSCoreTokens
|
|||||||
|
|
||||||
extension Tilelet {
|
extension Tilelet {
|
||||||
|
|
||||||
|
public enum IconColor: Equatable {
|
||||||
|
case token(UIColor.VDSColor)
|
||||||
|
case custom(UIColor)
|
||||||
|
|
||||||
|
private var reflectedValue: String { String(reflecting: self) }
|
||||||
|
|
||||||
|
public static func == (lhs: Self, rhs: Self) -> Bool {
|
||||||
|
lhs.reflectedValue == rhs.reflectedValue
|
||||||
|
}
|
||||||
|
|
||||||
|
public var uiColor: UIColor {
|
||||||
|
switch self {
|
||||||
|
case .token(let color):
|
||||||
|
return color.uiColor
|
||||||
|
case .custom(let color):
|
||||||
|
return color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Model that represents the options available for the descriptive icon.
|
/// Model that represents the options available for the descriptive icon.
|
||||||
public struct DescriptiveIcon {
|
public struct DescriptiveIcon {
|
||||||
/// A representation that will be used to render the icon with corresponding name.
|
/// A representation that will be used to render the icon with corresponding name.
|
||||||
public var name: Icon.Name
|
public var name: Icon.Name
|
||||||
|
|
||||||
/// Color of the icon.
|
/// Color of the icon.
|
||||||
public var colorConfiguration: SurfaceColorConfiguration
|
public var iconColor: IconColor?
|
||||||
|
|
||||||
/// Enum for a preset height and width for the icon.
|
/// Enum for a preset height and width for the icon.
|
||||||
public var size: Icon.Size
|
public var size: Icon.Size
|
||||||
@ -26,12 +46,12 @@ extension Tilelet {
|
|||||||
public var accessibleText: String
|
public var accessibleText: String
|
||||||
|
|
||||||
public init(name: Icon.Name = .multipleDocuments,
|
public init(name: Icon.Name = .multipleDocuments,
|
||||||
colorConfiguration: SurfaceColorConfiguration = .init(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark),
|
iconColor: IconColor? = nil,
|
||||||
size: Icon.Size = .medium,
|
size: Icon.Size = .medium,
|
||||||
accessibleText: String? = nil) {
|
accessibleText: String? = nil) {
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
self.colorConfiguration = colorConfiguration
|
self.iconColor = iconColor
|
||||||
self.accessibleText = accessibleText ?? name.rawValue
|
self.accessibleText = accessibleText ?? name.rawValue
|
||||||
self.size = size
|
self.size = size
|
||||||
}
|
}
|
||||||
@ -57,7 +77,7 @@ extension Tilelet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Color of the icon.
|
/// Color of the icon.
|
||||||
public var colorConfiguration: SurfaceColorConfiguration
|
public var iconColor: IconColor?
|
||||||
|
|
||||||
/// Accessible Text for the Icon
|
/// Accessible Text for the Icon
|
||||||
public var accessibleText: String
|
public var accessibleText: String
|
||||||
@ -68,13 +88,13 @@ extension Tilelet {
|
|||||||
/// Enum for a preset height and width for the icon.
|
/// Enum for a preset height and width for the icon.
|
||||||
public var size: IconSize
|
public var size: IconSize
|
||||||
|
|
||||||
public init(iconType: IconType = .rightArrow,
|
public init(iconType: IconType = .rightArrow,
|
||||||
colorConfiguration: SurfaceColorConfiguration = .init(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark),
|
iconColor: IconColor? = nil,
|
||||||
size: IconSize = .medium,
|
size: IconSize = .medium,
|
||||||
accessibleText: String? = nil) {
|
accessibleText: String? = nil) {
|
||||||
|
|
||||||
self.iconType = iconType
|
self.iconType = iconType
|
||||||
self.colorConfiguration = colorConfiguration
|
self.iconColor = iconColor
|
||||||
self.accessibleText = accessibleText ?? iconType.iconName.rawValue
|
self.accessibleText = accessibleText ?? iconType.iconName.rawValue
|
||||||
self.size = size
|
self.size = size
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,8 @@ extension TitleLockup {
|
|||||||
public enum TextColor: Equatable {
|
public enum TextColor: Equatable {
|
||||||
case primary
|
case primary
|
||||||
case secondary
|
case secondary
|
||||||
case custom(UIColor, UIColor)
|
case token(UIColor.VDSColor)
|
||||||
|
case custom(UIColor)
|
||||||
|
|
||||||
private var reflectedValue: String { String(reflecting: self) }
|
private var reflectedValue: String { String(reflecting: self) }
|
||||||
|
|
||||||
@ -31,15 +32,18 @@ extension TitleLockup {
|
|||||||
TitleLockup.textColorPrimaryConfiguration
|
TitleLockup.textColorPrimaryConfiguration
|
||||||
case .secondary:
|
case .secondary:
|
||||||
TitleLockup.textColorSecondaryConfiguration
|
TitleLockup.textColorSecondaryConfiguration
|
||||||
case .custom(let lightColor, let darkColor):
|
case .token(let color):
|
||||||
SurfaceColorConfiguration(lightColor, darkColor).eraseToAnyColorable()
|
SurfaceColorConfiguration(color.uiColor, color.uiColor).eraseToAnyColorable()
|
||||||
|
case .custom(let color):
|
||||||
|
SurfaceColorConfiguration(color, color).eraseToAnyColorable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TitleTextColor: Equatable {
|
public enum TitleTextColor: Equatable {
|
||||||
case primary
|
case primary
|
||||||
case custom(UIColor, UIColor)
|
case token(UIColor.VDSColor)
|
||||||
|
case custom(UIColor)
|
||||||
|
|
||||||
private var reflectedValue: String { String(reflecting: self) }
|
private var reflectedValue: String { String(reflecting: self) }
|
||||||
|
|
||||||
@ -51,8 +55,10 @@ extension TitleLockup {
|
|||||||
switch self {
|
switch self {
|
||||||
case .primary:
|
case .primary:
|
||||||
TitleLockup.textColorPrimaryConfiguration
|
TitleLockup.textColorPrimaryConfiguration
|
||||||
case .custom(let lightColor, let darkColor):
|
case .token(let color):
|
||||||
SurfaceColorConfiguration(lightColor, darkColor).eraseToAnyColorable()
|
SurfaceColorConfiguration(color.uiColor, color.uiColor).eraseToAnyColorable()
|
||||||
|
case .custom(let color):
|
||||||
|
SurfaceColorConfiguration(color, color).eraseToAnyColorable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user